[Mesa-dev] [PATCH v2 11/27] i965/miptree: Add support for window system images to create_for_dri_image
Jason Ekstrand
jason at jlekstrand.net
Fri Jun 30 03:13:20 UTC 2017
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.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
Reviewed-by: Chad Versace <chadversary at chromium.org>
---
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 3670c2a..03427e8 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,
- ISL_COLORSPACE_NONE);
+ ISL_COLORSPACE_NONE, 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 6159fb3..3c37fe3 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1041,7 +1041,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,
- enum isl_colorspace colorspace)
+ enum isl_colorspace colorspace,
+ bool is_winsys_image)
{
if (image->planar_format && image->planar_format->nplanes > 0) {
assert(colorspace == ISL_COLORSPACE_NONE ||
@@ -1083,6 +1084,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;
+
/* 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
@@ -1091,8 +1102,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 6668d31..c4ed525 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -690,7 +690,8 @@ struct intel_mipmap_tree *
intel_miptree_create_for_dri_image(struct brw_context *brw,
__DRIimage *image,
GLenum target,
- enum isl_colorspace colorspace);
+ enum isl_colorspace colorspace,
+ 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 7765d1b..68d0a57 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -357,7 +357,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
}
mt = intel_miptree_create_for_dri_image(brw, image, target,
- ISL_COLORSPACE_NONE);
+ ISL_COLORSPACE_NONE, false);
if (mt == NULL)
return;
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list