From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB72810E101 for ; Mon, 19 Dec 2022 09:16:27 +0000 (UTC) From: Jeevan B To: igt-dev@lists.freedesktop.org Date: Mon, 19 Dec 2022 14:41:54 +0530 Message-Id: <20221219091154.21828-1-jeevan.b@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v2] lib/igt_draw: Change MOCS settings for MTL List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lucas.demarchi@intel.com Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On MTL, we want the table entry labelled "UC (GO:Mem)" which has index 5. This means that the MOCS value is 10. v2: Add define for MOCS settings. (Lucas) Signed-off-by: Jeevan B --- lib/igt_draw.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/igt_draw.c b/lib/igt_draw.c index 975d65cd..4e19e42a 100644 --- a/lib/igt_draw.c +++ b/lib/igt_draw.c @@ -651,13 +651,16 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops, return buf; } +#define DG2_MOCS_UC_GO_MEM 2 /* MOCS index 0x1 */ +#define MTL_MOCS_UC_GO_MEM 10 /* MOCS index 0x5 */ + static void draw_rect_blt(int fd, struct cmd_data *cmd_data, struct buf_data *buf, struct rect *rect, uint32_t tiling, uint32_t color) { struct intel_bb *ibb; struct intel_buf *dst; - int blt_cmd_len, blt_cmd_tiling, blt_cmd_depth; + int blt_cmd_len, blt_cmd_tiling, blt_cmd_depth, mocs_val; uint32_t devid = intel_get_drm_devid(fd); int gen = intel_gen(devid); int pitch; @@ -702,8 +705,11 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data, 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)); + if (IS_METEORLAKE(intel_get_drm_devid(fd))) + mocs_val = MTL_MOCS_UC_GO_MEM; + else + mocs_val = DG2_MOCS_UC_GO_MEM; + intel_bb_out(ibb, blt_cmd_tiling | mocs_val << 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, -- 2.36.0