[PATCH 08/19] present: Add more hooks to internal flip mode API
Roman Gilg
subdiff at gmail.com
Mon Jan 29 13:34:06 UTC 2018
Add hooks to query caps, get crtcs, abort vblanks and destroy
a flip.
Signed-off-by: Roman Gilg <subdiff at gmail.com>
---
present/present.c | 28 ++++++++++++++++++++++++++++
present/present_priv.h | 33 +++++++++++++++++++++++++--------
present/present_scmd.c | 38 ++++++++++++++------------------------
present/present_screen.c | 6 ++++--
4 files changed, 71 insertions(+), 34 deletions(-)
diff --git a/present/present.c b/present/present.c
index 505d3ea..908575e 100644
--- a/present/present.c
+++ b/present/present.c
@@ -38,6 +38,34 @@ msc_is_equal_or_after(uint64_t test, uint64_t reference)
return (int64_t)(test - reference) >= 0;
}
+uint32_t
+present_query_capabilities(RRCrtcPtr crtc)
+{
+ present_screen_priv_ptr screen_priv;
+
+ if (!crtc)
+ return 0;
+
+ screen_priv = present_screen_priv(crtc->pScreen);
+
+ if (!screen_priv)
+ return 0;
+
+ return screen_priv->query_capabilities(screen_priv);
+}
+
+RRCrtcPtr
+present_get_crtc(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ present_screen_priv_ptr screen_priv = present_screen_priv(screen);
+
+ if (!screen_priv)
+ return NULL;
+
+ return screen_priv->get_crtc(screen_priv, window);
+}
+
/*
* Copies the update region from a pixmap to the target drawable
*/
diff --git a/present/present_priv.h b/present/present_priv.h
index 2c32457..b242e96 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -83,9 +83,15 @@ struct present_vblank {
Bool abort_flip; /* aborting this flip */
};
+typedef struct present_screen_priv present_screen_priv_rec, *present_screen_priv_ptr;
+
/*
* Mode hooks
*/
+typedef uint32_t (*present_priv_query_capabilities_ptr)(present_screen_priv_ptr screen_priv);
+typedef RRCrtcPtr (*present_priv_get_crtc_ptr)(present_screen_priv_ptr screen_priv,
+ WindowPtr window);
+
typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
WindowPtr window,
PixmapPtr pixmap,
@@ -121,7 +127,13 @@ typedef int (*present_priv_queue_vblank_ptr)(ScreenPtr screen,
typedef void (*present_priv_flush_ptr)(WindowPtr window);
typedef void (*present_priv_re_execute_ptr)(present_vblank_ptr vblank);
-typedef struct present_screen_priv {
+typedef void (*present_priv_abort_vblank_ptr)(ScreenPtr screen,
+ RRCrtcPtr crtc,
+ uint64_t event_id,
+ uint64_t msc);
+typedef void (*present_priv_flip_destroy_ptr)(ScreenPtr screen);
+
+struct present_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
@@ -143,6 +155,9 @@ typedef struct present_screen_priv {
present_screen_info_ptr info;
/* Mode hooks */
+ present_priv_query_capabilities_ptr query_capabilities;
+ present_priv_get_crtc_ptr get_crtc;
+
present_priv_check_flip_ptr check_flip;
present_priv_check_flip_window_ptr check_flip_window;
@@ -153,7 +168,9 @@ typedef struct present_screen_priv {
present_priv_flush_ptr flush;
present_priv_re_execute_ptr re_execute;
-} present_screen_priv_rec, *present_screen_priv_ptr;
+ present_priv_abort_vblank_ptr abort_vblank;
+ present_priv_flip_destroy_ptr flip_destroy;
+};
#define wrap(priv,real,mem,func) {\
priv->mem = real->mem; \
@@ -219,6 +236,12 @@ msc_is_after(uint64_t test, uint64_t reference)
/*
* present.c
*/
+uint32_t
+present_query_capabilities(RRCrtcPtr crtc);
+
+RRCrtcPtr
+present_get_crtc(WindowPtr window);
+
void
present_copy_region(DrawablePtr drawable,
PixmapPtr pixmap,
@@ -387,12 +410,6 @@ present_restore_screen_pixmap(ScreenPtr screen);
void
present_set_abort_flip(ScreenPtr screen);
-RRCrtcPtr
-present_get_crtc(WindowPtr window);
-
-uint32_t
-present_query_capabilities(RRCrtcPtr crtc);
-
Bool
present_init(void);
diff --git a/present/present_scmd.c b/present/present_scmd.c
index 3146ecb..73c9f52 100644
--- a/present/present_scmd.c
+++ b/present/present_scmd.c
@@ -149,34 +149,18 @@ present_flip(RRCrtcPtr crtc,
return (*screen_priv->info->flip) (crtc, event_id, target_msc, pixmap, sync_flip);
}
-RRCrtcPtr
-present_get_crtc(WindowPtr window)
+static RRCrtcPtr
+present_scmd_get_crtc(present_screen_priv_ptr screen_priv, WindowPtr window)
{
- ScreenPtr screen = window->drawable.pScreen;
- present_screen_priv_ptr screen_priv = present_screen_priv(screen);
-
- if (!screen_priv)
- return NULL;
-
if (!screen_priv->info)
return NULL;
return (*screen_priv->info->get_crtc)(window);
}
-uint32_t
-present_query_capabilities(RRCrtcPtr crtc)
+static uint32_t
+present_scmd_query_capabilities(present_screen_priv_ptr screen_priv)
{
- present_screen_priv_ptr screen_priv;
-
- if (!crtc)
- return 0;
-
- screen_priv = present_screen_priv(crtc->pScreen);
-
- if (!screen_priv)
- return 0;
-
if (!screen_priv->info)
return 0;
@@ -765,8 +749,8 @@ present_scmd_pixmap(WindowPtr window,
return Success;
}
-void
-present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
+static void
+present_scmd_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
{
present_vblank_ptr vblank;
@@ -796,8 +780,8 @@ present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64
}
}
-void
-present_flip_destroy(ScreenPtr screen)
+static void
+present_scmd_flip_destroy(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
@@ -812,6 +796,9 @@ present_flip_destroy(ScreenPtr screen)
void
present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
{
+ screen_priv->query_capabilities = &present_scmd_query_capabilities;
+ screen_priv->get_crtc = &present_scmd_get_crtc;
+
screen_priv->check_flip = &present_check_flip;
screen_priv->check_flip_window = &present_check_flip_window;
@@ -821,6 +808,9 @@ present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
screen_priv->queue_vblank = &present_queue_vblank;
screen_priv->flush = &present_flush;
screen_priv->re_execute = &present_re_execute;
+
+ screen_priv->abort_vblank = &present_scmd_abort_vblank;
+ screen_priv->flip_destroy = &present_scmd_flip_destroy;
}
Bool
diff --git a/present/present_screen.c b/present/present_screen.c
index 454cc53..98f701a 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -58,7 +58,7 @@ present_close_screen(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
- present_flip_destroy(screen);
+ screen_priv->flip_destroy(screen);
unwrap(screen_priv, screen, CloseScreen);
(*screen->CloseScreen) (screen);
@@ -72,11 +72,13 @@ present_close_screen(ScreenPtr screen)
static void
present_free_window_vblank(WindowPtr window)
{
+ ScreenPtr screen = window->drawable.pScreen;
+ present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window);
present_vblank_ptr vblank, tmp;
xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
- present_abort_vblank(window->drawable.pScreen, vblank->crtc, vblank->event_id, vblank->target_msc);
+ screen_priv->abort_vblank(window->drawable.pScreen, vblank->crtc, vblank->event_id, vblank->target_msc);
present_vblank_destroy(vblank);
}
}
--
2.7.4
More information about the xorg-devel
mailing list