summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple/i915_regions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_regions.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_regions.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c
index cff90ab5dda..577a6adfd8d 100644
--- a/src/mesa/pipe/i915simple/i915_regions.c
+++ b/src/mesa/pipe/i915simple/i915_regions.c
@@ -59,10 +59,13 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
{
struct i915_context *i915 = i915_context( pipe );
- if (!--region->map_refcount) {
- i915->pipe.winsys->buffer_unmap( i915->pipe.winsys,
- region->buffer );
- region->map = NULL;
+ if (region->map_refcount > 0) {
+ assert(region->map);
+ if (!--region->map_refcount) {
+ i915->pipe.winsys->buffer_unmap( i915->pipe.winsys,
+ region->buffer );
+ region->map = NULL;
+ }
}
}