From: Michel Dänzer <michel.daen...@amd.com> Needed for Xorg -background none.
Signed-off-by: Michel Dänzer <michel.daen...@amd.com> --- src/drmmode_display.c | 49 ++++++++++++++++++++++++++++++++++++++----------- src/radeon.h | 1 + src/radeon_kms.c | 7 +++++-- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 8caad70..326d863 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -348,11 +348,15 @@ static PixmapPtr create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) { - PixmapPtr pixmap = NULL; + RADEONInfoPtr info = RADEONPTR(pScrn); + PixmapPtr pixmap = info->fbcon_pixmap; struct radeon_bo *bo; drmModeFBPtr fbcon; struct drm_gem_flink flink; + if (pixmap) + return pixmap; + fbcon = drmModeGetFB(drmmode->fd, fbcon_id); if (fbcon == NULL) return NULL; @@ -379,12 +383,30 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height, fbcon->depth, fbcon->bpp, fbcon->pitch, 0, bo, NULL); + info->fbcon_pixmap = pixmap; radeon_bo_unref(bo); out_free_fb: drmModeFreeFB(fbcon); return pixmap; } +static void +destroy_pixmap_for_fbcon(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* XXX: The current GPUVM support in the kernel doesn't allow removing + * the virtual address range for this BO, so we need to keep around + * the pixmap to avoid breaking glamor with GPUVM + */ + if (info->use_glamor && info->ChipFamily >= CHIP_FAMILY_CAYMAN) + return; + + if (info->fbcon_pixmap) + pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap); + info->fbcon_pixmap = NULL; +} + #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) @@ -394,8 +416,9 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) PixmapPtr src, dst; ScreenPtr pScreen = pScrn->pScreen; int fbcon_id = 0; + Bool force; + GCPtr gc; int i; - Bool ret; for (i = 0; i < xf86_config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[i]->driver_private; @@ -421,18 +444,22 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) return; dst = pScreen->GetScreenPixmap(pScreen); - ret = info->accel_state->exa->PrepareCopy (src, dst, - -1, -1, GXcopy, FB_ALLONES); - if (!ret) - goto out_free_src; - info->accel_state->exa->Copy (dst, 0, 0, 0, 0, - pScrn->virtualX, pScrn->virtualY); - info->accel_state->exa->DoneCopy (dst); + + gc = GetScratchGC(pScrn->depth, pScreen); + ValidateGC(&dst->drawable, gc); + + force = info->accel_state->force; + info->accel_state->force = TRUE; + (*gc->ops->CopyArea)(&src->drawable, &dst->drawable, gc, 0, 0, + pScrn->virtualX, pScrn->virtualY, 0, 0); + info->accel_state->force = force; + + FreeScratchGC(gc); + radeon_cs_flush_indirect(pScrn); pScreen->canDoBGNoneRoot = TRUE; - out_free_src: - drmmode_destroy_bo_pixmap(src); + destroy_pixmap_for_fbcon(pScrn); return; } diff --git a/src/radeon.h b/src/radeon.h index 8220da7..cd03d53 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -475,6 +475,7 @@ typedef struct { uint_fast32_t gpu_flushed; uint_fast32_t gpu_synced; struct radeon_accel_state *accel_state; + PixmapPtr fbcon_pixmap; Bool accelOn; Bool use_glamor; Bool shadow_primary; diff --git a/src/radeon_kms.c b/src/radeon_kms.c index 082c5b6..fa40776 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -186,6 +186,9 @@ static void RADEONFreeRec(ScrnInfoPtr pScrn) info = RADEONPTR(pScrn); + if (info->fbcon_pixmap) + pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap); + if (info->dri2.drm_fd > 0) { DevUnion *pPriv; RADEONEntPtr pRADEONEnt; @@ -1706,7 +1709,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL) pScrn->pScreen = pScreen; #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 - if (bgNoneRoot && info->accelOn && !info->use_glamor) { + if (bgNoneRoot && info->accelOn) { info->CreateWindow = pScreen->CreateWindow; pScreen->CreateWindow = RADEONCreateWindow; } @@ -1772,7 +1775,7 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL) pScrn->vtSema = TRUE; #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 - if (bgNoneRoot && info->accelOn && !info->use_glamor) + if (bgNoneRoot && info->accelOn) drmmode_copy_fb(pScrn, &info->drmmode); #endif -- 2.1.4 _______________________________________________ xorg-driver-ati mailing list xorg-driver-ati@lists.x.org http://lists.x.org/mailman/listinfo/xorg-driver-ati