intel/blorp: Add support for swizzling fast-clear colors

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4218>
(cherry picked from commit 3fb8f19481)
This commit is contained in:
Jason Ekstrand 2020-03-17 13:36:40 -05:00 committed by Dylan Baker
parent 12ed35a395
commit 7eb4b33a9a
6 changed files with 15 additions and 5 deletions

View file

@ -328,7 +328,7 @@
"description": "intel/blorp: Add support for swizzling fast-clear colors",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -315,6 +315,7 @@ fast_clear_color(struct iris_context *ice,
* conversion in convert_fast_clear_color().
*/
blorp_fast_clear(&blorp_batch, &surf, isl_format_srgb_to_linear(format),
ISL_SWIZZLE_IDENTITY,
level, box->z, box->depth,
box->x, box->y, box->x + box->width,
box->y + box->height);

View file

@ -165,7 +165,8 @@ swizzle_color_value(union isl_color_value src, struct isl_swizzle swizzle);
void
blorp_fast_clear(struct blorp_batch *batch,
const struct blorp_surf *surf, enum isl_format format,
const struct blorp_surf *surf,
enum isl_format format, struct isl_swizzle swizzle,
uint32_t level, uint32_t start_layer, uint32_t num_layers,
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);

View file

@ -332,7 +332,8 @@ get_fast_clear_rect(const struct isl_device *dev,
void
blorp_fast_clear(struct blorp_batch *batch,
const struct blorp_surf *surf, enum isl_format format,
const struct blorp_surf *surf,
enum isl_format format, struct isl_swizzle swizzle,
uint32_t level, uint32_t start_layer, uint32_t num_layers,
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1)
{
@ -358,6 +359,12 @@ blorp_fast_clear(struct blorp_batch *batch,
start_layer, format, true);
params.num_samples = params.dst.surf.samples;
/* If a swizzle was provided, we need to swizzle the clear color so that
* the hardware color format conversion will work properly.
*/
params.dst.clear_color = swizzle_color_value(params.dst.clear_color,
swizzle);
batch->blorp->exec(batch, &params);
}

View file

@ -1782,7 +1782,7 @@ anv_image_mcs_op(struct anv_cmd_buffer *cmd_buffer,
switch (mcs_op) {
case ISL_AUX_OP_FAST_CLEAR:
blorp_fast_clear(&batch, &surf, format,
blorp_fast_clear(&batch, &surf, format, ISL_SWIZZLE_IDENTITY,
0, base_layer, layer_count,
0, 0, image->extent.width, image->extent.height);
break;
@ -1863,7 +1863,7 @@ anv_image_ccs_op(struct anv_cmd_buffer *cmd_buffer,
switch (ccs_op) {
case ISL_AUX_OP_FAST_CLEAR:
blorp_fast_clear(&batch, &surf, format,
blorp_fast_clear(&batch, &surf, format, ISL_SWIZZLE_IDENTITY,
level, base_layer, layer_count,
0, 0, level_width, level_height);
break;

View file

@ -1307,6 +1307,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw, 0);
blorp_fast_clear(&batch, &surf, isl_format_srgb_to_linear(isl_format),
ISL_SWIZZLE_IDENTITY,
level, irb->mt_layer, num_layers, x0, y0, x1, y1);
blorp_batch_finish(&batch);