summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-01-06 17:42:25 +0900
committerMichel Dänzer <michel.daenzer@amd.com>2017-01-06 17:42:25 +0900
commit5f712380883357d03c9934a753ef302e109aeb14 (patch)
tree77627c31f5fcfa4083a3e8bd60507f333a611fd4 /src
parentb5c189473dba2cffc9e4df310ce5c86ceca99a94 (diff)
Pass pitch from drmmode_crtc_scanout_allocate to drmmode_create_bo_pixmap
Mostly to align with radeon commit ea30d856ba5e7274c8ea499293b8b0e721b8e082, but also gets rid of a gbm_bo_get_stride call. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 63b3b07..4c35657 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -497,14 +497,13 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
static void *
drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
struct drmmode_scanout *scanout,
- int width, int height)
+ int width, int height, int *pitch)
{
ScrnInfoPtr pScrn = crtc->scrn;
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
int ret;
- int pitch;
union gbm_bo_handle bo_handle;
if (scanout->bo) {
@@ -515,8 +514,8 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
}
scanout->bo = amdgpu_alloc_pixmap_bo(pScrn, width, height,
- pScrn->depth, 0,
- pScrn->bitsPerPixel, &pitch);
+ pScrn->depth, 0,
+ pScrn->bitsPerPixel, pitch);
if (!scanout->bo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Failed to allocate rotation buffer memory\n");
@@ -525,7 +524,7 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
bo_handle = gbm_bo_get_handle(scanout->bo->bo.gbm);
ret = drmModeAddFB(pAMDGPUEnt->fd, width, height, pScrn->depth,
- pScrn->bitsPerPixel, pitch,
+ pScrn->bitsPerPixel, *pitch,
bo_handle.u32, &scanout->fb_id);
if (ret) {
ErrorF("failed to add rotate fb\n");
@@ -547,7 +546,7 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
ScrnInfoPtr pScrn = crtc->scrn;
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
- unsigned long rotate_pitch;
+ int pitch;
if (scanout->pixmap) {
if (scanout->width == width && scanout->height == height)
@@ -557,18 +556,16 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
}
if (!scanout->bo) {
- if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height))
+ if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height,
+ &pitch))
return NULL;
}
- rotate_pitch = gbm_bo_get_stride(scanout->bo->bo.gbm);
-
scanout->pixmap = drmmode_create_bo_pixmap(pScrn,
width, height,
pScrn->depth,
pScrn->bitsPerPixel,
- rotate_pitch,
- scanout->bo);
+ pitch, scanout->bo);
if (scanout->pixmap == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate shadow pixmap for rotated CRTC\n");
@@ -1054,9 +1051,10 @@ static void *drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width,
int height)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+ int pitch;
return drmmode_crtc_scanout_allocate(crtc, &drmmode_crtc->rotate,
- width, height);
+ width, height, &pitch);
}
static PixmapPtr