present: Add more hooks to internal flip mode API
Add hooks to query caps, get crtcs, abort vblanks and destroy a flip. Signed-off-by: Roman Gilg <subdiff@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
6a338b5959
commit
6d813bbd5e
|
@ -38,6 +38,34 @@ msc_is_equal_or_after(uint64_t test, uint64_t reference)
|
||||||
return (int64_t)(test - reference) >= 0;
|
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
|
* Copies the update region from a pixmap to the target drawable
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -85,9 +85,15 @@ struct present_vblank {
|
||||||
Bool has_suboptimal; /* whether client can support SuboptimalCopy mode */
|
Bool has_suboptimal; /* whether client can support SuboptimalCopy mode */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct present_screen_priv present_screen_priv_rec, *present_screen_priv_ptr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode hooks
|
* 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,
|
typedef Bool (*present_priv_check_flip_ptr)(RRCrtcPtr crtc,
|
||||||
WindowPtr window,
|
WindowPtr window,
|
||||||
PixmapPtr pixmap,
|
PixmapPtr pixmap,
|
||||||
|
@ -125,7 +131,13 @@ typedef int (*present_priv_queue_vblank_ptr)(ScreenPtr screen,
|
||||||
typedef void (*present_priv_flush_ptr)(WindowPtr window);
|
typedef void (*present_priv_flush_ptr)(WindowPtr window);
|
||||||
typedef void (*present_priv_re_execute_ptr)(present_vblank_ptr vblank);
|
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;
|
CloseScreenProcPtr CloseScreen;
|
||||||
ConfigNotifyProcPtr ConfigNotify;
|
ConfigNotifyProcPtr ConfigNotify;
|
||||||
DestroyWindowProcPtr DestroyWindow;
|
DestroyWindowProcPtr DestroyWindow;
|
||||||
|
@ -147,6 +159,9 @@ typedef struct present_screen_priv {
|
||||||
present_screen_info_ptr info;
|
present_screen_info_ptr info;
|
||||||
|
|
||||||
/* Mode hooks */
|
/* 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_ptr check_flip;
|
||||||
present_priv_check_flip_window_ptr check_flip_window;
|
present_priv_check_flip_window_ptr check_flip_window;
|
||||||
present_priv_can_window_flip_ptr can_window_flip;
|
present_priv_can_window_flip_ptr can_window_flip;
|
||||||
|
@ -158,7 +173,9 @@ typedef struct present_screen_priv {
|
||||||
present_priv_flush_ptr flush;
|
present_priv_flush_ptr flush;
|
||||||
present_priv_re_execute_ptr re_execute;
|
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) {\
|
#define wrap(priv,real,mem,func) {\
|
||||||
priv->mem = real->mem; \
|
priv->mem = real->mem; \
|
||||||
|
@ -224,6 +241,12 @@ msc_is_after(uint64_t test, uint64_t reference)
|
||||||
/*
|
/*
|
||||||
* present.c
|
* present.c
|
||||||
*/
|
*/
|
||||||
|
uint32_t
|
||||||
|
present_query_capabilities(RRCrtcPtr crtc);
|
||||||
|
|
||||||
|
RRCrtcPtr
|
||||||
|
present_get_crtc(WindowPtr window);
|
||||||
|
|
||||||
void
|
void
|
||||||
present_copy_region(DrawablePtr drawable,
|
present_copy_region(DrawablePtr drawable,
|
||||||
PixmapPtr pixmap,
|
PixmapPtr pixmap,
|
||||||
|
@ -398,12 +421,6 @@ present_restore_screen_pixmap(ScreenPtr screen);
|
||||||
void
|
void
|
||||||
present_set_abort_flip(ScreenPtr screen);
|
present_set_abort_flip(ScreenPtr screen);
|
||||||
|
|
||||||
RRCrtcPtr
|
|
||||||
present_get_crtc(WindowPtr window);
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
present_query_capabilities(RRCrtcPtr crtc);
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
present_init(void);
|
present_init(void);
|
||||||
|
|
||||||
|
|
|
@ -158,34 +158,18 @@ present_flip(RRCrtcPtr crtc,
|
||||||
return (*screen_priv->info->flip) (crtc, event_id, target_msc, pixmap, sync_flip);
|
return (*screen_priv->info->flip) (crtc, event_id, target_msc, pixmap, sync_flip);
|
||||||
}
|
}
|
||||||
|
|
||||||
RRCrtcPtr
|
static RRCrtcPtr
|
||||||
present_get_crtc(WindowPtr window)
|
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)
|
if (!screen_priv->info)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (*screen_priv->info->get_crtc)(window);
|
return (*screen_priv->info->get_crtc)(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
present_query_capabilities(RRCrtcPtr crtc)
|
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)
|
if (!screen_priv->info)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -779,8 +763,8 @@ present_scmd_pixmap(WindowPtr window,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
|
present_scmd_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
|
||||||
{
|
{
|
||||||
present_vblank_ptr vblank;
|
present_vblank_ptr vblank;
|
||||||
|
|
||||||
|
@ -810,8 +794,8 @@ present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
present_flip_destroy(ScreenPtr screen)
|
present_scmd_flip_destroy(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
|
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
|
||||||
|
|
||||||
|
@ -826,6 +810,9 @@ present_flip_destroy(ScreenPtr screen)
|
||||||
void
|
void
|
||||||
present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
|
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 = &present_check_flip;
|
||||||
screen_priv->check_flip_window = &present_check_flip_window;
|
screen_priv->check_flip_window = &present_check_flip_window;
|
||||||
screen_priv->can_window_flip = &present_scmd_can_window_flip;
|
screen_priv->can_window_flip = &present_scmd_can_window_flip;
|
||||||
|
@ -836,6 +823,9 @@ present_scmd_init_mode_hooks(present_screen_priv_ptr screen_priv)
|
||||||
screen_priv->queue_vblank = &present_queue_vblank;
|
screen_priv->queue_vblank = &present_queue_vblank;
|
||||||
screen_priv->flush = &present_flush;
|
screen_priv->flush = &present_flush;
|
||||||
screen_priv->re_execute = &present_re_execute;
|
screen_priv->re_execute = &present_re_execute;
|
||||||
|
|
||||||
|
screen_priv->abort_vblank = &present_scmd_abort_vblank;
|
||||||
|
screen_priv->flip_destroy = &present_scmd_flip_destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
|
@ -58,7 +58,7 @@ present_close_screen(ScreenPtr screen)
|
||||||
{
|
{
|
||||||
present_screen_priv_ptr screen_priv = present_screen_priv(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);
|
unwrap(screen_priv, screen, CloseScreen);
|
||||||
(*screen->CloseScreen) (screen);
|
(*screen->CloseScreen) (screen);
|
||||||
|
@ -72,11 +72,13 @@ present_close_screen(ScreenPtr screen)
|
||||||
static void
|
static void
|
||||||
present_free_window_vblank(WindowPtr window)
|
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_window_priv_ptr window_priv = present_window_priv(window);
|
||||||
present_vblank_ptr vblank, tmp;
|
present_vblank_ptr vblank, tmp;
|
||||||
|
|
||||||
xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
|
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);
|
present_vblank_destroy(vblank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user