[Mesa-dev] [PATCH] egl: updating surface size on x11

Pielech, Adrian adrian.pielech at intel.com
Fri Mar 11 08:24:07 UTC 2016


I've found that EGLSurface width and height are not updated after window resizing on x11.
Here is the patch for this issue.

---
 src/egl/drivers/dri2/platform_x11.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index a09632d..f3e78db 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -835,6 +835,22 @@ dri2_x11_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
 
+   //Updating surface width and height fields for querying
+   //size by eglQuerySurface with EGL_WIDTH, EGL_HEIGHT
+   //It's needed for window surface when window is resized
+   if (!(draw->Type & EGL_PBUFFER_BIT)) {
+       xcb_generic_error_t *error = NULL;
+        xcb_get_geometry_cookie_t cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable);
+        xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, &error);
+        if (reply != NULL)
+        {
+          dri2_surf->base.Width = reply->width;
+          dri2_surf->base.Height = reply->height;
+          free(reply);
+        }
+        if (error != NULL)
+          free(error);
+   }
+
    if (dri2_dpy->dri2) {
       int64_t ret_val = dri2_x11_swap_buffers_msc(drv, disp, draw, 0, 0, 0);
       if (ret_val != -1) {
-- 
2.7.0.rc3


--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.



More information about the mesa-dev mailing list