summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2012-10-15 21:02:05 +0200
committerFredrik Höglund <[email protected]>2012-10-16 02:24:42 +0200
commit0978707917e68fdb2da4035a810480622fed5410 (patch)
tree52952946eb3f03fdaa5612b358bad017cd9066b5 /src
parentdf3721fd2e10ef27ce12a0c1025c9770137fa8f7 (diff)
glx: Fix a regression in the new XCB code
dri2DrawableGetMSC(), dri2WaitForMSC() and dri2WaitForSBC() were inadvertently changed to return 0 on success. This resulted in the callers returning an error to the client. Restore the previous behavior and also check that the reply pointers are valid before accessing them. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glx/dri2_glx.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index ee07e606010..a58b3152c9d 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -439,12 +439,16 @@ dri2DrawableGetMSC(struct glx_screen *psc, __GLXDRIdrawable *pdraw,
get_msc_cookie = xcb_dri2_get_msc_unchecked(c, pdraw->xDrawable);
get_msc_reply = xcb_dri2_get_msc_reply(c, get_msc_cookie, NULL);
+
+ if (!get_msc_reply)
+ return 0;
+
*ust = merge_counter(get_msc_reply->ust_hi, get_msc_reply->ust_lo);
*msc = merge_counter(get_msc_reply->msc_hi, get_msc_reply->msc_lo);
*sbc = merge_counter(get_msc_reply->sbc_hi, get_msc_reply->sbc_lo);
free(get_msc_reply);
- return 0;
+ return 1;
}
static int
@@ -467,12 +471,16 @@ dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
divisor_hi, divisor_lo,
remainder_hi, remainder_lo);
wait_msc_reply = xcb_dri2_wait_msc_reply(c, wait_msc_cookie, NULL);
+
+ if (!wait_msc_reply)
+ return 0;
+
*ust = merge_counter(wait_msc_reply->ust_hi, wait_msc_reply->ust_lo);
*msc = merge_counter(wait_msc_reply->msc_hi, wait_msc_reply->msc_lo);
*sbc = merge_counter(wait_msc_reply->sbc_hi, wait_msc_reply->sbc_lo);
free(wait_msc_reply);
- return 0;
+ return 1;
}
static int
@@ -489,12 +497,16 @@ dri2WaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
wait_sbc_cookie = xcb_dri2_wait_sbc_unchecked(c, pdraw->xDrawable,
target_sbc_hi, target_sbc_lo);
wait_sbc_reply = xcb_dri2_wait_sbc_reply(c, wait_sbc_cookie, NULL);
+
+ if (!wait_sbc_reply)
+ return 0;
+
*ust = merge_counter(wait_sbc_reply->ust_hi, wait_sbc_reply->ust_lo);
*msc = merge_counter(wait_sbc_reply->msc_hi, wait_sbc_reply->msc_lo);
*sbc = merge_counter(wait_sbc_reply->sbc_hi, wait_sbc_reply->sbc_lo);
free(wait_sbc_reply);
- return 0;
+ return 1;
}
/**