diff mbox

[PULL,2/8] configure: add dma-buf support detection.

Message ID 1456237462-3687-3-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Feb. 23, 2016, 2:24 p.m. UTC
Set CONFIG_OPENGL_DMABUF in case both mesa and libepoxy are
new enough to have support for dma-buf import/export.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 configure | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini Feb. 26, 2016, 9:29 a.m. UTC | #1
On 23/02/2016 15:24, Gerd Hoffmann wrote:
> Set CONFIG_OPENGL_DMABUF in case both mesa and libepoxy are
> new enough to have support for dma-buf import/export.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  configure | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 0aa249b..0c0472a 100755
> --- a/configure
> +++ b/configure
> @@ -279,6 +279,7 @@ smartcard=""
>  libusb=""
>  usb_redir=""
>  opengl=""
> +opengl_dmabuf="no"
>  zlib="yes"
>  lzo=""
>  snappy=""
> @@ -3274,7 +3275,7 @@ libs_softmmu="$libs_softmmu $fdt_libs"
>  # opengl probe (for sdl2, gtk, milkymist-tmu2)
>  
>  if test "$opengl" != "no" ; then
> -  opengl_pkgs="epoxy"
> +  opengl_pkgs="epoxy libdrm gbm"

This disables OpenGL entirely if libdrm or mesa-libgbm is unavailable.
Is it intentional?

Thanks,

Paolo

>    if $pkg_config $opengl_pkgs x11; then
>      opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
>      opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
> @@ -3292,6 +3293,18 @@ if test "$opengl" != "no" ; then
>    fi
>  fi
>  
> +if test "$opengl" = "yes"; then
> +  cat > $TMPC << EOF
> +#include <epoxy/egl.h>
> +#ifndef EGL_MESA_image_dma_buf_export
> +# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
> +#endif
> +int main(void) { return 0; }
> +EOF
> +  if compile_prog "" "" ; then
> +    opengl_dmabuf=yes
> +  fi
> +fi
>  
>  ##########################################
>  # archipelago probe
> @@ -4752,6 +4765,7 @@ echo "smartcard support $smartcard"
>  echo "libusb            $libusb"
>  echo "usb net redir     $usb_redir"
>  echo "OpenGL support    $opengl"
> +echo "OpenGL dmabufs    $opengl_dmabuf"
>  echo "libiscsi support  $libiscsi"
>  echo "libnfs support    $libnfs"
>  echo "build guest agent $guest_agent"
> @@ -5050,6 +5064,7 @@ if test "$gtk" = "yes" ; then
>    echo "CONFIG_GTK=y" >> $config_host_mak
>    echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
>    echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
> +  echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
>    if test "$gtk_gl" = "yes" ; then
>      echo "CONFIG_GTK_GL=y" >> $config_host_mak
>    fi
> @@ -5158,6 +5173,9 @@ if test "$opengl" = "yes" ; then
>    echo "CONFIG_OPENGL=y" >> $config_host_mak
>    echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
>    echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
> +  if test "$opengl_dmabuf" = "yes" ; then
> +    echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
> +  fi
>  fi
>  
>  if test "$lzo" = "yes" ; then
>
Gerd Hoffmann Feb. 29, 2016, 11 a.m. UTC | #2
Hi,

> >  if test "$opengl" != "no" ; then
> > -  opengl_pkgs="epoxy"
> > +  opengl_pkgs="epoxy libdrm gbm"
> 
> This disables OpenGL entirely if libdrm or mesa-libgbm is unavailable.
> Is it intentional?

Right now OpenGL has a X11 dependency anyway, so I don't think this is a
big problem, libdrm + mesa-libgbm should be available for all current
users.

When enabling opengl on macos / windows we probably want look at this.

cheers,
  Gerd
diff mbox

Patch

diff --git a/configure b/configure
index 0aa249b..0c0472a 100755
--- a/configure
+++ b/configure
@@ -279,6 +279,7 @@  smartcard=""
 libusb=""
 usb_redir=""
 opengl=""
+opengl_dmabuf="no"
 zlib="yes"
 lzo=""
 snappy=""
@@ -3274,7 +3275,7 @@  libs_softmmu="$libs_softmmu $fdt_libs"
 # opengl probe (for sdl2, gtk, milkymist-tmu2)
 
 if test "$opengl" != "no" ; then
-  opengl_pkgs="epoxy"
+  opengl_pkgs="epoxy libdrm gbm"
   if $pkg_config $opengl_pkgs x11; then
     opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
     opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
@@ -3292,6 +3293,18 @@  if test "$opengl" != "no" ; then
   fi
 fi
 
+if test "$opengl" = "yes"; then
+  cat > $TMPC << EOF
+#include <epoxy/egl.h>
+#ifndef EGL_MESA_image_dma_buf_export
+# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
+#endif
+int main(void) { return 0; }
+EOF
+  if compile_prog "" "" ; then
+    opengl_dmabuf=yes
+  fi
+fi
 
 ##########################################
 # archipelago probe
@@ -4752,6 +4765,7 @@  echo "smartcard support $smartcard"
 echo "libusb            $libusb"
 echo "usb net redir     $usb_redir"
 echo "OpenGL support    $opengl"
+echo "OpenGL dmabufs    $opengl_dmabuf"
 echo "libiscsi support  $libiscsi"
 echo "libnfs support    $libnfs"
 echo "build guest agent $guest_agent"
@@ -5050,6 +5064,7 @@  if test "$gtk" = "yes" ; then
   echo "CONFIG_GTK=y" >> $config_host_mak
   echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
   echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
+  echo "GTK_LIBS=$gtk_libs" >> $config_host_mak
   if test "$gtk_gl" = "yes" ; then
     echo "CONFIG_GTK_GL=y" >> $config_host_mak
   fi
@@ -5158,6 +5173,9 @@  if test "$opengl" = "yes" ; then
   echo "CONFIG_OPENGL=y" >> $config_host_mak
   echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
   echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
+  if test "$opengl_dmabuf" = "yes" ; then
+    echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
+  fi
 fi
 
 if test "$lzo" = "yes" ; then