summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-04-04 18:28:02 +0900
committerMichel Dänzer <michel@daenzer.net>2016-04-04 18:28:02 +0900
commitaed1c17c43b2c0c983f6fc0973a5224d0faf32d9 (patch)
tree85e3982f7ac3d2e3346adcb7488ef296c1cda0cc
parentfaf9d720b7d650f5f1ea657a874d08eac3972e60 (diff)
glamor: Force GPU rendering to/from pixmaps created via DRI3
Fixes crash when running DRI3 clients with ShadowPrimary enabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94799 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_dri3.c6
-rw-r--r--src/amdgpu_glamor_wrappers.c11
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 &&