Date: Wednesday, August 3, 2016 @ 14:43:20 Author: lcarlier Revision: 272964
upgpkg: mesa 12.0.1-6 fix FS#50240 Added: mesa/trunk/0001-i965-import-prime-buffers-in-the-current-context-not.patch Modified: mesa/trunk/PKGBUILD -----------------------------------------------------------------+ 0001-i965-import-prime-buffers-in-the-current-context-not.patch | 66 ++++++++++ PKGBUILD | 12 + 2 files changed, 74 insertions(+), 4 deletions(-) Added: 0001-i965-import-prime-buffers-in-the-current-context-not.patch =================================================================== --- 0001-i965-import-prime-buffers-in-the-current-context-not.patch (rev 0) +++ 0001-i965-import-prime-buffers-in-the-current-context-not.patch 2016-08-03 14:43:20 UTC (rev 272964) @@ -0,0 +1,66 @@ +From e180e9e3c830d3611a6cf7d32e988b4c28d20942 Mon Sep 17 00:00:00 2001 +From: Martin Peres <martin.pe...@linux.intel.com> +Date: Wed, 3 Aug 2016 12:58:23 +0300 +Subject: [PATCH] i965: import prime buffers in the current context, not screen + +This 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 + +Cc: mesa-sta...@lists.freedesktop.org +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71759 +Signed-off-by: Martin Peres <martin.pe...@linux.intel.com> +--- + src/mesa/drivers/dri/i965/intel_screen.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c +index ae51c40..169d578 100644 +--- a/src/mesa/drivers/dri/i965/intel_screen.c ++++ b/src/mesa/drivers/dri/i965/intel_screen.c +@@ -702,8 +702,11 @@ intel_create_image_from_fds(__DRIscreen *screen, + int *fds, int num_fds, int *strides, int *offsets, + void *loaderPrivate) + { ++ GET_CURRENT_CONTEXT(ctx); + struct intel_screen *intelScreen = screen->driverPrivate; ++ struct brw_context *brw = brw_context(ctx); + struct intel_image_format *f; ++ dri_bufmgr *bufmgr; + __DRIimage *image; + int i, index; + +@@ -744,8 +747,26 @@ intel_create_image_from_fds(__DRIscreen *screen, + size = end; + } + +- image->bo = drm_intel_bo_gem_create_from_prime(intelScreen->bufmgr, +- fds[0], size); ++ /* Let's import the buffer into the current context instead of the current ++ * screen as some applications like gstreamer, totem, or obs create multiple ++ * X connections which end up creating multiple screens and thus multiple ++ * buffer managers. They then proceed to use a different X connection than ++ * the one used by the currently-bound context to call GLXBindTexImageExt() ++ * which should then import the buffer in the current bound context and not ++ * the current screen. This is done properly upstairs for texture management ++ * so we need to mirror this behaviour if we don't want the kernel rejecting ++ * our pushbuffers as the buffer would not have been imported by the same ++ * buffer manager that sent the pushbuffer referencing it. ++ * ++ * If there is no context currently bound, then revert to using the screen's ++ * buffer manager and hope for the best... ++ */ ++ if (brw) ++ bufmgr = brw->bufmgr; ++ else ++ bufmgr = intelScreen->bufmgr; ++ ++ image->bo = drm_intel_bo_gem_create_from_prime(bufmgr, fds[0], size); + if (image->bo == NULL) { + free(image); + return NULL; +-- +2.9.0 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2016-08-03 14:22:07 UTC (rev 272963) +++ PKGBUILD 2016-08-03 14:43:20 UTC (rev 272964) @@ -5,7 +5,7 @@ pkgbase=mesa pkgname=('opencl-mesa' 'vulkan-intel' 'libva-mesa-driver' 'mesa-vdpau' 'mesa' 'mesa-libgl') pkgver=12.0.1 -pkgrel=5 +pkgrel=6 arch=('i686' 'x86_64') makedepends=('python2-mako' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'dri3proto' 'presentproto' 'libxshmfence' 'libxxf86vm' 'libxdamage' 'libvdpau' 'libva' 'wayland' 'elfutils' 'llvm' @@ -17,7 +17,8 @@ remove-libpthread-stubs.patch 0001-st-mesa-fix-reference-counting-bug-in-st_vdpau.patch 0002-vl-dri3-fix-a-memory-leak-from-front-buffer.patch - 0001-Mesa-dev-st_glsl_to_tgsi-overlord-fix.patch) + 0001-Mesa-dev-st_glsl_to_tgsi-overlord-fix.patch + 0001-i965-import-prime-buffers-in-the-current-context-not.patch) sha256sums=('bab24fb79f78c876073527f515ed871fc9c81d816f66c8a0b051d8d653896389' 'SKIP' '7fdc119cf53c8ca65396ea73f6d10af641ba41ea1dd2bd44a824726e01c8b3f2' @@ -24,7 +25,8 @@ 'd82c329e89754266eb1538df29b94d33692a66e3b6882b2cee78f4d5aab4a39c' 'ccc8ea7f4e38f2dc26fd29150929e943aac5bc9b56bd3eddec882c6ccd1d64a5' 'f6c17257e96182ce51b85ef75cef4f6c205b00dfbf8fc1089cd77c4a3eda6981' - 'c1b650d2b3512d5f8f463f1974a28ed6b88e7e1936c5cfe1034ab97696d1de14') + 'c1b650d2b3512d5f8f463f1974a28ed6b88e7e1936c5cfe1034ab97696d1de14' + '6d6159b9080d75f653dbd43284b5138264612a7f4b895c37859f984d1ea2246d') validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D') # Emil Velikov <emil.l.veli...@gmail.com> prepare() { @@ -36,8 +38,10 @@ # fix memory leaks - merged upstream patch -Np1 -i ../0001-st-mesa-fix-reference-counting-bug-in-st_vdpau.patch patch -Np1 -i ../0002-vl-dri3-fix-a-memory-leak-from-front-buffer.patch - # fix rendering in overlord series games + # fix rendering in overlord series games - merged upstream patch -Np1 -i ../0001-Mesa-dev-st_glsl_to_tgsi-overlord-fix.patch + # fix https://bugs.freedesktop.org/show_bug.cgi?id=71759 / FS#50240 + patch -Np1 -i ../0001-i965-import-prime-buffers-in-the-current-context-not.patch autoreconf -fiv }