Commit 442efe73 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

Make drmmode_crtc_scanout_create/destroy static

And the latter inline.
parent 99f3c82e
Pipeline #152209 passed with stages
in 1 minute and 37 seconds
......@@ -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
......
......@@ -468,16 +468,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
return;
}
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)
{
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment