summaryrefslogtreecommitdiff
path: root/src/sna/sna_dri2.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-05-23 10:03:39 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-05-23 10:17:45 +0100
commitd6c4e72f1a8008818fc0e5c19c9dc147f1794777 (patch)
tree649450b8d7cfc0b258659891f131d19bbc0eaf30 /src/sna/sna_dri2.c
parent43fd06ee7d95db4114ce7b0261685380a48a8708 (diff)
sna/dri2: Free the private CRTC tracker on each window
Remember to clean up our privates when the window is destroyed. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_dri2.c')
-rw-r--r--src/sna/sna_dri2.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 20995d5c..6f1931f1 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -935,6 +935,24 @@ to_frame_event(uintptr_t data)
return (struct sna_dri2_frame_event *)(data & ~1);
}
+struct window_crtc {
+ xf86CrtcPtr crtc;
+ int64_t msc_delta;
+};
+
+static struct window_crtc *window_get_crtc(WindowPtr win)
+{
+ return ((void **)__get_private(win, sna_window_key))[3];
+}
+
+static void window_set_crtc(WindowPtr win, struct window_crtc *wc)
+{
+ assert(win->drawable.type == DRAWABLE_WINDOW);
+ assert(window_get_crtc(win) == NULL);
+ ((void **)__get_private(win, sna_window_key))[3] = wc;
+ assert(window_get_crtc(win) == wc);
+}
+
static xf86CrtcPtr
sna_dri2_get_crtc(DrawablePtr draw)
{
@@ -1061,6 +1079,8 @@ void sna_dri2_destroy_window(WindowPtr win)
struct sna *sna = to_sna_from_drawable(&win->drawable);
struct sna_dri2_frame_event *info, *chain;
+ free(window_get_crtc(win));
+
info = sna_dri2_window_get_chain(win);
if (info == NULL)
return;
@@ -1855,24 +1875,6 @@ sna_dri2_page_flip_handler(struct sna *sna,
sna_dri2_flip_event(sna, info);
}
-struct window_crtc {
- xf86CrtcPtr crtc;
- int64_t msc_delta;
-};
-
-static struct window_crtc *window_get_crtc(WindowPtr win)
-{
- return ((void **)__get_private(win, sna_window_key))[3];
-}
-
-static void window_set_crtc(WindowPtr win, struct window_crtc *wc)
-{
- assert(win->drawable.type == DRAWABLE_WINDOW);
- assert(window_get_crtc(win) == NULL);
- ((void **)__get_private(win, sna_window_key))[3] = wc;
- assert(window_get_crtc(win) == wc);
-}
-
static uint64_t
draw_current_msc(DrawablePtr draw, xf86CrtcPtr crtc, uint64_t msc)
{