summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2017-07-03 14:23:35 +0300
committerTopi Pohjolainen <[email protected]>2017-07-18 21:35:03 +0300
commit8fd18642e78858d454eac4581a07f00b9591d9c0 (patch)
tree094a58c0cb35ea792d5b4e4df8ea9f65ee71a68a
parentc2bb39d8d6eaf391d917db94ca671a6261800359 (diff)
i965/miptree: Set refcount before failing via _release()
Otherwise one wraps uint to UINT_MAX via -1. Fixes: 3cf470f2b6c ("i965: Add isl based miptree creator") Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 47475689f9c..5f60abb3de3 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -709,6 +709,8 @@ make_surface(struct brw_context *brw, GLenum target, mesa_format format,
return NULL;
}
+ mt->refcount = 1;
+
if (target == GL_TEXTURE_CUBE_MAP ||
target == GL_TEXTURE_CUBE_MAP_ARRAY)
isl_usage_flags |= ISL_SURF_USAGE_CUBE_BIT;
@@ -753,7 +755,6 @@ make_surface(struct brw_context *brw, GLenum target, mesa_format format,
mt->last_level = last_level;
mt->target = target;
mt->format = format;
- mt->refcount = 1;
mt->aux_state = NULL;
return mt;