intel: Fix the MOCS values in XY_FAST_COLOR_BLT for Xe2+

Xe2 changed the MOCS field in few instructions, those now have a field
for the MOCS index and other the encryption enable bit but ISL returns
the combination of both aka MEMORY_OBJECT_CONTROL_STATE.

To minimize changes I have added 2 macros to extract the values
from the value returned by isl.

From all the instructions changed Mesa only make use of two, so the
other instruction will be handled in the next patch.

Cc: mesa-stable
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34592>
(cherry picked from commit 161c412a8296961f21f06761f89d58ad124ecc0d)
This commit is contained in:
José Roberto de Souza
2025-04-17 12:00:01 -07:00
committed by Eric Engestrom
parent 6fdcc55f6d
commit 14a045df1c
6 changed files with 25 additions and 5 deletions

View File

@@ -344,7 +344,7 @@
"description": "intel: Fix the MOCS values in XY_FAST_COLOR_BLT for Xe2+",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -6229,10 +6229,17 @@ batch_emit_fast_color_dummy_blit(struct iris_batch *batch)
{
#if GFX_VERx10 >= 125
iris_emit_cmd(batch, GENX(XY_FAST_COLOR_BLT), blt) {
uint32_t mocs = iris_mocs(batch->screen->workaround_address.bo,
&batch->screen->isl_dev,
ISL_SURF_USAGE_BLITTER_DST_BIT);
blt.DestinationBaseAddress = batch->screen->workaround_address;
blt.DestinationMOCS = iris_mocs(batch->screen->workaround_address.bo,
&batch->screen->isl_dev,
ISL_SURF_USAGE_BLITTER_DST_BIT);
#if GFX_VERx10 >= 200
blt.DestinationMOCSindex = MOCS_GET_INDEX(mocs);
blt.DestinationEncryptEn = MOCS_GET_ENCRYPT_EN(mocs);
#else
blt.DestinationMOCS = mocs;
#endif
blt.DestinationPitch = 63;
blt.DestinationX2 = 1;
blt.DestinationY2 = 4;

View File

@@ -2157,7 +2157,12 @@ blorp_xy_fast_color_blit(struct blorp_batch *batch,
blt.DestinationPitch = (dst_surf->row_pitch_B / dst_pitch_unit) - 1;
blt.DestinationTiling = xy_bcb_tiling(dst_surf);
#if GFX_VERx10 >= 200
blt.DestinationMOCSindex = MOCS_GET_INDEX(params->dst.addr.mocs);
blt.DestinationEncryptEn = MOCS_GET_ENCRYPT_EN(params->dst.addr.mocs);
#else
blt.DestinationMOCS = params->dst.addr.mocs;
#endif
blt.DestinationX1 = params->x0;
blt.DestinationY1 = params->y0;
blt.DestinationX2 = params->x1;

View File

@@ -1283,7 +1283,7 @@
</field>
<field name="Destination Pitch" start="32" end="49" type="uint" />
<field name="Destination Encrypt En" start="53" end="53" type="bool" />
<field name="Destination MOCS" start="56" end="59" type="uint" />
<field name="Destination MOCS index" start="56" end="59" type="uint" />
<field name="Destination Tiling" start="62" end="63" type="uint" prefix="XY_TILE">
<value name="LINEAR" value="0" />
<value name="X" value="1" />

View File

@@ -2717,6 +2717,9 @@ isl_swizzle_compose(struct isl_swizzle first, struct isl_swizzle second);
struct isl_swizzle
isl_swizzle_invert(struct isl_swizzle swizzle);
#define MOCS_GET_INDEX(mocs) ((mocs) >> 1)
#define MOCS_GET_ENCRYPT_EN(mocs) ((mocs) & (1 << 0))
uint32_t isl_mocs(const struct isl_device *dev, isl_surf_usage_flags_t usage,
bool external);

View File

@@ -6424,7 +6424,12 @@ genX(batch_emit_fast_color_dummy_blit)(struct anv_batch *batch,
#if GFX_VERx10 >= 125
anv_batch_emit(batch, GENX(XY_FAST_COLOR_BLT), blt) {
blt.DestinationBaseAddress = device->workaround_address;
#if GFX_VERx10 >= 200
blt.DestinationMOCSindex = MOCS_GET_INDEX(device->isl_dev.mocs.blitter_dst);
blt.DestinationEncryptEn = MOCS_GET_ENCRYPT_EN(device->isl_dev.mocs.blitter_dst);
#else
blt.DestinationMOCS = device->isl_dev.mocs.blitter_dst;
#endif
blt.DestinationPitch = 63;
blt.DestinationX2 = 1;
blt.DestinationY2 = 4;