Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Maslak <jan.maslak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: zbigniew.kempczynski@intel.com, Jan Maslak <jan.maslak@intel.com>
Subject: [PATCH v6 05/11] lib/intel_bufops: Add intel_buf_mocs() helper
Date: Mon, 13 Jul 2026 15:37:40 +0200	[thread overview]
Message-ID: <20260713133746.453051-6-jan.maslak@intel.com> (raw)
In-Reply-To: <20260713133746.453051-1-jan.maslak@intel.com>

Some genxml-generated pack headers represent MOCS as a single 7-bit
field encoding both the 6-bit MOCS table index at bits 6:1 and the PXP
protected-content bit at bit 0.

intel_buf already carries both pieces of information, but callers would
otherwise have to open-code the packing each time they assign to a
genxml .MOCS field.

Add intel_buf_mocs(buf) to return the packed 7-bit value:

  (buf->mocs_index << 1) | intel_buf_pxp(buf)

This keeps the encoding logic in one place and makes genxml call sites
use the same packing convention consistently.

Signed-off-by: Jan Maslak <jan.maslak@intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 lib/intel_bufops.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index d111346aaa..ead2c53e3f 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -210,6 +210,19 @@ static inline bool intel_buf_pxp(const struct intel_buf *buf)
 	return buf->is_protected;
 }
 
+/**
+ * intel_buf_mocs:
+ * @buf: the intel_buf
+ *
+ * Returns the full 7-bit MOCS field value for @buf, encoding the 6-bit
+ * table index at bits 6:1 and the PXP protected-content bit at bit 0.
+ * Use this when assigning to a genxml-generated MOCS field.
+ */
+static inline uint8_t intel_buf_mocs(const struct intel_buf *buf)
+{
+	return (buf->mocs_index << 1) | (intel_buf_pxp(buf) ? 1 : 0);
+}
+
 void *intel_buf_cpu_map(struct intel_buf *buf, bool write);
 void *intel_buf_device_map(struct intel_buf *buf, bool write);
 void intel_buf_unmap(struct intel_buf *buf);
-- 
2.43.0


  parent reply	other threads:[~2026-07-13 13:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 13:37 [PATCH v6 00/11] lib/genxml: Introduce Mesa genxml infrastructure to IGT Jan Maslak
2026-07-13 13:37 ` [PATCH v6 01/11] lib/intel/genxml: Add genxml generators, headers, and build integration Jan Maslak
2026-07-13 13:37 ` [PATCH v6 04/11] lib/intel/genxml: Import Xe2/Xe3/Xe3p XML hardware definitions from Mesa Jan Maslak
2026-07-13 13:37 ` Jan Maslak [this message]
2026-07-13 13:37 ` [PATCH v6 06/11] lib/mocs: Add packed MOCS helpers Jan Maslak
2026-07-13 13:37 ` [PATCH v6 07/11] lib/rendercopy: Convert surface state and sampler setup to genxml Jan Maslak
2026-07-13 13:37 ` [PATCH v6 08/11] lib/rendercopy: Convert vertex data and CC state " Jan Maslak
2026-07-13 13:37 ` [PATCH v6 09/11] lib/rendercopy: Convert pipeline emit commands " Jan Maslak
2026-07-16  9:50   ` Zbigniew Kempczyński
2026-07-13 13:37 ` [PATCH v6 10/11] lib/rendercopy: Convert render op and entry points " Jan Maslak
2026-07-13 13:37 ` [PATCH v6 11/11] lib: Add genxml annotated batch buffer decode Jan Maslak
2026-07-16 10:54   ` Kamil Konieczny
2026-07-13 19:14 ` ✓ Xe.CI.BAT: success for lib/genxml: Introduce Mesa genxml infrastructure to IGT (rev7) Patchwork
2026-07-13 19:31 ` ✓ i915.CI.BAT: " Patchwork
2026-07-13 22:59 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-14  4:08 ` ✓ i915.CI.Full: success " 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=20260713133746.453051-6-jan.maslak@intel.com \
    --to=jan.maslak@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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