Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: juha-pekka.heikkila@intel.com
Subject: [igt-dev] [PATCH i-g-t v2 11/16] lib/igt_draw: Use XY_FAST_COLOR_BLT on DG2
Date: Mon, 14 Feb 2022 20:30:04 +0530	[thread overview]
Message-ID: <20220214150009.26815-12-jeevan.b@intel.com> (raw)
In-Reply-To: <20220214150009.26815-1-jeevan.b@intel.com>

From: Matt Roper <matthew.d.roper@intel.com>

The XY_COLOR_BLT instruction used by igt_draw's blitter implementation
doesn't support F-tile (plus we've heard informally from the hardware
team that the instruction is deprecated in general).  Switch to
XY_FAST_COLOR_BLT to perform our solid fills on DG2.  This instruction
will also allow us to extend the igt_draw support to 64bit+ color depths
in the future too if we have tests that start wanting to test that.

Note that we don't currently pass enough information down to this
routine to pick an appropriate value for the smem vs lmem performance
hint bit, but that doesn't impact the output generated.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
 lib/igt_draw.c  | 107 ++++++++++++++++++++++++++++++++++++------------
 lib/intel_reg.h |   2 +
 2 files changed, 83 insertions(+), 26 deletions(-)

diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index d78ecdf0..056101b9 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -666,36 +666,91 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
 	ibb = intel_bb_create(fd, PAGE_SIZE);
 	intel_bb_add_intel_buf(ibb, dst, true);
 
-	switch (buf->bpp) {
-	case 8:
-		blt_cmd_depth = 0;
-		break;
-	case 16: /* we're assuming 565 */
-		blt_cmd_depth = 1 << 24;
-		break;
-	case 32:
-		blt_cmd_depth = 3 << 24;
-		break;
-	default:
-		igt_assert(false);
-	}
+	if (IS_DG2(intel_get_drm_devid(fd))) {
+		int buf_height = buf->size / buf->stride;
+
+		switch (buf->bpp) {
+		case 8:
+			blt_cmd_depth = 0;
+			break;
+		case 16: /* we're assuming 565 */
+			blt_cmd_depth = 1 << 19;
+			break;
+		case 32:
+			blt_cmd_depth = 2 << 19;
+			break;
+		case 64:
+			/* Not used or supported yet */
+		default:
+			igt_assert(false);
+		}
+
+		switch (tiling) {
+		case I915_TILING_NONE:
+			blt_cmd_tiling = 0;
+			break;
+		case I915_TILING_X:
+			blt_cmd_tiling = 1 << 30;
+			break;
+		case I915_TILING_4:
+			blt_cmd_tiling = 2 << 30;
+			break;
+		default:
+			igt_assert(false);
+		}
+
+		pitch = tiling ? buf->stride / 4 : buf->stride;
+
+		intel_bb_out(ibb, XY_FAST_COLOR_BLT | blt_cmd_depth);
+		/* DG2 MOCS entry 2 is "UC - Non-Coherent; GO:Memory" */
+		intel_bb_out(ibb, blt_cmd_tiling | 2 << 21 | (pitch-1));
+		intel_bb_out(ibb, (rect->y << 16) | rect->x);
+		intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (rect->x + rect->w));
+		intel_bb_emit_reloc_fenced(ibb, dst->handle, 0,
+					   I915_GEM_DOMAIN_RENDER, 0,
+					   dst->addr.offset);
+		intel_bb_out(ibb, 0);	/* TODO: Pass down enough info for target memory hint */
+		intel_bb_out(ibb, color);
+		intel_bb_out(ibb, 0);	/* 64 bit color */
+		intel_bb_out(ibb, 0);	/* 96 bit color */
+		intel_bb_out(ibb, 0);	/* 128 bit color */
+		intel_bb_out(ibb, 0);	/* clear address */
+		intel_bb_out(ibb, 0);	/* clear address */
+		intel_bb_out(ibb, (1 << 29) | ((pitch-1) << 14) | (buf_height-1));
+		intel_bb_out(ibb, 0);	/* mipmap levels / qpitch */
+		intel_bb_out(ibb, 0);	/* mipmap index / alignment */
+	} else {
+		switch (buf->bpp) {
+		case 8:
+			blt_cmd_depth = 0;
+			break;
+		case 16: /* we're assuming 565 */
+			blt_cmd_depth = 1 << 24;
+			break;
+		case 32:
+			blt_cmd_depth = 3 << 24;
+			break;
+		default:
+			igt_assert(false);
+		}
 
-	blt_cmd_len = (gen >= 8) ?  0x5 : 0x4;
-	blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
-	pitch = (gen >= 4 && tiling) ? buf->stride / 4 : buf->stride;
+		blt_cmd_len = (gen >= 8) ?  0x5 : 0x4;
+		blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
+		pitch = (gen >= 4 && tiling) ? buf->stride / 4 : buf->stride;
 
-	switch_blt_tiling(ibb, tiling, true);
+		switch_blt_tiling(ibb, tiling, true);
 
-	intel_bb_out(ibb, XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
-		     XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);
-	intel_bb_out(ibb, blt_cmd_depth | (0xF0 << 16) | pitch);
-	intel_bb_out(ibb, (rect->y << 16) | rect->x);
-	intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (rect->x + rect->w));
-	intel_bb_emit_reloc_fenced(ibb, dst->handle, 0, I915_GEM_DOMAIN_RENDER,
-				   0, dst->addr.offset);
-	intel_bb_out(ibb, color);
+		intel_bb_out(ibb, XY_COLOR_BLT_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
+			     XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);
+		intel_bb_out(ibb, blt_cmd_depth | (0xF0 << 16) | pitch);
+		intel_bb_out(ibb, (rect->y << 16) | rect->x);
+		intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (rect->x + rect->w));
+		intel_bb_emit_reloc_fenced(ibb, dst->handle, 0, I915_GEM_DOMAIN_RENDER,
+					   0, dst->addr.offset);
+		intel_bb_out(ibb, color);
 
-	switch_blt_tiling(ibb, tiling, false);
+		switch_blt_tiling(ibb, tiling, false);
+	}
 
 	intel_bb_flush_blit(ibb);
 	intel_bb_destroy(ibb);
diff --git a/lib/intel_reg.h b/lib/intel_reg.h
index 44b0d480..cb627288 100644
--- a/lib/intel_reg.h
+++ b/lib/intel_reg.h
@@ -2557,6 +2557,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define XY_MONO_SRC_BLT_WRITE_ALPHA	(1<<21)
 #define XY_MONO_SRC_BLT_WRITE_RGB	(1<<20)
 
+#define XY_FAST_COLOR_BLT		((0x2<<29)|(0x44<<22)|0xe)
+
 #define XY_FAST_COPY_BLT				((2<<29)|(0x42<<22)|0x8)
 /* dword 0 */
 #define   XY_FAST_COPY_SRC_TILING_LINEAR		(0 << 20)
-- 
2.17.1

  parent reply	other threads:[~2022-02-14 15:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 14:59 [igt-dev] [PATCH i-g-t v2 00/16] DG2 platform definition and Tile 4 plane format support Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 01/16] lib/dg2: Add DG2 platform definition Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 02/16] lib/intel_device_info: Add a flag to indicate tiling 4 support Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 03/16] igt/lib: Add tile 4(F-tile) format support Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 04/16] lib/igt_draw: Add pixel math for tile-4 Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 05/16] igt/tests: Add support for Tile4(TileF) format to kms_draw_crc Jeevan B
2022-02-14 14:59 ` [igt-dev] [PATCH i-g-t v2 06/16] igt/tests: Add support for Tile4(TileF) format to kms_rotation_crc Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 07/16] igt/tests: Add support for Tile4(TileF) format to tests/kms_plane_multiple Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 08/16] igt/tests: Add support for Tile4(TileF) format to tests/kms_plane_lowres Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 09/16] igt/tests: Add support for Tile4(TileF) format to tests/kms_big_fb Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 10/16] igt/tests: Add support for Tile4(TileF) format to testdisplay Jeevan B
2022-02-14 15:00 ` Jeevan B [this message]
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 12/16] igt/tests: Add support for Tile4(TileF) format to tests/kms_addfb_basic Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 13/16] tests/kms_frontbuffer_tracking: Add support for 4 tiling Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 14/16] tests/kms_draw_crc: Use 4 tiling when filling framebuffer Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 15/16] tests/kms_plane_scaling: Adding Tile-4 support Jeevan B
2022-02-14 15:00 ` [igt-dev] [PATCH i-g-t v2 16/16] tests/kms_plane_scaling: Use tiling 4 if platform has support for it Jeevan B
2022-02-15 14:13 ` [igt-dev] ✗ Fi.CI.BUILD: failure for DG2 platform definition and Tile 4 plane format support (rev2) Patchwork
2022-02-15 14:22 ` [igt-dev] ✗ GitLab.Pipeline: warning " Patchwork

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=20220214150009.26815-12-jeevan.b@intel.com \
    --to=jeevan.b@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=juha-pekka.heikkila@intel.com \
    /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