Mesa (master): st/dri: add null-pointer check, remove duplicated local variable
Marek Olšák
mareko at kemper.freedesktop.org
Thu Jan 24 17:42:15 UTC 2013
Module: Mesa
Branch: master
Commit: fffe3e090878175269af8672d20c14a0ccab78a9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fffe3e090878175269af8672d20c14a0ccab78a9
Author: Marek Olšák <maraeo at gmail.com>
Date: Mon Jan 21 15:48:55 2013 +0100
st/dri: add null-pointer check, remove duplicated local variable
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Tested-by: Michel Dänzer <michel.daenzer at amd.com>
---
.../state_trackers/dri/common/dri_drawable.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index 2ea5478..d817a8c 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -446,6 +446,7 @@ dri_flush(__DRIcontext *cPriv,
/* Flush the context and throttle if needed. */
if (dri_screen(ctx->sPriv)->throttling_enabled &&
+ drawable &&
(reason == __DRI2_THROTTLE_SWAPBUFFER ||
reason == __DRI2_THROTTLE_FLUSHFRONT)) {
/* Throttle.
@@ -458,19 +459,19 @@ dri_flush(__DRIcontext *cPriv,
* pushes that fence on the queue. This requires that the st_context_iface
* flush method returns a fence even if there are no commands to flush.
*/
- struct dri_drawable *draw = dri_drawable(dPriv);
- struct pipe_screen *screen = draw->screen->base.screen;
+ struct pipe_screen *screen = drawable->screen->base.screen;
struct pipe_fence_handle *fence;
- fence = swap_fences_pop_front(draw);
+ fence = swap_fences_pop_front(drawable);
if (fence) {
(void) screen->fence_finish(screen, fence, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &fence, NULL);
}
ctx->st->flush(ctx->st, flush_flags, &fence);
+
if (fence) {
- swap_fences_push_back(draw, fence);
+ swap_fences_push_back(drawable, fence);
screen->fence_reference(screen, &fence, NULL);
}
}
More information about the mesa-commit
mailing list