From patchwork Tue Apr 18 10:07:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michel_D=C3=A4nzer?= X-Patchwork-Id: 9685273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFB4E602C2 for ; Tue, 18 Apr 2017 10:08:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5DE4209D8 for ; Tue, 18 Apr 2017 10:08:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA1BB28403; Tue, 18 Apr 2017 10:08:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59D58209D8 for ; Tue, 18 Apr 2017 10:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA5A089DFC; Tue, 18 Apr 2017 10:08:05 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from netline-mail3.netline.ch (mail.netline.ch [148.251.143.178]) by gabe.freedesktop.org (Postfix) with ESMTP id B8B8889CDD; Tue, 18 Apr 2017 10:08:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by netline-mail3.netline.ch (Postfix) with ESMTP id 2331D2AA0B8; Tue, 18 Apr 2017 12:08:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at netline-mail3.netline.ch Received: from netline-mail3.netline.ch ([127.0.0.1]) by localhost (netline-mail3.netline.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id J4cMldvCs_No; Tue, 18 Apr 2017 12:08:02 +0200 (CEST) Received: from kaveri (42-144-27-164.rev.home.ne.jp [42.144.27.164]) by netline-mail3.netline.ch (Postfix) with ESMTPSA id 3A3D32AA0F1; Tue, 18 Apr 2017 12:08:02 +0200 (CEST) Received: from daenzer by kaveri with local (Exim 4.89) (envelope-from ) id 1d0Q38-0003oY-OJ; Tue, 18 Apr 2017 19:07:54 +0900 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= To: xorg-devel@lists.x.org Date: Tue, 18 Apr 2017 19:07:53 +0900 Message-Id: <20170418100754.14621-1-michel@daenzer.net> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Cc: nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH xserver] Make PixmapDirtyUpdateRec::src a DrawablePtr X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Michel Dänzer This allows making the master screen's pixmap_dirty_list entries explicitly reflect that we're now tracking the root window instead of the screen pixmap, in order to allow Present page flipping on master outputs while there are active slave outputs. Define HAS_DIRTYTRACKING_DRAWABLE_SRC for drivers to check, but leave HAS_DIRTYTRACKING_ROTATION defined as well to make things slightly easier for drivers. Signed-off-by: Michel Dänzer Reviewed-by: Adam Jackson --- The Start/StopFlippingPixmapTracking related changes are only compile tested. The rest is smoke tested with the modesetting, amdgpu and radeon drivers. dix/pixmap.c | 24 +++++++++++------------- hw/xfree86/drivers/modesetting/driver.c | 10 +++++----- hw/xfree86/drivers/modesetting/drmmode_display.c | 5 +++-- hw/xfree86/drivers/modesetting/drmmode_display.h | 2 +- include/pixmap.h | 5 +++-- include/pixmapstr.h | 3 ++- include/scrnintstr.h | 6 +++--- randr/randrstr.h | 2 +- randr/rrcrtc.c | 20 +++++++++----------- 9 files changed, 38 insertions(+), 39 deletions(-) diff --git a/dix/pixmap.c b/dix/pixmap.c index b67a2e8a6..81ac5e2d8 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -181,12 +181,12 @@ PixmapDirtyDamageDestroy(DamagePtr damage, void *closure) } Bool -PixmapStartDirtyTracking(PixmapPtr src, +PixmapStartDirtyTracking(DrawablePtr src, PixmapPtr slave_dst, int x, int y, int dst_x, int dst_y, Rotation rotation) { - ScreenPtr screen = src->drawable.pScreen; + ScreenPtr screen = src->pScreen; PixmapDirtyUpdatePtr dirty_update; RegionPtr damageregion; RegionRec dstregion; @@ -204,8 +204,7 @@ PixmapStartDirtyTracking(PixmapPtr src, dirty_update->dst_y = dst_y; dirty_update->rotation = rotation; dirty_update->damage = DamageCreate(NULL, PixmapDirtyDamageDestroy, - DamageReportNone, - TRUE, src->drawable.pScreen, + DamageReportNone, TRUE, screen, dirty_update); if (rotation != RR_Rotate_0) { @@ -241,16 +240,15 @@ PixmapStartDirtyTracking(PixmapPtr src, RegionUnion(damageregion, damageregion, &dstregion); RegionUninit(&dstregion); - DamageRegister(screen->root ? &screen->root->drawable : &src->drawable, - dirty_update->damage); + DamageRegister(src, dirty_update->damage); xorg_list_add(&dirty_update->ent, &screen->pixmap_dirty_list); return TRUE; } Bool -PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst) +PixmapStopDirtyTracking(DrawablePtr src, PixmapPtr slave_dst) { - ScreenPtr screen = src->drawable.pScreen; + ScreenPtr screen = src->pScreen; PixmapDirtyUpdatePtr ent, safe; xorg_list_for_each_entry_safe(ent, safe, &screen->pixmap_dirty_list, ent) { @@ -269,8 +267,8 @@ PixmapDirtyCopyArea(PixmapPtr dst, PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region) { - ScreenPtr pScreen = dirty->src->drawable.pScreen; - DrawablePtr src = pScreen->root ? &pScreen->root->drawable : &dirty->src->drawable; + DrawablePtr src = dirty->src; + ScreenPtr pScreen = src->pScreen; int n; BoxPtr b; GCPtr pGC; @@ -309,7 +307,7 @@ PixmapDirtyCompositeRotate(PixmapPtr dst_pixmap, PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region) { - ScreenPtr pScreen = dirty->src->drawable.pScreen; + ScreenPtr pScreen = dirty->src->pScreen; PictFormatPtr format = PictureWindowFormat(pScreen->root); PicturePtr src, dst; XID include_inferiors = IncludeInferiors; @@ -318,7 +316,7 @@ PixmapDirtyCompositeRotate(PixmapPtr dst_pixmap, int error; src = CreatePicture(None, - &pScreen->root->drawable, + dirty->src, format, CPSubwindowMode, &include_inferiors, serverClient, &error); @@ -367,7 +365,7 @@ PixmapDirtyCompositeRotate(PixmapPtr dst_pixmap, */ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty) { - ScreenPtr pScreen = dirty->src->drawable.pScreen; + ScreenPtr pScreen = dirty->src->pScreen; RegionPtr region = DamageRegion(dirty->damage); PixmapPtr dst; SourceValidateProcPtr SourceValidate; diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index d7030e5c2..8ce51a502 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -1219,12 +1219,12 @@ msDisableSharedPixmapFlipping(RRCrtcPtr crtc) } static Bool -msStartFlippingPixmapTracking(RRCrtcPtr crtc, PixmapPtr src, +msStartFlippingPixmapTracking(RRCrtcPtr crtc, DrawablePtr src, PixmapPtr slave_dst1, PixmapPtr slave_dst2, int x, int y, int dst_x, int dst_y, Rotation rotation) { - ScreenPtr pScreen = src->drawable.pScreen; + ScreenPtr pScreen = src->pScreen; modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); msPixmapPrivPtr ppriv1 = msGetPixmapPriv(&ms->drmmode, slave_dst1), @@ -1264,7 +1264,7 @@ msPresentSharedPixmap(PixmapPtr slave_dst) RegionPtr region = DamageRegion(ppriv->dirty->damage); if (RegionNotEmpty(region)) { - redisplay_dirty(ppriv->slave_src->drawable.pScreen, ppriv->dirty, NULL); + redisplay_dirty(ppriv->slave_src->pScreen, ppriv->dirty, NULL); DamageEmpty(ppriv->dirty->damage); return TRUE; @@ -1274,10 +1274,10 @@ msPresentSharedPixmap(PixmapPtr slave_dst) } static Bool -msStopFlippingPixmapTracking(PixmapPtr src, +msStopFlippingPixmapTracking(DrawablePtr src, PixmapPtr slave_dst1, PixmapPtr slave_dst2) { - ScreenPtr pScreen = src->drawable.pScreen; + ScreenPtr pScreen = src->pScreen; modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); msPixmapPrivPtr ppriv1 = msGetPixmapPriv(&ms->drmmode, slave_dst1), diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 516eb7691..f00fc3194 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -857,7 +857,7 @@ drmmode_set_target_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix, int c, total_width = 0, max_height = 0, this_x = 0; if (*target) { - PixmapStopDirtyTracking(*target, screenpix); + PixmapStopDirtyTracking(&(*target)->drawable, screenpix); if (drmmode->fb_id) { drmModeRmFB(drmmode->fd, drmmode->fb_id); drmmode->fb_id = 0; @@ -897,7 +897,8 @@ drmmode_set_target_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix, screen->height = screenpix->drawable.height = max_height; } drmmode_crtc->prime_pixmap_x = this_x; - PixmapStartDirtyTracking(ppix, screenpix, 0, 0, this_x, 0, RR_Rotate_0); + PixmapStartDirtyTracking(&ppix->drawable, screenpix, 0, 0, this_x, 0, + RR_Rotate_0); *target = ppix; return TRUE; } diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h index f774250ef..c86e13f56 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.h +++ b/hw/xfree86/drivers/modesetting/drmmode_display.h @@ -153,7 +153,7 @@ typedef struct _msPixmapPriv { /** Source fields for flipping shared pixmaps */ Bool defer_dirty_update; /* if we want to manually update */ PixmapDirtyUpdatePtr dirty; /* cached dirty ent to avoid searching list */ - PixmapPtr slave_src; /* if we exported shared pixmap, dirty tracking src */ + DrawablePtr slave_src; /* if we exported shared pixmap, dirty tracking src */ Bool notify_on_damage; /* if sink has requested damage notification */ } msPixmapPrivRec, *msPixmapPrivPtr; diff --git a/include/pixmap.h b/include/pixmap.h index 86b513d47..b7fb25723 100644 --- a/include/pixmap.h +++ b/include/pixmap.h @@ -119,14 +119,15 @@ extern _X_EXPORT void PixmapUnshareSlavePixmap(PixmapPtr slave_pixmap); #define HAS_DIRTYTRACKING_ROTATION 1 +#define HAS_DIRTYTRACKING_DRAWABLE_SRC 1 extern _X_EXPORT Bool -PixmapStartDirtyTracking(PixmapPtr src, +PixmapStartDirtyTracking(DrawablePtr src, PixmapPtr slave_dst, int x, int y, int dst_x, int dst_y, Rotation rotation); extern _X_EXPORT Bool -PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst); +PixmapStopDirtyTracking(DrawablePtr src, PixmapPtr slave_dst); /* helper function, drivers can do this themselves if they can do it more efficently */ diff --git a/include/pixmapstr.h b/include/pixmapstr.h index 4bd246562..de501013a 100644 --- a/include/pixmapstr.h +++ b/include/pixmapstr.h @@ -88,7 +88,8 @@ typedef struct _Pixmap { } PixmapRec; typedef struct _PixmapDirtyUpdate { - PixmapPtr src, slave_dst; + DrawablePtr src; /* Root window / shared pixmap */ + PixmapPtr slave_dst; /* Shared / scanout pixmap */ int x, y; DamagePtr damage; struct xorg_list ent; diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 207289a91..9b663fa44 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -377,7 +377,7 @@ typedef Bool (*SetSharedPixmapBackingProcPtr)(PixmapPtr, void *); */ typedef void (*SyncSharedPixmapProcPtr)(PixmapDirtyUpdatePtr); -typedef Bool (*StartPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr, +typedef Bool (*StartPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr, int x, int y, int dst_x, int dst_y, Rotation rotation); @@ -386,9 +386,9 @@ typedef Bool (*PresentSharedPixmapProcPtr)(PixmapPtr); typedef Bool (*RequestSharedPixmapNotifyDamageProcPtr)(PixmapPtr); -typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr); +typedef Bool (*StopPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr); -typedef Bool (*StopFlippingPixmapTrackingProcPtr)(PixmapPtr, +typedef Bool (*StopFlippingPixmapTrackingProcPtr)(DrawablePtr, PixmapPtr, PixmapPtr); typedef Bool (*SharedPixmapNotifyDamageProcPtr)(PixmapPtr); diff --git a/randr/randrstr.h b/randr/randrstr.h index 706e9a7b0..95979a8c6 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -279,7 +279,7 @@ typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen, typedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap); -typedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, PixmapPtr, +typedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, DrawablePtr, PixmapPtr, PixmapPtr, int x, int y, int dst_x, int dst_y, diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index d1a51f0aa..cdf96df23 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -388,12 +388,12 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc) if (crtc->scanout_pixmap) { ScreenPtr master = crtc->pScreen->current_master; - PixmapPtr mscreenpix = master->GetScreenPixmap(master); + DrawablePtr mrootdraw = &master->root->drawable; if (crtc->scanout_pixmap_back) { pScrPriv->rrDisableSharedPixmapFlipping(crtc); - master->StopFlippingPixmapTracking(mscreenpix, + master->StopFlippingPixmapTracking(mrootdraw, crtc->scanout_pixmap, crtc->scanout_pixmap_back); @@ -402,7 +402,8 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc) } else { pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL); - master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap); + master->StopPixmapTracking(mrootdraw, + crtc->scanout_pixmap); } rrDestroySharedPixmap(crtc, crtc->scanout_pixmap); @@ -491,9 +492,8 @@ rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height, ScreenPtr master = crtc->pScreen->current_master; rrScrPrivPtr pMasterScrPriv = rrGetScrPriv(master); rrScrPrivPtr pSlaveScrPriv = rrGetScrPriv(crtc->pScreen); - - int depth; - PixmapPtr mscreenpix; + DrawablePtr mrootdraw = &master->root->drawable; + int depth = mrootdraw->depth; PixmapPtr spix_front; /* Create a pixmap on the master screen, then get a shared handle for it. @@ -515,9 +515,6 @@ rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height, defer to the slave. */ - mscreenpix = master->GetScreenPixmap(master); - depth = mscreenpix->drawable.depth; - if (crtc->scanout_pixmap) RRCrtcDetachScanoutPixmap(crtc); @@ -553,7 +550,8 @@ rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height, crtc->scanout_pixmap = spix_front; crtc->scanout_pixmap_back = spix_back; - if (!pMasterScrPriv->rrStartFlippingPixmapTracking(crtc, mscreenpix, + if (!pMasterScrPriv->rrStartFlippingPixmapTracking(crtc, + mrootdraw, spix_front, spix_back, x, y, 0, 0, @@ -588,7 +586,7 @@ fail: /* If flipping funcs fail, just fall back to unsynchronized */ } crtc->scanout_pixmap = spix_front; - master->StartPixmapTracking(mscreenpix, spix_front, x, y, 0, 0, rotation); + master->StartPixmapTracking(mrootdraw, spix_front, x, y, 0, 0, rotation); return TRUE; }