mirror of
https://github.com/X11Libre/xf86-video-amdgpu.git
synced 2026-03-24 01:24:31 +00:00
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>
This commit is contained in:
committed by
Michel Dänzer
parent
faf9d720b7
commit
aed1c17c43
@@ -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
|
||||
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user