summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-12-20 14:09:32 -0800
committerEric Anholt <[email protected]>2012-12-28 11:05:23 -0800
commit2f225f61451abd51c283c7ff103d7fd50a935034 (patch)
treedb7b59b28d59b1420f937077be71a74b6ccbccd1 /src/mesa/drivers/dri/intel
parent73c376bbde0cbea1d1e5a6d71df965d2e903e003 (diff)
intel: Skip texture validation logic when nothing has changed.
Improves GLBenchmark 2.1 offscreen performance by 3.2% +/- 1.5% (n=52). Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_obj.h6
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c18
5 files changed, 30 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 181130bd2ac..8d814bd6d4a 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -771,6 +771,8 @@ intel_miptree_copy_teximage(struct intel_context *intel,
struct intel_mipmap_tree *dst_mt)
{
struct intel_mipmap_tree *src_mt = intelImage->mt;
+ struct intel_texture_object *intel_obj =
+ intel_texture_object(intelImage->base.Base.TexObject);
int level = intelImage->base.Base.Level;
int face = intelImage->base.Base.Face;
GLuint depth = intelImage->base.Base.Depth;
@@ -780,6 +782,7 @@ intel_miptree_copy_teximage(struct intel_context *intel,
}
intel_miptree_reference(&intelImage->mt, dst_mt);
+ intel_obj->needs_validate = true;
}
bool
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 6820f9804e1..a2a36937490 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -36,6 +36,8 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
DBG("%s\n", __FUNCTION__);
_mesa_initialize_texture_object(&obj->base, name, target);
+ obj->needs_validate = true;
+
return &obj->base;
}
@@ -107,6 +109,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
image->Width, image->Height, image->Depth, intel_image->mt);
}
+ intel_texobj->needs_validate = true;
+
return true;
}
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index cc4d49fcf0b..7361e6a359e 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -274,6 +274,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
region);
if (intel_image->mt == NULL)
return;
+ intel_texobj->needs_validate = true;
intel_image->mt->offset = offset;
intel_image->base.RowStride = region->pitch;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_obj.h b/src/mesa/drivers/dri/intel/intel_tex_obj.h
index d1a5f05f9fc..8c166b40219 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_obj.h
+++ b/src/mesa/drivers/dri/intel/intel_tex_obj.h
@@ -49,6 +49,12 @@ struct intel_texture_object
* regions will be copied to this region and the old storage freed.
*/
struct intel_mipmap_tree *mt;
+
+ /**
+ * Set when mipmap trees in the texture images of this texture object
+ * might not all be the mipmap tree above.
+ */
+ bool needs_validate;
};
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 3f21601a8a9..fee58426387 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -21,12 +21,18 @@ intel_update_max_level(struct intel_texture_object *intelObj,
struct gl_sampler_object *sampler)
{
struct gl_texture_object *tObj = &intelObj->base;
+ int maxlevel;
if (sampler->MinFilter == GL_NEAREST ||
sampler->MinFilter == GL_LINEAR) {
- intelObj->_MaxLevel = tObj->BaseLevel;
+ maxlevel = tObj->BaseLevel;
} else {
- intelObj->_MaxLevel = tObj->_MaxLevel;
+ maxlevel = tObj->_MaxLevel;
+ }
+
+ if (intelObj->_MaxLevel != maxlevel) {
+ intelObj->_MaxLevel = maxlevel;
+ intelObj->needs_validate = true;
}
}
@@ -55,6 +61,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* What levels must the tree include at a minimum?
*/
intel_update_max_level(intelObj, sampler);
+ if (intelObj->mt && intelObj->mt->first_level != tObj->BaseLevel)
+ intelObj->needs_validate = true;
+
+ if (!intelObj->needs_validate)
+ return true;
+
firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
/* Check tree can hold all active levels. Check tree matches
@@ -122,6 +134,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
}
}
+ intelObj->needs_validate = false;
+
return true;
}