[Mesa-dev] [PATCH 18/34] i965/miptree: Add a helper functions for image creation

Jason Ekstrand jason at jlekstrand.net
Tue Jan 31 20:54:33 UTC 2017


On Wed, Jan 25, 2017 at 10:58 AM, Pohjolainen, Topi <
topi.pohjolainen at gmail.com> wrote:

> On Mon, Jan 23, 2017 at 10:21:41PM -0800, Ben Widawsky wrote:
> > This provides a common function or creating miptrees when there is an
> > existing DRIimage to use. That provides an easy way to add CCS
> > allocation.
> >
> > Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> > Acked-by: Daniel Stone <daniels at collabora.com>
> > ---
> >  src/mesa/drivers/dri/i965/intel_fbo.c         | 17 ++++++++---------
> >  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 25
> ++++++++++++++++++++++++-
> >  src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 10 ++++++++++
> >  src/mesa/drivers/dri/i965/intel_tex_image.c   | 17 ++++++++---------
> >  4 files changed, 50 insertions(+), 19 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c
> b/src/mesa/drivers/dri/i965/intel_fbo.c
> > index de0cd6aca2..f6e17599b8 100644
> > --- a/src/mesa/drivers/dri/i965/intel_fbo.c
> > +++ b/src/mesa/drivers/dri/i965/intel_fbo.c
> > @@ -362,15 +362,14 @@ intel_image_target_renderbuffer_storage(struct
> gl_context *ctx,
> >      * buffer's content to the main buffer nor for invalidating the aux
> buffer's
> >      * content.
> >      */
> > -   irb->mt = intel_miptree_create_for_bo(brw,
> > -                                         image->bo,
> > -                                         image->format,
> > -                                         image->offset,
> > -                                         image->width,
> > -                                         image->height,
> > -                                         1,
> > -                                         image->pitch,
> > -                                         MIPTREE_LAYOUT_DISABLE_AUX);
> > +   irb->mt = intel_miptree_create_for_image(brw,
> > +                                            image,
> > +                                            image->format,
> > +                                            image->offset,
> > +                                            image->width,
> > +                                            image->height,
> > +                                            image->pitch,
> > +                                            0);
> >     if (!irb->mt)
> >        return;
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > index ed514239e2..34b6591eb0 100644
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > @@ -24,7 +24,6 @@
> >   */
> >
> >  #include <GL/gl.h>
> > -#include <GL/internal/dri_interface.h>
> >
> >  #include "intel_batchbuffer.h"
> >  #include "intel_mipmap_tree.h"
> > @@ -32,6 +31,7 @@
> >  #include "intel_tex.h"
> >  #include "intel_blit.h"
> >  #include "intel_fbo.h"
> > +#include "intel_image.h"
> >
> >  #include "brw_blorp.h"
> >  #include "brw_context.h"
> > @@ -810,6 +810,29 @@ intel_miptree_create_for_bo(struct brw_context
> *brw,
> >     return mt;
> >  }
> >
> > +struct intel_mipmap_tree *
> > +intel_miptree_create_for_image(struct brw_context *intel,
> > +                               __DRIimage *image,
> > +                               mesa_format format,
> > +                               uint32_t offset,
> > +                               uint32_t width,
> > +                               uint32_t height,
> > +                               uint32_t pitch,
> > +                               uint32_t layout_flags)
> > +{
> > +   layout_flags = (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT) ?
> > +      MIPTREE_LAYOUT_FOR_SCANOUT : MIPTREE_LAYOUT_DISABLE_AUX;
>
> Before flags were unconditionally MIPTREE_LAYOUT_DISABLE_AUX. This should
> be
> mentioned in the commit message. And probably that functionally aux gets
> disabled because current logic does that for scanout?
>

Yeah, I don't really get this either.


> > +   return intel_miptree_create_for_bo(intel,
> > +                                      image->bo,
> > +                                      format,
> > +                                      offset,
> > +                                      width,
> > +                                      height,
> > +                                      1,
> > +                                      pitch,
> > +                                      layout_flags);
> > +}
> > +
> >  /**
> >   * For a singlesample renderbuffer, this simply wraps the given BO with
> a
> >   * miptree.
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > index 476c46b135..cf8f1a7687 100644
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > @@ -720,6 +720,16 @@ intel_miptree_create_for_bo(struct brw_context
> *brw,
> >                              int pitch,
> >                              uint32_t layout_flags);
> >
> > +struct intel_mipmap_tree *
> > +intel_miptree_create_for_image(struct brw_context *intel,
> > +                               __DRIimage *image,
> > +                               mesa_format format,
> > +                               uint32_t offset,
> > +                               uint32_t width,
> > +                               uint32_t height,
> > +                               uint32_t pitch,
> > +                               uint32_t layout_flags);
> > +
> >  void
> >  intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
> >                                           struct intel_renderbuffer *irb,
> > diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c
> b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > index 141996f707..2d79183b16 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > @@ -221,11 +221,11 @@ create_mt_for_planar_dri_image(struct brw_context
> *brw,
> >         * invalidating the aux buffer's content.
> >         */
> >        struct intel_mipmap_tree *mt =
> > -         intel_miptree_create_for_bo(brw, image->bo, format,
> > -                                     image->offsets[index],
> > -                                     width, height, 1,
> > -                                     image->strides[index],
> > -                                     MIPTREE_LAYOUT_DISABLE_AUX);
> > +         intel_miptree_create_for_image(brw, image, format,
> > +                                        image->offsets[index],
> > +                                        width, height,
> > +                                        image->strides[index],
> > +                                        0);
> >        if (mt == NULL)
> >           return NULL;
> >
> > @@ -259,10 +259,9 @@ create_mt_for_dri_image(struct brw_context *brw,
> >      * buffer's content to the main buffer nor for invalidating the aux
> buffer's
> >      * content.
> >      */
> > -   mt = intel_miptree_create_for_bo(brw, image->bo, image->format,
> > -                                    0, image->width, image->height, 1,
> > -                                    image->pitch,
> > -                                    MIPTREE_LAYOUT_DISABLE_AUX);
> > +   mt = intel_miptree_create_for_image(brw, image, image->format,
> > +                                       0, image->width, image->height,
> > +                                       image->pitch, 0);
> >     if (mt == NULL)
> >        return NULL;
> >
> > --
> > 2.11.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170131/c0a452bd/attachment-0001.html>


More information about the mesa-dev mailing list