Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kahola <mika.kahola@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v10 3/4] lib/intel_aux_pgtable: Initialize aux pagetable for fast clear
Date: Fri, 20 Nov 2020 11:36:45 +0200	[thread overview]
Message-ID: <20201120093646.1340401-4-mika.kahola@intel.com> (raw)
In-Reply-To: <20201120093646.1340401-1-mika.kahola@intel.com>

For fast clear we haven't defined source buffer. Therefore, we only
need to initialize only destination aux pagetable.

v2: Cleaner solution proposed by Imre (Imre)

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 lib/intel_aux_pgtable.c | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/lib/intel_aux_pgtable.c b/lib/intel_aux_pgtable.c
index ef6a9fef..c05d4511 100644
--- a/lib/intel_aux_pgtable.c
+++ b/lib/intel_aux_pgtable.c
@@ -514,18 +514,35 @@ gen12_aux_pgtable_init(struct aux_pgtable_info *info,
 		       struct intel_buf *dst_buf)
 {
 	struct intel_buf *bufs[2];
+	int buf_count = 0;
 	struct intel_buf *reserved_bufs[2];
 	int reserved_buf_count;
+	bool has_compressed_buf = false;
+	bool write_buf[2];
 	int i;
 
 	igt_assert_f(ibb->enforce_relocs == false,
 		     "We support aux pgtables for non-forced relocs yet!");
 
-	if (!intel_buf_compressed(src_buf) && !intel_buf_compressed(dst_buf))
-		return;
+	if (src_buf) {
+		bufs[buf_count] = src_buf;
+		write_buf[buf_count] = false;
+		buf_count++;
+
+		if (intel_buf_compressed(src_buf))
+			has_compressed_buf = true;
+	}
+	if (dst_buf) {
+		bufs[buf_count] = dst_buf;
+		write_buf[buf_count] = true;
+		buf_count++;
+
+		if (intel_buf_compressed(dst_buf))
+			has_compressed_buf = true;
+	}
 
-	bufs[0] = src_buf;
-	bufs[1] = dst_buf;
+	if (!has_compressed_buf)
+		return;
 
 	/*
 	 * Surface index in pgt table depend on its address so:
@@ -541,17 +558,15 @@ gen12_aux_pgtable_init(struct aux_pgtable_info *info,
 	 * surfaces.
 	 */
 
-	intel_bb_add_intel_buf(ibb, src_buf, false);
-	if (intel_buf_compressed(src_buf))
-		intel_bb_object_set_flag(ibb, src_buf->handle, EXEC_OBJECT_PINNED);
-
-	intel_bb_add_intel_buf(ibb, dst_buf, true);
-	if (intel_buf_compressed(dst_buf))
-		intel_bb_object_set_flag(ibb, dst_buf->handle, EXEC_OBJECT_PINNED);
+	for (i = 0; i < buf_count; i++) {
+		intel_bb_add_intel_buf(ibb, bufs[i], write_buf[i]);
+		if (intel_buf_compressed(bufs[i]))
+			intel_bb_object_set_flag(ibb, bufs[i]->handle, EXEC_OBJECT_PINNED);
+	}
 
 	reserved_buf_count = 0;
 	/* First reserve space for any bufs that are bound already. */
-	for (i = 0; i < ARRAY_SIZE(bufs); i++) {
+	for (i = 0; i < buf_count; i++) {
 		igt_assert(bufs[i]->addr.offset != INTEL_BUF_INVALID_ADDRESS);
 		aux_pgtable_reserve_buf_slot(reserved_bufs,
 					     reserved_buf_count++,
-- 
2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-11-20  9:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20  9:36 [igt-dev] [PATCH i-g-t v10 0/4] tests/kms_ccs: CCS Clear Color test Mika Kahola
2020-11-20  9:36 ` [igt-dev] [PATCH i-g-t v10 1/4] tests/kms_ccs: Add debug information on format modifier Mika Kahola
2020-11-20  9:36 ` [igt-dev] [PATCH i-g-t v10 2/4] lib/rendercopy: Enable fast clear Mika Kahola
2020-11-20 11:43   ` Imre Deak
2020-11-20  9:36 ` Mika Kahola [this message]
2020-11-20 11:44   ` [igt-dev] [PATCH i-g-t v10 3/4] lib/intel_aux_pgtable: Initialize aux pagetable for " Imre Deak
2020-11-20  9:36 ` [igt-dev] [PATCH i-g-t v10 4/4] tests/kms_ccs: CCS Clear Color test Mika Kahola
2020-11-20 11:52   ` Imre Deak
2020-11-20 11:56     ` Kahola, Mika
2020-11-20 10:09 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-11-20 12:09 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20201120093646.1340401-4-mika.kahola@intel.com \
    --to=mika.kahola@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