[PATCH xf86-video-ati 02/10] Pass reference CRTC to radeon_do_pageflip directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Simplifies the code slightly.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 11 +++--------
 src/drmmode_display.h |  2 +-
 src/radeon_dri2.c     |  4 +---
 src/radeon_present.c  |  6 ++----
 4 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 533148466..46a579ff3 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2959,7 +2959,7 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			PixmapPtr new_front, uint64_t id, void *data,
-			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
+			xf86CrtcPtr ref_crtc, radeon_drm_handler_proc handler,
 			radeon_drm_abort_proc abort,
 			enum drmmode_flip_sync flip_sync,
 			uint32_t target_msc)
@@ -3000,6 +3000,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
         flipdata->event_data = data;
         flipdata->handler = handler;
         flipdata->abort = abort;
+        flipdata->fe_crtc = ref_crtc;
 
 	for (i = 0; i < config->num_crtc; i++) {
 		crtc = config->crtc[i];
@@ -3010,12 +3011,6 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 		flipdata->flip_count++;
 		drmmode_crtc = crtc->driver_private;
 
-		/* Only the reference crtc will finally deliver its page flip
-		 * completion event. All other crtc's events will be discarded.
-		 */
-		if (drmmode_crtc->hw_id == ref_crtc_hw_id)
-			flipdata->fe_crtc = crtc;
-
 		drm_queue_seq = radeon_drm_queue_alloc(crtc, client, id,
 						       flipdata,
 						       drmmode_flip_handler,
@@ -3026,7 +3021,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			goto error;
 		}
 
-		if (drmmode_crtc->hw_id == ref_crtc_hw_id) {
+		if (crtc == ref_crtc) {
 			if (drmmode_page_flip_target_absolute(pRADEONEnt,
 							      drmmode_crtc,
 							      fb->handle,
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 82dcff0ed..f21047890 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -219,7 +219,7 @@ extern void drmmode_clear_pending_flip(xf86CrtcPtr crtc);
 
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			PixmapPtr new_front, uint64_t id, void *data,
-			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
+			xf86CrtcPtr ref_crtc, radeon_drm_handler_proc handler,
 			radeon_drm_abort_proc abort,
 			enum drmmode_flip_sync flip_sync,
 			uint32_t target_msc);
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 4b059897e..80b17f1f9 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -654,7 +654,6 @@ radeon_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
     RADEONInfoPtr info = RADEONPTR(scrn);
     struct dri2_buffer_priv *back_priv;
     DRI2FrameEventPtr flip_info;
-    int ref_crtc_hw_id = drmmode_get_crtc_id(crtc);
 
     flip_info = calloc(1, sizeof(DRI2FrameEventRec));
     if (!flip_info)
@@ -674,8 +673,7 @@ radeon_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
     /* Page flip the full screen buffer */
     back_priv = back->driverPrivate;
     if (radeon_do_pageflip(scrn, client, back_priv->pixmap,
-			   RADEON_DRM_QUEUE_ID_DEFAULT, flip_info,
-			   ref_crtc_hw_id,
+			   RADEON_DRM_QUEUE_ID_DEFAULT, flip_info, crtc,
 			   radeon_dri2_flip_event_handler,
 			   radeon_dri2_flip_event_abort, FLIP_VSYNC,
 			   target_msc - radeon_get_msc_delta(draw, crtc))) {
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 4d43733e9..c01ba95f9 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -325,8 +325,6 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     RADEONInfoPtr info = RADEONPTR(scrn);
     struct radeon_present_vblank_event *event;
-    xf86CrtcPtr xf86_crtc = crtc->devPrivate;
-    int crtc_id = xf86_crtc ? drmmode_get_crtc_id(xf86_crtc) : -1;
     Bool ret;
 
     if (!radeon_present_check_flip(crtc, screen->root, pixmap, sync_flip))
@@ -341,7 +339,7 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
     radeon_cs_flush_indirect(scrn);
 
     ret = radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
-			     event_id, event, crtc_id,
+			     event_id, event, crtc->devPrivate,
 			     radeon_present_flip_event,
 			     radeon_present_flip_abort,
 			     sync_flip ? FLIP_VSYNC : FLIP_ASYNC,
@@ -385,7 +383,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
     event->unflip = TRUE;
 
     if (radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
-			   event_id, event, -1, radeon_present_flip_event,
+			   event_id, event, NULL, radeon_present_flip_event,
 			   radeon_present_flip_abort, flip_sync, 0))
 	return;
 
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux