summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-03-02 16:47:06 +0900
committerMichel Dänzer <michel@daenzer.net>2017-03-03 16:07:49 +0900
commit7f3abf35a2e1225ffd6a777b23f6a7a6355c1691 (patch)
treeedeffe1fcc497c84ad11f4cb9cd7b0aa29233b75 /src
parent03c2db3c67bf5ad3c0744add9e0bb611b6cd3df7 (diff)
Fold drmmode_crtc_scanout_allocate into drmmode_crtc_scanout_create
Not used anywhere else anymore. (Ported from radeon commit ae921a3150f69c38b5b3c88a9e37d54fdf0d5093) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c71
1 files changed, 22 insertions, 49 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index c7c9f17..b3c850c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -494,71 +494,39 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
drmmode_crtc_scanout_free(xf86_config->crtc[c]->driver_private);
}
-static void *
-drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
- struct drmmode_scanout *scanout,
- int width, int height, int *pitch)
+static PixmapPtr
+drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
+ int width, int height)
{
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;
union gbm_bo_handle bo_handle;
+ int pitch;
- if (scanout->bo) {
+ if (scanout->pixmap) {
if (scanout->width == width && scanout->height == height)
- return scanout->bo;
+ return scanout->pixmap;
drmmode_crtc_scanout_destroy(drmmode, scanout);
}
scanout->bo = amdgpu_alloc_pixmap_bo(pScrn, width, height,
pScrn->depth, 0,
- pScrn->bitsPerPixel, pitch);
+ pScrn->bitsPerPixel, &pitch);
if (!scanout->bo) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate rotation buffer memory\n");
- return NULL;
+ "Failed to allocate scanout buffer memory\n");
+ goto error;
}
bo_handle = gbm_bo_get_handle(scanout->bo->bo.gbm);
- ret = drmModeAddFB(pAMDGPUEnt->fd, width, height, pScrn->depth,
- pScrn->bitsPerPixel, *pitch,
- bo_handle.u32, &scanout->fb_id);
- if (ret) {
- ErrorF("failed to add rotate fb\n");
- amdgpu_bo_unref(&scanout->bo);
- scanout->bo = NULL;
- return NULL;
- }
-
- scanout->width = width;
- scanout->height = height;
- return scanout->bo;
-}
-
-static PixmapPtr
-drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
- struct drmmode_scanout *scanout,
- int width, int height)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- int pitch;
-
- if (scanout->pixmap) {
- if (scanout->width == width && scanout->height == height)
- return scanout->pixmap;
-
- drmmode_crtc_scanout_destroy(drmmode, scanout);
- }
-
- if (!scanout->bo) {
- if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height,
- &pitch))
- return NULL;
+ if (drmModeAddFB(pAMDGPUEnt->fd, width, height, pScrn->depth,
+ pScrn->bitsPerPixel, pitch,
+ bo_handle.u32, &scanout->fb_id) != 0) {
+ ErrorF("failed to add scanout fb\n");
+ goto error;
}
scanout->pixmap = drmmode_create_bo_pixmap(pScrn,
@@ -566,12 +534,17 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
pScrn->depth,
pScrn->bitsPerPixel,
pitch, scanout->bo);
- if (scanout->pixmap == NULL) {
+ if (scanout->pixmap) {
+ scanout->width = width;
+ scanout->height = height;
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Couldn't allocate shadow pixmap for rotated CRTC\n");
+ "Couldn't allocate scanout pixmap for CRTC\n");
+error:
+ drmmode_crtc_scanout_destroy(drmmode, scanout);
}
- return scanout->pixmap;
+ return scanout->pixmap;
}
static void