[Mesa-dev] [PATCH 14/30] i965/miptree: Add support for window system images to create_for_dri_image
Pohjolainen, Topi
topi.pohjolainen at gmail.com
Mon Jun 26 19:22:08 UTC 2017
On Mon, Jun 26, 2017 at 09:27:53PM +0300, Pohjolainen, Topi wrote:
> On Fri, Jun 16, 2017 at 03:41:36PM -0700, Jason Ekstrand wrote:
> > We want to start using create_for_dri_image for all miptrees created
> > from __DRIimage, including those which come from a window system. In
> > order to allow for fast clears to still work on window system buffers,
> > we need to allow for creating aux surfaces.
> > ---
> > src/mesa/drivers/dri/i965/intel_fbo.c | 2 +-
> > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 16 +++++++++++++---
> > src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 ++-
> > src/mesa/drivers/dri/i965/intel_tex_image.c | 2 +-
> > 4 files changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
> > index 130eab1..db4cfee 100644
> > --- a/src/mesa/drivers/dri/i965/intel_fbo.c
> > +++ b/src/mesa/drivers/dri/i965/intel_fbo.c
> > @@ -363,7 +363,7 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
> > * content.
> > */
> > irb->mt = intel_miptree_create_for_dri_image(brw, image, GL_TEXTURE_2D,
> > - image->format);
> > + image->format, false);
> > 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 7b4d431..83c99ed 100644
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> > @@ -901,7 +901,8 @@ miptree_create_for_planar_image(struct brw_context *brw,
> > struct intel_mipmap_tree *
> > intel_miptree_create_for_dri_image(struct brw_context *brw,
> > __DRIimage *image, GLenum target,
> > - mesa_format format)
> > + mesa_format format,
> > + bool is_winsys_image)
> > {
> > if (image->planar_format && image->planar_format->nplanes > 0)
> > return miptree_create_for_planar_image(brw, image, target);
> > @@ -909,6 +910,16 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
> > if (!brw->ctx.TextureFormatSupported[format])
> > return NULL;
> >
> > + /* If this image comes in from a window system, we have different
> > + * requirements than if it comes in via an EGL import operation. Window
> > + * system images can use any form of auxiliary compression we wish because
> > + * they get "flushed" before being handed off to the window system and we
> > + * have the opportunity to do resolves. Window system buffers also may be
> > + * used for scanout so we need to flag that appropriately.
> > + */
> > + const uint32_t mt_layout_flags =
> > + is_winsys_image ? MIPTREE_LAYOUT_FOR_SCANOUT : MIPTREE_LAYOUT_DISABLE_AUX;
>
> Is there any particular why we couldn't pass 'layout_flags' directly instead
> of 'is_winsys_image'? That would work at least for the next patch in the
> series.
Okay, I just read patch 25. Ignore this comment.
>
> > +
> > /* Disable creation of the texture's aux buffers because the driver exposes
> > * no EGL API to manage them. That is, there is no API for resolving the aux
> > * buffer's content to the main buffer nor for invalidating the aux buffer's
> > @@ -917,8 +928,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
> > struct intel_mipmap_tree *mt =
> > intel_miptree_create_for_bo(brw, image->bo, format,
> > image->offset, image->width, image->height, 1,
> > - image->pitch,
> > - MIPTREE_LAYOUT_DISABLE_AUX);
> > + image->pitch, mt_layout_flags);
> > if (mt == NULL)
> > return NULL;
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > index 8044a1b..2a4cda2 100644
> > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> > @@ -700,7 +700,8 @@ struct intel_mipmap_tree *
> > intel_miptree_create_for_dri_image(struct brw_context *brw,
> > __DRIimage *image,
> > GLenum target,
> > - mesa_format format);
> > + mesa_format format,
> > + bool is_winsys_image);
> >
> > bool
> > intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
> > diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > index 76a6e13..53e1087 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > @@ -344,7 +344,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
> > }
> >
> > mt = intel_miptree_create_for_dri_image(brw, image, target,
> > - image->format);
> > + image->format, false);
> > if (mt == NULL)
> > return;
> >
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list