Skip to contentSkip to conversation

DRI2GetMSC: Do not send a bogus ust when no drawable is not displayed

PATCH In review Daniel Kurtz 3 participants 6 messages Mar 29, 2013 – Apr 2, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DRI2GetMSC: Do not send a bogus ust when no drawable is not displayed

According to the opengl glx_sync_control spec, the Unadjusted System Time (or UST) is a 64-bit monotonically increasing counter that is available throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. Instead, just return FALSE indicating that the operation could not be completed.

---
 src/intel_dri.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
src/intel_dri.c +3 -6
index f351203..179bfb7 100644
@@ -1339,12 +1339,9 @@ I830DRI2GetMSC(DrawablePtr draw, CARD64 *ust, CARD64 *msc)
 	drmVBlank vbl;
 	int ret, pipe = I830DRI2DrawablePipe(draw);
 
-	/* Drawable not displayed, make up a value */
-	if (pipe == -1) {
-		*ust = 0;
-		*msc = 0;
-		return TRUE;
-	}
+	/* Drawable not displayed, return FALSE */
+	if (pipe == -1)
+		return FALSE;
 
 	vbl.request.type = DRM_VBLANK_RELATIVE | pipe_select(pipe);
 	vbl.request.sequence = 0;
Signature · 1 line
1.8.1.3
#1 lore raw
Quoted 8 lines · Daniel Kurtz

According to the opengl glx_sync_control spec, the Unadjusted System Time (or UST) is a 64-bit monotonically increasing counter that is available throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. Instead, just return FALSE indicating that the operation could not be completed.

The problem is that ends up sending BadDrawable back to the client, which ends up killing many clients and a compositor or two due to the unexpected error.

Would you prefer querying pipe 0 in this case for the UST? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · Chris Wilson
Quoted 8 lines · Daniel Kurtz

According to the opengl glx_sync_control spec, the Unadjusted System Time (or UST) is a 64-bit monotonically increasing counter that is available throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. Instead, just return FALSE indicating that the operation could not be completed.

Quoted 5 lines

The problem is that ends up sending BadDrawable back to the client, which ends up killing many clients and a compositor or two due to the unexpected error.

Would you prefer querying pipe 0 in this case for the UST?

For us it comes down to the fact that we'd like something monotonous. So yes querying pipe 0 could work if it's enabled. But I wonder what do you do when you have no enabled pipe though? Return the last UST?

Stéphane

#3 lore raw
Quoted 15 lines · Stéphane Marchesin
Quoted 14 lines · Chris Wilson
Quoted 8 lines · Daniel Kurtz

According to the opengl glx_sync_control spec, the Unadjusted System Time (or UST) is a 64-bit monotonically increasing counter that is available throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. Instead, just return FALSE indicating that the operation could not be completed.

The problem is that ends up sending BadDrawable back to the client, which ends up killing many clients and a compositor or two due to the unexpected error.

Quoted 5 lines
Quoted 1 line

Would you prefer querying pipe 0 in this case for the UST?

For us it comes down to the fact that we'd like something monotonous. So yes querying pipe 0 could work if it's enabled. But I wonder what do you do when you have no enabled pipe though? Return the last UST?

That's a problem as we would need a running pipe, which is not guaranteed. I wonder if CLOCK_MONOTONIC would suffice? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 16 lines · Chris Wilson
Quoted 15 lines · Stéphane Marchesin
Quoted 14 lines · Chris Wilson
Quoted 8 lines · Daniel Kurtz

According to the opengl glx_sync_control spec, the Unadjusted System Time (or UST) is a 64-bit monotonically increasing counter that is available throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. Instead, just return FALSE indicating that the operation could not be completed.

The problem is that ends up sending BadDrawable back to the client, which ends up killing many clients and a compositor or two due to the unexpected error.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Would you prefer querying pipe 0 in this case for the UST?

For us it comes down to the fact that we'd like something monotonous. So yes querying pipe 0 could work if it's enabled. But I wonder what do you do when you have no enabled pipe though? Return the last UST?

That's a problem as we would need a running pipe, which is not guaranteed. I wonder if CLOCK_MONOTONIC would suffice?

Yeah that's what I had in mind. Would that work for you?

Stéphane

#5 lore raw
Quoted 5 lines · Stéphane Marchesin
Quoted 2 lines · Chris Wilson

That's a problem as we would need a running pipe, which is not guaranteed. I wonder if CLOCK_MONOTONIC would suffice?

Yeah that's what I had in mind. Would that work for you?

I think so, the value looks like it should be consistent with the kernel. I've applied a patch to return the CLOCK_MONOTONIC usec, thanks. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre