[PATCH xf86-video-amdgpu] glamor: Force GPU rendering to/from pixmaps created via DRI3
Michel Dänzer
michel at daenzer.net
Mon Apr 4 09:30:47 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
Fixes crash when running DRI3 clients with ShadowPrimary enabled.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94799
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_dri3.c | 6 +++++-
src/amdgpu_glamor_wrappers.c | 11 ++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/amdgpu_dri3.c b/src/amdgpu_dri3.c
index c3042e7..0686599 100644
--- a/src/amdgpu_dri3.c
+++ b/src/amdgpu_dri3.c
@@ -135,8 +135,12 @@ static PixmapPtr amdgpu_dri3_pixmap_from_fd(ScreenPtr screen,
if (AMDGPUPTR(xf86ScreenToScrn(screen))->use_glamor) {
pixmap = glamor_pixmap_from_fd(screen, fd, width, height,
stride, depth, bpp);
- if (pixmap)
+ if (pixmap) {
+ struct amdgpu_pixmap *priv = calloc(1, sizeof(*priv));
+
+ amdgpu_set_pixmap_private(pixmap, priv);
return pixmap;
+ }
}
#endif
diff --git a/src/amdgpu_glamor_wrappers.c b/src/amdgpu_glamor_wrappers.c
index 6700851..35b6d7e 100644
--- a/src/amdgpu_glamor_wrappers.c
+++ b/src/amdgpu_glamor_wrappers.c
@@ -148,10 +148,11 @@ amdgpu_glamor_finish_access_cpu(PixmapPtr pixmap)
*/
static Bool
-amdgpu_glamor_use_gpu(PixmapPtr pixmap)
+amdgpu_glamor_use_gpu(PixmapPtr pixmap, struct amdgpu_pixmap *priv)
{
return (pixmap->usage_hint &
- (AMDGPU_CREATE_PIXMAP_SCANOUT | AMDGPU_CREATE_PIXMAP_DRI2)) != 0;
+ (AMDGPU_CREATE_PIXMAP_SCANOUT | AMDGPU_CREATE_PIXMAP_DRI2)) != 0 ||
+ (priv && !priv->bo);
}
static Bool
@@ -432,7 +433,7 @@ amdgpu_glamor_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
PixmapPtr pixmap = get_drawable_pixmap(pDrawable);
struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
- if ((info->force_accel || amdgpu_glamor_use_gpu(pixmap)) &&
+ if ((info->force_accel || amdgpu_glamor_use_gpu(pixmap, priv)) &&
amdgpu_glamor_prepare_access_gpu(priv)) {
info->glamor.SavedPolyFillRect(pDrawable, pGC, nrect, prect);
amdgpu_glamor_finish_access_gpu_rw(info, priv);
@@ -536,8 +537,8 @@ amdgpu_glamor_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
struct amdgpu_pixmap *dst_priv = amdgpu_get_pixmap_private(dst_pixmap);
RegionPtr ret = NULL;
- if (amdgpu_glamor_use_gpu(dst_pixmap) ||
- amdgpu_glamor_use_gpu(src_pixmap)) {
+ if (amdgpu_glamor_use_gpu(dst_pixmap, dst_priv) ||
+ amdgpu_glamor_use_gpu(src_pixmap, src_priv)) {
if (!amdgpu_glamor_prepare_access_gpu(dst_priv))
goto fallback;
if (src_priv != dst_priv &&
--
2.8.0.rc3
More information about the xorg-driver-ati
mailing list