[PATCH xf86-video-ati 1/2] Pass pixmap instead of handle to radeon_do_pageflip

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

 



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

This brings us in line with amdgpu and prepares for the following
change, no functional change intended.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c |  8 ++++++--
 src/drmmode_display.h |  2 +-
 src/radeon_dri2.c     |  5 +----
 src/radeon_present.c  | 15 ++-------------
 4 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 84e7ef967..a92cf785f 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2900,7 +2900,7 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 }
 
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
-			uint32_t new_front_handle, uint64_t id, void *data,
+			PixmapPtr pixmap, uint64_t id, void *data,
 			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
 			radeon_drm_abort_proc abort,
 			enum drmmode_flip_sync flip_sync,
@@ -2918,6 +2918,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	uint32_t flip_flags = flip_sync == FLIP_ASYNC ? DRM_MODE_PAGE_FLIP_ASYNC : 0;
 	drmmode_flipdata_ptr flipdata;
 	uintptr_t drm_queue_seq = 0;
+	uint32_t handle;
 
 	if (info->allowColorTiling) {
 		if (info->ChipFamily >= CHIP_FAMILY_R600)
@@ -2939,13 +2940,16 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
              goto error;
         }
 
+	if (!radeon_get_pixmap_handle(pixmap, &handle))
+		goto error;
+
 	/*
 	 * Create a new handle for the back buffer
 	 */
 	flipdata->old_fb_id = drmmode->fb_id;
 	if (drmModeAddFB(drmmode->fd, scrn->virtualX, scrn->virtualY,
 			 scrn->depth, scrn->bitsPerPixel, pitch,
-			 new_front_handle, &drmmode->fb_id))
+			 handle, &drmmode->fb_id))
 		goto error;
 
 	/*
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index bd3f5f987..efca331cb 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -168,7 +168,7 @@ extern int drmmode_get_base_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
 extern void drmmode_clear_pending_flip(xf86CrtcPtr crtc);
 
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
-			uint32_t new_front_handle, uint64_t id, void *data,
+			PixmapPtr pixmap, uint64_t id, void *data,
 			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
 			radeon_drm_abort_proc abort,
 			enum drmmode_flip_sync flip_sync,
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index c108ceab2..cc72bd52d 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -652,7 +652,6 @@ radeon_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
     ScrnInfoPtr scrn = crtc->scrn;
     RADEONInfoPtr info = RADEONPTR(scrn);
     struct dri2_buffer_priv *back_priv;
-    struct radeon_bo *bo;
     DRI2FrameEventPtr flip_info;
     int ref_crtc_hw_id = drmmode_get_crtc_id(crtc);
 
@@ -673,9 +672,7 @@ radeon_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
 
     /* Page flip the full screen buffer */
     back_priv = back->driverPrivate;
-    bo = radeon_get_pixmap_bo(back_priv->pixmap);
-
-    if (radeon_do_pageflip(scrn, client, bo->handle,
+    if (radeon_do_pageflip(scrn, client, back_priv->pixmap,
 			   RADEON_DRM_QUEUE_ID_DEFAULT, flip_info,
 			   ref_crtc_hw_id,
 			   radeon_dri2_flip_event_handler,
diff --git a/src/radeon_present.c b/src/radeon_present.c
index af55e462f..90632d0ec 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -332,15 +332,11 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
     struct radeon_present_vblank_event *event;
     xf86CrtcPtr xf86_crtc = crtc->devPrivate;
     int crtc_id = xf86_crtc ? drmmode_get_crtc_id(xf86_crtc) : -1;
-    uint32_t handle;
     Bool ret;
 
     if (!radeon_present_check_flip(crtc, screen->root, pixmap, sync_flip))
 	return FALSE;
 
-    if (!radeon_get_pixmap_handle(pixmap, &handle))
-	return FALSE;
-
     event = calloc(1, sizeof(struct radeon_present_vblank_event));
     if (!event)
 	return FALSE;
@@ -349,7 +345,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, handle,
+    ret = radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
 			     event_id, event, crtc_id,
 			     radeon_present_flip_event,
 			     radeon_present_flip_abort,
@@ -377,7 +373,6 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
     enum drmmode_flip_sync flip_sync =
 	(radeon_present_screen_info.capabilities & PresentCapabilityAsync) ?
 	FLIP_ASYNC : FLIP_VSYNC;
-    uint32_t handle;
     int old_fb_id;
     int i;
 
@@ -386,12 +381,6 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
     if (!radeon_present_check_unflip(scrn))
 	goto modeset;
 
-    if (!radeon_get_pixmap_handle(pixmap, &handle)) {
-	ErrorF("%s: radeon_get_pixmap_handle failed, display might freeze\n",
-	       __func__);
-	goto modeset;
-    }
-
     event = calloc(1, sizeof(struct radeon_present_vblank_event));
     if (!event) {
 	ErrorF("%s: calloc failed, display might freeze\n", __func__);
@@ -401,7 +390,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
     event->event_id = event_id;
     event->unflip = TRUE;
 
-    if (radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, handle,
+    if (radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
 			   event_id, event, -1, radeon_present_flip_event,
 			   radeon_present_flip_abort, flip_sync, 0))
 	return;
-- 
2.11.0



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

  Powered by Linux