summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/radeon_bo_helper.c33
-rw-r--r--src/radeon_bo_helper.h3
2 files changed, 36 insertions, 0 deletions
diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c
index f45aa767..fdff0328 100644
--- a/src/radeon_bo_helper.c
+++ b/src/radeon_bo_helper.c
@@ -226,8 +226,16 @@ Bool radeon_get_pixmap_handle(PixmapPtr pixmap, uint32_t *handle)
r = drmPrimeFDToHandle(info->dri2.drm_fd, fd, &priv->handle);
close(fd);
if (r == 0) {
+ struct drm_radeon_gem_set_tiling args = { .handle = priv->handle };
+
priv->handle_valid = TRUE;
*handle = priv->handle;
+
+ if (drmCommandWriteRead(info->dri2.drm_fd,
+ DRM_RADEON_GEM_GET_TILING, &args,
+ sizeof(args)) == 0)
+ priv->tiling_flags = args.tiling_flags;
+
return TRUE;
}
}
@@ -236,6 +244,31 @@ Bool radeon_get_pixmap_handle(PixmapPtr pixmap, uint32_t *handle)
return FALSE;
}
+uint32_t radeon_get_pixmap_tiling_flags(PixmapPtr pPix)
+{
+#ifdef USE_GLAMOR
+ RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(pPix->drawable.pScreen));
+
+ if (info->use_glamor) {
+ struct radeon_pixmap *priv = radeon_get_pixmap_private(pPix);
+
+ if (!priv || (!priv->bo && !priv->handle_valid)) {
+ uint32_t handle;
+
+ radeon_get_pixmap_handle(pPix, &handle);
+ priv = radeon_get_pixmap_private(pPix);
+ }
+
+ return priv ? priv->tiling_flags : 0;
+ } else
+#endif
+ {
+ struct radeon_exa_pixmap_priv *driver_priv;
+ driver_priv = exaGetPixmapDriverPrivate(pPix);
+ return driver_priv ? driver_priv->tiling_flags : 0;
+ }
+}
+
#ifdef RADEON_PIXMAP_SHARING
Bool radeon_share_pixmap_backing(struct radeon_bo *bo, void **handle_p)
diff --git a/src/radeon_bo_helper.h b/src/radeon_bo_helper.h
index 89ad4be0..d4a4ee01 100644
--- a/src/radeon_bo_helper.h
+++ b/src/radeon_bo_helper.h
@@ -31,6 +31,9 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,
extern Bool
radeon_get_pixmap_handle(PixmapPtr pixmap, uint32_t *handle);
+extern uint32_t
+radeon_get_pixmap_tiling_flags(PixmapPtr pPix);
+
extern Bool
radeon_share_pixmap_backing(struct radeon_bo *bo, void **handle_p);