diff options
author | Jason Ekstrand <[email protected]> | 2017-06-16 09:57:12 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-07-12 21:15:46 -0700 |
commit | 90d93755d17397bb2b27fece9aec02914e31e9b7 (patch) | |
tree | fa9c6272cdde77737f1dfb061f36eabfb52d8631 | |
parent | 2dd4e2348f3c05cd11cd6573fbbaeea7ab898692 (diff) |
i965/miptree: Add support for window system images to create_for_dri_image
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 <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 | ||||
-rw-r--r-- | 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 3670c2a0b7f..03427e8c8fe 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 6159fb31a25..3c37fe3bf09 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 6668d317a26..c4ed525934f 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 7765d1bddf8..68d0a576670 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; |