[Glamor] [PATCH v3] Add DRI3 support to glamor

davyaxel at free.fr davyaxel at free.fr
Mon Dec 9 01:28:10 PST 2013


On 09/12/2013, Gaetan Nadon wrote :
> On 13-12-08 03:51 PM, davyaxel at free.fr wrote:
>> I've searched, and it should do to check if "EGL_KHR_image", "EGL_KHR_gl_texture_2D_image" and "EGL_EXT_image_dma_buf_import" are defined.
>> Those should be defined in <EGL/eglext.h>.
> The <EGL/eglext.h> header is include in the "egl" software package.
>
> This is the code to add to configure.ac to check for the 3 symbols which should be added after the PKG_CHECK_MODULES for EGL.
>
>     SAVE_CFLAGS=$CFLAGS
>     CFLAGS="$EGL_CFLAGS"
>     AC_CHECK_DECLS([EGL_KHR_image, EGL_KHR_gl_texture_2D_image, EGL_EXT_image_dma_buf_import], [], [],[
>              AC_INCLUDES_DEFAULT
>              #include <EGL/egl.h>
>              #include <EGL/eglext.h>
>     ])
>     CFLAGS=$SAVE_CFLAGS 
>
> When you run ./autogen.sh, a new ./configure script is created which includes a short C program to test if the symbols are declared. Running the new script yields this output:
>
>     checking whether EGL_KHR_image is declared... yes
>     checking whether EGL_KHR_gl_texture_2D_image is declared... yes
>     checking whether EGL_EXT_image_dma_buf_import is declared... yes 
>
> New #defines have also been added in config.h:
>
>     /* Define to 1 if you have the declaration of `EGL_EXT_image_dma_buf_import',
>        and to 0 if you don't. */
>     #define HAVE_DECL_EGL_EXT_IMAGE_DMA_BUF_IMPORT 1
>
>     /* Define to 1 if you have the declaration of `EGL_KHR_gl_texture_2D_image',
>        and to 0 if you don't. */
>     #define HAVE_DECL_EGL_KHR_GL_TEXTURE_2D_IMAGE 1
>
>     /* Define to 1 if you have the declaration of `EGL_KHR_image', and to 0 if you
>        don't. */
>     #define HAVE_DECL_EGL_KHR_IMAGE 1 
>
> Should the C test program fails when running ./configure, the compiler output and the program listing is written in config.log.
>
> Have a go at it and experiment. See if this will help you write conditional around the egl extension.
>
> Skipping the includes, this is the short C program:
>
>      int
>      main ()
>      {
>      #ifndef EGL_KHR_image
>      #ifdef __cplusplus
>        (void) EGL_KHR_image;
>      #else
>        (void) EGL_KHR_image;
>      #endif
>      #endif
>        ;
>        return 0;
>      } 
>
Thanks.

The following code seems to work for the additional check:

SAVE_CFLAGS=$CFLAGS
CFLAGS="$EGL_CFLAGS"
AC_LANG(C)
AC_CHECK_DECLS([EGL_KHR_image, EGL_KHR_gl_texture_2D_image, EGL_EXT_image_dma_buf_import], [], [GLAMOR_DRI3_HELPERS=no],[
         AC_INCLUDES_DEFAULT
         #include <EGL/egl.h>
         #include <EGL/eglext.h>
])

CFLAGS=-Werror
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
#include <gbm.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>]],[[struct gbm_bo *bo = gbm_bo_create (gbm_create_device(1), 0, 0, GBM_FORMAT_ARGB8888,GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
                      EGLNativePixmapType native_pixmap;native_pixmap = bo;]])], [], [GLAMOR_DRI3_HELPERS=no])
CFLAGS=$SAVE_CFLAGS


If EGLNativePixmapType is a pointer on another structure than gbm_bo, it raises an error, and the helpers are disabled.
However if EGLNativePixmapType is (void *) the compilation works. Perhaps you know how we could have the compilation failing in this case too?

Axel Davy


More information about the Glamor mailing list