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 <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
This commit is contained in:
Jason Ekstrand 2017-06-16 09:57:12 -07:00
parent 2dd4e2348f
commit 90d93755d1
4 changed files with 17 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;