From: Michel Dänzer <michel.daen...@amd.com>

Preparation for following changes, no functional change intended yet.

(Ported from radeon commit 1443270e52e8562bd8dc3603f301963bd4027cef)

Signed-off-by: Michel Dänzer <michel.daen...@amd.com>
---
 src/amdgpu_drv.h      |  3 ++-
 src/amdgpu_kms.c      | 18 +++++++++---------
 src/drmmode_display.c |  3 ++-
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index da71ce848..515d46625 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -340,7 +340,8 @@ typedef struct {
 Bool amdgpu_dri3_screen_init(ScreenPtr screen);
 
 /* amdgpu_kms.c */
-Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id);
+Bool amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
+                              DrawablePtr src_draw);
 void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
 #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
                                   , RegionPtr pBSRegion
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index d8f667df0..230a779fc 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -792,7 +792,8 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
 #endif
 
 Bool
-amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
+amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
+                         DrawablePtr src_draw)
 {
        drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
        RegionPtr pRegion = DamageRegion(drmmode_crtc->scanout_damage);
@@ -827,10 +828,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int 
scanout_id)
                PicturePtr src, dst;
                XID include_inferiors = IncludeInferiors;
 
-               src = CreatePicture(None,
-                                   &pScreen->root->drawable,
-                                   format,
-                                   CPSubwindowMode,
+               src = CreatePicture(None, src_draw, format, CPSubwindowMode,
                                    &include_inferiors, serverClient, &error);
                if (!src) {
                        ErrorF("Failed to create source picture for transformed 
scanout "
@@ -874,8 +872,7 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int 
scanout_id)
                GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
 
                ValidateGC(pDraw, gc);
-               
(*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable,
-                                    pDraw, gc,
+               (*gc->ops->CopyArea)(src_draw, pDraw, gc,
                                     xf86_crtc->x + extents.x1, xf86_crtc->y + 
extents.y1,
                                     extents.x2 - extents.x1, extents.y2 - 
extents.y1,
                                     extents.x1, extents.y1);
@@ -900,8 +897,10 @@ amdgpu_scanout_update_handler(xf86CrtcPtr crtc, uint32_t 
frame, uint64_t usec,
                                                          void *event_data)
 {
        drmmode_crtc_private_ptr drmmode_crtc = event_data;
+       ScreenPtr screen = crtc->scrn->pScreen;
 
-       amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id);
+       amdgpu_scanout_do_update(crtc, drmmode_crtc->scanout_id,
+                                
&screen->GetWindowPixmap(screen->root)->drawable);
 
        amdgpu_scanout_update_abort(crtc, event_data);
 }
@@ -988,7 +987,8 @@ amdgpu_scanout_flip(ScreenPtr pScreen, AMDGPUInfoPtr info,
                return;
 
        scanout_id = drmmode_crtc->scanout_id ^ 1;
-       if (!amdgpu_scanout_do_update(xf86_crtc, scanout_id))
+       if (!amdgpu_scanout_do_update(xf86_crtc, scanout_id,
+                                     
&pScreen->GetWindowPixmap(pScreen->root)->drawable))
                return;
 
        drm_queue_seq = amdgpu_drm_queue_alloc(xf86_crtc,
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index eb701a89a..972a6f217 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -770,7 +770,8 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, 
DisplayModePtr mode,
                *fb = 
amdgpu_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
                *x = *y = 0;
 
-               amdgpu_scanout_do_update(crtc, scanout_id);
+               amdgpu_scanout_do_update(crtc, scanout_id,
+                                        
&screen->GetWindowPixmap(screen->root)->drawable);
                amdgpu_glamor_finish(scrn);
        }
 }
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to