Commit cf838f5c authored by Roman Gilg's avatar Roman Gilg Committed by Adam Jackson
Browse files

xwayland: persistent window struct on present



Instead of reusing xwl_window introduce a persistent window struct for every
window, that asks for Present flips.

This struct saves all relevant data and is only freed on window destroy.
Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
Tested-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
parent c9afd8cb
This diff is collapsed.
......@@ -531,17 +531,6 @@ xwl_realize_window(WindowPtr window)
wl_region_destroy(region);
}
#ifdef GLAMOR_HAS_GBM
if (xwl_screen->present) {
xwl_window->present_crtc_fake = RRCrtcCreate(xwl_screen->screen, xwl_window);
xwl_window->present_msc = 1;
xwl_window->present_ust = GetTimeInMicros();
xorg_list_init(&xwl_window->present_event_list);
xorg_list_init(&xwl_window->present_release_queue);
}
#endif
wl_display_flush(xwl_screen->display);
send_surface_id_event(xwl_window);
......@@ -607,12 +596,6 @@ xwl_unrealize_window(WindowPtr window)
compUnredirectWindow(serverClient, window, CompositeRedirectManual);
#ifdef GLAMOR_HAS_GBM
xwl_window = xwl_window_from_window(window);
if (xwl_window && xwl_screen->present)
xwl_present_cleanup(xwl_window, window);
#endif
screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
ret = (*screen->UnrealizeWindow) (window);
xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
......@@ -629,11 +612,6 @@ xwl_unrealize_window(WindowPtr window)
if (xwl_window->frame_callback)
wl_callback_destroy(xwl_window->frame_callback);
#ifdef GLAMOR_HAS_GBM
if (xwl_window->present_crtc_fake)
RRCrtcDestroy(xwl_window->present_crtc_fake);
#endif
free(xwl_window);
dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
......@@ -661,6 +639,31 @@ static const struct wl_callback_listener frame_listener = {
frame_callback
};
static Bool
xwl_destroy_window(WindowPtr window)
{
ScreenPtr screen = window->drawable.pScreen;
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
Bool ret;
#ifdef GLAMOR_HAS_GBM
if (xwl_screen->present)
xwl_present_cleanup(window);
#endif
screen->DestroyWindow = xwl_screen->DestroyWindow;
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
xwl_screen->DestroyWindow = screen->DestroyWindow;
screen->DestroyWindow = xwl_destroy_window;
return ret;
}
static void
xwl_window_post_damage(struct xwl_window *xwl_window)
{
......@@ -1114,6 +1117,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = xwl_unrealize_window;
xwl_screen->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = xwl_destroy_window;
xwl_screen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_close_screen;
......
......@@ -77,6 +77,7 @@ struct xwl_screen {
CloseScreenProcPtr CloseScreen;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow;
struct xorg_list output_list;
......@@ -172,26 +173,29 @@ struct xwl_window {
struct xorg_list link_damage;
struct wl_callback *frame_callback;
Bool allow_commits;
#ifdef GLAMOR_HAS_GBM
/* present */
RRCrtcPtr present_crtc_fake;
struct xorg_list present_link;
WindowPtr present_window;
uint64_t present_msc;
uint64_t present_ust;
};
#ifdef GLAMOR_HAS_GBM
struct xwl_present_window {
struct xwl_screen *xwl_screen;
WindowPtr window;
struct xorg_list link;
OsTimerPtr present_timer;
Bool present_timer_firing;
RRCrtcPtr crtc_fake;
uint64_t msc;
uint64_t ust;
struct wl_callback *present_frame_callback;
struct wl_callback *present_sync_callback;
OsTimerPtr frame_timer;
Bool frame_timer_firing;
struct xorg_list present_event_list;
struct xorg_list present_release_queue;
#endif
struct wl_callback *frame_callback;
struct wl_callback *sync_callback;
struct xorg_list event_list;
struct xorg_list release_queue;
};
#ifdef GLAMOR_HAS_GBM
struct xwl_present_event {
uint64_t event_id;
uint64_t target_msc;
......@@ -200,8 +204,7 @@ struct xwl_present_event {
Bool pending;
Bool buffer_released;
WindowPtr present_window;
struct xwl_window *xwl_window;
struct xwl_present_window *xwl_present_window;
struct wl_buffer *buffer;
struct xorg_list list;
......@@ -433,7 +436,7 @@ Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
#ifdef GLAMOR_HAS_GBM
Bool xwl_present_init(ScreenPtr screen);
void xwl_present_cleanup(struct xwl_window *xwl_window, WindowPtr window);
void xwl_present_cleanup(WindowPtr window);
#endif
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment