diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2017-02-28 17:47:09 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2017-03-01 16:56:53 +0900 |
commit | ae921a3150f69c38b5b3c88a9e37d54fdf0d5093 (patch) | |
tree | ddabe9d51949e0b3d9ad9a6b8238b8b25ce6c1ac /src | |
parent | 987a34adb319923ad36e2b47a26837248f187c3e (diff) |
Fold drmmode_crtc_scanout_allocate into drmmode_crtc_scanout_create
Not used anywhere else anymore.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 560bfae4..38b36b24 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -550,10 +550,9 @@ 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; RADEONInfoPtr info = RADEONPTR(pScrn); @@ -561,11 +560,11 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc, drmmode_ptr drmmode = drmmode_crtc->drmmode; struct radeon_surface surface; uint32_t tiling = RADEON_CREATE_PIXMAP_TILING_MACRO; - int ret; + int pitch; - if (scanout->bo) { + if (scanout->pixmap) { if (scanout->width == width && scanout->height == height) - return scanout->bo->ptr; + return scanout->pixmap; drmmode_crtc_scanout_destroy(drmmode, scanout); } @@ -574,48 +573,16 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc, tiling |= RADEON_CREATE_PIXMAP_TILING_MICRO; scanout->bo = radeon_alloc_pixmap_bo(pScrn, width, height, pScrn->depth, tiling, pScrn->bitsPerPixel, - pitch, &surface, &tiling); + &pitch, &surface, &tiling); if (scanout->bo == NULL) - return NULL; - - radeon_bo_map(scanout->bo, 1); + goto error; - ret = drmModeAddFB(drmmode->fd, width, height, pScrn->depth, - pScrn->bitsPerPixel, *pitch, + if (drmModeAddFB(drmmode->fd, width, height, pScrn->depth, + pScrn->bitsPerPixel, pitch, scanout->bo->handle, - &scanout->fb_id); - if (ret) { + &scanout->fb_id) != 0) { ErrorF("failed to add scanout fb\n"); - radeon_bo_unref(scanout->bo); - scanout->bo = NULL; - return NULL; - } - - scanout->width = width; - scanout->height = height; - return scanout->bo->ptr; -} - -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; + goto error; } scanout->pixmap = drmmode_create_bo_pixmap(pScrn, @@ -623,9 +590,15 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout, pScrn->depth, pScrn->bitsPerPixel, pitch, scanout->bo, NULL); - if (scanout->pixmap == NULL) + if (scanout->pixmap) { + scanout->width = width; + scanout->height = height; + } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Couldn't allocate scanout pixmap for CRTC\n"); +error: + drmmode_crtc_scanout_destroy(drmmode, scanout); + } return scanout->pixmap; } |