Mesa (staging/19.1): wayland/egl: Ensure correct buffer size when allocating

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 27 10:53:49 UTC 2019


Module: Mesa
Branch: staging/19.1
Commit: 955c54cea0883721b7deb97eae7570af1a9229cc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=955c54cea0883721b7deb97eae7570af1a9229cc

Author: Jonas Ådahl <jadahl at gmail.com>
Date:   Mon May  6 09:54:27 2019 +0200

wayland/egl: Ensure correct buffer size when allocating

Whenever a buffer is allocated, e.g. by the first draw call or EGL call after a
buffer swap, make sure the size is up to date. Prior to this commit, we
failed to do so when querying the buffer age, or swapping buffers
without any prior EGL call or draw call.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
(cherry picked from commit 903ad59407ac965f9fbc8c0c397cc6f09263a2b8)

---

 src/egl/drivers/dri2/platform_wayland.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 5b5a3204426..2c04be93d64 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -663,6 +663,15 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
    return 0;
 }
 
+static int
+update_buffers_if_needed(struct dri2_egl_surface *dri2_surf)
+{
+   if (dri2_surf->back != NULL)
+      return 0;
+
+   return update_buffers(dri2_surf);
+}
+
 static __DRIbuffer *
 dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
                                 int *width, int *height,
@@ -980,7 +989,7 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
 
    /* Make sure we have a back buffer in case we're swapping without ever
     * rendering. */
-   if (get_back_bo(dri2_surf) < 0)
+   if (update_buffers_if_needed(dri2_surf) < 0)
       return _eglError(EGL_BAD_ALLOC, "dri2_swap_buffers");
 
    if (draw->SwapInterval > 0) {
@@ -1066,7 +1075,7 @@ dri2_wl_query_buffer_age(_EGLDriver *drv,
 {
    struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
 
-   if (get_back_bo(dri2_surf) < 0) {
+   if (update_buffers_if_needed(dri2_surf) < 0) {
       _eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
       return -1;
    }




More information about the mesa-commit mailing list