As a preperation for future flip mode alternatives move most of the
functionality from 'present.c' into a separate file.
Leave some functions needed by future other flip modes in 'present.c'.
Signed-off-by: Roman Gilg
---
present/Makefile.am| 1 +
present/meson.build| 1 +
present/present.c | 969 +--
present/present_priv.h | 116 +++---
present/present_scmd.c | 992 +
5 files changed, 1067 insertions(+), 1012 deletions(-)
create mode 100644 present/present_scmd.c
diff --git a/present/Makefile.am b/present/Makefile.am
index 7fea669..3b458fd 100644
--- a/present/Makefile.am
+++ b/present/Makefile.am
@@ -12,6 +12,7 @@ libpresent_la_SOURCES = \
present_notify.c \
present_priv.h \
present_request.c \
+ present_scmd.c \
present_screen.c
sdk_HEADERS = present.h presentext.h
diff --git a/present/meson.build b/present/meson.build
index a4296ca..bbe0de5 100644
--- a/present/meson.build
+++ b/present/meson.build
@@ -5,6 +5,7 @@ srcs_present = [
'present_fence.c',
'present_notify.c',
'present_request.c',
+'present_scmd.c',
'present_screen.c',
]
diff --git a/present/present.c b/present/present.c
index 176e89c..ec29533 100644
--- a/present/present.c
+++ b/present/present.c
@@ -26,51 +26,11 @@
#include "present_priv.h"
#include
-#include
-#include
-#ifdef MONOTONIC_CLOCK
-#include
-#endif
-
-static uint64_t present_event_id;
-static struct xorg_list present_exec_queue;
-static struct xorg_list present_flip_queue;
-
-#if 0
-#define DebugPresent(x) ErrorF x
-#else
-#define DebugPresent(x)
-#endif
-
-static void
-present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
-
-/*
- * Returns:
- * TRUE if the first MSC value is after the second one
- * FALSE if the first MSC value is equal to or before the second one
- */
-static Bool
-msc_is_after(uint64_t test, uint64_t reference)
-{
-return (int64_t)(test - reference) > 0;
-}
-
-/*
- * Returns:
- * TRUE if the first MSC value is equal to or after the second one
- * FALSE if the first MSC value is before the second one
- */
-static Bool
-msc_is_equal_or_after(uint64_t test, uint64_t reference)
-{
-return (int64_t)(test - reference) >= 0;
-}
/*
* Copies the update region from a pixmap to the target drawable
*/
-static void
+void
present_copy_region(DrawablePtr drawable,
PixmapPtr pixmap,
RegionPtr update,
@@ -103,120 +63,7 @@ present_copy_region(DrawablePtr drawable,
FreeScratchGC(gc);
}
-static inline PixmapPtr
-present_flip_pending_pixmap(ScreenPtr screen)
-{
-present_screen_priv_ptr screen_priv = present_screen_priv(screen);
-
-if (!screen_priv)
-return NULL;
-
-if (!screen_priv->flip_pending)
-return NULL;
-
-return screen_priv->flip_pending->pixmap;
-}
-
-static Bool
-present_check_flip(RRCrtcPtrcrtc,
- WindowPtrwindow,
- PixmapPtrpixmap,
- Bool sync_flip,
- RegionPtrvalid,
- int16_t x_off,
- int16_t y_off)
-{
-ScreenPtr screen = window->drawable.pScreen;
-PixmapPtr window_pixmap;
-WindowPtr root = screen->root;
-present_screen_priv_ptr screen_priv = present_screen_priv(screen);
-
-if (!screen_priv)
-return FALSE;
-
-if (!screen_priv->info)
-return FALSE;
-
-if (!crtc)
-return FALSE;
-
-/* Check to see if the driver supports flips at all */
-if (!screen_priv->info->flip)
-return FALSE;
-
-/* Make sure the window hasn't been redirected with Composite */
-window_pixmap = screen->GetWindowPixmap(window);
-if (window_pixmap != screen->GetScreenPixmap(screen) &&
-window_pixmap != screen_priv->flip_pixmap &&
-window_pixmap != present_flip_pending_pixmap(screen))
-return FALSE;
-
-/* Check for full-screen window */
-if (!RegionEqual(>clipList, >winSize)) {
-return FALSE;
-}
-
-/* Source pixmap must align with window exactly */
-if (x_off || y_off) {
-return FALSE;
-}
-
-/* Make sure the area marked as valid fills the screen */
-if (valid && !RegionEqual(valid, >winSize)) {
-return FALSE;
-}
-
-/* Does the window match the pixmap exactly? */
-if (window->drawable.x != 0 || window->drawable.y != 0 ||
-#ifdef COMPOSITE
-window->drawable.x != pixmap->screen_x || window->drawable.y !=
pixmap->screen_y ||
-#endif
-window->drawable.width != pixmap->drawable.width ||
-window->drawable.height != pixmap->drawable.height) {
-return FALSE;
-}
-
-/* Ask the driver for permission */
-if (screen_priv->info->check_flip) {
-if