Skip to contentSkip to conversation

Update Tegra support

PATCH In review Thierry Reding 3 participants 16 messages Feb 17, 2022 – Feb 24, 2022 Tegra architecture support

lore
Share & tools
lore
#0 lore raw

v2 cover Update Tegra support

From: Thierry Reding <[email protected]>

Hi all,

this is the userspace part of the kernel patches that were recently merged into drm-next:

https://patchwork.freedesktop.org/series/92378/

The goal is to provide a userspace implementation of the UAPI exposed by the kernel and show its usage in some test programs that can also be used for basic sanity testing. More complete userspace implementations are available here:

* https://github.com/cyndis/vaapi-tegra-driver
* https://github.com/grate-driver/xf86-video-opentegra
* https://github.com/grate-driver/grate

Changes in v2:
- implement vic_clear() as a helper using ->fill() (Michał Mirosław)
- rebase and fix a couple of Meson errors/warnings

Thierry

Thierry Reding (25):
tegra: Indent according to .editorconfig
tegra: Remove unused IOCTL implementations
tegra: Extract common buffer object allocation code
tegra: Fix mmap() of GEM buffer objects
tegra: Add flink helpers
tegra: Add PRIME support helpers
tegra: Make API more consistent
tegra: Install tegra-openclose test
tegra: Update for new UABI
tegra: Include private.h in list of source files
tegra: Add channel APIs
tegra: Add job and push buffer APIs
tegra: Add syncpoint APIs
tests: tegra: Add helper library for tests
tests: tegra: Add gr2d-fill test
tests: tegra: Add syncpt-wait test
tests: tegra: Add syncpoint timeout test
tests: tegra: Add VIC support
tests: tegra: Add VIC 3.0 support
tests: tegra: Add VIC 4.0 support
tests: tegra: Add VIC 4.1 support
tests: tegra: Add VIC 4.2 support
tests: tegra: Add VIC clear test
tests: tegra: Add VIC blit test
tests: tegra: Add VIC flip test

 include/drm/tegra_drm.h      | 429 +++++++++++++++++++++++--
 tegra/channel.c              | 195 ++++++++++++
 tegra/job.c                  | 187 +++++++++++
 tegra/meson.build            |   7 +-
 tegra/private.h              |  85 ++++-
 tegra/pushbuf.c              | 184 +++++++++++
 tegra/syncpt.c               | 101 ++++++
 tegra/tegra-symbols.txt      |  27 +-
 tegra/tegra.c                | 386 +++++++++++-----------
 tegra/tegra.h                |  95 +++++-
 tests/tegra/.gitignore       |   3 +-
 tests/tegra/drm-test-tegra.c | 147 +++++++++
 tests/tegra/drm-test-tegra.h |  55 ++++
 tests/tegra/drm-test.c       | 248 +++++++++++++++
 tests/tegra/drm-test.h       |  72 +++++
 tests/tegra/gr2d-fill.c      | 146 +++++++++
 tests/tegra/host1x.h         |  34 ++
 tests/tegra/meson.build      |  88 +++++-
 tests/tegra/openclose.c      |  52 +--
 tests/tegra/syncpt-timeout.c | 163 ++++++++++
 tests/tegra/syncpt-wait.c    | 151 +++++++++
 tests/tegra/vic-blit.c       | 333 +++++++++++++++++++
 tests/tegra/vic-clear.c      | 173 ++++++++++
 tests/tegra/vic-flip.c       | 333 +++++++++++++++++++
 tests/tegra/vic.c            | 184 +++++++++++
 tests/tegra/vic.h            | 181 +++++++++++
 tests/tegra/vic30.c          | 458 +++++++++++++++++++++++++++
 tests/tegra/vic30.h          | 439 ++++++++++++++++++++++++++
 tests/tegra/vic40.c          | 370 ++++++++++++++++++++++
 tests/tegra/vic40.h          | 285 +++++++++++++++++
 tests/tegra/vic41.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic41.h          | 372 ++++++++++++++++++++++
 tests/tegra/vic42.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic42.h          | 597 +++++++++++++++++++++++++++++++++++
 34 files changed, 7068 insertions(+), 260 deletions(-)
 create mode 100644 tegra/channel.c
 create mode 100644 tegra/job.c
 create mode 100644 tegra/pushbuf.c
 create mode 100644 tegra/syncpt.c
 create mode 100644 tests/tegra/drm-test-tegra.c
 create mode 100644 tests/tegra/drm-test-tegra.h
 create mode 100644 tests/tegra/drm-test.c
 create mode 100644 tests/tegra/drm-test.h
 create mode 100644 tests/tegra/gr2d-fill.c
 create mode 100644 tests/tegra/host1x.h
 create mode 100644 tests/tegra/syncpt-timeout.c
 create mode 100644 tests/tegra/syncpt-wait.c
 create mode 100644 tests/tegra/vic-blit.c
 create mode 100644 tests/tegra/vic-clear.c
 create mode 100644 tests/tegra/vic-flip.c
 create mode 100644 tests/tegra/vic.c
 create mode 100644 tests/tegra/vic.h
 create mode 100644 tests/tegra/vic30.c
 create mode 100644 tests/tegra/vic30.h
 create mode 100644 tests/tegra/vic40.c
 create mode 100644 tests/tegra/vic40.h
 create mode 100644 tests/tegra/vic41.c
 create mode 100644 tests/tegra/vic41.h
 create mode 100644 tests/tegra/vic42.c
 create mode 100644 tests/tegra/vic42.h
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/25 tegra: Indent according to .editorconfig

From: Thierry Reding <[email protected]>

Reindent the sources according to the settings found in the newly added .editorconfig.

---
 tegra/private.h         |  18 +--
 tegra/tegra.c           | 348 ++++++++++++++++++++--------------------
 tegra/tegra.h           |  12 +-
 tests/tegra/openclose.c |  52 +++---
 4 files changed, 217 insertions(+), 213 deletions(-)
tegra/private.h +9 -9
index bb6c1a516530..215dd3309bce 100644
@@ -34,18 +34,18 @@
 #include "tegra.h"
 
 struct drm_tegra {
-	bool close;
-	int fd;
+    bool close;
+    int fd;
 };
 
 struct drm_tegra_bo {
-	struct drm_tegra *drm;
-	uint32_t handle;
-	uint32_t offset;
-	uint32_t flags;
-	uint32_t size;
-	atomic_t ref;
-	void *map;
+    struct drm_tegra *drm;
+    uint32_t handle;
+    uint32_t offset;
+    uint32_t flags;
+    uint32_t size;
+    atomic_t ref;
+    void *map;
 };
 
 #endif /* __DRM_TEGRA_PRIVATE_H__ */
tegra/tegra.c +176 -172

464 lines not on this page · raw message

tegra/tegra.h +6 -6
index 31b0995ad691..62205a5174b4 100644
@@ -35,9 +35,9 @@ int drm_tegra_new(struct drm_tegra **drmp, int fd);
 void drm_tegra_close(struct drm_tegra *drm);
 
 int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		     uint32_t flags, uint32_t size);
+                     uint32_t flags, uint32_t size);
 int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		      uint32_t handle, uint32_t flags, uint32_t size);
+                      uint32_t handle, uint32_t flags, uint32_t size);
 struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo);
 void drm_tegra_bo_unref(struct drm_tegra_bo *bo);
 int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
@@ -48,13 +48,13 @@ int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags);
 int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags);
 
 struct drm_tegra_bo_tiling {
-	uint32_t mode;
-	uint32_t value;
+    uint32_t mode;
+    uint32_t value;
 };
 
 int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-			    struct drm_tegra_bo_tiling *tiling);
+                            struct drm_tegra_bo_tiling *tiling);
 int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-			    const struct drm_tegra_bo_tiling *tiling);
+                            const struct drm_tegra_bo_tiling *tiling);
 
 #endif /* __DRM_TEGRA_H__ */
tests/tegra/openclose.c +26 -26

63 lines not on this page · raw message

Signature · 1 line
2.35.1
#2 lore raw

PATCH v2 2/25 tegra: Remove unused IOCTL implementations

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The DRM_TEGRA_GEM_{GET,SET}_FLAGS and DRM_TEGRA_GEM_{GET,SET}_TILING IOCTLs were badly designed and have since been obsoleted by framebuffer modifiers. Remove these implementations to make it clear their usage is discouraged.

---
 tegra/tegra-symbols.txt |  4 --
 tegra/tegra.c           | 95 -----------------------------------------
 tegra/tegra.h           | 12 ------
 3 files changed, 111 deletions(-)
tegra/tegra-symbols.txt +0 -4
index 5e3e955f2901..9422696c1416 100644
@@ -1,11 +1,7 @@
-drm_tegra_bo_get_flags
 drm_tegra_bo_get_handle
-drm_tegra_bo_get_tiling
 drm_tegra_bo_map
 drm_tegra_bo_new
 drm_tegra_bo_ref
-drm_tegra_bo_set_flags
-drm_tegra_bo_set_tiling
 drm_tegra_bo_unmap
 drm_tegra_bo_unref
 drm_tegra_bo_wrap
tegra/tegra.c +0 -95

98 lines not on this page · raw message

tegra/tegra.h +0 -12
index 62205a5174b4..c6b4f984de45 100644
@@ -44,17 +44,5 @@ int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
 int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr);
 int drm_tegra_bo_unmap(struct drm_tegra_bo *bo);
 
-int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags);
-int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags);
-
-struct drm_tegra_bo_tiling {
-    uint32_t mode;
-    uint32_t value;
-};
-
-int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-                            struct drm_tegra_bo_tiling *tiling);
-int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-                            const struct drm_tegra_bo_tiling *tiling);
 
 #endif /* __DRM_TEGRA_H__ */
Signature · 1 line
2.35.1
#3 lore raw

Re: [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations

17.02.2022 22:16, Thierry Reding пишет:

Quoted 8 lines

From: Thierry Reding <[email protected]>

The DRM_TEGRA_GEM_{GET,SET}_FLAGS and DRM_TEGRA_GEM_{GET,SET}_TILING IOCTLs were badly designed and have since been obsoleted by framebuffer modifiers. Remove these implementations to make it clear their usage is discouraged.

To me it's not a good idea to remove any function, you're breaking ABI.

I foresee that get/set flags should become useful.

Instead of the removal, you may mark functions deprecated to let compiler produce a compile-time warning and add clarifying comments to the code.

#4 lore raw

PATCH v2 3/25 tegra: Extract common buffer object allocation code

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

All of the buffer object allocation functions use the same boilerplate code. Move that code into a separate function that can be reused.

---
 tegra/tegra.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)
tegra/tegra.c +22 -13
index 630aea45f957..74e1fd33c6e5 100644
@@ -97,6 +97,26 @@ drm_public void drm_tegra_close(struct drm_tegra *drm)
     free(drm);
 }
 
+static struct drm_tegra_bo *drm_tegra_bo_alloc(struct drm_tegra *drm,
+                                               uint32_t handle,
+                                               uint32_t flags,
+                                               uint32_t size)
+{
+    struct drm_tegra_bo *bo;
+
+    bo = calloc(1, sizeof(*bo));
+    if (!bo)
+        return NULL;
+
+    atomic_set(&bo->ref, 1);
+    bo->handle = handle;
+    bo->flags = flags;
+    bo->size = size;
+    bo->drm = drm;
+
+    return bo;
+}
+
 drm_public int
 drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
                  uint32_t flags, uint32_t size)
@@ -108,15 +128,10 @@ drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
     if (!drm || size == 0 || !bop)
         return -EINVAL;
 
-    bo = calloc(1, sizeof(*bo));
+    bo = drm_tegra_bo_alloc(drm, 0, flags, size);
     if (!bo)
         return -ENOMEM;
 
-    atomic_set(&bo->ref, 1);
-    bo->flags = flags;
-    bo->size = size;
-    bo->drm = drm;
-
     memset(&args, 0, sizeof(args));
     args.flags = flags;
     args.size = size;
@@ -145,16 +160,10 @@ drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
     if (!drm || !bop)
         return -EINVAL;
 
-    bo = calloc(1, sizeof(*bo));
+    bo = drm_tegra_bo_alloc(drm, handle, flags, size);
     if (!bo)
         return -ENOMEM;
 
-    atomic_set(&bo->ref, 1);
-    bo->handle = handle;
-    bo->flags = flags;
-    bo->size = size;
-    bo->drm = drm;
-
     *bop = bo;
 
     return 0;
Signature · 1 line
2.35.1
#5 lore raw

PATCH v2 4/25 tegra: Fix mmap() of GEM buffer objects

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Store 64-bit offset values and use libdrm's built-in drm_mmap() function instead of mmap() to ensure the full 64-bit offset is used.

---
 tegra/private.h | 2 +-
 tegra/tegra.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tegra/private.h +1 -1
index 215dd3309bce..d0f2944bfb3a 100644
@@ -41,7 +41,7 @@ struct drm_tegra {
 struct drm_tegra_bo {
     struct drm_tegra *drm;
     uint32_t handle;
-    uint32_t offset;
+    uint64_t offset;
     uint32_t flags;
     uint32_t size;
     atomic_t ref;
tegra/tegra.c +2 -2
index 74e1fd33c6e5..a9087e956f94 100644
@@ -211,8 +211,8 @@ drm_public int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
 
         bo->offset = args.offset;
 
-        bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
-                       drm->fd, bo->offset);
+        bo->map = drm_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+                           drm->fd, bo->offset);
         if (bo->map == MAP_FAILED) {
             bo->map = NULL;
             return -errno;
Signature · 1 line
2.35.1
#6 lore raw

PATCH v2 5/25 tegra: Add flink helpers

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Add helpers to export and import buffer objects via flink names.

---
Changes in v3:
- add drm_public annotations

---
 tegra/tegra-symbols.txt |  2 ++
 tegra/tegra.c           | 50 +++++++++++++++++++++++++++++++++++++++++
 tegra/tegra.h           |  3 +++
 3 files changed, 55 insertions(+)
tegra/tegra-symbols.txt +2 -0
index 9422696c1416..630e075fa5d7 100644
@@ -1,6 +1,8 @@
 drm_tegra_bo_get_handle
+drm_tegra_bo_get_name
 drm_tegra_bo_map
 drm_tegra_bo_new
+drm_tegra_bo_open
 drm_tegra_bo_ref
 drm_tegra_bo_unmap
 drm_tegra_bo_unref
tegra/tegra.c +50 -0

53 lines not on this page · raw message

tegra/tegra.h +3 -0
index c6b4f984de45..333690f23118 100644
@@ -44,5 +44,8 @@ int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle);
 int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr);
 int drm_tegra_bo_unmap(struct drm_tegra_bo *bo);
 
+int drm_tegra_bo_get_name(struct drm_tegra_bo *bo, uint32_t *name);
+int drm_tegra_bo_open(struct drm_tegra *drm, uint32_t name, uint32_t flags,
+                      struct drm_tegra_bo **bop);
 
 #endif /* __DRM_TEGRA_H__ */
Signature · 1 line
2.35.1
#7 lore raw

Re: [PATCH libdrm v2 05/25] tegra: Add flink helpers

17.02.2022 22:16, Thierry Reding пишет:

tegra/tegra.h int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle); · line 49

Quoted 3 lines
tegra/tegra.h +3 -0
+int drm_tegra_bo_get_name(struct drm_tegra_bo *bo, uint32_t *name);
+int drm_tegra_bo_open(struct drm_tegra *drm, uint32_t name, uint32_t flags,
+                      struct drm_tegra_bo **bop);

drm_tegra_bo_open() isn't a very good name for a function. How will you name dmabuf and handle variants?

In grate-drive we're using these names:

drm_tegra_bo_from_name
drm_tegra_bo_from_dmabuf
drm_tegra_bo_from_handle

I suggest to use more meaningful function names before will be too late, especially given that this is the upstream libdrm.

#8 lore raw
In reply to Thierry Reding

17.02.2022 22:16, Thierry Reding пишет:

Quoted 78 lines

From: Thierry Reding <[email protected]>

Hi all,

this is the userspace part of the kernel patches that were recently merged into drm-next:

https://patchwork.freedesktop.org/series/92378/

The goal is to provide a userspace implementation of the UAPI exposed by the kernel and show its usage in some test programs that can also be used for basic sanity testing. More complete userspace implementations are available here:

* https://github.com/cyndis/vaapi-tegra-driver
* https://github.com/grate-driver/xf86-video-opentegra
* https://github.com/grate-driver/grate

Changes in v2:
- implement vic_clear() as a helper using ->fill() (Michał Mirosław)
- rebase and fix a couple of Meson errors/warnings

Thierry

Thierry Reding (25):
tegra: Indent according to .editorconfig
tegra: Remove unused IOCTL implementations
tegra: Extract common buffer object allocation code
tegra: Fix mmap() of GEM buffer objects
tegra: Add flink helpers
tegra: Add PRIME support helpers
tegra: Make API more consistent
tegra: Install tegra-openclose test
tegra: Update for new UABI
tegra: Include private.h in list of source files
tegra: Add channel APIs
tegra: Add job and push buffer APIs
tegra: Add syncpoint APIs
tests: tegra: Add helper library for tests
tests: tegra: Add gr2d-fill test
tests: tegra: Add syncpt-wait test
tests: tegra: Add syncpoint timeout test
tests: tegra: Add VIC support
tests: tegra: Add VIC 3.0 support
tests: tegra: Add VIC 4.0 support
tests: tegra: Add VIC 4.1 support
tests: tegra: Add VIC 4.2 support
tests: tegra: Add VIC clear test
tests: tegra: Add VIC blit test
tests: tegra: Add VIC flip test

 include/drm/tegra_drm.h      | 429 +++++++++++++++++++++++--
 tegra/channel.c              | 195 ++++++++++++
 tegra/job.c                  | 187 +++++++++++
 tegra/meson.build            |   7 +-
 tegra/private.h              |  85 ++++-
 tegra/pushbuf.c              | 184 +++++++++++
 tegra/syncpt.c               | 101 ++++++
 tegra/tegra-symbols.txt      |  27 +-
 tegra/tegra.c                | 386 +++++++++++-----------
 tegra/tegra.h                |  95 +++++-
 tests/tegra/.gitignore       |   3 +-
 tests/tegra/drm-test-tegra.c | 147 +++++++++
 tests/tegra/drm-test-tegra.h |  55 ++++
 tests/tegra/drm-test.c       | 248 +++++++++++++++
 tests/tegra/drm-test.h       |  72 +++++
 tests/tegra/gr2d-fill.c      | 146 +++++++++
 tests/tegra/host1x.h         |  34 ++
 tests/tegra/meson.build      |  88 +++++-
 tests/tegra/openclose.c      |  52 +--
 tests/tegra/syncpt-timeout.c | 163 ++++++++++
 tests/tegra/syncpt-wait.c    | 151 +++++++++
 tests/tegra/vic-blit.c       | 333 +++++++++++++++++++
 tests/tegra/vic-clear.c      | 173 ++++++++++
 tests/tegra/vic-flip.c       | 333 +++++++++++++++++++
 tests/tegra/vic.c            | 184 +++++++++++
 tests/tegra/vic.h            | 181 +++++++++++
 tests/tegra/vic30.c          | 458 +++++++++++++++++++++++++++
Quoted 8 lines
 tests/tegra/vic30.h          | 439 ++++++++++++++++++++++++++
 tests/tegra/vic40.c          | 370 ++++++++++++++++++++++
 tests/tegra/vic40.h          | 285 +++++++++++++++++
 tests/tegra/vic41.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic41.h          | 372 ++++++++++++++++++++++
 tests/tegra/vic42.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic42.h          | 597 +++++++++++++++++++++++++++++++++++
 34 files changed, 7068 insertions(+), 260 deletions(-)

Why do we need these tests in libdrm? Why not IGT?

#9 lore raw
Quoted 89 lines · Dmitry Osipenko

17.02.2022 22:16, Thierry Reding пишет:

Quoted 78 lines

From: Thierry Reding <[email protected]>

Hi all,

this is the userspace part of the kernel patches that were recently merged into drm-next:

https://patchwork.freedesktop.org/series/92378/

The goal is to provide a userspace implementation of the UAPI exposed by the kernel and show its usage in some test programs that can also be used for basic sanity testing. More complete userspace implementations are available here:

* https://github.com/cyndis/vaapi-tegra-driver
* https://github.com/grate-driver/xf86-video-opentegra
* https://github.com/grate-driver/grate

Changes in v2:
- implement vic_clear() as a helper using ->fill() (Michał Mirosław)
- rebase and fix a couple of Meson errors/warnings

Thierry

Thierry Reding (25):
tegra: Indent according to .editorconfig
tegra: Remove unused IOCTL implementations
tegra: Extract common buffer object allocation code
tegra: Fix mmap() of GEM buffer objects
tegra: Add flink helpers
tegra: Add PRIME support helpers
tegra: Make API more consistent
tegra: Install tegra-openclose test
tegra: Update for new UABI
tegra: Include private.h in list of source files
tegra: Add channel APIs
tegra: Add job and push buffer APIs
tegra: Add syncpoint APIs
tests: tegra: Add helper library for tests
tests: tegra: Add gr2d-fill test
tests: tegra: Add syncpt-wait test
tests: tegra: Add syncpoint timeout test
tests: tegra: Add VIC support
tests: tegra: Add VIC 3.0 support
tests: tegra: Add VIC 4.0 support
tests: tegra: Add VIC 4.1 support
tests: tegra: Add VIC 4.2 support
tests: tegra: Add VIC clear test
tests: tegra: Add VIC blit test
tests: tegra: Add VIC flip test

 include/drm/tegra_drm.h      | 429 +++++++++++++++++++++++--
 tegra/channel.c              | 195 ++++++++++++
 tegra/job.c                  | 187 +++++++++++
 tegra/meson.build            |   7 +-
 tegra/private.h              |  85 ++++-
 tegra/pushbuf.c              | 184 +++++++++++
 tegra/syncpt.c               | 101 ++++++
 tegra/tegra-symbols.txt      |  27 +-
 tegra/tegra.c                | 386 +++++++++++-----------
 tegra/tegra.h                |  95 +++++-
 tests/tegra/.gitignore       |   3 +-
 tests/tegra/drm-test-tegra.c | 147 +++++++++
 tests/tegra/drm-test-tegra.h |  55 ++++
 tests/tegra/drm-test.c       | 248 +++++++++++++++
 tests/tegra/drm-test.h       |  72 +++++
 tests/tegra/gr2d-fill.c      | 146 +++++++++
 tests/tegra/host1x.h         |  34 ++
 tests/tegra/meson.build      |  88 +++++-
 tests/tegra/openclose.c      |  52 +--
 tests/tegra/syncpt-timeout.c | 163 ++++++++++
 tests/tegra/syncpt-wait.c    | 151 +++++++++
 tests/tegra/vic-blit.c       | 333 +++++++++++++++++++
 tests/tegra/vic-clear.c      | 173 ++++++++++
 tests/tegra/vic-flip.c       | 333 +++++++++++++++++++
 tests/tegra/vic.c            | 184 +++++++++++
 tests/tegra/vic.h            | 181 +++++++++++
 tests/tegra/vic30.c          | 458 +++++++++++++++++++++++++++
Quoted 8 lines
 tests/tegra/vic30.h          | 439 ++++++++++++++++++++++++++
 tests/tegra/vic40.c          | 370 ++++++++++++++++++++++
 tests/tegra/vic40.h          | 285 +++++++++++++++++
 tests/tegra/vic41.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic41.h          | 372 ++++++++++++++++++++++
 tests/tegra/vic42.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic42.h          | 597 +++++++++++++++++++++++++++++++++++
 34 files changed, 7068 insertions(+), 260 deletions(-)
Quoted 1 line

Why do we need these tests in libdrm? Why not IGT?

Oops, sorry. I had meant to reply to your question in the previous version. The idea was to have this minimal set of tests in libdrm as a way to demonstrate how to use the various APIs. At the same time, this is meant to serve as an easy way to validate that everything works from the comparatively simple libdrm package.

But yes, adding more tests on top of this to IGT is something that I've been pondering and I certainly wouldn't object if anyone else was going to attempt to do so. I don't think IGT and libdrm need to be mutually exclusive, though.

Thierry

#10 lore raw

18.02.2022 00:37, Thierry Reding пишет:

Quoted 90 lines · Dmitry Osipenko
Quoted 89 lines

17.02.2022 22:16, Thierry Reding пишет:

Quoted 86 lines

From: Thierry Reding <[email protected]>

Hi all,

this is the userspace part of the kernel patches that were recently merged into drm-next:

https://patchwork.freedesktop.org/series/92378/

The goal is to provide a userspace implementation of the UAPI exposed by the kernel and show its usage in some test programs that can also be used for basic sanity testing. More complete userspace implementations are available here:

* https://github.com/cyndis/vaapi-tegra-driver
* https://github.com/grate-driver/xf86-video-opentegra
* https://github.com/grate-driver/grate

Changes in v2:
- implement vic_clear() as a helper using ->fill() (Michał Mirosław)
- rebase and fix a couple of Meson errors/warnings

Thierry

Thierry Reding (25):
tegra: Indent according to .editorconfig
tegra: Remove unused IOCTL implementations
tegra: Extract common buffer object allocation code
tegra: Fix mmap() of GEM buffer objects
tegra: Add flink helpers
tegra: Add PRIME support helpers
tegra: Make API more consistent
tegra: Install tegra-openclose test
tegra: Update for new UABI
tegra: Include private.h in list of source files
tegra: Add channel APIs
tegra: Add job and push buffer APIs
tegra: Add syncpoint APIs
tests: tegra: Add helper library for tests
tests: tegra: Add gr2d-fill test
tests: tegra: Add syncpt-wait test
tests: tegra: Add syncpoint timeout test
tests: tegra: Add VIC support
tests: tegra: Add VIC 3.0 support
tests: tegra: Add VIC 4.0 support
tests: tegra: Add VIC 4.1 support
tests: tegra: Add VIC 4.2 support
tests: tegra: Add VIC clear test
tests: tegra: Add VIC blit test
tests: tegra: Add VIC flip test

 include/drm/tegra_drm.h      | 429 +++++++++++++++++++++++--
 tegra/channel.c              | 195 ++++++++++++
 tegra/job.c                  | 187 +++++++++++
 tegra/meson.build            |   7 +-
 tegra/private.h              |  85 ++++-
 tegra/pushbuf.c              | 184 +++++++++++
 tegra/syncpt.c               | 101 ++++++
 tegra/tegra-symbols.txt      |  27 +-
 tegra/tegra.c                | 386 +++++++++++-----------
 tegra/tegra.h                |  95 +++++-
 tests/tegra/.gitignore       |   3 +-
 tests/tegra/drm-test-tegra.c | 147 +++++++++
 tests/tegra/drm-test-tegra.h |  55 ++++
 tests/tegra/drm-test.c       | 248 +++++++++++++++
 tests/tegra/drm-test.h       |  72 +++++
 tests/tegra/gr2d-fill.c      | 146 +++++++++
 tests/tegra/host1x.h         |  34 ++
 tests/tegra/meson.build      |  88 +++++-
 tests/tegra/openclose.c      |  52 +--
 tests/tegra/syncpt-timeout.c | 163 ++++++++++
 tests/tegra/syncpt-wait.c    | 151 +++++++++
 tests/tegra/vic-blit.c       | 333 +++++++++++++++++++
 tests/tegra/vic-clear.c      | 173 ++++++++++
 tests/tegra/vic-flip.c       | 333 +++++++++++++++++++
 tests/tegra/vic.c            | 184 +++++++++++
 tests/tegra/vic.h            | 181 +++++++++++
 tests/tegra/vic30.c          | 458 +++++++++++++++++++++++++++
 tests/tegra/vic30.h          | 439 ++++++++++++++++++++++++++
 tests/tegra/vic40.c          | 370 ++++++++++++++++++++++
 tests/tegra/vic40.h          | 285 +++++++++++++++++
 tests/tegra/vic41.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic41.h          | 372 ++++++++++++++++++++++
 tests/tegra/vic42.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic42.h          | 597 +++++++++++++++++++++++++++++++++++
 34 files changed, 7068 insertions(+), 260 deletions(-)
Quoted 7 lines
Quoted 1 line

Why do we need these tests in libdrm? Why not IGT?

Oops, sorry. I had meant to reply to your question in the previous version. The idea was to have this minimal set of tests in libdrm as a way to demonstrate how to use the various APIs. At the same time, this is meant to serve as an easy way to validate that everything works from the comparatively simple libdrm package.

Who will be validating libdrm on Tegra?

Quoted 4 lines

But yes, adding more tests on top of this to IGT is something that I've been pondering and I certainly wouldn't object if anyone else was going to attempt to do so. I don't think IGT and libdrm need to be mutually exclusive, though.

I know that IGT tests are regularly run by the KernelCI at least on TK1.

#11 lore raw

18.02.2022 17:16, Dmitry Osipenko пишет:

Quoted 99 lines

18.02.2022 00:37, Thierry Reding пишет:

Quoted 90 lines · Dmitry Osipenko
Quoted 89 lines

17.02.2022 22:16, Thierry Reding пишет:

Quoted 86 lines

From: Thierry Reding <[email protected]>

Hi all,

this is the userspace part of the kernel patches that were recently merged into drm-next:

https://patchwork.freedesktop.org/series/92378/

The goal is to provide a userspace implementation of the UAPI exposed by the kernel and show its usage in some test programs that can also be used for basic sanity testing. More complete userspace implementations are available here:

* https://github.com/cyndis/vaapi-tegra-driver
* https://github.com/grate-driver/xf86-video-opentegra
* https://github.com/grate-driver/grate

Changes in v2:
- implement vic_clear() as a helper using ->fill() (Michał Mirosław)
- rebase and fix a couple of Meson errors/warnings

Thierry

Thierry Reding (25):
tegra: Indent according to .editorconfig
tegra: Remove unused IOCTL implementations
tegra: Extract common buffer object allocation code
tegra: Fix mmap() of GEM buffer objects
tegra: Add flink helpers
tegra: Add PRIME support helpers
tegra: Make API more consistent
tegra: Install tegra-openclose test
tegra: Update for new UABI
tegra: Include private.h in list of source files
tegra: Add channel APIs
tegra: Add job and push buffer APIs
tegra: Add syncpoint APIs
tests: tegra: Add helper library for tests
tests: tegra: Add gr2d-fill test
tests: tegra: Add syncpt-wait test
tests: tegra: Add syncpoint timeout test
tests: tegra: Add VIC support
tests: tegra: Add VIC 3.0 support
tests: tegra: Add VIC 4.0 support
tests: tegra: Add VIC 4.1 support
tests: tegra: Add VIC 4.2 support
tests: tegra: Add VIC clear test
tests: tegra: Add VIC blit test
tests: tegra: Add VIC flip test

 include/drm/tegra_drm.h      | 429 +++++++++++++++++++++++--
 tegra/channel.c              | 195 ++++++++++++
 tegra/job.c                  | 187 +++++++++++
 tegra/meson.build            |   7 +-
 tegra/private.h              |  85 ++++-
 tegra/pushbuf.c              | 184 +++++++++++
 tegra/syncpt.c               | 101 ++++++
 tegra/tegra-symbols.txt      |  27 +-
 tegra/tegra.c                | 386 +++++++++++-----------
 tegra/tegra.h                |  95 +++++-
 tests/tegra/.gitignore       |   3 +-
 tests/tegra/drm-test-tegra.c | 147 +++++++++
 tests/tegra/drm-test-tegra.h |  55 ++++
 tests/tegra/drm-test.c       | 248 +++++++++++++++
 tests/tegra/drm-test.h       |  72 +++++
 tests/tegra/gr2d-fill.c      | 146 +++++++++
 tests/tegra/host1x.h         |  34 ++
 tests/tegra/meson.build      |  88 +++++-
 tests/tegra/openclose.c      |  52 +--
 tests/tegra/syncpt-timeout.c | 163 ++++++++++
 tests/tegra/syncpt-wait.c    | 151 +++++++++
 tests/tegra/vic-blit.c       | 333 +++++++++++++++++++
 tests/tegra/vic-clear.c      | 173 ++++++++++
 tests/tegra/vic-flip.c       | 333 +++++++++++++++++++
 tests/tegra/vic.c            | 184 +++++++++++
 tests/tegra/vic.h            | 181 +++++++++++
 tests/tegra/vic30.c          | 458 +++++++++++++++++++++++++++
 tests/tegra/vic30.h          | 439 ++++++++++++++++++++++++++
 tests/tegra/vic40.c          | 370 ++++++++++++++++++++++
 tests/tegra/vic40.h          | 285 +++++++++++++++++
 tests/tegra/vic41.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic41.h          | 372 ++++++++++++++++++++++
 tests/tegra/vic42.c          | 374 ++++++++++++++++++++++
 tests/tegra/vic42.h          | 597 +++++++++++++++++++++++++++++++++++
 34 files changed, 7068 insertions(+), 260 deletions(-)
Quoted 7 lines
Quoted 1 line

Why do we need these tests in libdrm? Why not IGT?

Oops, sorry. I had meant to reply to your question in the previous version. The idea was to have this minimal set of tests in libdrm as a way to demonstrate how to use the various APIs. At the same time, this is meant to serve as an easy way to validate that everything works from the comparatively simple libdrm package.

Quoted 8 lines

Who will be validating libdrm on Tegra?

Quoted 4 lines

But yes, adding more tests on top of this to IGT is something that I've been pondering and I certainly wouldn't object if anyone else was going to attempt to do so. I don't think IGT and libdrm need to be mutually exclusive, though.

I know that IGT tests are regularly run by the KernelCI at least on TK1.

Finishing my thought.. It's good to have a demo within libdrm, but in my opinion it's not very practical to put effort into libdrm from the perspective of testing. Much more practical should be to put effort into IGT, which already has a use on Tegra.

#13 lore raw

18.02.2022 12:31, Mikko Perttunen пишет:

Quoted 7 lines · Thierry Reding
Quoted 1 line

...

Left one cosmetic comment in the VIC4.0 patch, but overall looks OK. I think it would be fine to have some basic tests in libdrm as well.

There is a question about who is going to use this libdrm API. Are you going to use it in the VAAPI driver?

Grate drivers can't use this API because:

1. More features are needed
2. There is no stable API
3. It's super painful to keep all drivers and libdrm in sync from a packaging perspective.

It's much more practical nowadays to use DRM directly, without SoC-specific libdrm API, i.e. to bundle that SoC-specific API within the drivers.

#14 lore raw
Quoted 14 lines · Dmitry Osipenko

18.02.2022 12:31, Mikko Perttunen пишет:

Quoted 7 lines · Thierry Reding
Quoted 1 line

...

Left one cosmetic comment in the VIC4.0 patch, but overall looks OK. I think it would be fine to have some basic tests in libdrm as well.

There is a question about who is going to use this libdrm API. Are you going to use it in the VAAPI driver?

Grate drivers can't use this API because:

Quoted 8 lines

1. More features are needed
2. There is no stable API
3. It's super painful to keep all drivers and libdrm in sync from a packaging perspective.

It's much more practical nowadays to use DRM directly, without SoC-specific libdrm API, i.e. to bundle that SoC-specific API within the drivers.

I'm not planning to use this in the VAAPI driver -- I don't personally have any use case for the libdrm API.

Mikko

#15 lore raw
Quoted 20 lines · Mikko Perttunen
Quoted 19 lines · Dmitry Osipenko

18.02.2022 12:31, Mikko Perttunen пишет:

Quoted 7 lines · Thierry Reding
Quoted 1 line

...

Left one cosmetic comment in the VIC4.0 patch, but overall looks OK. I think it would be fine to have some basic tests in libdrm as well.

There is a question about who is going to use this libdrm API. Are you going to use it in the VAAPI driver?

Grate drivers can't use this API because:

1. More features are needed
2. There is no stable API
3. It's super painful to keep all drivers and libdrm in sync from a packaging perspective.

Quoted 6 lines
Quoted 3 lines

It's much more practical nowadays to use DRM directly, without SoC-specific libdrm API, i.e. to bundle that SoC-specific API within the drivers.

I'm not planning to use this in the VAAPI driver -- I don't personally have any use case for the libdrm API.

As I mentioned, the intention here was to provide a reference implementation along with a simple API that could be used to achieve results in an easy way, without having to do all the buffer tracking for relocations etc. manually. If other projects find this to be useful, that's great (I was thinking of using this to add a few tests to IGT). If they want to use their own constructs, that's absolutely fine, too.

Thierry