[PATCH xf86-video-amdgpu 6/6] On screen resize, clear the new buffer before displaying it
Michel Dänzer
michel at daenzer.net
Thu Aug 6 02:59:36 PDT 2015
From: Michel Dänzer <michel.daenzer at amd.com>
Fixes garbage being intermittently visible during a screen resize.
(Ported from radeon commit 80f3d727f93cb6efedd2b39338d2301035965fe2)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_drv.h | 1 +
src/amdgpu_glamor_wrappers.c | 9 +++++++++
src/drmmode_display.c | 21 ++++++++++++++++++---
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 7194a48..3a8144f 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -206,6 +206,7 @@ typedef struct {
uint_fast32_t gpu_flushed;
uint_fast32_t gpu_synced;
Bool use_glamor;
+ Bool force_accel;
Bool shadow_primary;
Bool tear_free;
diff --git a/src/amdgpu_glamor_wrappers.c b/src/amdgpu_glamor_wrappers.c
index 8edfde0..7ff2f30 100644
--- a/src/amdgpu_glamor_wrappers.c
+++ b/src/amdgpu_glamor_wrappers.c
@@ -428,9 +428,17 @@ amdgpu_glamor_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC,
int nrect, xRectangle *prect)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pDrawable->pScreen);
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
PixmapPtr pixmap = get_drawable_pixmap(pDrawable);
struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
+ if ((info->force_accel || amdgpu_glamor_use_gpu(pixmap)) &&
+ amdgpu_glamor_prepare_access_gpu(priv)) {
+ info->glamor.SavedPolyFillRect(pDrawable, pGC, nrect, prect);
+ amdgpu_glamor_finish_access_gpu_rw(info, priv);
+ return;
+ }
+
if (amdgpu_glamor_prepare_access_cpu_rw(scrn, pixmap, priv)) {
if (amdgpu_glamor_prepare_access_gc(scrn, pGC)) {
fbPolyFillRect(pDrawable, pGC, nrect, prect);
@@ -629,6 +637,7 @@ amdgpu_glamor_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawabl
glamor_validate_gc(pGC, changes, pDrawable);
info->glamor.SavedCopyArea = pGC->ops->CopyArea;
+ info->glamor.SavedPolyFillRect = pGC->ops->PolyFillRect;
if (amdgpu_get_pixmap_private(get_drawable_pixmap(pDrawable)) ||
(pGC->stipple && amdgpu_get_pixmap_private(pGC->stipple)) ||
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 161c2ca..98dd3b1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1541,6 +1541,8 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
uint32_t bo_handle;
void *fb_shadow;
int hint = 0;
+ xRectangle rect;
+ GCPtr gc;
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
@@ -1614,6 +1616,22 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
scrn->pixmapPrivate.ptr = ppix->devPrivate.ptr;
#endif
+ if (info->use_glamor)
+ amdgpu_glamor_create_screen_resources(scrn->pScreen);
+
+ /* Clear new buffer */
+ gc = GetScratchGC(ppix->drawable.depth, scrn->pScreen);
+ ValidateGC(&ppix->drawable, gc);
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = width;
+ rect.height = height;
+ info->force_accel = TRUE;
+ (*gc->ops->PolyFillRect)(&ppix->drawable, gc, 1, &rect);
+ info->force_accel = FALSE;
+ FreeScratchGC(gc);
+ amdgpu_glamor_flush(scrn);
+
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
@@ -1624,9 +1642,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
crtc->rotation, crtc->x, crtc->y);
}
- if (info->use_glamor)
- amdgpu_glamor_create_screen_resources(scrn->pScreen);
-
if (old_fb_id)
drmModeRmFB(drmmode->fd, old_fb_id);
if (old_front) {
--
2.5.0
More information about the xorg-driver-ati
mailing list