From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [igt-dev] [PATCH i-g-t v3 11/13] lib/intel_blt: Support Xe2 in xy-block-copy command
Date: Wed, 4 Oct 2023 08:49:20 -0700 [thread overview]
Message-ID: <20231004154922.3478014-12-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20231004154922.3478014-1-lucas.demarchi@intel.com>
Xe2 block-copy command is slightly different, with dw01 and dw02
having a few differences: 1) different bitrange for mocs; 2) no
ctrl_surface_type, aux_mode or compression.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
lib/intel_blt.c | 111 +++++++++++++++++++++++++++++++-----------------
1 file changed, 73 insertions(+), 38 deletions(-)
diff --git a/lib/intel_blt.c b/lib/intel_blt.c
index d1aa0872c..4e0fe6320 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -55,15 +55,26 @@ struct gen12_block_copy_data {
uint32_t client: BITRANGE(29, 31);
} dw00;
- struct {
- uint32_t dst_pitch: BITRANGE(0, 17);
- uint32_t dst_aux_mode: BITRANGE(18, 20);
- uint32_t pxp: BITRANGE(21, 21);
- uint32_t dst_mocs_index: BITRANGE(22, 27);
- uint32_t dst_ctrl_surface_type: BITRANGE(28, 28);
- uint32_t dst_compression: BITRANGE(29, 29);
- uint32_t dst_tiling: BITRANGE(30, 31);
- } dw01;
+ union {
+ struct {
+ uint32_t dst_pitch: BITRANGE(0, 17);
+ uint32_t dst_aux_mode: BITRANGE(18, 20);
+ uint32_t pxp: BITRANGE(21, 21);
+ uint32_t dst_mocs_index: BITRANGE(22, 27);
+ uint32_t dst_ctrl_surface_type: BITRANGE(28, 28);
+ uint32_t dst_compression: BITRANGE(29, 29);
+ uint32_t dst_tiling: BITRANGE(30, 31);
+ } dw01;
+ struct {
+ uint32_t dst_pitch: BITRANGE(0, 17);
+ uint32_t dst_aux_mode: BITRANGE(18, 20);
+ uint32_t pxp: BITRANGE(21, 21);
+ uint32_t dst_mocs_index: BITRANGE(22, 27);
+ uint32_t dst_ctrl_surface_type: BITRANGE(28, 28);
+ uint32_t dst_compression: BITRANGE(29, 29);
+ uint32_t dst_tiling: BITRANGE(30, 31);
+ } dw01_xe2;
+ };
struct {
int32_t dst_x1: BITRANGE(0, 15);
@@ -96,15 +107,26 @@ struct gen12_block_copy_data {
int32_t src_y1: BITRANGE(16, 31);
} dw07;
- struct {
- uint32_t src_pitch: BITRANGE(0, 17);
- uint32_t src_aux_mode: BITRANGE(18, 20);
- uint32_t pxp: BITRANGE(21, 21);
- uint32_t src_mocs_index: BITRANGE(22, 27);
- uint32_t src_ctrl_surface_type: BITRANGE(28, 28);
- uint32_t src_compression: BITRANGE(29, 29);
- uint32_t src_tiling: BITRANGE(30, 31);
- } dw08;
+ union {
+ struct {
+ uint32_t src_pitch: BITRANGE(0, 17);
+ uint32_t src_aux_mode: BITRANGE(18, 20);
+ uint32_t pxp: BITRANGE(21, 21);
+ uint32_t src_mocs_index: BITRANGE(22, 27);
+ uint32_t src_ctrl_surface_type: BITRANGE(28, 28);
+ uint32_t src_compression: BITRANGE(29, 29);
+ uint32_t src_tiling: BITRANGE(30, 31);
+ } dw08;
+ struct {
+ uint32_t src_pitch: BITRANGE(0, 17);
+ uint32_t pad0: BITRANGE(18, 20);
+ uint32_t pxp: BITRANGE(21, 21);
+ uint32_t pad1: BITRANGE(22, 23);
+ uint32_t src_mocs_index: BITRANGE(24, 27);
+ uint32_t pad2: BITRANGE(28, 29);
+ uint32_t src_tiling: BITRANGE(30, 31);
+ } dw08_xe2;
+ };
struct {
uint32_t src_address_lo;
@@ -553,7 +575,7 @@ static bool __new_tile_y_type(enum blt_tiling_type tiling)
static void fill_data(struct gen12_block_copy_data *data,
const struct blt_copy_data *blt,
uint64_t src_offset, uint64_t dst_offset,
- bool extended_command)
+ bool extended_command, unsigned int ip_ver)
{
data->dw00.client = 0x2;
data->dw00.opcode = 0x41;
@@ -561,18 +583,24 @@ static void fill_data(struct gen12_block_copy_data *data,
data->dw00.special_mode = __special_mode(blt);
data->dw00.length = extended_command ? 20 : 10;
- if (__special_mode(blt) == SM_FULL_RESOLVE)
- data->dw01.dst_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->src);
- else
- data->dw01.dst_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->dst);
- data->dw01.dst_pitch = blt->dst.pitch - 1;
+ if (ip_ver >= IP_VER(20, 0)) {
+ data->dw01_xe2.dst_pitch = blt->dst.pitch - 1;
+ data->dw01_xe2.dst_mocs_index = blt->dst.mocs_index;
+ data->dw01_xe2.dst_tiling = __block_tiling(blt->dst.tiling);
+ } else {
+ if (__special_mode(blt) == SM_FULL_RESOLVE)
+ data->dw01.dst_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->src);
+ else
+ data->dw01.dst_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->dst);
+ data->dw01.dst_pitch = blt->dst.pitch - 1;
- data->dw01.dst_mocs_index = blt->dst.mocs_index;
- data->dw01.dst_compression = blt->dst.compression;
- data->dw01.dst_tiling = __block_tiling(blt->dst.tiling);
+ data->dw01.dst_mocs_index = blt->dst.mocs_index;
+ data->dw01.dst_compression = blt->dst.compression;
+ data->dw01.dst_tiling = __block_tiling(blt->dst.tiling);
- if (blt->dst.compression)
- data->dw01.dst_ctrl_surface_type = blt->dst.compression_type;
+ if (blt->dst.compression)
+ data->dw01.dst_ctrl_surface_type = blt->dst.compression_type;
+ }
data->dw02.dst_x1 = blt->dst.x1;
data->dw02.dst_y1 = blt->dst.y1;
@@ -590,14 +618,20 @@ static void fill_data(struct gen12_block_copy_data *data,
data->dw07.src_x1 = blt->src.x1;
data->dw07.src_y1 = blt->src.y1;
- data->dw08.src_pitch = blt->src.pitch - 1;
- data->dw08.src_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->src);
- data->dw08.src_mocs_index = blt->src.mocs_index;
- data->dw08.src_compression = blt->src.compression;
- data->dw08.src_tiling = __block_tiling(blt->src.tiling);
-
- if (blt->src.compression)
- data->dw08.src_ctrl_surface_type = blt->src.compression_type;
+ if (ip_ver >= IP_VER(20, 0)) {
+ data->dw08_xe2.src_pitch = blt->src.pitch - 1;
+ data->dw08_xe2.src_mocs_index = blt->src.mocs_index;
+ data->dw08_xe2.src_tiling = __block_tiling(blt->src.tiling);
+ } else {
+ data->dw08.src_pitch = blt->src.pitch - 1;
+ data->dw08.src_aux_mode = __aux_mode(blt->fd, blt->driver, &blt->src);
+ data->dw08.src_mocs_index = blt->src.mocs_index;
+ data->dw08.src_compression = blt->src.compression;
+ data->dw08.src_tiling = __block_tiling(blt->src.tiling);
+
+ if (blt->src.compression)
+ data->dw08.src_ctrl_surface_type = blt->src.compression_type;
+ }
data->dw09.src_address_lo = src_offset;
data->dw10.src_address_hi = src_offset >> 32;
@@ -802,6 +836,7 @@ uint64_t emit_blt_block_copy(int fd,
uint64_t bb_pos,
bool emit_bbe)
{
+ unsigned int ip_ver = intel_graphics_ver(intel_get_drm_devid(fd));
struct gen12_block_copy_data data = {};
struct gen12_block_copy_data_ext dext = {};
uint64_t dst_offset, src_offset, bb_offset, alignment;
@@ -818,7 +853,7 @@ uint64_t emit_blt_block_copy(int fd,
+ blt->dst.plane_offset;
bb_offset = get_offset(ahnd, blt->bb.handle, blt->bb.size, alignment);
- fill_data(&data, blt, src_offset, dst_offset, ext);
+ fill_data(&data, blt, src_offset, dst_offset, ext, ip_ver);
bb = bo_map(fd, blt->bb.handle, blt->bb.size, blt->driver);
--
2.40.1
next prev parent reply other threads:[~2023-10-04 15:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 15:49 [igt-dev] [PATCH i-g-t v3 00/13] Adapt copy commands for Xe2 Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 01/13] lib/rendercopy: Use common mocs function Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 02/13] lib/gpu_cmds: Remove prefix from gen7_fill_binding_table() Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 03/13] lib/gpu_cmds: Reorder if/else ladder according to IP version Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 04/13] lib/gpu_cmds: Fork a gen9_fill_surface_state() Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 05/13] lib/gpu_cmds: Reduce scope of xehp_fill_surface_state() Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 06/13] lib: Fork gen9_media.h Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 07/13] lib/intel_mocs: Stop encoding mocs Lucas De Marchi
2023-10-09 18:54 ` Matt Roper
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 08/13] lib/intel_mocs: Add Xe2 mocs indexes Lucas De Marchi
2023-10-09 18:56 ` Matt Roper
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 09/13] lib/igt_draw: Add Xe2 mocs to XY_FAST_COLOR_BLT Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 10/13] lib/intel_mocs: Remove unused lefotver defines Lucas De Marchi
2023-10-04 15:49 ` Lucas De Marchi [this message]
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 12/13] lib/intel_blt: Support xe2 in xy-fast-copy command Lucas De Marchi
2023-10-06 22:38 ` [igt-dev] [PATCH i-g-t v3.1 " Lucas De Marchi
2023-10-04 15:49 ` [igt-dev] [PATCH i-g-t v3 13/13] lib/intel_blt: Support xe2 in ctrl-surf-copy command Lucas De Marchi
2023-10-04 18:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for Adapt copy commands for Xe2 (rev4) Patchwork
2023-10-04 19:36 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
2023-10-04 21:49 ` [igt-dev] ✓ Fi.CI.BAT: success for Adapt copy commands for Xe2 (rev5) Patchwork
2023-10-04 23:52 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-10-05 8:32 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-10-06 23:34 ` [igt-dev] ✓ Fi.CI.BAT: success for Adapt copy commands for Xe2 (rev6) Patchwork
2023-10-06 23:34 ` [igt-dev] ✓ CI.xeBAT: " Patchwork
2023-10-07 13:11 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-10-10 15:49 ` [igt-dev] [PATCH i-g-t v3 00/13] Adapt copy commands for Xe2 Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231004154922.3478014-12-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox