<p dir="ltr"></p>
<p dir="ltr">On Tue, Jan 13, 2015 at 6:35 PM, Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> On Tuesday, January 13, 2015 10:39:22 AM Jason Ekstrand wrote:<br>
> > Before we were always coping from the buffer being mapped into the<br>
> > temporary buffer. However, if INVALIDATE_RANGE is set, then we know that<br>
> > the data is going to be junk after we unmap so there's no point in doing<br>
> > the blit. This is important because doing the blit will cause a stall 3<br>
> > lines later when we map the buffer.<br>
> ><br>
> > Signed-off-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
> > ---<br>
> > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 23 +++++++++++++++--------<br>
> > 1 file changed, 15 insertions(+), 8 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > index f815fbe..d44df18 100644<br>
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c<br>
> > @@ -1807,14 +1807,21 @@ intel_miptree_map_blit(struct brw_context *brw,<br>
> > }<br>
> > map->stride = map->mt->pitch;<br>
> ><br>
> > - if (!intel_miptree_blit(brw,<br>
> > - mt, level, slice,<br>
> > - map->x, map->y, false,<br>
> > - map->mt, 0, 0,<br>
> > - 0, 0, false,<br>
> > - map->w, map->h, GL_COPY)) {<br>
> > - fprintf(stderr, "Failed to blit\n");<br>
> > - goto fail;<br>
> > + /* One of either READ_BIT or WRITE_BIT or both is set. READ_BIT implies no<br>
> > + * INVALIDATE_RANGE_BIT. WRITE_BIT needs the original values read in unless<br>
> > + * invalidate is set, since we'll be writing the whole rectangle from our<br>
> > + * temporary buffer back out.<br>
> > + */<br>
> > + if (!(map->mode & GL_MAP_INVALIDATE_RANGE_BIT)) {<br>
> > + if (!intel_miptree_blit(brw,<br>
> > + mt, level, slice,<br>
> > + map->x, map->y, false,<br>
> > + map->mt, 0, 0,<br>
> > + 0, 0, false,<br>
> > + map->w, map->h, GL_COPY)) {<br>
> > + fprintf(stderr, "Failed to blit\n");<br>
> > + goto fail;<br>
> > + }<br>
> > }<br>
> ><br>
> > map->ptr = intel_miptree_map_raw(brw, map->mt);<br>
><br>
> Just for the hell of it, how about<br>
><br>
> if (!(map->mode & (GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT)))<br>
><br>
> I don't think we pass INVALIDATE_BUFFER_BIT today, but we could someday,<br>
> and the same logic applies.</p>
<p dir="ltr"> <br>
Sure, it would be valid. However, it would also be confusing as that's the only place in the entire file where INVALIDATE_BUFFER_BIT would occur. Let's leave it for now. We can add INVALIDATE_BUFFER_BIT support later and actually be clever about it then.</p>
<p dir="ltr">> Either way,<br>
> Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br></p>
<p dir="ltr">Thanks,<br>
--Jason<br>
</p>