All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: dri-devel@lists.freedesktop.org
Cc: Lubomir Rintel <lkundrak@v3.sk>, etnaviv@lists.freedesktop.org
Subject: [PATCH libdrm 2/3] tests/etnaviv_2d_test: pick the 2D core
Date: Tue,  1 Dec 2020 21:38:28 +0100	[thread overview]
Message-ID: <20201201203829.1735559-3-lkundrak@v3.sk> (raw)
In-Reply-To: <20201201203829.1735559-1-lkundrak@v3.sk>

Run the test on a core capable of 2D rendering instead of hardcoding to
core zero.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 tests/etnaviv/etnaviv_2d_test.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c
index eb9dfa59..a75a4a89 100644
--- a/tests/etnaviv/etnaviv_2d_test.c
+++ b/tests/etnaviv/etnaviv_2d_test.c
@@ -161,6 +161,8 @@ int main(int argc, char *argv[])
 
 	drmVersionPtr version;
 	int fd, ret = 0;
+	uint64_t feat;
+	int core = 0;
 
 	if (argc < 2) {
 		fprintf(stderr, "Usage: %s /dev/dri/<device>\n", argv[0]);
@@ -190,13 +192,28 @@ int main(int argc, char *argv[])
 		goto out;
 	}
 
-	/* TODO: we assume that core 0 is a 2D capable one */
-	gpu = etna_gpu_new(dev, 0);
-	if (!gpu) {
-		perror("etna_gpu_new");
-		ret = 3;
-		goto out_device;
-	}
+	do {
+		gpu = etna_gpu_new(dev, core);
+		if (!gpu) {
+			perror("etna_gpu_new");
+			ret = 3;
+			goto out_device;
+		}
+
+		if (etna_gpu_get_param(gpu, ETNA_GPU_FEATURES_0, &feat)) {
+			perror("etna_gpu_get_param");
+			ret = 4;
+			goto out_device;
+		}
+
+		if ((feat & (1 << 9)) == 0) {
+			/* GPU not 2D capable. */
+			etna_gpu_del(gpu);
+			gpu = NULL;
+		}
+
+		core++;
+	} while (!gpu);
 
 	pipe = etna_pipe_new(gpu, ETNA_PIPE_2D);
 	if (!pipe) {
-- 
2.28.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-12-02  8:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 20:38 [PATCH libdrm 0/3] tests/etnaviv_2d_test: some test improvements Lubomir Rintel
2020-12-01 20:38 ` [PATCH libdrm 1/3] tests/etnaviv_2d_test: explain the errors Lubomir Rintel
2020-12-09 14:54   ` Christian Gmeiner
2020-12-01 20:38 ` Lubomir Rintel [this message]
2020-12-09 14:56   ` [PATCH libdrm 2/3] tests/etnaviv_2d_test: pick the 2D core Christian Gmeiner
2020-12-01 20:38 ` [PATCH libdrm 3/3] tests/etnaviv_2d_test: check whether the rendering is correct Lubomir Rintel
2020-12-09 14:58   ` Christian Gmeiner

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=20201201203829.1735559-3-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.