[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mesa: Changes to 'ubuntu'



 debian/patches/egl-platform-mir.patch |  129 ++++++++++++++++++++--------------
 debian/patches/egl-platform-rs.patch  |  104 ++++++++++++++++-----------
 2 files changed, 137 insertions(+), 96 deletions(-)

New commits:
commit df04f869c02a2168fe7cea228265288d3fb3ab3f
Author: Christopher James Halse Rogers <raof@ubuntu.com>
Date:   Thu Aug 10 17:32:47 2017 +1000

    Finish refreshing Mir EGL platform patches

diff --git a/debian/patches/egl-platform-mir.patch b/debian/patches/egl-platform-mir.patch
index 8801731..8cc5b67 100644
--- a/debian/patches/egl-platform-mir.patch
+++ b/debian/patches/egl-platform-mir.patch
@@ -1,6 +1,8 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -1723,7 +1723,9 @@ for plat in $platforms; do
+Index: mesa/configure.ac
+===================================================================
+--- mesa.orig/configure.ac	2017-08-10 16:37:31.970030645 +1000
++++ mesa/configure.ac	2017-08-10 17:18:19.000000000 +1000
+@@ -1723,7 +1723,9 @@
          PKG_CHECK_MODULES([ANDROID], [cutils hardware sync])
          DEFINES="$DEFINES -DHAVE_ANDROID_PLATFORM"
          ;;
@@ -11,7 +13,7 @@
      *)
          AC_MSG_ERROR([platform '$plat' does not exist])
          ;;
-@@ -1754,6 +1756,7 @@ AM_CONDITIONAL(HAVE_PLATFORM_WAYLAND, ec
+@@ -1754,6 +1756,7 @@
  AM_CONDITIONAL(HAVE_PLATFORM_DRM, echo "$platforms" | grep -q 'drm')
  AM_CONDITIONAL(HAVE_PLATFORM_SURFACELESS, echo "$platforms" | grep -q 'surfaceless')
  AM_CONDITIONAL(HAVE_PLATFORM_ANDROID, echo "$platforms" | grep -q 'android')
@@ -19,9 +21,11 @@
  
  dnl
  dnl More DRI setup
---- a/include/EGL/eglplatform.h
-+++ b/include/EGL/eglplatform.h
-@@ -105,6 +105,13 @@ typedef struct ANativeWindow*
+Index: mesa/include/EGL/eglplatform.h
+===================================================================
+--- mesa.orig/include/EGL/eglplatform.h	2017-08-10 16:37:31.970030645 +1000
++++ mesa/include/EGL/eglplatform.h	2017-08-10 17:18:19.000000000 +1000
+@@ -105,6 +105,13 @@
  typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
  typedef void*                           EGLNativeDisplayType;
  
@@ -35,9 +39,11 @@
  #elif defined(__unix__) || defined(__APPLE__)
  
  #if defined(MESA_EGL_NO_X11_HEADERS)
---- a/include/GL/internal/dri_interface.h
-+++ b/include/GL/internal/dri_interface.h
-@@ -964,10 +964,12 @@ struct __DRIbufferRec {
+Index: mesa/include/GL/internal/dri_interface.h
+===================================================================
+--- mesa.orig/include/GL/internal/dri_interface.h	2017-08-10 16:37:31.970030645 +1000
++++ mesa/include/GL/internal/dri_interface.h	2017-08-10 16:37:31.966030819 +1000
+@@ -964,10 +964,12 @@
      unsigned int pitch;
      unsigned int cpp;
      unsigned int flags;
@@ -51,9 +57,11 @@
  struct __DRIdri2LoaderExtensionRec {
      __DRIextension base;
  
---- a/src/egl/drivers/dri2/egl_dri2.c
-+++ b/src/egl/drivers/dri2/egl_dri2.c
-@@ -858,6 +858,11 @@ dri2_initialize(_EGLDriver *drv, _EGLDis
+Index: mesa/src/egl/drivers/dri2/egl_dri2.c
+===================================================================
+--- mesa.orig/src/egl/drivers/dri2/egl_dri2.c	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/egl/drivers/dri2/egl_dri2.c	2017-08-10 17:18:19.000000000 +1000
+@@ -858,6 +858,11 @@
        ret = dri2_initialize_wayland(drv, disp);
        break;
  #endif
@@ -65,7 +73,7 @@
  #ifdef HAVE_ANDROID_PLATFORM
     case _EGL_PLATFORM_ANDROID:
        ret = dri2_initialize_android(drv, disp);
-@@ -936,6 +941,13 @@ dri2_display_destroy(_EGLDisplay *disp)
+@@ -936,6 +941,13 @@
        }
        break;
  #endif
@@ -79,7 +87,7 @@
  #ifdef HAVE_WAYLAND_PLATFORM
     case _EGL_PLATFORM_WAYLAND:
        if (dri2_dpy->wl_drm)
-@@ -963,7 +975,8 @@ dri2_display_destroy(_EGLDisplay *disp)
+@@ -963,7 +975,8 @@
      * the ones from the gbm device. As such the gbm itself is responsible
      * for the cleanup.
      */
@@ -89,9 +97,11 @@
        for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++)
           free((__DRIconfig *) dri2_dpy->driver_configs[i]);
        free(dri2_dpy->driver_configs);
---- a/src/egl/drivers/dri2/egl_dri2.h
-+++ b/src/egl/drivers/dri2/egl_dri2.h
-@@ -65,6 +65,10 @@ struct zwp_linux_dmabuf_v1;
+Index: mesa/src/egl/drivers/dri2/egl_dri2.h
+===================================================================
+--- mesa.orig/src/egl/drivers/dri2/egl_dri2.h	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/egl/drivers/dri2/egl_dri2.h	2017-08-10 17:18:19.000000000 +1000
+@@ -65,6 +65,10 @@
  
  #endif /* HAVE_ANDROID_PLATFORM */
  
@@ -102,7 +112,7 @@
  #include "eglconfig.h"
  #include "eglcontext.h"
  #include "egldisplay.h"
-@@ -234,6 +238,9 @@ struct dri2_egl_display
+@@ -234,6 +238,9 @@
  
     bool                      is_render_node;
     bool                      is_different_gpu;
@@ -112,7 +122,7 @@
  };
  
  struct dri2_egl_context
-@@ -283,7 +290,7 @@ struct dri2_egl_surface
+@@ -283,7 +290,7 @@
     struct gbm_dri_surface *gbm_surf;
  #endif
  
@@ -121,7 +131,7 @@
     __DRIbuffer           *dri_buffers[__DRI_BUFFER_COUNT];
     struct {
  #ifdef HAVE_WAYLAND_PLATFORM
-@@ -295,9 +302,13 @@ struct dri2_egl_surface
+@@ -295,9 +302,13 @@
        void *data;
        int data_size;
  #endif
@@ -136,7 +146,7 @@
        bool                locked;
        int                 age;
     } color_buffers[4], *back, *current;
-@@ -326,6 +337,10 @@ struct dri2_egl_surface
+@@ -326,6 +337,10 @@
        __DRIimage           *front;
        unsigned int         visual;
  #endif
@@ -147,7 +157,7 @@
  };
  
  struct dri2_egl_config
-@@ -417,6 +432,9 @@ dri2_initialize_android(_EGLDriver *drv,
+@@ -417,6 +432,9 @@
  EGLBoolean
  dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
  
@@ -157,9 +167,11 @@
  void
  dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
  
---- /dev/null
-+++ b/src/egl/drivers/dri2/platform_mir.c
-@@ -0,0 +1,632 @@
+Index: mesa/src/egl/drivers/dri2/platform_mir.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ mesa/src/egl/drivers/dri2/platform_mir.c	2017-08-10 17:20:55.133969688 +1000
+@@ -0,0 +1,633 @@
 +/*
 + * Copyright © 2012 Canonical, Inc
 + *
@@ -211,10 +223,9 @@
 +      dri2_egl_display(dri2_surf->base.Resource.Display);
 +   int i;
 +
-+   dri2_surf->buffer_count = 0;
 +   for (i = 0; i < 2*count; i+=2) {
 +      assert(attachments[i] < __DRI_BUFFER_COUNT);
-+      assert(dri2_surf->buffer_count < 5);
++      assert((i/2) < ARRAY_SIZE(dri2_surf->buffers));
 +
 +      if (dri2_surf->dri_buffers[attachments[i]] == NULL) {
 +         /* Our frame callback must keep these buffers valid */
@@ -226,22 +237,22 @@
 +                  attachments[i], attachments[i+1],
 +                  dri2_surf->base.Width, dri2_surf->base.Height);
 +
-+         if (!dri2_surf->dri_buffers[attachments[i]])
-+            continue;
++         if (!dri2_surf->dri_buffers[attachments[i]]) {
++            _eglError(EGL_BAD_ALLOC, "failed to allocate auxiliary buffer");
++	    return NULL;
++	 }
 +      }
 +
-+      memcpy(&dri2_surf->buffers[dri2_surf->buffer_count],
++      memcpy(&dri2_surf->buffers[i/2],
 +             dri2_surf->dri_buffers[attachments[i]],
 +             sizeof(__DRIbuffer));
-+
-+      dri2_surf->buffer_count++;
 +   }
 +
 +   assert(dri2_surf->base.Type == EGL_PIXMAP_BIT ||
 +          dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
 +
-+   *out_count = dri2_surf->buffer_count;
-+   if (dri2_surf->buffer_count == 0)
++   *out_count = i/2;
++   if (i == 0)
 +	   return NULL;
 +
 +   *width = dri2_surf->base.Width;
@@ -770,6 +781,8 @@
 +      gbm_dri->get_buffers_with_format = dri2_get_buffers_with_format;
 +      gbm_dri->image_get_buffers = dri2_image_get_buffers;
 +
++      if (!dri2_setup_extensions(disp))
++         goto cleanup_dpy;
 +      dri2_setup_screen(disp);
 +   }
 +
@@ -792,8 +805,10 @@
 +
 +   return EGL_FALSE;
 +}
---- a/src/egl/main/egldisplay.c
-+++ b/src/egl/main/egldisplay.c
+Index: mesa/src/egl/main/egldisplay.c
+===================================================================
+--- mesa.orig/src/egl/main/egldisplay.c	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/egl/main/egldisplay.c	2017-08-10 17:18:19.000000000 +1000
 @@ -55,7 +55,10 @@
  #ifdef HAVE_DRM_PLATFORM
  #include <gbm.h>
@@ -806,7 +821,7 @@
  
  /**
   * Map --with-platforms names to platform types.
-@@ -70,6 +73,7 @@ static const struct {
+@@ -70,6 +73,7 @@
     { _EGL_PLATFORM_ANDROID, "android" },
     { _EGL_PLATFORM_HAIKU, "haiku" },
     { _EGL_PLATFORM_SURFACELESS, "surfaceless" },
@@ -814,7 +829,7 @@
  };
  
  
-@@ -100,6 +104,47 @@ _eglGetNativePlatformFromEnv(void)
+@@ -100,6 +104,47 @@
     return plat;
  }
  
@@ -862,7 +877,7 @@
  
  /**
   * Try detecting native platform with the help of native display characteristcs.
-@@ -110,6 +155,11 @@ _eglNativePlatformDetectNativeDisplay(vo
+@@ -110,6 +155,11 @@
     if (nativeDisplay == EGL_DEFAULT_DISPLAY)
        return _EGL_INVALID_PLATFORM;
  
@@ -874,7 +889,7 @@
     if (_eglPointerIsDereferencable(nativeDisplay)) {
        void *first_pointer = *(void **) nativeDisplay;
  
-@@ -141,14 +191,13 @@ _eglNativePlatformDetectNativeDisplay(vo
+@@ -141,14 +191,13 @@
     return _EGL_INVALID_PLATFORM;
  }
  
@@ -890,9 +905,11 @@
     _EGLPlatformType detected_platform = native_platform;
  
     if (detected_platform == _EGL_INVALID_PLATFORM) {
---- a/src/egl/main/egldisplay.h
-+++ b/src/egl/main/egldisplay.h
-@@ -50,6 +50,7 @@ enum _egl_platform_type {
+Index: mesa/src/egl/main/egldisplay.h
+===================================================================
+--- mesa.orig/src/egl/main/egldisplay.h	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/egl/main/egldisplay.h	2017-08-10 17:18:19.000000000 +1000
+@@ -50,6 +50,7 @@
     _EGL_PLATFORM_ANDROID,
     _EGL_PLATFORM_HAIKU,
     _EGL_PLATFORM_SURFACELESS,
@@ -900,9 +917,11 @@
  
     _EGL_NUM_PLATFORMS,
     _EGL_INVALID_PLATFORM = -1
---- a/src/gallium/state_trackers/dri/dri2.c
-+++ b/src/gallium/state_trackers/dri/dri2.c
-@@ -707,13 +707,21 @@ dri2_allocate_textures(struct dri_contex
+Index: mesa/src/gallium/state_trackers/dri/dri2.c
+===================================================================
+--- mesa.orig/src/gallium/state_trackers/dri/dri2.c	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/gallium/state_trackers/dri/dri2.c	2017-08-10 16:37:31.970030645 +1000
+@@ -707,13 +707,21 @@
           templ.height0 = dri_drawable->h;
           templ.format = format;
           templ.bind = bind;
@@ -928,9 +947,11 @@
           drawable->textures[statt] =
              screen->base.screen->resource_from_handle(screen->base.screen,
                    &templ, &whandle,
---- a/src/gbm/backends/dri/gbm_dri.c
-+++ b/src/gbm/backends/dri/gbm_dri.c
-@@ -214,7 +214,7 @@ static const __DRIimageLookupExtension i
+Index: mesa/src/gbm/backends/dri/gbm_dri.c
+===================================================================
+--- mesa.orig/src/gbm/backends/dri/gbm_dri.c	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/gbm/backends/dri/gbm_dri.c	2017-08-10 16:37:31.970030645 +1000
+@@ -214,7 +214,7 @@
  };
  
  static const __DRIdri2LoaderExtension dri2_loader_extension = {
@@ -939,9 +960,11 @@
  
     .getBuffers              = dri_get_buffers,
     .flushFrontBuffer        = dri_flush_front_buffer,
---- a/src/egl/Makefile.am
-+++ b/src/egl/Makefile.am
-@@ -104,6 +104,12 @@ libEGL_common_la_LIBADD += $(ANDROID_LIB
+Index: mesa/src/egl/Makefile.am
+===================================================================
+--- mesa.orig/src/egl/Makefile.am	2017-08-10 16:37:31.970030645 +1000
++++ mesa/src/egl/Makefile.am	2017-08-10 17:18:19.000000000 +1000
+@@ -104,6 +104,12 @@
  dri2_backend_FILES += drivers/dri2/platform_android.c
  endif
  
diff --git a/debian/patches/egl-platform-rs.patch b/debian/patches/egl-platform-rs.patch
index 9d941e9..30ae44b 100644
--- a/debian/patches/egl-platform-rs.patch
+++ b/debian/patches/egl-platform-rs.patch
@@ -1,6 +1,8 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -98,6 +98,7 @@ XVMC_REQUIRED=1.0.6
+Index: mesa/configure.ac
+===================================================================
+--- mesa.orig/configure.ac	2017-08-10 16:08:00.456139559 +1000
++++ mesa/configure.ac	2017-08-10 16:08:00.452139468 +1000
+@@ -98,6 +98,7 @@
  PYTHON_MAKO_REQUIRED=0.8.0
  LIBSENSORS_REQUIRED=4.0.0
  ZLIB_REQUIRED=1.2.3
@@ -8,7 +10,7 @@
  
  dnl LLVM versions
  LLVM_REQUIRED_GALLIUM=3.3.0
-@@ -1726,6 +1727,9 @@ for plat in $platforms; do
+@@ -1726,6 +1727,9 @@
      mir)
          PKG_CHECK_MODULES([MIR], [mirclient mir-client-platform-mesa])
          ;;
@@ -18,7 +20,7 @@
      *)
          AC_MSG_ERROR([platform '$plat' does not exist])
          ;;
-@@ -1757,6 +1761,7 @@ AM_CONDITIONAL(HAVE_PLATFORM_DRM, echo "
+@@ -1757,6 +1761,7 @@
  AM_CONDITIONAL(HAVE_PLATFORM_SURFACELESS, echo "$platforms" | grep -q 'surfaceless')
  AM_CONDITIONAL(HAVE_PLATFORM_ANDROID, echo "$platforms" | grep -q 'android')
  AM_CONDITIONAL(HAVE_PLATFORM_MIR, echo "$platforms" | grep -q 'mir')
@@ -26,9 +28,11 @@
  
  dnl
  dnl More DRI setup
---- a/include/EGL/eglplatform.h
-+++ b/include/EGL/eglplatform.h
-@@ -112,6 +112,13 @@ typedef MirEGLNativeDisplayType EGLNativ
+Index: mesa/include/EGL/eglplatform.h
+===================================================================
+--- mesa.orig/include/EGL/eglplatform.h	2017-08-10 16:08:00.456139559 +1000
++++ mesa/include/EGL/eglplatform.h	2017-08-10 16:08:00.452139468 +1000
+@@ -112,6 +112,13 @@
  typedef void                   *EGLNativePixmapType;
  typedef MirEGLNativeWindowType  EGLNativeWindowType;
  
@@ -42,9 +46,11 @@
  #elif defined(__unix__) || defined(__APPLE__)
  
  #if defined(MESA_EGL_NO_X11_HEADERS)
---- a/src/egl/Makefile.am
-+++ b/src/egl/Makefile.am
-@@ -110,6 +110,13 @@ AM_CFLAGS += $(MIR_CFLAGS)
+Index: mesa/src/egl/Makefile.am
+===================================================================
+--- mesa.orig/src/egl/Makefile.am	2017-08-10 16:08:00.456139559 +1000
++++ mesa/src/egl/Makefile.am	2017-08-10 16:08:00.452139468 +1000
+@@ -110,6 +110,13 @@
  dri2_backend_FILES += drivers/dri2/platform_mir.c
  endif
  
@@ -58,9 +64,11 @@
  AM_CFLAGS += \
  	-I$(top_srcdir)/src/loader \
  	-I$(top_builddir)/src/egl/drivers/dri2 \
---- a/src/egl/drivers/dri2/egl_dri2.c
-+++ b/src/egl/drivers/dri2/egl_dri2.c
-@@ -868,6 +868,11 @@ dri2_initialize(_EGLDriver *drv, _EGLDis
+Index: mesa/src/egl/drivers/dri2/egl_dri2.c
+===================================================================
+--- mesa.orig/src/egl/drivers/dri2/egl_dri2.c	2017-08-10 16:08:00.456139559 +1000
++++ mesa/src/egl/drivers/dri2/egl_dri2.c	2017-08-10 16:08:00.452139468 +1000
+@@ -868,6 +868,11 @@
        ret = dri2_initialize_android(drv, disp);
        break;
  #endif
@@ -72,7 +80,7 @@
     default:
        _eglLog(_EGL_WARNING, "No EGL platform enabled.");
        return EGL_FALSE;
-@@ -941,6 +946,13 @@ dri2_display_destroy(_EGLDisplay *disp)
+@@ -941,6 +946,13 @@
        }
        break;
  #endif
@@ -86,7 +94,7 @@
  #ifdef HAVE_MIR_PLATFORM
     case _EGL_PLATFORM_MIR:
        if (dri2_dpy->own_device) {
-@@ -976,7 +988,9 @@ dri2_display_destroy(_EGLDisplay *disp)
+@@ -976,7 +988,9 @@
      * for the cleanup.
      */
     if (disp->Platform != _EGL_PLATFORM_DRM &&
@@ -97,9 +105,11 @@
        for (unsigned i = 0; dri2_dpy->driver_configs[i]; i++)
           free((__DRIconfig *) dri2_dpy->driver_configs[i]);
        free(dri2_dpy->driver_configs);
---- a/src/egl/drivers/dri2/egl_dri2.h
-+++ b/src/egl/drivers/dri2/egl_dri2.h
-@@ -69,6 +69,10 @@ struct zwp_linux_dmabuf_v1;
+Index: mesa/src/egl/drivers/dri2/egl_dri2.h
+===================================================================
+--- mesa.orig/src/egl/drivers/dri2/egl_dri2.h	2017-08-10 16:08:00.456139559 +1000
++++ mesa/src/egl/drivers/dri2/egl_dri2.h	2017-08-10 16:08:00.452139468 +1000
+@@ -69,6 +69,10 @@
  #include <mir_toolkit/mesa/native_display.h>
  #endif
  
@@ -110,7 +120,7 @@
  #include "eglconfig.h"
  #include "eglcontext.h"
  #include "egldisplay.h"
-@@ -241,6 +245,11 @@ struct dri2_egl_display
+@@ -241,6 +245,11 @@
  #ifdef HAVE_MIR_PLATFORM
     MirMesaEGLNativeDisplay *mir_disp;
  #endif
@@ -122,7 +132,7 @@
  };
  
  struct dri2_egl_context
-@@ -302,10 +311,10 @@ struct dri2_egl_surface
+@@ -302,10 +311,10 @@
        void *data;
        int data_size;
  #endif
@@ -135,7 +145,7 @@
        int                 fd;
        int                 buffer_age;
  #endif
-@@ -333,6 +342,10 @@ struct dri2_egl_surface
+@@ -333,6 +342,10 @@
     } color_buffers[3], *back;
  #endif
  
@@ -146,7 +156,7 @@
  #if defined(HAVE_SURFACELESS_PLATFORM)
        __DRIimage           *front;
        unsigned int         visual;
-@@ -435,6 +448,9 @@ dri2_initialize_surfaceless(_EGLDriver *
+@@ -435,6 +448,9 @@
  EGLBoolean
  dri2_initialize_mir(_EGLDriver *drv, _EGLDisplay *disp);
  
@@ -156,9 +166,11 @@
  void
  dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
  
---- /dev/null
-+++ b/src/egl/drivers/dri2/platform_rs.c
-@@ -0,0 +1,962 @@
+Index: mesa/src/egl/drivers/dri2/platform_rs.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ mesa/src/egl/drivers/dri2/platform_rs.c	2017-08-10 16:37:18.982594770 +1000
+@@ -0,0 +1,964 @@
 +/*
 + * Copyright © 2016 Canonical, Inc
 + *
@@ -259,7 +271,7 @@
 +static int
 +get_format_bpp(MirPixelFormat format)
 +{
-+   int bpp;
++	int bpp;
 +
 +   switch (format) {
 +   case mir_pixel_format_argb_8888:
@@ -845,10 +857,9 @@
 +      dri2_egl_display(dri2_surf->base.Resource.Display);
 +   int i;
 +
-+   dri2_surf->buffer_count = 0;
 +   for (i = 0; i < 2*count; i+=2) {
 +      assert(attachments[i] < __DRI_BUFFER_COUNT);
-+      assert(dri2_surf->buffer_count < 5);
++      assert((i/2) < ARRAY_SIZE(dri2_surf->buffers));
 +
 +      if (dri2_surf->dri_buffers[attachments[i]] == NULL) {
 +         /* Our frame callback must keep these buffers valid */
@@ -860,22 +871,22 @@
 +                  attachments[i], attachments[i+1],
 +                  dri2_surf->base.Width, dri2_surf->base.Height);
 +
-+         if (!dri2_surf->dri_buffers[attachments[i]])
-+            continue;
++         if (!dri2_surf->dri_buffers[attachments[i]]) {
++            _eglError(EGL_BAD_ALLOC, "Failed to allocate auxiliary buffer");
++            return NULL;
++         }
 +      }
 +
-+      memcpy(&dri2_surf->buffers[dri2_surf->buffer_count],
++      memcpy(&dri2_surf->buffers[(i/2)],
 +             dri2_surf->dri_buffers[attachments[i]],
 +             sizeof(__DRIbuffer));
-+
-+      dri2_surf->buffer_count++;
 +   }
 +
 +   assert(dri2_surf->base.Type == EGL_PIXMAP_BIT ||
 +          dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
 +
-+   *out_count = dri2_surf->buffer_count;
-+   if (dri2_surf->buffer_count == 0)
++   *out_count = i/2;
++   if (i == 0)
 +       return NULL;
 +
 +   *width = dri2_surf->base.Width;
@@ -1098,6 +1109,9 @@
 +      gbm_dri->get_buffers_with_format = dri2_rs_get_buffers_with_format;
 +      gbm_dri->image_get_buffers = dri2_rs_image_get_buffers;
 +
++      if (!dri2_setup_extensions(disp))
++         goto cleanup_dpy;
++
 +      dri2_setup_screen(disp);
 +   }
 +
@@ -1121,8 +1135,10 @@
 +
 +   return EGL_FALSE;
 +}
---- a/src/egl/main/egldisplay.c
-+++ b/src/egl/main/egldisplay.c
+Index: mesa/src/egl/main/egldisplay.c
+===================================================================
+--- mesa.orig/src/egl/main/egldisplay.c	2017-08-10 16:08:00.456139559 +1000
++++ mesa/src/egl/main/egldisplay.c	2017-08-10 16:37:05.000000000 +1000
 @@ -59,6 +59,9 @@
  #include <dlfcn.h>
  #include <mir_toolkit/mesa/native_display.h>
@@ -1133,7 +1149,7 @@
  
  /**
   * Map --with-platforms names to platform types.
-@@ -73,7 +76,8 @@ static const struct {
+@@ -73,7 +76,8 @@
     { _EGL_PLATFORM_ANDROID, "android" },
     { _EGL_PLATFORM_HAIKU, "haiku" },
     { _EGL_PLATFORM_SURFACELESS, "surfaceless" },
@@ -1143,7 +1159,7 @@
  };
  
  
-@@ -115,6 +119,11 @@ _eglNativePlatformDetectNativeDisplay(vo
+@@ -155,6 +159,11 @@
     if (nativeDisplay == EGL_DEFAULT_DISPLAY)
        return _EGL_INVALID_PLATFORM;
  
@@ -1155,9 +1171,11 @@
  #ifdef HAVE_MIR_PLATFORM
     if (_mir_display_is_valid(nativeDisplay))
        return _EGL_PLATFORM_MIR;
---- a/src/egl/main/egldisplay.h
-+++ b/src/egl/main/egldisplay.h
-@@ -51,6 +51,7 @@ enum _egl_platform_type {
+Index: mesa/src/egl/main/egldisplay.h
+===================================================================
+--- mesa.orig/src/egl/main/egldisplay.h	2017-08-10 16:08:00.456139559 +1000
++++ mesa/src/egl/main/egldisplay.h	2017-08-10 16:37:05.000000000 +1000
+@@ -51,6 +51,7 @@
     _EGL_PLATFORM_HAIKU,
     _EGL_PLATFORM_SURFACELESS,
     _EGL_PLATFORM_MIR,


Reply to: