Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-31 Thread Adam Jackson
On Fri, 2018-07-27 at 16:16 +0200, Olivier Fourdan wrote:
> Hi,
> 
> On Thu, 26 Jul 2018 at 19:53, Eric Anholt  wrote:
> > 
> > Olivier Fourdan  writes:
> > 
> > > get_supported_modifiers() and pixmap_from_buffers() requests both
> > > expect a window as drawable, passing a pixmap will fail as the Xserver
> > > will fail to match the given drawable to a window.
> > > 
> > > That leads to dri3_alloc_render_buffer() to return NULL and breaks
> > > rendering when using GLX_DOUBLEBUFFER on pixmaps.
> > > 
> > > Query the root window of the pixmap on first init, and use the root
> > > window instead of the pixmap drawable for get_supported_modifiers()
> > > and pixmap_from_buffers().
> > > 
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
> > > Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
> > > Signed-off-by: Olivier Fourdan 
> > 
> > Looks great!
> > 
> > Reviewed-by: Eric Anholt 
> 
> Thanks both Daniel and Eric for the reviews!
> 
> If I may, could someone push that fix for me, I don't think I have
> commit rights in Mesa...
> 
> (It's a regression affecting Mesa 18.1 with Xserver 1.20, would be
> great to have it fixed)

Merged, thanks:

To gitlab.freedesktop.org:mesa/mesa.git
   16b5e15e918..03a61b977e1  master -> master

- ajax
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-27 Thread Olivier Fourdan
Hi,

On Thu, 26 Jul 2018 at 19:53, Eric Anholt  wrote:
>
> Olivier Fourdan  writes:
>
> > get_supported_modifiers() and pixmap_from_buffers() requests both
> > expect a window as drawable, passing a pixmap will fail as the Xserver
> > will fail to match the given drawable to a window.
> >
> > That leads to dri3_alloc_render_buffer() to return NULL and breaks
> > rendering when using GLX_DOUBLEBUFFER on pixmaps.
> >
> > Query the root window of the pixmap on first init, and use the root
> > window instead of the pixmap drawable for get_supported_modifiers()
> > and pixmap_from_buffers().
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
> > Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
> > Signed-off-by: Olivier Fourdan 
>
> Looks great!
>
> Reviewed-by: Eric Anholt 

Thanks both Daniel and Eric for the reviews!

If I may, could someone push that fix for me, I don't think I have
commit rights in Mesa...

(It's a regression affecting Mesa 18.1 with Xserver 1.20, would be
great to have it fixed)

Cheers,
Olivier
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Eric Anholt
Olivier Fourdan  writes:

> get_supported_modifiers() and pixmap_from_buffers() requests both
> expect a window as drawable, passing a pixmap will fail as the Xserver
> will fail to match the given drawable to a window.
>
> That leads to dri3_alloc_render_buffer() to return NULL and breaks
> rendering when using GLX_DOUBLEBUFFER on pixmaps.
>
> Query the root window of the pixmap on first init, and use the root
> window instead of the pixmap drawable for get_supported_modifiers()
> and pixmap_from_buffers().
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
> Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
> Signed-off-by: Olivier Fourdan 

Looks great!

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Daniel Stone
On Thu, 26 Jul 2018 at 08:46, Olivier Fourdan  wrote:
> get_supported_modifiers() and pixmap_from_buffers() requests both
> expect a window as drawable, passing a pixmap will fail as the Xserver
> will fail to match the given drawable to a window.
>
> That leads to dri3_alloc_render_buffer() to return NULL and breaks
> rendering when using GLX_DOUBLEBUFFER on pixmaps.
>
> Query the root window of the pixmap on first init, and use the root
> window instead of the pixmap drawable for get_supported_modifiers()
> and pixmap_from_buffers().

Looks good to me, thanks Olivier!

Reviewed-by: Daniel Stone 

Cheers,
Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] dri3: For 1.2, use root window instead of pixmap drawable

2018-07-26 Thread Olivier Fourdan
get_supported_modifiers() and pixmap_from_buffers() requests both
expect a window as drawable, passing a pixmap will fail as the Xserver
will fail to match the given drawable to a window.

That leads to dri3_alloc_render_buffer() to return NULL and breaks
rendering when using GLX_DOUBLEBUFFER on pixmaps.

Query the root window of the pixmap on first init, and use the root
window instead of the pixmap drawable for get_supported_modifiers()
and pixmap_from_buffers().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
Fixes: 069fdd5 ("egl/x11: Support DRI3 v1.1")
Signed-off-by: Olivier Fourdan 
---
 v2: Use the root window instead of reverting to pixmap_from_buffer()
 as suggested by Eric.
 v3: Much simpler patch, no need to issue an xcb_get_geometry() twice,
 we already did it in dri3_update_drawable(), just save the root window
 from there... Sorry for the noise!

 src/loader/loader_dri3_helper.c | 12 +---
 src/loader/loader_dri3_helper.h |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index f0ff2f07bd..b8eb87f5aa 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1149,7 +1149,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
  uint32_t count = 0;
 
  mod_cookie = xcb_dri3_get_supported_modifiers(draw->conn,
-   draw->drawable,
+   draw->window,
depth, buffer->cpp * 8);
  mod_reply = xcb_dri3_get_supported_modifiers_reply(draw->conn,
 mod_cookie,
@@ -1281,7 +1281,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
buffer->modifier != DRM_FORMAT_MOD_INVALID) {
   xcb_dri3_pixmap_from_buffers(draw->conn,
pixmap,
-   draw->drawable,
+   draw->window,
num_planes,
width, height,
buffer->strides[0], buffer->offsets[0],
@@ -1357,6 +1357,7 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
   xcb_generic_error_t   *error;
   xcb_present_query_capabilities_cookie_t   present_capabilities_cookie;
   xcb_present_query_capabilities_reply_t*present_capabilities_reply;
+  xcb_window_t   root_win;
 
   draw->first_init = false;
 
@@ -1394,11 +1395,11 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
  mtx_unlock(&draw->mtx);
  return false;
   }
-
   draw->width = geom_reply->width;
   draw->height = geom_reply->height;
   draw->depth = geom_reply->depth;
   draw->vtable->set_drawable_size(draw, draw->width, draw->height);
+  root_win = geom_reply->root;
 
   free(geom_reply);
 
@@ -1432,6 +1433,11 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
  xcb_unregister_for_special_event(draw->conn, draw->special_event);
  draw->special_event = NULL;
   }
+
+  if (draw->is_pixmap)
+ draw->window = root_win;
+  else
+ draw->window = draw->drawable;
}
dri3_flush_present_events(draw);
mtx_unlock(&draw->mtx);
diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h
index 7e3d82947b..51d000343d 100644
--- a/src/loader/loader_dri3_helper.h
+++ b/src/loader/loader_dri3_helper.h
@@ -114,6 +114,7 @@ struct loader_dri3_drawable {
xcb_connection_t *conn;
__DRIdrawable *dri_drawable;
xcb_drawable_t drawable;
+   xcb_window_t window;
int width;
int height;
int depth;
-- 
2.17.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev