[Mesa-dev] [PATCH 05/27] i965: Replace open coded with intel_miptree_get_image_offset()

Jason Ekstrand jason at jlekstrand.net
Tue Jan 17 15:50:56 UTC 2017


On Mon, Jan 16, 2017 at 11:59 PM, Pohjolainen, Topi <
topi.pohjolainen at gmail.com> wrote:

> On Mon, Jan 16, 2017 at 09:13:59AM -0800, Jason Ekstrand wrote:
> >    On Mon, Jan 16, 2017 at 1:13 AM, Topi Pohjolainen
> >    <[1]topi.pohjolainen at gmail.com> wrote:
> >
> >      Signed-off-by: Topi Pohjolainen <[2]topi.pohjolainen at intel.com>
> >      ---
> >       src/mesa/drivers/dri/i965/intel_pixel_read.c | 16 ++++++++++++++--
> >       1 file changed, 14 insertions(+), 2 deletions(-)
> >      diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> >      b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> >      index 2563897..ace94a0 100644
> >      --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> >      +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> >      @@ -47,6 +47,19 @@
> >       #define FILE_DEBUG_FLAG DEBUG_PIXEL
> >      +static void
> >      +adjust_image_offset(const struct intel_renderbuffer *irb,
> >      +                    int *xoffset, int *yoffset)
> >      +{
> >      +   unsigned x;
> >      +   unsigned y;
> >      +   intel_miptree_get_image_offset(irb->mt, irb->mt_level,
> >      irb->mt_layer,
> >      +                                  &x, &y);
> >      +
> >      +   *xoffset += x;
> >      +   *yoffset += y;
> >      +}
> >      +
> >       /**
> >        * \brief A fast path for glReadPixels
> >        *
> >      @@ -153,8 +166,7 @@ intel_readpixels_tiled_memcpy(struct gl_context
> >      * ctx,
> >             return false;
> >          }
> >      -   xoffset += irb->mt->level[irb->mt_level].
> >      slice[irb->mt_layer].x_offset;
> >      -   yoffset += irb->mt->level[irb->mt_level].
> >      slice[irb->mt_layer].y_offset;
> >      +   adjust_image_offset(irb, &xoffset, &yoffset);
> >
> >    We do this a lot more places than just readpixels.  Maybe we want to
> >    just add a intel_miptree_get_texel_xy_offset helper that takes a
> >    miptree, level, slice, and x/y and returns the total x/y.  In any
> case,
> >    we really should make such a helper a bit more global and use it all
> of
> >    the other random places we do this calculation such as
> >    texsubimage_tiled_memcpy.
>
> Agreed. This is in fact not needed in this series. I tried quite a number
> of things and some of them I left for later. This somehow slipped here.
>

I was wondering about that... A quick glance didn't reveal any other cases
of this.  Let's drop this patch in that case.

--Jason


> >
> >          dst_pitch = _mesa_image_row_stride(pack, width, format, type);
> >      --
> >      2.5.5
> >      _______________________________________________
> >      mesa-dev mailing list
> >      [3]mesa-dev at lists.freedesktop.org
> >      [4]https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> > References
> >
> >    1. mailto:topi.pohjolainen at gmail.com
> >    2. mailto:topi.pohjolainen at intel.com
> >    3. mailto:mesa-dev at lists.freedesktop.org
> >    4. https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170117/8ab9a72c/attachment.html>


More information about the mesa-dev mailing list