[PATCH xf86-video-amdgpu 08/11] Add AMDGPU_CREATE_PIXMAP_GTT flag

Michel Dänzer michel at daenzer.net
Wed Jun 10 02:04:23 PDT 2015


From: Michel Dänzer <michel.daenzer at amd.com>

When set, the pixmap memory is allocated in GTT instead of in VRAM.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_bo_helper.c | 6 ++++--
 src/amdgpu_pixmap.h    | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index 47cd9eb..00e8643 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -62,7 +62,7 @@ struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 	struct amdgpu_buffer *pixmap_buffer;
 
-	if (info->gbm) {
+	if (!(usage_hint & AMDGPU_CREATE_PIXMAP_GTT) && info->gbm) {
 		uint32_t bo_use = GBM_BO_USE_RENDERING;
 		uint32_t gbm_format = amdgpu_get_gbm_format(depth, bitsPerPixel);
 
@@ -107,9 +107,11 @@ struct amdgpu_buffer *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
 		unsigned cpp = (bitsPerPixel + 7) / 8;
 		unsigned pitch = cpp *
 			AMDGPU_ALIGN(width, drmmode_get_pitch_align(pScrn, cpp));
+		uint32_t domain = (usage_hint & AMDGPU_CREATE_PIXMAP_GTT) ?
+			AMDGPU_GEM_DOMAIN_GTT : AMDGPU_GEM_DOMAIN_VRAM;
 
 		pixmap_buffer = amdgpu_bo_open(pAMDGPUEnt->pDev, pitch * height,
-					       4096, AMDGPU_GEM_DOMAIN_VRAM);
+					       4096, domain);
 
 		if (new_pitch)
 			*new_pitch = pitch;
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index a5dc081..b269853 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -107,6 +107,7 @@ enum {
 	AMDGPU_CREATE_PIXMAP_DRI2    = 0x08000000,
 	AMDGPU_CREATE_PIXMAP_LINEAR  = 0x04000000,
 	AMDGPU_CREATE_PIXMAP_SCANOUT = 0x02000000,
+	AMDGPU_CREATE_PIXMAP_GTT     = 0x01000000,
 };
 
 extern Bool amdgpu_pixmap_init(ScreenPtr screen);
-- 
2.1.4



More information about the xorg-driver-ati mailing list