summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2015-04-02 18:29:38 +0900
committerMichel Dänzer <michel@daenzer.net>2015-04-23 10:17:40 +0900
commit3999bf88cdb192fe2f30b03bd2ed6f6a3f9f9057 (patch)
tree6e1e1d524e8489117ec0128be831895e3c1b01e7 /src
parenta4a8cdbcc10c1c5f07485a2af9e9e81e490c3e1d (diff)
Make drmmode_copy_fb() work with glamor as well
Needed for Xorg -background none. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c49
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_kms.c7
3 files changed, 44 insertions, 13 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8caad70c..326d8639 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 8220da71..cd03d536 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 554a88a3..0690ef06 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