summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-03-23 17:29:47 +0900
committerMichel Dänzer <michel@daenzer.net>2016-03-24 18:00:11 +0900
commitb2b079be0e7ef2704c3df9ee25fe46166e450e83 (patch)
tree350eddb5fd9967d4a8903ea85a9d8c6ffcbaac3a
parentd21ac4669a8b2cdd4eec5e5a94d1950b7423b8b5 (diff)
Use radeon_alloc_pixmap_bo for allocating scanout BOs
This enables tiling for scanout BOs used for TearFree / ShadowPrimary, and simplifies the code a little. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/drmmode_display.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ad3de7f4..cb0b0a0c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -531,11 +531,10 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
ScrnInfoPtr pScrn = crtc->scrn;
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
- int aligned_height;
- int size;
+ struct radeon_surface surface;
+ uint32_t tiling;
int ret;
- unsigned long rotate_pitch;
- int base_align;
+ int pitch;
if (scanout->bo) {
if (scanout->width == width && scanout->height == height)
@@ -544,23 +543,18 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
drmmode_crtc_scanout_destroy(drmmode, scanout);
}
- rotate_pitch =
- RADEON_ALIGN(width, drmmode_get_pitch_align(pScrn, drmmode->cpp, 0))
- * drmmode->cpp;
- aligned_height = RADEON_ALIGN(height, drmmode_get_height_align(pScrn, 0));
- base_align = drmmode_get_base_align(pScrn, drmmode->cpp, 0);
- size = RADEON_ALIGN(rotate_pitch * aligned_height, RADEON_GPU_PAGE_SIZE);
-
- scanout->bo = radeon_bo_open(drmmode->bufmgr, 0, size, base_align,
- RADEON_GEM_DOMAIN_VRAM,
- RADEON_GEM_NO_CPU_ACCESS);
+ scanout->bo = radeon_alloc_pixmap_bo(pScrn, width, height, pScrn->depth,
+ RADEON_CREATE_PIXMAP_TILING_MACRO |
+ RADEON_CREATE_PIXMAP_TILING_MICRO,
+ pScrn->bitsPerPixel, &pitch,
+ &surface, &tiling);
if (scanout->bo == NULL)
return NULL;
radeon_bo_map(scanout->bo, 1);
ret = drmModeAddFB(drmmode->fd, width, height, pScrn->depth,
- pScrn->bitsPerPixel, rotate_pitch,
+ pScrn->bitsPerPixel, pitch,
scanout->bo->handle,
&scanout->fb_id);
if (ret) {