[PATCH xserver v2 02/22] present: Preliminary internal flip mode API
Roman Gilg
subdiff at gmail.com
Wed Feb 28 16:36:44 UTC 2018
Add some basic function hooks to our future present-internal flip mode API,
that will allow us to share functionality in between modes and move more code
in separate files.
Signed-off-by: Roman Gilg <subdiff at gmail.com>
---
present/present_priv.h | 26 +++++++++++++++++++++++---
present/present_scmd.c | 20 ++++++++++++++++++--
present/present_screen.c | 4 +++-
3 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/present/present_priv.h b/present/present_priv.h
index 5abec06..738c8aa 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -83,6 +83,20 @@ struct present_vblank {
Bool abort_flip; /* aborting this flip */
};
+/*
+ * Mode hooks
+ */
+typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
+ WindowPtr window,
+ PixmapPtr pixmap,
+ Bool sync_flip,
+ RegionPtr valid,
+ int16_t x_off,
+ int16_t y_off);
+typedef void (*present_priv_check_flip_window_ptr)(WindowPtr window);
+
+typedef void (*present_priv_create_event_id_ptr)(present_vblank_ptr vblank);
+
typedef struct present_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
@@ -103,6 +117,12 @@ typedef struct present_screen_priv {
Bool flip_sync;
present_screen_info_ptr info;
+
+ /* Mode hooks */
+ present_priv_check_flip_ptr check_flip;
+ present_priv_check_flip_window_ptr check_flip_window;
+
+ present_priv_create_event_id_ptr create_event_id;
} present_screen_priv_rec, *present_screen_priv_ptr;
#define wrap(priv,real,mem,func) {\
@@ -316,9 +336,6 @@ present_restore_screen_pixmap(ScreenPtr screen);
void
present_set_abort_flip(ScreenPtr screen);
-void
-present_check_flip_window(WindowPtr window);
-
RRCrtcPtr
present_get_crtc(WindowPtr window);
@@ -328,6 +345,9 @@ present_query_capabilities(RRCrtcPtr crtc);
Bool
present_init(void);
+void
+present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv);
+
/*
* present_screen.c
*/
diff --git a/present/present_scmd.c b/present/present_scmd.c
index 8b83876..f40e5ab 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -68,6 +68,12 @@ msc_is_equal_or_after(uint64_t test, uint64_t reference)
return (int64_t)(test - reference) >= 0;
}
+static void
+present_scmd_create_event_id(present_vblank_ptr vblank)
+{
+ vblank->event_id = ++present_event_id;
+}
+
static inline PixmapPtr
present_flip_pending_pixmap(ScreenPtr screen)
{
@@ -475,7 +481,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
* 'window' is being reconfigured. Check to see if it is involved
* in flipping and clean up as necessary
*/
-void
+static void
present_check_flip_window (WindowPtr window)
{
ScreenPtr screen = window->drawable.pScreen;
@@ -804,7 +810,8 @@ present_pixmap(WindowPtr window,
vblank->screen = screen;
vblank->window = window;
vblank->pixmap = pixmap;
- vblank->event_id = ++present_event_id;
+ present_scmd_create_event_id(vblank);
+
if (pixmap) {
vblank->kind = PresentCompleteKindPixmap;
pixmap->refcnt++;
@@ -982,6 +989,15 @@ present_vblank_destroy(present_vblank_ptr vblank)
free(vblank);
}
+void
+present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
+{
+ screen_priv->check_flip = &present_check_flip;
+ screen_priv->check_flip_window = &present_check_flip_window;
+
+ screen_priv->create_event_id = &present_scmd_create_event_id;
+}
+
Bool
present_init(void)
{
diff --git a/present/present_screen.c b/present/present_screen.c
index 9d03c8a..454cc53 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -161,7 +161,7 @@ present_clip_notify(WindowPtr window, int dx, int dy)
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- present_check_flip_window(window);
+ screen_priv->check_flip_window(window);
unwrap(screen_priv, screen, ClipNotify)
if (screen->ClipNotify)
screen->ClipNotify (window, dx, dy);
@@ -194,6 +194,8 @@ present_screen_init(ScreenPtr screen, present_screen_info_ptr info)
dixSetPrivate(&screen->devPrivates, &present_screen_private_key, screen_priv);
+ present_scmd_init_mode_hooks(screen_priv);
+
present_fake_screen_init(screen);
}
--
2.7.4
More information about the xorg-devel
mailing list