<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 16, 2017 at 11:59 PM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jan 16, 2017 at 09:13:59AM -0800, Jason Ekstrand wrote:<br>
> On Mon, Jan 16, 2017 at 1:13 AM, Topi Pohjolainen<br>
</span>> <[1]<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a><wbr>> wrote:<br>
><br>
> Signed-off-by: Topi Pohjolainen <[2]<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a><wbr>><br>
<div><div class="h5">> ---<br>
> src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c | 16 ++++++++++++++--<br>
> 1 file changed, 14 insertions(+), 2 deletions(-)<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
> b/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
> index 2563897..ace94a0 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_pixel_read.c<br>
> @@ -47,6 +47,19 @@<br>
> #define FILE_DEBUG_FLAG DEBUG_PIXEL<br>
> +static void<br>
> +adjust_image_offset(const struct intel_renderbuffer *irb,<br>
> + int *xoffset, int *yoffset)<br>
> +{<br>
> + unsigned x;<br>
> + unsigned y;<br>
> + intel_miptree_get_image_<wbr>offset(irb->mt, irb->mt_level,<br>
> irb->mt_layer,<br>
> + &x, &y);<br>
> +<br>
> + *xoffset += x;<br>
> + *yoffset += y;<br>
> +}<br>
> +<br>
> /**<br>
> * \brief A fast path for glReadPixels<br>
> *<br>
> @@ -153,8 +166,7 @@ intel_readpixels_tiled_memcpy(<wbr>struct gl_context<br>
> * ctx,<br>
> return false;<br>
> }<br>
> - xoffset += irb->mt->level[irb->mt_level].<br>
> slice[irb->mt_layer].x_offset;<br>
> - yoffset += irb->mt->level[irb->mt_level].<br>
> slice[irb->mt_layer].y_offset;<br>
> + adjust_image_offset(irb, &xoffset, &yoffset);<br>
><br>
> We do this a lot more places than just readpixels. Maybe we want to<br>
> just add a intel_miptree_get_texel_xy_<wbr>offset helper that takes a<br>
> miptree, level, slice, and x/y and returns the total x/y. In any case,<br>
> we really should make such a helper a bit more global and use it all of<br>
> the other random places we do this calculation such as<br>
> texsubimage_tiled_memcpy.<br>
<br>
</div></div>Agreed. This is in fact not needed in this series. I tried quite a number<br>
of things and some of them I left for later. This somehow slipped here.<span class=""><br></span></blockquote><div><br></div><div>I was wondering about that... A quick glance didn't reveal any other cases of this. Let's drop this patch in that case.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
><br>
> dst_pitch = _mesa_image_row_stride(pack, width, format, type);<br>
> --<br>
> 2.5.5<br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
</span>> [3]<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.<wbr>org</a><br>
> [4]<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a><br>
><br>
> References<br>
><br>
> 1. mailto:<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.<wbr>com</a><br>
> 2. mailto:<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.<wbr>com</a><br>
> 3. mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.<wbr>freedesktop.org</a><br>
> 4. <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>