<div dir="ltr"><div><div><div><div>Hello,<br><br></div>My issue of graphical corruption is completely fixed when applying these two patches, and [PATCH]
glamor: Prepare for GLAMOR_* flags being removed from xserver.<br><br></div>
Tested-by: Nick Sarnie <<a href="mailto:commendsarnex@gmail.com">commendsarnex@gmail.com</a>><br><br></div>Thank you very much,<br></div>Nick Sarnie<br><div><div><div><div> 

<p style="margin-bottom:0in;line-height:200%"><br>

</p>

</div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 26, 2015 at 11:37 PM, Michel Dänzer <span dir="ltr"><<a href="mailto:michel@daenzer.net" target="_blank">michel@daenzer.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com">michel.daenzer@amd.com</a>><br>
<br>
Now we can share pixmaps with no struct radeon_bo via DRI2.<br>
<br>
Fixes VDPAU video playback freezing when using an OpenGL compositor with<br>
DRI3 enabled.<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=89755" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=89755</a><br>
Signed-off-by: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com">michel.daenzer@amd.com</a>><br>
---<br>
 src/radeon_dri2.c | 35 ++++++++++++++++++++++++++---------<br>
 1 file changed, 26 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c<br>
index 2636456..edf643d 100644<br>
--- a/src/radeon_dri2.c<br>
+++ b/src/radeon_dri2.c<br>
@@ -40,6 +40,7 @@<br>
 #include <fcntl.h><br>
 #include <errno.h><br>
<br>
+#include "radeon_bo_helper.h"<br>
 #include "radeon_version.h"<br>
 #include "radeon_list.h"<br>
<br>
@@ -125,6 +126,26 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)<br>
        return old;<br>
 }<br>
<br>
+/* Get GEM flink name for a pixmap */<br>
+static Bool<br>
+radeon_get_flink_name(RADEONInfoPtr info, PixmapPtr pixmap, uint32_t *name)<br>
+{<br>
+    struct radeon_bo *bo = radeon_get_pixmap_bo(pixmap);<br>
+    struct drm_gem_flink flink;<br>
+<br>
+    if (bo)<br>
+       return radeon_gem_get_kernel_name(bo, name) == 0;<br>
+<br>
+    if (radeon_get_pixmap_handle(pixmap, &flink.handle)) {<br>
+       if (drmIoctl(info->dri2.drm_fd, DRM_IOCTL_GEM_FLINK, &flink) != 0)<br>
+           return FALSE;<br>
+<br>
+       *name = <a href="http://flink.name" target="_blank">flink.name</a>;<br>
+       return TRUE;<br>
+    }<br>
+<br>
+    return FALSE;<br>
+}<br>
<br>
 static BufferPtr<br>
 radeon_dri2_create_buffer2(ScreenPtr pScreen,<br>
@@ -137,7 +158,6 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,<br>
     BufferPtr buffers;<br>
     struct dri2_buffer_priv *privates;<br>
     PixmapPtr pixmap, depth_pixmap;<br>
-    struct radeon_bo *bo;<br>
     int flags;<br>
     unsigned front_width;<br>
     uint32_t tiling = 0;<br>
@@ -171,10 +191,12 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,<br>
     pixmap = depth_pixmap = NULL;<br>
<br>
     if (attachment == DRI2BufferFrontLeft) {<br>
+       uint32_t handle;<br>
+<br>
         pixmap = get_drawable_pixmap(drawable);<br>
        if (pScreen != pixmap->drawable.pScreen)<br>
            pixmap = NULL;<br>
-       else if (info->use_glamor && !radeon_get_pixmap_bo(pixmap)) {<br>
+       else if (info->use_glamor && !radeon_get_pixmap_handle(pixmap, &handle)) {<br>
            is_glamor_pixmap = TRUE;<br>
            aligned_width = pixmap->drawable.width;<br>
            height = pixmap->drawable.height;<br>
@@ -285,8 +307,7 @@ radeon_dri2_create_buffer2(ScreenPtr pScreen,<br>
<br>
        if (is_glamor_pixmap)<br>
            pixmap = fixup_glamor(drawable, pixmap);<br>
-       bo = radeon_get_pixmap_bo(pixmap);<br>
-       if (!bo || radeon_gem_get_kernel_name(bo, &buffers->name) != 0)<br>
+       if (!radeon_get_flink_name(info, pixmap, &buffers->name))<br>
            goto error;<br>
     }<br>
<br>
@@ -657,20 +678,16 @@ radeon_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client,<br>
 static Bool<br>
 update_front(DrawablePtr draw, DRI2BufferPtr front)<br>
 {<br>
-    int r;<br>
     PixmapPtr pixmap;<br>
     RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(draw->pScreen));<br>
     struct dri2_buffer_priv *priv = front->driverPrivate;<br>
-    struct radeon_bo *bo;<br>
<br>
     pixmap = get_drawable_pixmap(draw);<br>
     pixmap->refcnt++;<br>
<br>
     if (!info->use_glamor)<br>
        exaMoveInPixmap(pixmap);<br>
-    bo = radeon_get_pixmap_bo(pixmap);<br>
-    r = radeon_gem_get_kernel_name(bo, &front->name);<br>
-    if (r) {<br>
+    if (!radeon_get_flink_name(info, pixmap, &front->name)) {<br>
        (*draw->pScreen->DestroyPixmap)(pixmap);<br>
        return FALSE;<br>
     }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br></div>