summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-08-22 11:43:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-08-22 11:43:11 +0100
commit275d8b039a5e2e9937c4015355dddd57a301c028 (patch)
tree60e157844a5dbb87d21d0770ecfe8af5dc5a3a3b /src
parentc26cfbcc0c46e05de887ddb750240f16f34029a8 (diff)
sna/dri2: Report an error if WaitMSC/GetMSC are called without any CRTCs
On a headless or hosted system, we do not have any CRTC on which to report or queue the vblank. Reporting a BadDrawable is evil (as clients never expect the error) but is better than crashing the Xserver. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_dri2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index accbef62..d5eeb072 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -3389,6 +3389,9 @@ sna_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
/* Drawable not displayed, make up a *monotonic* value */
if (crtc == NULL)
crtc = sna_primary_crtc(sna);
+ if (crtc == NULL)
+ return FALSE;
+
if (sna_query_vblank(sna, crtc, &vbl) == 0)
sna_crtc_record_vblank(crtc, &vbl);
@@ -3427,7 +3430,7 @@ sna_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, CARD64 target_msc
if (crtc == NULL)
crtc = sna_primary_crtc(sna);
if (crtc == NULL)
- goto out_complete;
+ return FALSE;
current_msc = get_current_msc(sna, draw, crtc);
@@ -3473,8 +3476,6 @@ sna_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw, CARD64 target_msc
out_free_info:
sna_dri2_event_free(info);
out_complete:
- if (crtc == NULL)
- crtc = sna_primary_crtc(sna);
swap = sna_crtc_last_swap(crtc);
DRI2WaitMSCComplete(client, draw,
draw_current_msc(draw, crtc, swap->msc),