summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/amdgpu_kms.c13
-rw-r--r--src/drmmode_display.c35
-rw-r--r--src/drmmode_display.h15
3 files changed, 28 insertions, 35 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index f3c6aac..91894d8 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1231,8 +1231,7 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
&drmmode_crtc->scanout_last_region);
RegionEmpty(&drmmode_crtc->scanout_last_region);
amdgpu_scanout_update(xf86_crtc);
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[scanout_id]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[scanout_id]);
drmmode_crtc->tear_free = FALSE;
return;
}
@@ -2269,7 +2268,6 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
if (!info->shadow_fb) {
AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- PixmapPtr black_scanout = NULL;
xf86CrtcPtr crtc;
drmmode_crtc_private_ptr drmmode_crtc;
unsigned w = 0, h = 0;
@@ -2295,7 +2293,11 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
/* Make all active CRTCs scan out from an all-black framebuffer */
if (w > 0 && h > 0) {
- if (drmmode_crtc_scanout_create(crtc, &black_scanout, w, h)) {
+ PixmapPtr black_scanout =
+ pScreen->CreatePixmap(pScreen, w, h, pScrn->depth,
+ AMDGPU_CREATE_PIXMAP_SCANOUT);
+
+ if (black_scanout) {
struct drmmode_fb *black_fb =
amdgpu_pixmap_get_fb(black_scanout);
@@ -2327,11 +2329,12 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
}
}
}
+
+ pScreen->DestroyPixmap(black_scanout);
}
}
xf86RotateFreeShadow(pScrn);
- drmmode_crtc_scanout_destroy(&info->drmmode, &black_scanout);
/* Unreference FBs of all pixmaps. After this, the only FB remaining
* should be the all-black one being scanned out by active CRTCs
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 5b0ec52..9c1fcbb 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -469,16 +469,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
}
void
-drmmode_crtc_scanout_destroy(drmmode_ptr drmmode, PixmapPtr *scanout)
-{
- if (!*scanout)
- return;
-
- (*scanout)->drawable.pScreen->DestroyPixmap(*scanout);
- (*scanout) = NULL;
-}
-
-void
drmmode_crtc_scanout_free(xf86CrtcPtr crtc)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -490,30 +480,26 @@ drmmode_crtc_scanout_free(xf86CrtcPtr crtc)
amdgpu_drm_queue_handle_deferred(crtc);
}
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[0]);
- drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
- &drmmode_crtc->scanout[1]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[0]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[1]);
if (drmmode_crtc->scanout_damage)
DamageDestroy(drmmode_crtc->scanout_damage);
}
-PixmapPtr
+static Bool
drmmode_crtc_scanout_create(xf86CrtcPtr crtc, PixmapPtr *scanout,
int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
ScreenPtr screen = pScrn->pScreen;
if (*scanout) {
if ((*scanout)->drawable.width == width &&
(*scanout)->drawable.height == height)
- return *scanout;
+ return TRUE;
- drmmode_crtc_scanout_destroy(drmmode, scanout);
+ drmmode_crtc_scanout_destroy(scanout);
}
*scanout = screen->CreatePixmap(screen, width, height, pScrn->depth,
@@ -526,10 +512,10 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, PixmapPtr *scanout,
if (!amdgpu_pixmap_get_fb(*scanout)) {
ErrorF("failed to create CRTC scanout FB\n");
error:
- drmmode_crtc_scanout_destroy(drmmode, scanout);
+ drmmode_crtc_scanout_destroy(scanout);
}
- return *scanout;
+ return FALSE;
}
static void
@@ -1313,7 +1299,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
Bool handle_deferred = FALSE;
unsigned scanout_id = 0;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
int saved_x, saved_y;
Rotation saved_rotation;
DisplayModeRec saved_mode;
@@ -1436,8 +1421,7 @@ done:
fb != amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id])) {
drmmode_crtc_scanout_free(crtc);
} else if (!drmmode_crtc->tear_free) {
- drmmode_crtc_scanout_destroy(drmmode,
- &drmmode_crtc->scanout[1]);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->scanout[1]);
}
}
@@ -1769,9 +1753,8 @@ drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap,
void *data)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->rotate);
+ drmmode_crtc_scanout_destroy(&drmmode_crtc->rotate);
}
static void
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 8f132c3..b7d5401 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -234,6 +234,17 @@ drmmode_fb_reference_loc(int drm_fd, struct drmmode_fb **old, struct drmmode_fb
drmmode_fb_reference_loc(fd, old, new, __func__, __LINE__)
+static inline void
+drmmode_crtc_scanout_destroy(PixmapPtr *scanout)
+{
+ if (!*scanout)
+ return;
+
+ (*scanout)->drawable.pScreen->DestroyPixmap(*scanout);
+ (*scanout) = NULL;
+}
+
+
extern int drmmode_page_flip_target_absolute(AMDGPUEntPtr pAMDGPUEnt,
drmmode_crtc_private_ptr drmmode_crtc,
int fb_id, uint32_t flags,
@@ -253,11 +264,7 @@ extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
-extern void drmmode_crtc_scanout_destroy(drmmode_ptr drmmode,
- PixmapPtr *scanout);
void drmmode_crtc_scanout_free(xf86CrtcPtr crtc);
-PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc, PixmapPtr *scanout,
- int width, int height);
extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);