diff mbox series

[libdrm,2/3] tests/etnaviv_2d_test: pick the 2D core

Message ID 20201201203829.1735559-3-lkundrak@v3.sk (mailing list archive)
State New, archived
Headers show
Series tests/etnaviv_2d_test: some test improvements | expand

Commit Message

Lubomir Rintel Dec. 1, 2020, 8:38 p.m. UTC
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(-)

Comments

Christian Gmeiner Dec. 9, 2020, 2:56 p.m. UTC | #1
Am Di., 1. Dez. 2020 um 21:38 Uhr schrieb Lubomir Rintel <lkundrak@v3.sk>:
>
> Run the test on a core capable of 2D rendering instead of hardcoding to
> core zero.
>

Thanks - I should have done this before landing this test :)

> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>  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
>
> _______________________________________________
> etnaviv mailing list
> etnaviv@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
diff mbox series

Patch

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) {