<div dir="ltr">On 24 May 2013 13:56, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For a blit-uploaded temporary, it's faster on current hardware to memcpy<br>
the data into a linear CPU mapping than to go through the GTT.<br>
---<br>
src/mesa/drivers/dri/intel/intel_fbo.c | 2 +-<br>
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 22 +++++++++++++---------<br>
src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 2 +-<br>
src/mesa/drivers/dri/intel/intel_tex_image.c | 2 +-<br>
src/mesa/drivers/dri/intel/intel_tex_validate.c | 2 +-<br>
5 files changed, 17 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c<br>
index 05ff784..73ed91d 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_fbo.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c<br>
@@ -924,7 +924,7 @@ intel_renderbuffer_move_to_temp(struct intel_context *intel,<br>
width, height, depth,<br>
true,<br>
irb->mt->num_samples,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
<br>
if (intel->vtbl.is_hiz_depth_format(intel, new_mt->format)) {<br>
intel_miptree_alloc_hiz(intel, new_mt);<br>
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
index c3e55f4..d41fbdf 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
@@ -265,7 +265,7 @@ intel_miptree_create_layout(struct intel_context *intel,<br>
mt->logical_depth0,<br>
true,<br>
num_samples,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
if (!mt->stencil_mt) {<br>
intel_miptree_release(&mt);<br>
return NULL;<br>
@@ -309,7 +309,7 @@ intel_miptree_choose_tiling(struct intel_context *intel,<br>
gl_format format,<br>
uint32_t width0,<br>
uint32_t num_samples,<br>
- bool force_y_tiling,<br>
+ int force_tiling_mask,<br>
struct intel_mipmap_tree *mt)<br>
{<br>
<br>
@@ -320,8 +320,12 @@ intel_miptree_choose_tiling(struct intel_context *intel,<br>
return I915_TILING_NONE;<br>
}<br>
<br>
- if (force_y_tiling)<br>
- return I915_TILING_Y;<br>
+ /* Some usages may want only one type of tiling, like depth miptrees (Y<br>
+ * tiled), or temporary BOs for uploading data once (linear). So far the<br>
+ * mask only ever has one bit set.<br>
+ */<br>
+ if (force_tiling_mask)<br>
+ return ffs(force_tiling_mask) - 1;<br></blockquote><div><br></div><div>I'm not comfortable with the meaning of force_tiling_mask. Effectively at the moment it's:<br><br></div><div>- 0 means all tiling formats are allowed<br>
</div><div>- (1 << n) means tiling format is required to be n<br></div><div>- any other value is undefined.<br><br></div><div>I'd prefer to see an "allowed_tiling_mask" where we set bit n if and only if tiling mode n is allowed.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
if (num_samples > 1) {<br>
/* From p82 of the Sandy Bridge PRM, dw3[1] of SURFACE_STATE ("Tiled<br>
@@ -375,7 +379,7 @@ intel_miptree_create(struct intel_context *intel,<br>
GLuint depth0,<br>
bool expect_accelerated_upload,<br>
GLuint num_samples,<br>
- bool force_y_tiling)<br>
+ int force_tiling_mask)<br>
{<br>
struct intel_mipmap_tree *mt;<br>
gl_format tex_format = format;<br>
@@ -441,7 +445,7 @@ intel_miptree_create(struct intel_context *intel,<br>
}<br>
<br>
uint32_t tiling = intel_miptree_choose_tiling(intel, format, width0,<br>
- num_samples, force_y_tiling,<br>
+ num_samples, force_tiling_mask,<br>
mt);<br>
bool y_or_x = tiling == (I915_TILING_Y | I915_TILING_X);<br>
<br>
@@ -570,7 +574,7 @@ intel_miptree_create_for_renderbuffer(struct intel_context *intel,<br>
<br>
mt = intel_miptree_create(intel, GL_TEXTURE_2D, format, 0, 0,<br>
width, height, depth, true, num_samples,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
if (!mt)<br>
goto fail;<br>
<br>
@@ -1008,7 +1012,7 @@ intel_miptree_alloc_mcs(struct intel_context *intel,<br>
mt->logical_depth0,<br>
true,<br>
0 /* num_samples */,<br>
- true /* force_y_tiling */);<br>
+ (1 << I915_TILING_Y));<br>
<br>
/* From the Ivy Bridge PRM, Vol 2 Part 1 p326:<br>
*<br>
@@ -1089,7 +1093,7 @@ intel_miptree_alloc_hiz(struct intel_context *intel,<br>
mt->logical_depth0,<br>
true,<br>
mt->num_samples,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
<br>
if (!mt->hiz_mt)<br>
return false;<br>
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
index 543182a..4ccbd0d 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
@@ -399,7 +399,7 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,<br>
GLuint depth0,<br>
bool expect_accelerated_upload,<br>
GLuint num_samples,<br>
- bool force_y_tiling);<br>
+ int force_tiling_mask);<br>
<br>
struct intel_mipmap_tree *<br>
intel_miptree_create_layout(struct intel_context *intel,<br>
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c<br>
index 4e307f8..a3928bb 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c<br>
@@ -103,7 +103,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel,<br>
depth,<br>
expect_accelerated_upload,<br>
intelImage->base.Base.NumSamples,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
}<br>
<br>
/* XXX: Do this for TexSubImage also:<br>
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c<br>
index eaa2561..8f43db5 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c<br>
@@ -106,7 +106,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)<br>
depth,<br>
true,<br>
0 /* num_samples */,<br>
- false /* force_y_tiling */);<br>
+ 0 /* force_tiling_mask */);<br>
if (!intelObj->mt)<br>
return false;<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.rc0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>