From eb7d1b9474b021769e2d1f1b64901c64130e53d8 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 20 Dec 2011 17:25:22 +0800 Subject: [PATCH] egl_dri2/x11: error check coordinates in eglPostSubBufferNV EGL_BAD_PARAMETER should be returned when any of the coordinates is negative. --- src/egl/drivers/dri2/platform_x11.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 08a2c8d8789..d789ec6793a 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -248,11 +248,8 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, free(reply); } - if (dri2_dpy->dri2 && type == EGL_WINDOW_BIT && - dri2_surf->base.RenderBuffer == EGL_BACK_BUFFER) - dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE; - else - dri2_surf->base.PostSubBufferSupportedNV = EGL_FALSE; + /* we always copy the back buffer to front */ + dri2_surf->base.PostSubBufferSupportedNV = EGL_TRUE; return &dri2_surf->base; @@ -760,6 +757,9 @@ dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, { const EGLint rect[4] = { x, draw->Height - y - height, width, height }; + if (x < 0 || y < 0 || width < 0 || height < 0) + _eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV"); + return dri2_swap_buffers_region(drv, disp, draw, 1, rect); } -- 2.30.2