All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-ati 1/3] Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmaps
@ 2016-08-19 10:01 Michel Dänzer
       [not found] ` <20160819100106.23006-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2016-08-19 10:01 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This should allow using multiple CRTCs via RandR 1.4 even with xserver
< 1.17. It also simplifies the code a little, and paves the way for
following changes.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 71 ++++++++++++++-------------------------------------
 src/drmmode_display.h |  1 -
 src/radeon_kms.c      | 16 +++++++-----
 3 files changed, 28 insertions(+), 60 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0401724..14d86c7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -789,11 +789,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 		fb_id = drmmode->fb_id;
 #ifdef RADEON_PIXMAP_SHARING
 		if (crtc->randr_crtc && crtc->randr_crtc->scanout_pixmap) {
-			x = drmmode_crtc->prime_pixmap_x;
-			y = 0;
-
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
-			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
+			fb_id = drmmode_crtc->scanout[0].fb_id;
+			x = y = 0;
 		} else
 #endif
 		if (drmmode_crtc->rotate.fb_id) {
@@ -802,11 +799,12 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 
 			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
 			drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
-		} else if (info->tear_free ||
+		} else if (!pScreen->isGPU &&
+			   (info->tear_free ||
 #if XF86_CRTC_VERSION >= 4
-			   crtc->driverIsPerformingTransform ||
+			    crtc->driverIsPerformingTransform ||
 #endif
-			   info->shadow_primary) {
+			    info->shadow_primary)) {
 			for (i = 0; i < (info->tear_free ? 2 : 1); i++) {
 				drmmode_crtc_scanout_create(crtc,
 							    &drmmode_crtc->scanout[i],
@@ -1118,61 +1116,30 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
 static Bool
 drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 {
-	ScreenPtr screen = xf86ScrnToScreen(crtc->scrn);
-	PixmapPtr screenpix = screen->GetScreenPixmap(screen);
-	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-	int c, total_width = 0, max_height = 0, this_x = 0;
 
 	if (!ppix) {
 		if (crtc->randr_crtc->scanout_pixmap)
-			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
-		drmmode_crtc->prime_pixmap_x = 0;
+			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap,
+						drmmode_crtc->scanout[0].pixmap);
+		drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
+					     &drmmode_crtc->scanout[0]);
 		return TRUE;
 	}
 
-	/* iterate over all the attached crtcs -
-	   work out bounding box */
-	for (c = 0; c < xf86_config->num_crtc; c++) {
-		xf86CrtcPtr iter = xf86_config->crtc[c];
-		if (!iter->enabled && iter != crtc)
-			continue;
-		if (iter == crtc) {
-			this_x = total_width;
-			total_width += ppix->drawable.width;
-			if (max_height < ppix->drawable.height)
-				max_height = ppix->drawable.height;
-		} else {
-			total_width += iter->mode.HDisplay;
-			if (max_height < iter->mode.VDisplay)
-				max_height = iter->mode.VDisplay;
-		}
-#if !defined(HAS_DIRTYTRACKING_ROTATION) && !defined(HAS_DIRTYTRACKING2)
-		if (iter != crtc) {
-			ErrorF("Cannot do multiple crtcs without X server dirty tracking 2 interface\n");
-			return FALSE;
-		}
-#endif
-	}
-
-	if (total_width != screenpix->drawable.width ||
-	    max_height != screenpix->drawable.height) {
-		Bool ret;
-		ret = drmmode_xf86crtc_resize(crtc->scrn, total_width, max_height);
-		if (ret == FALSE)
-			return FALSE;
+	if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
+					 ppix->drawable.width,
+					 ppix->drawable.height))
+		return FALSE;
 
-		screenpix = screen->GetScreenPixmap(screen);
-		screen->width = screenpix->drawable.width = total_width;
-		screen->height = screenpix->drawable.height = max_height;
-	}
-	drmmode_crtc->prime_pixmap_x = this_x;
 #ifdef HAS_DIRTYTRACKING_ROTATION
-	PixmapStartDirtyTracking(ppix, screenpix, 0, 0, this_x, 0, RR_Rotate_0);
+	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[0].pixmap,
+				 0, 0, 0, 0, RR_Rotate_0);
 #elif defined(HAS_DIRTYTRACKING2)
-	PixmapStartDirtyTracking2(ppix, screenpix, 0, 0, this_x, 0);
+	PixmapStartDirtyTracking2(ppix, drmmode_crtc->scanout[0].pixmap,
+				  0, 0, 0, 0);
 #else
-	PixmapStartDirtyTracking(ppix, screenpix, 0, 0);
+	PixmapStartDirtyTracking(ppix, drmmode_crtc->scanout[0].pixmap, 0, 0);
 #endif
 	return TRUE;
 }
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index c1109f7..24e3efb 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -95,7 +95,6 @@ typedef struct {
     int dpms_last_fps;
     uint32_t interpolated_vblanks;
     uint16_t lut_r[256], lut_g[256], lut_b[256];
-    int prime_pixmap_x;
 
     /* Modeset needed (for DPMS on or after a page flip crossing with a
      * modeset)
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 1fe64a7..d48c9b6 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -696,15 +696,17 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
     (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
     pScreen->BlockHandler = RADEONBlockHandler_KMS;
 
-    for (c = 0; c < xf86_config->num_crtc; c++) {
-	if (info->tear_free)
-	    radeon_scanout_flip(pScreen, info, xf86_config->crtc[c]);
-	else if (info->shadow_primary
+    if (!pScreen->isGPU) {
+	for (c = 0; c < xf86_config->num_crtc; c++) {
+	    if (info->tear_free)
+		radeon_scanout_flip(pScreen, info, xf86_config->crtc[c]);
+	    else if (info->shadow_primary
 #if XF86_CRTC_VERSION >= 4
-		 || xf86_config->crtc[c]->driverIsPerformingTransform
+		     || xf86_config->crtc[c]->driverIsPerformingTransform
 #endif
-	    )
-	    radeon_scanout_update(xf86_config->crtc[c]);
+		)
+		radeon_scanout_update(xf86_config->crtc[c]);
+	}
     }
 
     radeon_cs_flush_indirect(pScrn);
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH xf86-video-ati 2/3] Handle RandR 1.4 slave dirty updates via radeon_drm_queue
       [not found] ` <20160819100106.23006-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2016-08-19 10:01   ` Michel Dänzer
  2016-08-19 10:01   ` [PATCH xf86-video-ati 3/3] Track damage accurately for RandR 1.4 slave scanout Michel Dänzer
  1 sibling, 0 replies; 4+ messages in thread
From: Michel Dänzer @ 2016-08-19 10:01 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This reduces PCIe bandwidth usage and tearing.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_kms.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 90 insertions(+), 4 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index d48c9b6..adf56fd 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -383,9 +383,9 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
 
 #ifdef RADEON_PIXMAP_SHARING
 static void
-redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
+redisplay_dirty(PixmapDirtyUpdatePtr dirty)
 {
-	ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
+	ScrnInfoPtr pScrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
 	RegionRec pixregion;
 
 	PixmapRegionInit(&pixregion, dirty->slave_dst);
@@ -399,6 +399,90 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
 	radeon_cs_flush_indirect(pScrn);
 	DamageRegionProcessPending(&dirty->slave_dst->drawable);
 	RegionUninit(&pixregion);
+
+	DamageEmpty(dirty->damage);
+}
+
+static void
+radeon_prime_scanout_update_abort(xf86CrtcPtr crtc, void *event_data)
+{
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+    drmmode_crtc->scanout_update_pending = FALSE;
+}
+
+void
+radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t usec,
+				    void *event_data)
+{
+    ScrnInfoPtr scrn = crtc->scrn;
+    ScreenPtr screen = scrn->pScreen;
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+    PixmapPtr scanoutpix = crtc->randr_crtc->scanout_pixmap;
+    PixmapDirtyUpdatePtr dirty;
+
+    xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+	if (dirty->src == scanoutpix &&
+	    dirty->slave_dst == drmmode_crtc->scanout[0].pixmap) {
+	    redisplay_dirty(dirty);
+	    break;
+	}
+    }
+
+    drmmode_crtc->scanout_update_pending = FALSE;
+}
+
+static void
+radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
+{
+    ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
+    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+    xf86CrtcPtr xf86_crtc = NULL;
+    drmmode_crtc_private_ptr drmmode_crtc = NULL;
+    uintptr_t drm_queue_seq;
+    drmVBlank vbl;
+    int c;
+
+    /* Find the CRTC which is scanning out from this slave pixmap */
+    for (c = 0; c < xf86_config->num_crtc; c++) {
+	xf86_crtc = xf86_config->crtc[c];
+	drmmode_crtc = xf86_crtc->driver_private;
+	if (drmmode_crtc->scanout[0].pixmap == dirty->slave_dst)
+	    break;
+    }
+
+    if (c == xf86_config->num_crtc ||
+	!xf86_crtc->enabled ||
+	drmmode_crtc->scanout_update_pending ||
+	!drmmode_crtc->scanout[0].pixmap ||
+	drmmode_crtc->pending_dpms_mode != DPMSModeOn)
+	return;
+
+    drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
+					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
+					   RADEON_DRM_QUEUE_ID_DEFAULT, NULL,
+					   radeon_prime_scanout_update_handler,
+					   radeon_prime_scanout_update_abort);
+    if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
+	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+		   "radeon_drm_queue_alloc failed for PRIME update\n");
+	return;
+    }
+
+    vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
+    vbl.request.type |= radeon_populate_vbl_request_type(xf86_crtc);
+    vbl.request.sequence = 1;
+    vbl.request.signal = drm_queue_seq;
+    if (drmWaitVBlank(RADEONPTR(scrn)->dri2.drm_fd, &vbl)) {
+	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+		   "drmWaitVBlank failed for PRIME update: %s\n",
+		   strerror(errno));
+	radeon_drm_abort_entry(drm_queue_seq);
+	return;
+    }
+
+    drmmode_crtc->scanout_update_pending = TRUE;
 }
 
 static void
@@ -413,8 +497,10 @@ radeon_dirty_update(ScreenPtr screen)
 	xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
 		region = DamageRegion(ent->damage);
 		if (RegionNotEmpty(region)) {
-			redisplay_dirty(screen, ent);
-			DamageEmpty(ent->damage);
+			if (screen->isGPU)
+				radeon_prime_scanout_update(ent);
+			else
+				redisplay_dirty(ent);
 		}
 	}
 }
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH xf86-video-ati 3/3] Track damage accurately for RandR 1.4 slave scanout
       [not found] ` <20160819100106.23006-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2016-08-19 10:01   ` [PATCH xf86-video-ati 2/3] Handle RandR 1.4 slave dirty updates via radeon_drm_queue Michel Dänzer
@ 2016-08-19 10:01   ` Michel Dänzer
       [not found]     ` <20160819100106.23006-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2016-08-19 10:01 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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

This further reduces the PCIe bandwidth usage.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_kms.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 71 insertions(+), 11 deletions(-)

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index adf56fd..e353d66 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -382,23 +382,76 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
 }
 
 #ifdef RADEON_PIXMAP_SHARING
+static RegionPtr
+dirty_region(PixmapDirtyUpdatePtr dirty)
+{
+	RegionPtr damageregion = DamageRegion(dirty->damage);
+	RegionPtr dstregion;
+
+#ifdef HAS_DIRTYTRACKING_ROTATION
+	if (dirty->rotation != RR_Rotate_0) {
+		BoxPtr boxes = RegionRects(damageregion);
+		int nboxes = RegionNumRects(damageregion);
+		xRectanglePtr rects = malloc(nboxes * sizeof(*rects));
+		int dst_w = dirty->slave_dst->drawable.width;
+		int dst_h = dirty->slave_dst->drawable.height;
+		int nrects = 0;
+		BoxRec box;
+		int i;
+
+		for (i = 0; i < nboxes; i++) {
+			box.x1 = boxes[i].x1;
+			box.x2 = boxes[i].x2;
+			box.y1 = boxes[i].y1;
+			box.y2 = boxes[i].y2;
+			pixman_f_transform_bounds(&dirty->f_inverse, &box);
+
+			box.x1 = max(box.x1, 0);
+			box.y1 = max(box.y1, 0);
+			box.x2 = min(box.x2, dst_w);
+			box.y2 = min(box.y2, dst_h);
+			if (box.x1 >= box.x2 || box.y1 >= box.y2)
+				continue;
+
+			rects[nrects].x = box.x1;
+			rects[nrects].y = box.y1;
+			rects[nrects].width = box.x2 - box.x1;
+			rects[nrects].height = box.y2 - box.y1;
+			nrects++;
+		}
+		dstregion = RegionFromRects(nrects, rects, CT_UNSORTED);
+	} else
+#endif
+	{
+	    RegionRec pixregion;
+
+	    dstregion = RegionDuplicate(damageregion);
+	    RegionTranslate(dstregion, -dirty->x, -dirty->y);
+	    PixmapRegionInit(&pixregion, dirty->slave_dst);
+	    RegionIntersect(dstregion, dstregion, &pixregion);
+	    RegionUninit(&pixregion);
+	}
+
+	return dstregion;
+}
+
 static void
-redisplay_dirty(PixmapDirtyUpdatePtr dirty)
+redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
 {
 	ScrnInfoPtr pScrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
-	RegionRec pixregion;
 
-	PixmapRegionInit(&pixregion, dirty->slave_dst);
-	DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
+	if (dirty->slave_dst->master_pixmap)
+	    DamageRegionAppend(&dirty->slave_dst->drawable, region);
+
 #ifdef HAS_DIRTYTRACKING_ROTATION
 	PixmapSyncDirtyHelper(dirty);
 #else
-	PixmapSyncDirtyHelper(dirty, &pixregion);
+	PixmapSyncDirtyHelper(dirty, region);
 #endif
 
 	radeon_cs_flush_indirect(pScrn);
-	DamageRegionProcessPending(&dirty->slave_dst->drawable);
-	RegionUninit(&pixregion);
+	if (dirty->slave_dst->master_pixmap)
+	    DamageRegionProcessPending(&dirty->slave_dst->drawable);
 
 	DamageEmpty(dirty->damage);
 }
@@ -424,7 +477,10 @@ radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame, uint64_t u
     xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
 	if (dirty->src == scanoutpix &&
 	    dirty->slave_dst == drmmode_crtc->scanout[0].pixmap) {
-	    redisplay_dirty(dirty);
+	    RegionPtr region = dirty_region(dirty);
+
+	    redisplay_dirty(dirty, region);
+	    RegionDestroy(region);
 	    break;
 	}
     }
@@ -488,20 +544,24 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
 static void
 radeon_dirty_update(ScreenPtr screen)
 {
-	RegionPtr region;
 	PixmapDirtyUpdatePtr ent;
 
 	if (xorg_list_is_empty(&screen->pixmap_dirty_list))
 		return;
 
 	xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
-		region = DamageRegion(ent->damage);
+		RegionPtr region = dirty_region(ent);
+
 		if (RegionNotEmpty(region)) {
 			if (screen->isGPU)
 				radeon_prime_scanout_update(ent);
 			else
-				redisplay_dirty(ent);
+				redisplay_dirty(ent, region);
+		} else {
+			DamageEmpty(ent->damage);
 		}
+
+		RegionDestroy(region);
 	}
 }
 #endif
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH xf86-video-ati 3/3] Track damage accurately for RandR 1.4 slave scanout
       [not found]     ` <20160819100106.23006-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2016-08-19 15:33       ` Deucher, Alexander
  0 siblings, 0 replies; 4+ messages in thread
From: Deucher, Alexander @ 2016-08-19 15:33 UTC (permalink / raw)
  To: 'Michel Dänzer', amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Friday, August 19, 2016 6:01 AM
> To: amd-gfx@lists.freedesktop.org
> Subject: [PATCH xf86-video-ati 3/3] Track damage accurately for RandR 1.4
> slave scanout
> 
> From: Michel Dänzer <michel.daenzer@amd.com>
> 
> This further reduces the PCIe bandwidth usage.
> 
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  src/radeon_kms.c | 82
> ++++++++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 71 insertions(+), 11 deletions(-)
> 
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index adf56fd..e353d66 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -382,23 +382,76 @@ static Bool
> RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
>  }
> 
>  #ifdef RADEON_PIXMAP_SHARING
> +static RegionPtr
> +dirty_region(PixmapDirtyUpdatePtr dirty)
> +{
> +	RegionPtr damageregion = DamageRegion(dirty->damage);
> +	RegionPtr dstregion;
> +
> +#ifdef HAS_DIRTYTRACKING_ROTATION
> +	if (dirty->rotation != RR_Rotate_0) {
> +		BoxPtr boxes = RegionRects(damageregion);
> +		int nboxes = RegionNumRects(damageregion);
> +		xRectanglePtr rects = malloc(nboxes * sizeof(*rects));
> +		int dst_w = dirty->slave_dst->drawable.width;
> +		int dst_h = dirty->slave_dst->drawable.height;
> +		int nrects = 0;
> +		BoxRec box;
> +		int i;
> +
> +		for (i = 0; i < nboxes; i++) {
> +			box.x1 = boxes[i].x1;
> +			box.x2 = boxes[i].x2;
> +			box.y1 = boxes[i].y1;
> +			box.y2 = boxes[i].y2;
> +			pixman_f_transform_bounds(&dirty->f_inverse,
> &box);
> +
> +			box.x1 = max(box.x1, 0);
> +			box.y1 = max(box.y1, 0);
> +			box.x2 = min(box.x2, dst_w);
> +			box.y2 = min(box.y2, dst_h);
> +			if (box.x1 >= box.x2 || box.y1 >= box.y2)
> +				continue;
> +
> +			rects[nrects].x = box.x1;
> +			rects[nrects].y = box.y1;
> +			rects[nrects].width = box.x2 - box.x1;
> +			rects[nrects].height = box.y2 - box.y1;
> +			nrects++;
> +		}
> +		dstregion = RegionFromRects(nrects, rects, CT_UNSORTED);
> +	} else
> +#endif
> +	{
> +	    RegionRec pixregion;
> +
> +	    dstregion = RegionDuplicate(damageregion);
> +	    RegionTranslate(dstregion, -dirty->x, -dirty->y);
> +	    PixmapRegionInit(&pixregion, dirty->slave_dst);
> +	    RegionIntersect(dstregion, dstregion, &pixregion);
> +	    RegionUninit(&pixregion);
> +	}
> +
> +	return dstregion;
> +}
> +
>  static void
> -redisplay_dirty(PixmapDirtyUpdatePtr dirty)
> +redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
>  {
>  	ScrnInfoPtr pScrn = xf86ScreenToScrn(dirty->src-
> >drawable.pScreen);
> -	RegionRec pixregion;
> 
> -	PixmapRegionInit(&pixregion, dirty->slave_dst);
> -	DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
> +	if (dirty->slave_dst->master_pixmap)
> +	    DamageRegionAppend(&dirty->slave_dst->drawable, region);
> +
>  #ifdef HAS_DIRTYTRACKING_ROTATION
>  	PixmapSyncDirtyHelper(dirty);
>  #else
> -	PixmapSyncDirtyHelper(dirty, &pixregion);
> +	PixmapSyncDirtyHelper(dirty, region);
>  #endif
> 
>  	radeon_cs_flush_indirect(pScrn);
> -	DamageRegionProcessPending(&dirty->slave_dst->drawable);
> -	RegionUninit(&pixregion);
> +	if (dirty->slave_dst->master_pixmap)
> +	    DamageRegionProcessPending(&dirty->slave_dst->drawable);
> 
>  	DamageEmpty(dirty->damage);
>  }
> @@ -424,7 +477,10 @@
> radeon_prime_scanout_update_handler(xf86CrtcPtr crtc, uint32_t frame,
> uint64_t u
>      xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
>  	if (dirty->src == scanoutpix &&
>  	    dirty->slave_dst == drmmode_crtc->scanout[0].pixmap) {
> -	    redisplay_dirty(dirty);
> +	    RegionPtr region = dirty_region(dirty);
> +
> +	    redisplay_dirty(dirty, region);
> +	    RegionDestroy(region);
>  	    break;
>  	}
>      }
> @@ -488,20 +544,24 @@
> radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
>  static void
>  radeon_dirty_update(ScreenPtr screen)
>  {
> -	RegionPtr region;
>  	PixmapDirtyUpdatePtr ent;
> 
>  	if (xorg_list_is_empty(&screen->pixmap_dirty_list))
>  		return;
> 
>  	xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
> -		region = DamageRegion(ent->damage);
> +		RegionPtr region = dirty_region(ent);
> +
>  		if (RegionNotEmpty(region)) {
>  			if (screen->isGPU)
>  				radeon_prime_scanout_update(ent);
>  			else
> -				redisplay_dirty(ent);
> +				redisplay_dirty(ent, region);
> +		} else {
> +			DamageEmpty(ent->damage);
>  		}
> +
> +		RegionDestroy(region);
>  	}
>  }
>  #endif
> --
> 2.9.3
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-19 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 10:01 [PATCH xf86-video-ati 1/3] Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmaps Michel Dänzer
     [not found] ` <20160819100106.23006-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 10:01   ` [PATCH xf86-video-ati 2/3] Handle RandR 1.4 slave dirty updates via radeon_drm_queue Michel Dänzer
2016-08-19 10:01   ` [PATCH xf86-video-ati 3/3] Track damage accurately for RandR 1.4 slave scanout Michel Dänzer
     [not found]     ` <20160819100106.23006-3-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 15:33       ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.