From: Michel Dänzer <michel.daenzer@xxxxxxx> Not used anywhere else anymore. Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- src/drmmode_display.c | 65 +++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 560bfae44..38b36b244 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; } -- 2.11.0