diff options
author | Martin Peres <[email protected]> | 2016-10-06 17:10:35 +0300 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-11-08 16:23:17 +0000 |
commit | 17f59da9dbf22d080e765525703d7cb3ade1d0d7 (patch) | |
tree | a2e0b34e7e6f52db6bd5fa1c5284379868e2ed58 /src | |
parent | 0ae4d909ea443d3a8655ee25faa2717cc621b2c6 (diff) |
loader/dri3: import prime buffers in the currently-bound screen
This tries to mirrors the codepath taken by DRI2 in IntelSetTexBuffer2()
and fixes many applications when using DRI3:
- Totem with libva on hw-accelerated decoding
- obs-studio, using Window Capture (Xcomposite) as a Source
- gstreamer with VAAPI
v2:
- introduce get_dri_screen() in the dri3 loader's vtable (krh)
Tested-by: Timo Aaltonen <[email protected]>
Tested-by: Ionut Biru <[email protected]>
Cc: [email protected]
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71759
Reviewed-by: Emil Velikov <[email protected]>
Signed-off-by: Martin Peres <[email protected]>
(cherry picked from commit a599b1c2037ac8aca6c92350c8a7b3e42c81deaa)
Diffstat (limited to 'src')
-rw-r--r-- | src/loader/loader_dri3_helper.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 2411c0acf6c..4c2e849be73 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -1111,6 +1111,7 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format, xcb_sync_fence_t sync_fence; struct xshmfence *shm_fence; int fence_fd; + __DRIscreen *cur_screen; if (buffer) return buffer; @@ -1141,8 +1142,17 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format, if (!bp_reply) goto no_image; + /* Get the currently-bound screen or revert to using the drawable's screen if + * no contexts are currently bound. The latter case is at least necessary for + * obs-studio, when using Window Capture (Xcomposite) as a Source. + */ + cur_screen = draw->vtable->get_dri_screen(draw); + if (!cur_screen) { + cur_screen = draw->dri_screen; + } + buffer->image = loader_dri3_create_image(draw->conn, bp_reply, format, - draw->dri_screen, draw->ext->image, + cur_screen, draw->ext->image, buffer); if (!buffer->image) goto no_image; |