aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2017-06-08 12:24:24 +0300
committerEmil Velikov <[email protected]>2017-06-14 12:47:57 +0100
commit6f062ba8931eb8f35c31807cf336ef29c95b2cd5 (patch)
tree81f9ba602535372cfcf9d0b38ecdfc643c54b166
parent891dafc8e7ccf1489e072df889aee9c6596eda84 (diff)
egl: fix _eglQuerySurface in EGL_BUFFER_AGE_EXT case
Specification states that in case of error, value should not be written, patch changes buffer age queries to return -1 in case of error so that we can skip changing the value. In addition, small change to droid_query_buffer_age to return 0 in case buffer does not have a back buffer available. Fixes: dEQP-EGL.functional.negative_partial_update.not_postable_surface Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: [email protected] (cherry picked from commit 8fac894f9b8e4e2cb93061fdd25f3aecbfb3bbb7)
-rw-r--r--src/egl/drivers/dri2/platform_android.c4
-rw-r--r--src/egl/drivers/dri2/platform_drm.c2
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c2
-rw-r--r--src/egl/main/eglsurface.c6
4 files changed, 9 insertions, 5 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 5d2768d8170..2713b1f566e 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -609,10 +609,10 @@ droid_query_buffer_age(_EGLDriver *drv,
if (update_buffers(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "droid_query_buffer_age");
- return 0;
+ return -1;
}
- return dri2_surf->back->age;
+ return dri2_surf->back ? dri2_surf->back->age : 0;
}
static EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 9431d95e0a7..be0b8a44beb 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -463,7 +463,7 @@ dri2_drm_query_buffer_age(_EGLDriver *drv,
if (get_back_bo(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
- return 0;
+ return -1;
}
return dri2_surf->back->age;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index e0282675330..7a8c194ca49 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -808,7 +808,7 @@ dri2_wl_query_buffer_age(_EGLDriver *drv,
if (get_back_bo(dri2_surf) < 0) {
_eglError(EGL_BAD_ALLOC, "dri2_query_buffer_age");
- return 0;
+ return -1;
}
return dri2_surf->back->age;
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index e935c832713..5b3e83ee92c 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -409,7 +409,11 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
return EGL_FALSE;
}
- *value = drv->API.QueryBufferAge(drv, dpy, surface);
+ EGLint result = drv->API.QueryBufferAge(drv, dpy, surface);
+ /* error happened */
+ if (result < 0)
+ return EGL_FALSE;
+ *value = result;
break;
default:
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");