diff options
author | Roman Gilg <subdiff@gmail.com> | 2018-03-13 16:00:35 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-03-28 14:36:14 -0400 |
commit | c5c50c6db1e71e976596750277b1a618704c04aa (patch) | |
tree | 501cc75548afc784518e9d34c7922780c484e886 /present | |
parent | dda7efec36b495e100e670e057d7ef5022ef3976 (diff) |
present: Preliminary internal flip mode API
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@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'present')
-rw-r--r-- | present/present_priv.h | 27 | ||||
-rw-r--r-- | present/present_scmd.c | 20 | ||||
-rw-r--r-- | present/present_screen.c | 4 |
3 files changed, 45 insertions, 6 deletions
diff --git a/present/present_priv.h b/present/present_priv.h index 66539e183..8908061c0 100644 --- a/present/present_priv.h +++ b/present/present_priv.h @@ -85,6 +85,21 @@ struct present_vblank { Bool has_suboptimal; /* whether client can support SuboptimalCopy mode */ }; +/* + * 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, + PresentFlipReason *reason); +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; @@ -105,6 +120,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) {\ @@ -318,9 +339,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); @@ -330,6 +348,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 bd92b2760..17a1758d8 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) { @@ -484,7 +490,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; @@ -858,7 +864,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++; @@ -1038,6 +1045,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 9d03c8aa4..454cc533c 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); } |