All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qiang Yu <Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
To: xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org
Cc: Qiang Yu <Qiang.Yu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xserver 1/6] modesetting: make ms_do_pageflip generic for share with DRI2
Date: Wed, 17 Aug 2016 18:29:06 +0800	[thread overview]
Message-ID: <1471429751-17269-2-git-send-email-Qiang.Yu@amd.com> (raw)
In-Reply-To: <1471429751-17269-1-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
---
 hw/xfree86/drivers/modesetting/present.c | 36 +++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index 0093fb5..ff24594 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -235,7 +235,7 @@ ms_present_flush(WindowPtr window)
  */
 struct ms_flipdata {
     ScreenPtr screen;
-    struct ms_present_vblank_event *event;
+    void *event;
     /* number of CRTC events referencing this */
     int flip_count;
     uint64_t fe_msc;
@@ -254,6 +254,12 @@ struct ms_crtc_pageflip {
     struct ms_flipdata *flipdata;
 };
 
+typedef void (*ms_pageflip_handler_proc)(uint64_t frame,
+                                         uint64_t usec,
+                                         void *data);
+
+typedef void (*ms_pageflip_abort_proc)(void *data);
+
 /**
  * Free an ms_crtc_pageflip.
  *
@@ -277,7 +283,7 @@ ms_present_flip_free(struct ms_crtc_pageflip *flip)
  * extension code telling it when that happened
  */
 static void
-ms_flip_handler(uint64_t msc, uint64_t ust, void *data)
+ms_present_flip_handler(uint64_t msc, uint64_t ust, void *data)
 {
     struct ms_crtc_pageflip *flip = data;
     ScreenPtr screen = flip->flipdata->screen;
@@ -331,7 +337,9 @@ ms_present_flip_abort(void *data)
 static Bool
 queue_flip_on_crtc(ScreenPtr screen, xf86CrtcPtr crtc,
                    struct ms_flipdata *flipdata,
-                   int ref_crtc_vblank_pipe, uint32_t flags)
+                   int ref_crtc_vblank_pipe, uint32_t flags,
+                   ms_pageflip_handler_proc pageflip_handler,
+                   ms_pageflip_abort_proc pageflip_abort)
 {
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
     modesettingPtr ms = modesettingPTR(scrn);
@@ -353,17 +361,12 @@ queue_flip_on_crtc(ScreenPtr screen, xf86CrtcPtr crtc,
     flip->on_reference_crtc = (drmmode_crtc->vblank_pipe == ref_crtc_vblank_pipe);
     flip->flipdata = flipdata;
 
-    seq = ms_drm_queue_alloc(crtc, flip, ms_flip_handler, ms_present_flip_abort);
+    seq = ms_drm_queue_alloc(crtc, flip, pageflip_handler, pageflip_abort);
     if (!seq) {
         free(flip);
         return FALSE;
     }
 
-    DebugPresent(("\t\tms:fq %lld c %d -> %d seq %llu\n",
-                  (long long) flipdata->event->event_id,
-                  flipdata->flip_count, flipdata->flip_count + 1,
-                  (long long) seq));
-
     /* take a reference on flipdata for use in flip */
     flipdata->flip_count++;
 
@@ -394,9 +397,11 @@ queue_flip_on_crtc(ScreenPtr screen, xf86CrtcPtr crtc,
 static Bool
 ms_do_pageflip(ScreenPtr screen,
                PixmapPtr new_front,
-               struct ms_present_vblank_event *event,
+               void *event,
                int ref_crtc_vblank_pipe,
-               Bool async)
+               Bool async,
+               ms_pageflip_handler_proc pageflip_handler,
+               ms_pageflip_abort_proc pageflip_abort)
 {
 #ifndef GLAMOR_HAS_GBM
     return FALSE;
@@ -470,7 +475,8 @@ ms_do_pageflip(ScreenPtr screen,
 
         if (!queue_flip_on_crtc(screen, crtc, flipdata,
                                 ref_crtc_vblank_pipe,
-                                flags)) {
+                                flags, pageflip_handler,
+                                pageflip_abort)) {
             goto error_undo;
         }
     }
@@ -589,7 +595,8 @@ ms_present_flip(RRCrtcPtr crtc,
         return FALSE;
 
     event->event_id = event_id;
-    ret = ms_do_pageflip(screen, pixmap, event, drmmode_crtc->vblank_pipe, !sync_flip);
+    ret = ms_do_pageflip(screen, pixmap, event, drmmode_crtc->vblank_pipe, !sync_flip,
+                         ms_present_flip_handler, ms_present_flip_abort);
     if (!ret)
         xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
 
@@ -615,7 +622,8 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
     event->event_id = event_id;
 
     if (ms_present_check_flip(NULL, screen->root, pixmap, TRUE) &&
-        ms_do_pageflip(screen, pixmap, event, -1, FALSE)) {
+        ms_do_pageflip(screen, pixmap, event, -1, FALSE,
+                       ms_present_flip_handler, ms_present_flip_abort)) {
         return;
     }
 
-- 
2.7.4

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

  parent reply	other threads:[~2016-08-17 10:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 10:29 [PATCH xserver 0/6] modesetting: add DRI2 page flip support Qiang Yu
     [not found] ` <1471429751-17269-1-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-17 10:29   ` Qiang Yu [this message]
     [not found]     ` <1471429751-17269-2-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-18  7:48       ` [PATCH xserver 1/6] modesetting: make ms_do_pageflip generic for share with DRI2 Michel Dänzer
2016-08-17 10:29   ` [PATCH xserver 2/6] modesetting: move ms_do_pageflip to pageflip.c Qiang Yu
2016-08-17 10:29   ` [PATCH xserver 3/6] modesetting: add DRI2 page flip support Qiang Yu
     [not found]     ` <1471429751-17269-4-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-18  8:12       ` Michel Dänzer
     [not found]         ` <7ae3a1a6-0e00-856b-885f-a8c39e7d5842-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19  7:06           ` Yu, Qiang
     [not found]             ` <DM5PR12MB120959145EBDFF1847B5FF1A8F160-2J9CzHegvk/Xl62ebUdyqgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19  7:25               ` Michel Dänzer
     [not found]                 ` <1349a122-864e-2abd-9599-c7fa41e900c2-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19  7:48                   ` Yu, Qiang
     [not found]                     ` <MWHPR12MB12152F00C2A18FC6149473F18F160-Gy0DoCVfaSXDoeKT4XqzagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19  9:06                       ` Michel Dänzer
2016-08-17 10:29   ` [PATCH xserver 4/6] modesetting: exclude DRI2 and Present page flip Qiang Yu
2016-08-17 10:29   ` [PATCH xserver 5/6] modesetting: merge common page flip code for present and dri2 Qiang Yu
2016-08-17 10:29   ` [PATCH xserver 6/6] modesetting: remove redundent pixmap destroy Qiang Yu
2016-08-17 15:54   ` [PATCH xserver 0/6] modesetting: add DRI2 page flip support Martin Peres
2016-08-18  8:18   ` Michel Dänzer
     [not found]     ` <1b121a8c-a201-396e-426c-838c4abed8f3-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19  1:52       ` Yu, Qiang
2016-08-18 11:03   ` Emil Velikov
     [not found]     ` <CACvgo52vhzcyAS384uQdYy_XrA0LmKRdsRnLF0UB0OhV49A7uw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-19  2:02       ` Yu, Qiang
     [not found]         ` <MWHPR12MB121593BB7CA6C60D65B21E6B8F160-Gy0DoCVfaSXDoeKT4XqzagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19  2:09           ` Michel Dänzer
     [not found]             ` <09c2176a-6a7e-b28d-d7e1-6a4bb76dab58-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19  5:11               ` Keith Packard
2016-08-19  7:57               ` Emil Velikov
     [not found]                 ` <CACvgo51CgrEqe+pE-0-FOrhk3NhLSygLA54RU2U3aoFfHEvXGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-19  9:09                   ` Michel Dänzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471429751-17269-2-git-send-email-Qiang.Yu@amd.com \
    --to=qiang.yu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.