[Piglit] [PATCH 2/4] cmake, dma_buf: Require xcb-dri2 for dma_buf tests
Pohjolainen, Topi
topi.pohjolainen at intel.com
Wed Sep 11 05:35:43 PDT 2013
On Tue, Sep 10, 2013 at 11:07:52AM -0700, Chad Versace wrote:
> xcb-dri2 is an optional build dependency for the dma_buf tests. If
> xcb-dri2 is present, then the tests use it to gain DRM authentication.
> Otherwise, the tests must be ran as root.
>
> No one likes running tests as root, so require xcb-dri2 for these tests.
>
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
> CMakeLists.txt | 7 +++++--
> tests/util/CMakeLists.txt | 17 +++--------------
> tests/util/piglit-framework-gl/piglit_drm_dma_buf.c | 6 ------
> 3 files changed, 8 insertions(+), 22 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2aba844..955516b 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -99,10 +99,12 @@ ENDIF()
>
> # Choose to build tests that use dma_buf.
> #
> +# Piglit's dma_buf utilities require xcb-dri2 to gain DRM authentication.
> +#
> # The presence of libdrm is not sufficient. At least one libdrm_${hardware}
> # library is also needed.
> #
> -if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND)
> +if(LIBDRM_FOUND AND LIBDRM_INTEL_FOUND AND XCB_DRI2_FOUND)
> set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID true)
> else()
> set(PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID false)
> @@ -118,7 +120,8 @@ endif()
> # we need to validate it.
> if(PIGLIT_BUILD_DMA_BUF_TESTS AND NOT PIGLIT_BUILD_DMA_BUF_TESTS_IS_VALID)
> message(FATAL_ERROR
> - "PIGLIT_BUILD_DMA_BUF_TESTS require libdrm and libdrm_intel")
> + "PIGLIT_BUILD_DMA_BUF_TESTS require libdrm and libdrm_intel, "
> + "and xcb-dri2")
> endif()
>
> IF(PIGLIT_BUILD_GLX_TESTS)
> diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
> index 6bfe451..fb6dd3e 100644
> --- a/tests/util/CMakeLists.txt
> +++ b/tests/util/CMakeLists.txt
> @@ -62,10 +62,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>
> list(APPEND UTIL_GL_LIBS
> ${LIBDRM_LDFLAGS}
> + ${XCB_DRI2_LDFLAGS}
> +
Is this extra line intentional?
> )
>
> list(APPEND UTIL_GL_INCLUDES
> ${LIBDRM_INCLUDE_DIRS}
> + ${XCB_DRI2_INCLUDE_DIRS}
> )
>
> if(LIBDRM_INTEL_FOUND)
> @@ -75,20 +78,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
> ${LIBDRM_INTEL_LDFLAGS}
> )
> endif()
> -
> - # xcb-dri2 is used to gain DRM authentication.
> - if(XCB_DRI2_FOUND)
> - add_definitions(-DHAVE_XCB_DRI2)
> -
> - list(APPEND UTIL_GL_LIBS
> - ${XCB_DRI2_LDFLAGS}
> - )
> -
> - list(APPEND UTIL_GL_INCLUDES
> - ${XCB_DRI2_INCLUDE_DIRS}
> - )
> - endif()
> -
> endif()
>
> set(UTIL_GL_LIBS
> diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> index 9a7ff3b..cc6c366 100644
> --- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> +++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
> @@ -32,10 +32,8 @@
> #include <string.h>
> #include <xf86drm.h>
> #include <stdbool.h>
> -#ifdef HAVE_XCB_DRI2
> #include <xcb/dri2.h>
> #include <drm.h>
> -#endif
>
> static const char *drm_device_filename = "/dev/dri/card0";
>
> @@ -77,7 +75,6 @@ piglit_drm_device_get(void)
> return fd;
> }
>
> -#ifdef HAVE_XCB_DRI2
> static bool
> piglit_drm_x11_authenticate(void)
> {
> @@ -116,7 +113,6 @@ piglit_drm_x11_authenticate(void)
>
> return true;
> }
> -#endif /* HAVE_XCB_DRI2 */
>
> #ifdef HAVE_LIBDRM_INTEL
> static drm_intel_bufmgr *
> @@ -131,10 +127,8 @@ piglit_intel_bufmgr_get(void)
> if (!piglit_drm_device_get())
> return NULL;
>
> -#ifdef HAVE_XCB_DRI2
> if (!piglit_drm_x11_authenticate())
> return NULL;
> -#endif /* HAVE_XCB_DRI2 */
>
> mgr = intel_bufmgr_gem_init(piglit_drm_device_get(), batch_sz);
>
> --
> 1.8.3.1
>
More information about the Piglit
mailing list