MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / validate

Function validate

src/platform/linux/vaapi.cpp:573–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571 }
572
573 bool validate(int fd) {
574 va::display_t display {vaGetDisplayDRM(fd)};
575 if (!display) {
576 char string[1024];
577
578 auto bytes = readlink(std::format("/proc/self/fd/{}", fd).c_str(), string, sizeof(string));
579
580 std::string_view render_device {string, (std::size_t) bytes};
581
582 BOOST_LOG(error) << "Couldn't open a va display from DRM with device: "sv << render_device;
583 return false;
584 }
585
586 int major, minor;
587 auto status = vaInitialize(display.get(), &major, &minor);
588 if (status) {
589 BOOST_LOG(error) << "Couldn't initialize va display: "sv << vaErrorStr(status);
590 return false;
591 }
592
593 if (!query(display.get(), VAProfileH264Main)) {
594 return false;
595 }
596
597 if (video::active_hevc_mode > 1 && !query(display.get(), VAProfileHEVCMain)) {
598 return false;
599 }
600
601 if (video::active_hevc_mode > 2 && !query(display.get(), VAProfileHEVCMain10)) {
602 return false;
603 }
604
605 return true;
606 }
607
608 std::unique_ptr<platf::avcodec_encode_device_t> make_avcodec_encode_device(int width, int height, file_t &&card, int offset_x, int offset_y, bool vram) {
609 if (vram) {

Callers 1

initMethod · 0.70

Calls 2

queryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected