Skip to contentSkip to conversation

Consolidate radeon_scanout_flip_abort/handler helpers

PATCH In review Michel Dänzer 2 participants 2 messages Aug 16, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Consolidate radeon_scanout_flip_abort/handler helpers

From: Michel Dänzer <[email protected]>

While at it, make them use crtc->driver_private.

---
 src/radeon_kms.c | 85 ++++++++++++++++++++++++--------------------------------
 1 file changed, 36 insertions(+), 49 deletions(-)
src/radeon_kms.c +36 -49
index 7febf1487..4c001a31f 100644
@@ -518,6 +518,38 @@ radeon_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region,
     RegionUninit(&remaining);
 }
 
+static void
+radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
+{
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
+			 NULL);
+}
+
+static void
+radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
+				  void *event_data)
+{
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
+			 drmmode_crtc->flip_pending);
+    radeon_scanout_flip_abort(crtc, event_data);
+
+#ifdef HAVE_PRESENT_H
+    if (drmmode_crtc->present_vblank_event_id) {
+	present_event_notify(drmmode_crtc->present_vblank_event_id,
+			     drmmode_crtc->present_vblank_usec,
+			     drmmode_crtc->present_vblank_msc);
+	drmmode_crtc->present_vblank_event_id = 0;
+    }
+#endif
+}
+
 #ifdef RADEON_PIXMAP_SHARING
 
 static RegionPtr
@@ -762,38 +794,6 @@ radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
     drmmode_crtc->scanout_update_pending = TRUE;
 }
 
-static void
-radeon_prime_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
-{
-    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
-    drmmode_crtc_private_ptr drmmode_crtc = event_data;
-
-    drmmode_crtc->scanout_update_pending = FALSE;
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
-			 NULL);
-}
-
-static void
-radeon_prime_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
-				  void *event_data)
-{
-    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
-    drmmode_crtc_private_ptr drmmode_crtc = event_data;
-
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
-			 drmmode_crtc->flip_pending);
-    radeon_prime_scanout_flip_abort(crtc, event_data);
-
-#ifdef HAVE_PRESENT_H
-    if (drmmode_crtc->present_vblank_event_id) {
-	present_event_notify(drmmode_crtc->present_vblank_event_id,
-			     drmmode_crtc->present_vblank_usec,
-			     drmmode_crtc->present_vblank_msc);
-	drmmode_crtc->present_vblank_event_id = 0;
-    }
-#endif
-}
-
 static void
 radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
 {
@@ -821,9 +821,9 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent)
     drm_queue_seq = radeon_drm_queue_alloc(crtc,
 					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
 					   RADEON_DRM_QUEUE_ID_DEFAULT,
-					   drmmode_crtc,
-					   radeon_prime_scanout_flip_handler,
-					   radeon_prime_scanout_flip_abort);
+					   NULL,
+					   radeon_scanout_flip_handler,
+					   radeon_scanout_flip_abort);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "Allocating DRM event queue entry failed for PRIME flip.\n");
@@ -1081,19 +1081,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
     drmmode_crtc->scanout_update_pending = TRUE;
 }
 
-static void
-radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
-{
-    radeon_prime_scanout_flip_abort(crtc, event_data);
-}
-
-static void
-radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
-			    void *event_data)
-{
-    radeon_prime_scanout_flip_handler(crtc, msc, usec, event_data);
-}
-
 static void
 radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
 		    xf86CrtcPtr xf86_crtc)
@@ -1120,7 +1107,7 @@ radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
     drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
 					   RADEON_DRM_QUEUE_CLIENT_DEFAULT,
 					   RADEON_DRM_QUEUE_ID_DEFAULT,
-					   drmmode_crtc,
+					   NULL,
 					   radeon_scanout_flip_handler,
 					   radeon_scanout_flip_abort);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20170816093534.11341-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Wednesday, August 16, 2017 5:36 AM
To: [email protected]
Subject: [PATCH xf86-video-ati] Consolidate radeon_scanout_flip_abort/handler helpers

Quoted 5 lines

From: Michel Dänzer <[email protected]>

While at it, make them use crtc->driver_private.

Quoted 145 lines
---
 src/radeon_kms.c | 85 ++++++++++++++++++++++++---------------------------
-----
 1 file changed, 36 insertions(+), 49 deletions(-)
src/radeon_kms.c +32 -0
index 7febf1487..4c001a31f 100644
@@ -518,6 +518,38 @@ radeon_sync_scanout_pixmaps(xf86CrtcPtr
 xf86_crtc, RegionPtr new_region,
     RegionUninit(&remaining);
 }
 
+static void
+radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
+{
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+    drmmode_crtc->scanout_update_pending = FALSE;
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc-
 >flip_pending,
+			 NULL);
+}
+
+static void
+radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
+				  void *event_data)
+{
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
+    drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
+			 drmmode_crtc->flip_pending);
+    radeon_scanout_flip_abort(crtc, event_data);
+
+#ifdef HAVE_PRESENT_H
+    if (drmmode_crtc->present_vblank_event_id) {
+	present_event_notify(drmmode_crtc->present_vblank_event_id,
+			     drmmode_crtc->present_vblank_usec,
+			     drmmode_crtc->present_vblank_msc);
+	drmmode_crtc->present_vblank_event_id = 0;
+    }
+#endif
+}
+
 #ifdef RADEON_PIXMAP_SHARING

static RegionPtr

src/radeon_kms.c +0 -32
@@ -762,38 +794,6 @@
 radeon_prime_scanout_update(PixmapDirtyUpdatePtr dirty)
     drmmode_crtc->scanout_update_pending = TRUE;
 }
 
-static void
-radeon_prime_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
-{
-    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
-    drmmode_crtc_private_ptr drmmode_crtc = event_data;
-
-    drmmode_crtc->scanout_update_pending = FALSE;
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc-
 >flip_pending,
-			 NULL);
-}
-
-static void
-radeon_prime_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc,
 uint64_t usec,
-				  void *event_data)
-{
-    RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
-    drmmode_crtc_private_ptr drmmode_crtc = event_data;
-
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
-			 drmmode_crtc->flip_pending);
-    radeon_prime_scanout_flip_abort(crtc, event_data);
-
-#ifdef HAVE_PRESENT_H
-    if (drmmode_crtc->present_vblank_event_id) {
-	present_event_notify(drmmode_crtc->present_vblank_event_id,
-			     drmmode_crtc->present_vblank_usec,
-			     drmmode_crtc->present_vblank_msc);
-	drmmode_crtc->present_vblank_event_id = 0;
-    }
-#endif
-}
-

static void radeon_prime_scanout_flip(PixmapDirtyUpdatePtr ent) {

src/radeon_kms.c +3 -3
@@ -821,9 +821,9 @@ radeon_prime_scanout_flip(PixmapDirtyUpdatePtr
 ent)
     drm_queue_seq = radeon_drm_queue_alloc(crtc,
 
 RADEON_DRM_QUEUE_CLIENT_DEFAULT,
 
 RADEON_DRM_QUEUE_ID_DEFAULT,
-					   drmmode_crtc,
-
 radeon_prime_scanout_flip_handler,
-					   radeon_prime_scanout_flip_abort);
+					   NULL,
+					   radeon_scanout_flip_handler,
+					   radeon_scanout_flip_abort);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 		   "Allocating DRM event queue entry failed for PRIME

flip.\n");

src/radeon_kms.c +1 -14
@@ -1081,19 +1081,6 @@ radeon_scanout_update(xf86CrtcPtr xf86_crtc)
     drmmode_crtc->scanout_update_pending = TRUE;
 }
 
-static void
-radeon_scanout_flip_abort(xf86CrtcPtr crtc, void *event_data)
-{
-    radeon_prime_scanout_flip_abort(crtc, event_data);
-}
-
-static void
-radeon_scanout_flip_handler(xf86CrtcPtr crtc, uint32_t msc, uint64_t usec,
-			    void *event_data)
-{
-    radeon_prime_scanout_flip_handler(crtc, msc, usec, event_data);
-}
-
 static void
 radeon_scanout_flip(ScreenPtr pScreen, RADEONInfoPtr info,
 		    xf86CrtcPtr xf86_crtc)
@@ -1120,7 +1107,7 @@ radeon_scanout_flip(ScreenPtr pScreen,
 RADEONInfoPtr info,
     drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
 
 RADEON_DRM_QUEUE_CLIENT_DEFAULT,
 
 RADEON_DRM_QUEUE_ID_DEFAULT,
-					   drmmode_crtc,
+					   NULL,
src/radeon_kms.c +0 -1
 					   radeon_scanout_flip_handler,
 					   radeon_scanout_flip_abort);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
--

2.14.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx