summaryrefslogtreecommitdiff
path: root/src/sna/sna_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-06-22 11:45:35 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-06-22 11:47:06 +0100
commitdae370423ad85b9d9c576277da5a9fb92ab3d3df (patch)
tree7e005a14ce5b9e04df20adecfacb545418be0bfd /src/sna/sna_display.c
parent923dc207df7b05c138c628983ccaf2493dd63b62 (diff)
sna: Clean up CRTC on CloseScreen
We need to do this to stop any stray references escaping through kernel events now that we are passing the CRTC through the event. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_display.c')
-rw-r--r--src/sna/sna_display.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 305bccf7..91ec2cdb 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -203,6 +203,10 @@ static inline bool event_pending(int fd)
static bool sna_mode_has_pending_events(struct sna *sna)
{
+ /* In order to workaround a kernel bug in not honouring O_NONBLOCK,
+ * check that the fd is readable before attempting to read the next
+ * event from drm.
+ */
return event_pending(sna->kgem.fd);
}
@@ -5266,26 +5270,18 @@ sna_mode_wants_tear_free(struct sna *sna)
void
sna_mode_close(struct sna *sna)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
- int i;
-
- /* In order to workaround a kernel bug in not honouring O_NONBLOCK,
- * check that the fd is readable before attempting to read the next
- * event from drm.
- */
while (sna_mode_has_pending_events(sna))
sna_mode_wakeup(sna);
if (sna->flags & SNA_IS_HOSTED)
return;
- sna_backlight_close(sna);
- sna_cursor_close(sna);
-
- for (i = 0; i < sna->mode.num_real_crtc; i++)
- sna_crtc_disable_shadow(sna, to_sna_crtc(config->crtc[i]));
+ sna_mode_reset(sna);
+ sna_cursor_close(sna);
sna_cursors_fini(sna);
+
+ sna_backlight_close(sna);
}
void
@@ -5801,6 +5797,10 @@ void sna_mode_reset(struct sna *sna)
sna_output_backlight_set(sna_output,
sna_output->backlight.max);
}
+
+ /* drain the event queue */
+ while (sna_mode_has_pending_events(sna))
+ sna_mode_wakeup(sna);
}
static void transformed_box(BoxRec *box, xf86CrtcPtr crtc)