[Mesa-dev] [PATCH v13 25/36] i965/miptree: Allocate mt earlier in update winsys
Daniel Stone
daniels at collabora.com
Fri May 19 09:38:08 UTC 2017
From: Ben Widawsky <ben at bwidawsk.net>
Allows us to continue utilizing common miptree creation using __DRIimage
without creating a new DRIimage (for the intel_process_dri2_buffer()
case).
This is a bit ugly, but I think it's the best one can do.
v2: This patch let's us remove the temporary no_aux variable since mt
allocation should work correctly now.
Unref the BO is miptree creation fails (Jason)
v3: Rebase (Daniel)
Cc: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Acked-by: Daniel Stone <daniels at collabora.com>
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
src/mesa/drivers/dri/i965/brw_context.c | 31 ++++++++++++++++++++++-----
src/mesa/drivers/dri/i965/intel_fbo.h | 7 ------
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 ++-------------
src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 2 +-
4 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 3ae84fd332..f0e08b9874 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1660,10 +1660,25 @@ intel_process_dri2_buffer(struct brw_context *brw,
return;
}
- if (!intel_update_winsys_renderbuffer_miptree(brw, rb, bo,
+ struct intel_mipmap_tree *mt = intel_miptree_create_for_bo(brw,
+ bo,
+ intel_rb_format(rb),
+ 0,
+ drawable->w,
+ drawable->h,
+ 1,
+ buffer->pitch,
+ MIPTREE_LAYOUT_FOR_SCANOUT);
+ if (!mt) {
+ brw_bo_unreference(bo);
+ return;
+ }
+
+ if (!intel_update_winsys_renderbuffer_miptree(brw, rb, mt,
drawable->w, drawable->h,
buffer->pitch)) {
brw_bo_unreference(bo);
+ intel_miptree_release(&mt);
return;
}
@@ -1721,13 +1736,19 @@ intel_update_image_buffer(struct brw_context *intel,
if (last_mt && last_mt->bo == buffer->bo)
return;
- if (!buffer->aux_offset)
- rb->no_aux = true;
+ struct intel_mipmap_tree *mt = intel_miptree_create_for_image(intel,
+ buffer, intel_rb_format(rb), 0,
+ buffer->width, buffer->height,
+ buffer->pitch, MIPTREE_LAYOUT_FOR_SCANOUT);
+ if (!mt)
+ return;
- if (!intel_update_winsys_renderbuffer_miptree(intel, rb, buffer->bo,
+ if (!intel_update_winsys_renderbuffer_miptree(intel, rb, mt,
buffer->width, buffer->height,
- buffer->pitch))
+ buffer->pitch)) {
+ intel_miptree_release(&mt);
return;
+ }
if (_mesa_is_front_buffer_drawing(fb) &&
buffer_type == __DRI_IMAGE_BUFFER_FRONT &&
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.h b/src/mesa/drivers/dri/i965/intel_fbo.h
index 9265aab2e2..08b82e8934 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.h
+++ b/src/mesa/drivers/dri/i965/intel_fbo.h
@@ -111,13 +111,6 @@ struct intel_renderbuffer
* for the duration of a mapping.
*/
bool singlesample_mt_is_tmp;
-
- /**
- * Set to true if this buffer definitely does not have auxiliary data, like
- * CCS, associated with it. It's generally to be used when importing a
- * DRIimage, where that DRIimage had no modifier.
- */
- bool no_aux;
};
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index edda132f7b..b33afdeb3f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -873,11 +873,10 @@ intel_miptree_create_for_image(struct brw_context *intel,
bool
intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
struct intel_renderbuffer *irb,
- struct brw_bo *bo,
+ struct intel_mipmap_tree *singlesample_mt,
uint32_t width, uint32_t height,
uint32_t pitch)
{
- struct intel_mipmap_tree *singlesample_mt = NULL;
struct intel_mipmap_tree *multisample_mt = NULL;
struct gl_renderbuffer *rb = &irb->Base.Base;
mesa_format format = rb->Format;
@@ -889,18 +888,7 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
assert(_mesa_get_format_base_format(format) == GL_RGB ||
_mesa_get_format_base_format(format) == GL_RGBA);
- singlesample_mt = intel_miptree_create_for_bo(intel,
- bo,
- format,
- 0,
- width,
- height,
- 1,
- pitch,
- MIPTREE_LAYOUT_FOR_SCANOUT |
- irb->no_aux ? MIPTREE_LAYOUT_DISABLE_AUX: 0);
- if (!singlesample_mt)
- goto fail;
+ assert(singlesample_mt);
/* If this miptree is not capable of supporting fast color clears, flag
* mcs allocation disabled.
@@ -940,7 +928,6 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
return true;
fail:
- intel_miptree_release(&irb->singlesample_mt);
intel_miptree_release(&irb->mt);
return false;
}
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 15e81300a2..c1a7ad450a 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -720,7 +720,7 @@ intel_miptree_create_for_image(struct brw_context *intel,
bool
intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
struct intel_renderbuffer *irb,
- struct brw_bo *bo,
+ struct intel_mipmap_tree *singlesample_mt,
uint32_t width, uint32_t height,
uint32_t pitch);
--
2.13.0
More information about the mesa-dev
mailing list