diff --git a/CMakeLists.txt b/CMakeLists.txt index bf6b0c6..d4d1fdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ find_package(PkgConfig REQUIRED) pkg_search_module(LIBDRM REQUIRED libdrm) pkg_search_module(LIBVNCSERVER REQUIRED libvncserver) pkg_search_module(XKBCOMMON REQUIRED xkbcommon) +pkg_search_module(LIBVA REQUIRED libva) +pkg_search_module(LIBVA_DRM REQUIRED libva-drm) include(CheckIncludeFiles) CHECK_INCLUDE_FILES("linux/uinput.h;linux/dma-buf.h" HAVE_LINUX_API_HEADERS) @@ -17,17 +19,21 @@ IF(NOT HAVE_LINUX_API_HEADERS) message(FATAL_ERROR "linux-api-headers not found") ENDIF() -add_executable(kmsvnc kmsvnc.c drm.c input.c keymap.c) +add_executable(kmsvnc kmsvnc.c drm.c input.c keymap.c va.c) target_include_directories(kmsvnc PUBLIC ${LIBDRM_INCLUDEDIR} ${LIBDRM_INCLUDEDIR}/libdrm ${LIBVNCSERVER_INCLUDEDIR} ${XKBCOMMON_INCLUDEDIR} + ${LIBVA_INCLUDEDIR} + ${LIBVA_DRM_INCLUDEDIR} ) target_link_libraries(kmsvnc PUBLIC m ${LIBDRM_LIBRARIES} ${LIBVNCSERVER_LIBRARIES} ${XKBCOMMON_LIBRARIES} + ${LIBVA_LIBRARIES} + ${LIBVA_DRM_LIBRARIES} ) install(TARGETS kmsvnc RUNTIME DESTINATION bin) diff --git a/drm.c b/drm.c index 43ce2b0..ac79b06 100644 --- a/drm.c +++ b/drm.c @@ -272,7 +272,7 @@ static int drm_kmsbuf_prime_vaapi() { drm->funcs->sync_start = &drm_sync_start; drm->funcs->sync_end = &drm_sync_end; drm->mmap_fd = drm->prime_fd; - drm->mapped = kmsvnc->buf; + drm->mapped = kmsvnc->va->imgbuf; return 0; } diff --git a/va.c b/va.c index e920464..fc9e9cb 100644 --- a/va.c +++ b/va.c @@ -115,7 +115,7 @@ int va_init() { prime_attrs, KMSVNC_ARRAY_ELEMENTS(prime_attrs))) { printf("vaCreateSurfaces prime2 error %#x %s, trying prime\n", s, vaErrorStr(s)); - + VASurfaceAttribExternalBuffers buffer_desc; VASurfaceAttrib buffer_attrs[2] = { {