All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-17 19:16 ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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

-- 
2.35.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-17 19:16 ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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

-- 
2.35.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 01/25] tegra: Indent according to .editorconfig
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 19:16   ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/private.h         |  18 +--
 tegra/tegra.c           | 348 ++++++++++++++++++++--------------------
 tegra/tegra.h           |  12 +-
 tests/tegra/openclose.c |  52 +++---
 4 files changed, 217 insertions(+), 213 deletions(-)

diff --git a/tegra/private.h b/tegra/private.h
index bb6c1a516530..215dd3309bce 100644
--- a/tegra/private.h
+++ b/tegra/private.h
@@ -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__ */
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 420b171c5dd5..95aaa4b35425 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -37,288 +37,292 @@
 
 static void drm_tegra_bo_free(struct drm_tegra_bo *bo)
 {
-	struct drm_tegra *drm = bo->drm;
+    struct drm_tegra *drm = bo->drm;
 
-	if (bo->map)
-		munmap(bo->map, bo->size);
+    if (bo->map)
+        munmap(bo->map, bo->size);
 
-	drmCloseBufferHandle(drm->fd, bo->handle);
+    drmCloseBufferHandle(drm->fd, bo->handle);
 
-	free(bo);
+    free(bo);
 }
 
 static int drm_tegra_wrap(struct drm_tegra **drmp, int fd, bool close)
 {
-	struct drm_tegra *drm;
+    struct drm_tegra *drm;
 
-	if (fd < 0 || !drmp)
-		return -EINVAL;
+    if (fd < 0 || !drmp)
+        return -EINVAL;
 
-	drm = calloc(1, sizeof(*drm));
-	if (!drm)
-		return -ENOMEM;
+    drm = calloc(1, sizeof(*drm));
+    if (!drm)
+        return -ENOMEM;
 
-	drm->close = close;
-	drm->fd = fd;
+    drm->close = close;
+    drm->fd = fd;
 
-	*drmp = drm;
+    *drmp = drm;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_new(struct drm_tegra **drmp, int fd)
 {
-	bool supported = false;
-	drmVersionPtr version;
+    bool supported = false;
+    drmVersionPtr version;
 
-	version = drmGetVersion(fd);
-	if (!version)
-		return -ENOMEM;
+    version = drmGetVersion(fd);
+    if (!version)
+        return -ENOMEM;
 
-	if (!strncmp(version->name, "tegra", version->name_len))
-		supported = true;
+    if (!strncmp(version->name, "tegra", version->name_len))
+        supported = true;
 
-	drmFreeVersion(version);
+    drmFreeVersion(version);
 
-	if (!supported)
-		return -ENOTSUP;
+    if (!supported)
+        return -ENOTSUP;
 
-	return drm_tegra_wrap(drmp, fd, false);
+    return drm_tegra_wrap(drmp, fd, false);
 }
 
 drm_public void drm_tegra_close(struct drm_tegra *drm)
 {
-	if (!drm)
-		return;
+    if (!drm)
+        return;
 
-	if (drm->close)
-		close(drm->fd);
+    if (drm->close)
+        close(drm->fd);
 
-	free(drm);
+    free(drm);
 }
 
-drm_public int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		     uint32_t flags, uint32_t size)
+drm_public int
+drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+                 uint32_t flags, uint32_t size)
 {
-	struct drm_tegra_gem_create args;
-	struct drm_tegra_bo *bo;
-	int err;
+    struct drm_tegra_gem_create args;
+    struct drm_tegra_bo *bo;
+    int err;
 
-	if (!drm || size == 0 || !bop)
-		return -EINVAL;
+    if (!drm || size == 0 || !bop)
+        return -EINVAL;
 
-	bo = calloc(1, sizeof(*bo));
-	if (!bo)
-		return -ENOMEM;
+    bo = calloc(1, sizeof(*bo));
+    if (!bo)
+        return -ENOMEM;
 
-	atomic_set(&bo->ref, 1);
-	bo->flags = flags;
-	bo->size = size;
-	bo->drm = drm;
+    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;
+    memset(&args, 0, sizeof(args));
+    args.flags = flags;
+    args.size = size;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_CREATE, &args,
-				  sizeof(args));
-	if (err < 0) {
-		err = -errno;
-		free(bo);
-		return err;
-	}
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_CREATE, &args,
+                              sizeof(args));
+    if (err < 0) {
+        err = -errno;
+        free(bo);
+        return err;
+    }
 
-	bo->handle = args.handle;
+    bo->handle = args.handle;
 
-	*bop = bo;
+    *bop = bo;
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		      uint32_t handle, uint32_t flags, uint32_t size)
+drm_public int
+drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+                  uint32_t handle, uint32_t flags, uint32_t size)
 {
-	struct drm_tegra_bo *bo;
+    struct drm_tegra_bo *bo;
 
-	if (!drm || !bop)
-		return -EINVAL;
+    if (!drm || !bop)
+        return -EINVAL;
 
-	bo = calloc(1, sizeof(*bo));
-	if (!bo)
-		return -ENOMEM;
+    bo = calloc(1, sizeof(*bo));
+    if (!bo)
+        return -ENOMEM;
 
-	atomic_set(&bo->ref, 1);
-	bo->handle = handle;
-	bo->flags = flags;
-	bo->size = size;
-	bo->drm = drm;
+    atomic_set(&bo->ref, 1);
+    bo->handle = handle;
+    bo->flags = flags;
+    bo->size = size;
+    bo->drm = drm;
 
-	*bop = bo;
+    *bop = bo;
 
-	return 0;
+    return 0;
 }
 
 drm_public struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo)
 {
-	if (bo)
-		atomic_inc(&bo->ref);
+    if (bo)
+        atomic_inc(&bo->ref);
 
-	return bo;
+    return bo;
 }
 
 drm_public void drm_tegra_bo_unref(struct drm_tegra_bo *bo)
 {
-	if (bo && atomic_dec_and_test(&bo->ref))
-		drm_tegra_bo_free(bo);
+    if (bo && atomic_dec_and_test(&bo->ref))
+        drm_tegra_bo_free(bo);
 }
 
 drm_public int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle)
 {
-	if (!bo || !handle)
-		return -EINVAL;
+    if (!bo || !handle)
+        return -EINVAL;
 
-	*handle = bo->handle;
+    *handle = bo->handle;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
 {
-	struct drm_tegra *drm = bo->drm;
+    struct drm_tegra *drm = bo->drm;
 
-	if (!bo->map) {
-		struct drm_tegra_gem_mmap args;
-		int err;
+    if (!bo->map) {
+        struct drm_tegra_gem_mmap args;
+        int err;
 
-		memset(&args, 0, sizeof(args));
-		args.handle = bo->handle;
+        memset(&args, 0, sizeof(args));
+        args.handle = bo->handle;
 
-		err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_MMAP, &args,
-					  sizeof(args));
-		if (err < 0)
-			return -errno;
+        err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_MMAP, &args,
+                                  sizeof(args));
+        if (err < 0)
+            return -errno;
 
-		bo->offset = args.offset;
+        bo->offset = args.offset;
 
-		bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
-			       drm->fd, bo->offset);
-		if (bo->map == MAP_FAILED) {
-			bo->map = NULL;
-			return -errno;
-		}
-	}
+        bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+                       drm->fd, bo->offset);
+        if (bo->map == MAP_FAILED) {
+            bo->map = NULL;
+            return -errno;
+        }
+    }
 
-	if (ptr)
-		*ptr = bo->map;
+    if (ptr)
+        *ptr = bo->map;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 {
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	if (!bo->map)
-		return 0;
+    if (!bo->map)
+        return 0;
 
-	if (munmap(bo->map, bo->size))
-		return -errno;
+    if (munmap(bo->map, bo->size))
+        return -errno;
 
-	bo->map = NULL;
+    bo->map = NULL;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
 {
-	struct drm_tegra_gem_get_flags args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_flags args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	if (flags)
-		*flags = args.flags;
+    if (flags)
+        *flags = args.flags;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
 {
-	struct drm_tegra_gem_get_flags args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_flags args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
-	args.flags = flags;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+    args.flags = flags;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-			    struct drm_tegra_bo_tiling *tiling)
+drm_public int
+drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
+                        struct drm_tegra_bo_tiling *tiling)
 {
-	struct drm_tegra_gem_get_tiling args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_tiling args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	if (tiling) {
-		tiling->mode = args.mode;
-		tiling->value = args.value;
-	}
+    if (tiling) {
+        tiling->mode = args.mode;
+        tiling->value = args.value;
+    }
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-			    const struct drm_tegra_bo_tiling *tiling)
+drm_public int
+drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
+                        const struct drm_tegra_bo_tiling *tiling)
 {
-	struct drm_tegra_gem_set_tiling args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_set_tiling args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
-	args.mode = tiling->mode;
-	args.value = tiling->value;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+    args.mode = tiling->mode;
+    args.value = tiling->value;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	return 0;
+    return 0;
 }
diff --git a/tegra/tegra.h b/tegra/tegra.h
index 31b0995ad691..62205a5174b4 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
diff --git a/tests/tegra/openclose.c b/tests/tegra/openclose.c
index f80f52d477ee..104e83806f3a 100644
--- a/tests/tegra/openclose.c
+++ b/tests/tegra/openclose.c
@@ -31,37 +31,37 @@ static const char default_device[] = "/dev/dri/card0";
 
 int main(int argc, char *argv[])
 {
-	struct drm_tegra *tegra;
-	drmVersionPtr version;
-	const char *device;
-	int err, fd;
+    struct drm_tegra *tegra;
+    drmVersionPtr version;
+    const char *device;
+    int err, fd;
 
-	if (argc < 2)
-		device = default_device;
-	else
-		device = argv[1];
+    if (argc < 2)
+        device = default_device;
+    else
+        device = argv[1];
 
-	fd = open(device, O_RDWR);
-	if (fd < 0)
-		return 1;
+    fd = open(device, O_RDWR);
+    if (fd < 0)
+        return 1;
 
-	version = drmGetVersion(fd);
-	if (version) {
-		printf("Version: %d.%d.%d\n", version->version_major,
-		       version->version_minor, version->version_patchlevel);
-		printf("  Name: %s\n", version->name);
-		printf("  Date: %s\n", version->date);
-		printf("  Description: %s\n", version->desc);
+    version = drmGetVersion(fd);
+    if (version) {
+        printf("Version: %d.%d.%d\n", version->version_major,
+               version->version_minor, version->version_patchlevel);
+        printf("  Name: %s\n", version->name);
+        printf("  Date: %s\n", version->date);
+        printf("  Description: %s\n", version->desc);
 
-		drmFreeVersion(version);
-	}
+        drmFreeVersion(version);
+    }
 
-	err = drm_tegra_new(&tegra, fd);
-	if (err < 0)
-		return 1;
+    err = drm_tegra_new(&tegra, fd);
+    if (err < 0)
+        return 1;
 
-	drm_tegra_close(tegra);
-	close(fd);
+    drm_tegra_close(tegra);
+    close(fd);
 
-	return 0;
+    return 0;
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 01/25] tegra: Indent according to .editorconfig
@ 2022-02-17 19:16   ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/private.h         |  18 +--
 tegra/tegra.c           | 348 ++++++++++++++++++++--------------------
 tegra/tegra.h           |  12 +-
 tests/tegra/openclose.c |  52 +++---
 4 files changed, 217 insertions(+), 213 deletions(-)

diff --git a/tegra/private.h b/tegra/private.h
index bb6c1a516530..215dd3309bce 100644
--- a/tegra/private.h
+++ b/tegra/private.h
@@ -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__ */
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 420b171c5dd5..95aaa4b35425 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -37,288 +37,292 @@
 
 static void drm_tegra_bo_free(struct drm_tegra_bo *bo)
 {
-	struct drm_tegra *drm = bo->drm;
+    struct drm_tegra *drm = bo->drm;
 
-	if (bo->map)
-		munmap(bo->map, bo->size);
+    if (bo->map)
+        munmap(bo->map, bo->size);
 
-	drmCloseBufferHandle(drm->fd, bo->handle);
+    drmCloseBufferHandle(drm->fd, bo->handle);
 
-	free(bo);
+    free(bo);
 }
 
 static int drm_tegra_wrap(struct drm_tegra **drmp, int fd, bool close)
 {
-	struct drm_tegra *drm;
+    struct drm_tegra *drm;
 
-	if (fd < 0 || !drmp)
-		return -EINVAL;
+    if (fd < 0 || !drmp)
+        return -EINVAL;
 
-	drm = calloc(1, sizeof(*drm));
-	if (!drm)
-		return -ENOMEM;
+    drm = calloc(1, sizeof(*drm));
+    if (!drm)
+        return -ENOMEM;
 
-	drm->close = close;
-	drm->fd = fd;
+    drm->close = close;
+    drm->fd = fd;
 
-	*drmp = drm;
+    *drmp = drm;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_new(struct drm_tegra **drmp, int fd)
 {
-	bool supported = false;
-	drmVersionPtr version;
+    bool supported = false;
+    drmVersionPtr version;
 
-	version = drmGetVersion(fd);
-	if (!version)
-		return -ENOMEM;
+    version = drmGetVersion(fd);
+    if (!version)
+        return -ENOMEM;
 
-	if (!strncmp(version->name, "tegra", version->name_len))
-		supported = true;
+    if (!strncmp(version->name, "tegra", version->name_len))
+        supported = true;
 
-	drmFreeVersion(version);
+    drmFreeVersion(version);
 
-	if (!supported)
-		return -ENOTSUP;
+    if (!supported)
+        return -ENOTSUP;
 
-	return drm_tegra_wrap(drmp, fd, false);
+    return drm_tegra_wrap(drmp, fd, false);
 }
 
 drm_public void drm_tegra_close(struct drm_tegra *drm)
 {
-	if (!drm)
-		return;
+    if (!drm)
+        return;
 
-	if (drm->close)
-		close(drm->fd);
+    if (drm->close)
+        close(drm->fd);
 
-	free(drm);
+    free(drm);
 }
 
-drm_public int drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		     uint32_t flags, uint32_t size)
+drm_public int
+drm_tegra_bo_new(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+                 uint32_t flags, uint32_t size)
 {
-	struct drm_tegra_gem_create args;
-	struct drm_tegra_bo *bo;
-	int err;
+    struct drm_tegra_gem_create args;
+    struct drm_tegra_bo *bo;
+    int err;
 
-	if (!drm || size == 0 || !bop)
-		return -EINVAL;
+    if (!drm || size == 0 || !bop)
+        return -EINVAL;
 
-	bo = calloc(1, sizeof(*bo));
-	if (!bo)
-		return -ENOMEM;
+    bo = calloc(1, sizeof(*bo));
+    if (!bo)
+        return -ENOMEM;
 
-	atomic_set(&bo->ref, 1);
-	bo->flags = flags;
-	bo->size = size;
-	bo->drm = drm;
+    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;
+    memset(&args, 0, sizeof(args));
+    args.flags = flags;
+    args.size = size;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_CREATE, &args,
-				  sizeof(args));
-	if (err < 0) {
-		err = -errno;
-		free(bo);
-		return err;
-	}
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_CREATE, &args,
+                              sizeof(args));
+    if (err < 0) {
+        err = -errno;
+        free(bo);
+        return err;
+    }
 
-	bo->handle = args.handle;
+    bo->handle = args.handle;
 
-	*bop = bo;
+    *bop = bo;
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
-		      uint32_t handle, uint32_t flags, uint32_t size)
+drm_public int
+drm_tegra_bo_wrap(struct drm_tegra_bo **bop, struct drm_tegra *drm,
+                  uint32_t handle, uint32_t flags, uint32_t size)
 {
-	struct drm_tegra_bo *bo;
+    struct drm_tegra_bo *bo;
 
-	if (!drm || !bop)
-		return -EINVAL;
+    if (!drm || !bop)
+        return -EINVAL;
 
-	bo = calloc(1, sizeof(*bo));
-	if (!bo)
-		return -ENOMEM;
+    bo = calloc(1, sizeof(*bo));
+    if (!bo)
+        return -ENOMEM;
 
-	atomic_set(&bo->ref, 1);
-	bo->handle = handle;
-	bo->flags = flags;
-	bo->size = size;
-	bo->drm = drm;
+    atomic_set(&bo->ref, 1);
+    bo->handle = handle;
+    bo->flags = flags;
+    bo->size = size;
+    bo->drm = drm;
 
-	*bop = bo;
+    *bop = bo;
 
-	return 0;
+    return 0;
 }
 
 drm_public struct drm_tegra_bo *drm_tegra_bo_ref(struct drm_tegra_bo *bo)
 {
-	if (bo)
-		atomic_inc(&bo->ref);
+    if (bo)
+        atomic_inc(&bo->ref);
 
-	return bo;
+    return bo;
 }
 
 drm_public void drm_tegra_bo_unref(struct drm_tegra_bo *bo)
 {
-	if (bo && atomic_dec_and_test(&bo->ref))
-		drm_tegra_bo_free(bo);
+    if (bo && atomic_dec_and_test(&bo->ref))
+        drm_tegra_bo_free(bo);
 }
 
 drm_public int drm_tegra_bo_get_handle(struct drm_tegra_bo *bo, uint32_t *handle)
 {
-	if (!bo || !handle)
-		return -EINVAL;
+    if (!bo || !handle)
+        return -EINVAL;
 
-	*handle = bo->handle;
+    *handle = bo->handle;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_map(struct drm_tegra_bo *bo, void **ptr)
 {
-	struct drm_tegra *drm = bo->drm;
+    struct drm_tegra *drm = bo->drm;
 
-	if (!bo->map) {
-		struct drm_tegra_gem_mmap args;
-		int err;
+    if (!bo->map) {
+        struct drm_tegra_gem_mmap args;
+        int err;
 
-		memset(&args, 0, sizeof(args));
-		args.handle = bo->handle;
+        memset(&args, 0, sizeof(args));
+        args.handle = bo->handle;
 
-		err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_MMAP, &args,
-					  sizeof(args));
-		if (err < 0)
-			return -errno;
+        err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_MMAP, &args,
+                                  sizeof(args));
+        if (err < 0)
+            return -errno;
 
-		bo->offset = args.offset;
+        bo->offset = args.offset;
 
-		bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
-			       drm->fd, bo->offset);
-		if (bo->map == MAP_FAILED) {
-			bo->map = NULL;
-			return -errno;
-		}
-	}
+        bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+                       drm->fd, bo->offset);
+        if (bo->map == MAP_FAILED) {
+            bo->map = NULL;
+            return -errno;
+        }
+    }
 
-	if (ptr)
-		*ptr = bo->map;
+    if (ptr)
+        *ptr = bo->map;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 {
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	if (!bo->map)
-		return 0;
+    if (!bo->map)
+        return 0;
 
-	if (munmap(bo->map, bo->size))
-		return -errno;
+    if (munmap(bo->map, bo->size))
+        return -errno;
 
-	bo->map = NULL;
+    bo->map = NULL;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
 {
-	struct drm_tegra_gem_get_flags args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_flags args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	if (flags)
-		*flags = args.flags;
+    if (flags)
+        *flags = args.flags;
 
-	return 0;
+    return 0;
 }
 
 drm_public int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
 {
-	struct drm_tegra_gem_get_flags args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_flags args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
-	args.flags = flags;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+    args.flags = flags;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-			    struct drm_tegra_bo_tiling *tiling)
+drm_public int
+drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
+                        struct drm_tegra_bo_tiling *tiling)
 {
-	struct drm_tegra_gem_get_tiling args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_get_tiling args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	if (tiling) {
-		tiling->mode = args.mode;
-		tiling->value = args.value;
-	}
+    if (tiling) {
+        tiling->mode = args.mode;
+        tiling->value = args.value;
+    }
 
-	return 0;
+    return 0;
 }
 
-drm_public int drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-			    const struct drm_tegra_bo_tiling *tiling)
+drm_public int
+drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
+                        const struct drm_tegra_bo_tiling *tiling)
 {
-	struct drm_tegra_gem_set_tiling args;
-	struct drm_tegra *drm = bo->drm;
-	int err;
+    struct drm_tegra_gem_set_tiling args;
+    struct drm_tegra *drm = bo->drm;
+    int err;
 
-	if (!bo)
-		return -EINVAL;
+    if (!bo)
+        return -EINVAL;
 
-	memset(&args, 0, sizeof(args));
-	args.handle = bo->handle;
-	args.mode = tiling->mode;
-	args.value = tiling->value;
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+    args.mode = tiling->mode;
+    args.value = tiling->value;
 
-	err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
-				  sizeof(args));
-	if (err < 0)
-		return -errno;
+    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
+                              sizeof(args));
+    if (err < 0)
+        return -errno;
 
-	return 0;
+    return 0;
 }
diff --git a/tegra/tegra.h b/tegra/tegra.h
index 31b0995ad691..62205a5174b4 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
diff --git a/tests/tegra/openclose.c b/tests/tegra/openclose.c
index f80f52d477ee..104e83806f3a 100644
--- a/tests/tegra/openclose.c
+++ b/tests/tegra/openclose.c
@@ -31,37 +31,37 @@ static const char default_device[] = "/dev/dri/card0";
 
 int main(int argc, char *argv[])
 {
-	struct drm_tegra *tegra;
-	drmVersionPtr version;
-	const char *device;
-	int err, fd;
+    struct drm_tegra *tegra;
+    drmVersionPtr version;
+    const char *device;
+    int err, fd;
 
-	if (argc < 2)
-		device = default_device;
-	else
-		device = argv[1];
+    if (argc < 2)
+        device = default_device;
+    else
+        device = argv[1];
 
-	fd = open(device, O_RDWR);
-	if (fd < 0)
-		return 1;
+    fd = open(device, O_RDWR);
+    if (fd < 0)
+        return 1;
 
-	version = drmGetVersion(fd);
-	if (version) {
-		printf("Version: %d.%d.%d\n", version->version_major,
-		       version->version_minor, version->version_patchlevel);
-		printf("  Name: %s\n", version->name);
-		printf("  Date: %s\n", version->date);
-		printf("  Description: %s\n", version->desc);
+    version = drmGetVersion(fd);
+    if (version) {
+        printf("Version: %d.%d.%d\n", version->version_major,
+               version->version_minor, version->version_patchlevel);
+        printf("  Name: %s\n", version->name);
+        printf("  Date: %s\n", version->date);
+        printf("  Description: %s\n", version->desc);
 
-		drmFreeVersion(version);
-	}
+        drmFreeVersion(version);
+    }
 
-	err = drm_tegra_new(&tegra, fd);
-	if (err < 0)
-		return 1;
+    err = drm_tegra_new(&tegra, fd);
+    if (err < 0)
+        return 1;
 
-	drm_tegra_close(tegra);
-	close(fd);
+    drm_tegra_close(tegra);
+    close(fd);
 
-	return 0;
+    return 0;
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 19:16   ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/tegra-symbols.txt |  4 --
 tegra/tegra.c           | 95 -----------------------------------------
 tegra/tegra.h           | 12 ------
 3 files changed, 111 deletions(-)

diff --git a/tegra/tegra-symbols.txt b/tegra/tegra-symbols.txt
index 5e3e955f2901..9422696c1416 100644
--- a/tegra/tegra-symbols.txt
+++ b/tegra/tegra-symbols.txt
@@ -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
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 95aaa4b35425..630aea45f957 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -231,98 +231,3 @@ drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 
     return 0;
 }
-
-drm_public int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
-{
-    struct drm_tegra_gem_get_flags args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    if (flags)
-        *flags = args.flags;
-
-    return 0;
-}
-
-drm_public int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
-{
-    struct drm_tegra_gem_get_flags args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-    args.flags = flags;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    return 0;
-}
-
-drm_public int
-drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-                        struct drm_tegra_bo_tiling *tiling)
-{
-    struct drm_tegra_gem_get_tiling args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    if (tiling) {
-        tiling->mode = args.mode;
-        tiling->value = args.value;
-    }
-
-    return 0;
-}
-
-drm_public int
-drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-                        const struct drm_tegra_bo_tiling *tiling)
-{
-    struct drm_tegra_gem_set_tiling args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-    args.mode = tiling->mode;
-    args.value = tiling->value;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    return 0;
-}
diff --git a/tegra/tegra.h b/tegra/tegra.h
index 62205a5174b4..c6b4f984de45 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations
@ 2022-02-17 19:16   ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/tegra-symbols.txt |  4 --
 tegra/tegra.c           | 95 -----------------------------------------
 tegra/tegra.h           | 12 ------
 3 files changed, 111 deletions(-)

diff --git a/tegra/tegra-symbols.txt b/tegra/tegra-symbols.txt
index 5e3e955f2901..9422696c1416 100644
--- a/tegra/tegra-symbols.txt
+++ b/tegra/tegra-symbols.txt
@@ -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
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 95aaa4b35425..630aea45f957 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -231,98 +231,3 @@ drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 
     return 0;
 }
-
-drm_public int drm_tegra_bo_get_flags(struct drm_tegra_bo *bo, uint32_t *flags)
-{
-    struct drm_tegra_gem_get_flags args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_FLAGS, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    if (flags)
-        *flags = args.flags;
-
-    return 0;
-}
-
-drm_public int drm_tegra_bo_set_flags(struct drm_tegra_bo *bo, uint32_t flags)
-{
-    struct drm_tegra_gem_get_flags args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-    args.flags = flags;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_FLAGS, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    return 0;
-}
-
-drm_public int
-drm_tegra_bo_get_tiling(struct drm_tegra_bo *bo,
-                        struct drm_tegra_bo_tiling *tiling)
-{
-    struct drm_tegra_gem_get_tiling args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_GET_TILING, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    if (tiling) {
-        tiling->mode = args.mode;
-        tiling->value = args.value;
-    }
-
-    return 0;
-}
-
-drm_public int
-drm_tegra_bo_set_tiling(struct drm_tegra_bo *bo,
-                        const struct drm_tegra_bo_tiling *tiling)
-{
-    struct drm_tegra_gem_set_tiling args;
-    struct drm_tegra *drm = bo->drm;
-    int err;
-
-    if (!bo)
-        return -EINVAL;
-
-    memset(&args, 0, sizeof(args));
-    args.handle = bo->handle;
-    args.mode = tiling->mode;
-    args.value = tiling->value;
-
-    err = drmCommandWriteRead(drm->fd, DRM_TEGRA_GEM_SET_TILING, &args,
-                              sizeof(args));
-    if (err < 0)
-        return -errno;
-
-    return 0;
-}
diff --git a/tegra/tegra.h b/tegra/tegra.h
index 62205a5174b4..c6b4f984de45 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 03/25] tegra: Extract common buffer object allocation code
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 19:16   ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/tegra.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/tegra/tegra.c b/tegra/tegra.c
index 630aea45f957..74e1fd33c6e5 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 03/25] tegra: Extract common buffer object allocation code
@ 2022-02-17 19:16   ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/tegra.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/tegra/tegra.c b/tegra/tegra.c
index 630aea45f957..74e1fd33c6e5 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 04/25] tegra: Fix mmap() of GEM buffer objects
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 19:16   ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/private.h | 2 +-
 tegra/tegra.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tegra/private.h b/tegra/private.h
index 215dd3309bce..d0f2944bfb3a 100644
--- a/tegra/private.h
+++ b/tegra/private.h
@@ -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;
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 74e1fd33c6e5..a9087e956f94 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 04/25] tegra: Fix mmap() of GEM buffer objects
@ 2022-02-17 19:16   ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 tegra/private.h | 2 +-
 tegra/tegra.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tegra/private.h b/tegra/private.h
index 215dd3309bce..d0f2944bfb3a 100644
--- a/tegra/private.h
+++ b/tegra/private.h
@@ -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;
diff --git a/tegra/tegra.c b/tegra/tegra.c
index 74e1fd33c6e5..a9087e956f94 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -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;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 05/25] tegra: Add flink helpers
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 19:16   ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
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(+)

diff --git a/tegra/tegra-symbols.txt b/tegra/tegra-symbols.txt
index 9422696c1416..630e075fa5d7 100644
--- a/tegra/tegra-symbols.txt
+++ b/tegra/tegra-symbols.txt
@@ -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
diff --git a/tegra/tegra.c b/tegra/tegra.c
index a9087e956f94..3d645d87dd3d 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -240,3 +240,53 @@ drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 
     return 0;
 }
+
+drm_public int drm_tegra_bo_get_name(struct drm_tegra_bo *bo, uint32_t *name)
+{
+    struct drm_tegra *drm = bo->drm;
+    struct drm_gem_flink args;
+    int err;
+
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+
+    err = drmIoctl(drm->fd, DRM_IOCTL_GEM_FLINK, &args);
+    if (err < 0)
+        return err;
+
+    if (name)
+        *name = args.name;
+
+    return 0;
+}
+
+drm_public int
+drm_tegra_bo_open(struct drm_tegra *drm, uint32_t name, uint32_t flags,
+                  struct drm_tegra_bo **bop)
+{
+    struct drm_gem_open args;
+    struct drm_tegra_bo *bo;
+    int err;
+
+    bo = drm_tegra_bo_alloc(drm, 0, flags, 0);
+    if (!bo)
+        return -ENOMEM;
+
+    memset(&args, 0, sizeof(args));
+    args.name = name;
+
+    err = drmIoctl(drm->fd, DRM_IOCTL_GEM_OPEN, &args);
+    if (err < 0)
+        goto free;
+
+    bo->handle = args.handle;
+    bo->size = args.size;
+
+    *bop = bo;
+
+    return 0;
+
+free:
+    free(bo);
+    return err;
+}
diff --git a/tegra/tegra.h b/tegra/tegra.h
index c6b4f984de45..333690f23118 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH libdrm v2 05/25] tegra: Add flink helpers
@ 2022-02-17 19:16   ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 19:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
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(+)

diff --git a/tegra/tegra-symbols.txt b/tegra/tegra-symbols.txt
index 9422696c1416..630e075fa5d7 100644
--- a/tegra/tegra-symbols.txt
+++ b/tegra/tegra-symbols.txt
@@ -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
diff --git a/tegra/tegra.c b/tegra/tegra.c
index a9087e956f94..3d645d87dd3d 100644
--- a/tegra/tegra.c
+++ b/tegra/tegra.c
@@ -240,3 +240,53 @@ drm_public int drm_tegra_bo_unmap(struct drm_tegra_bo *bo)
 
     return 0;
 }
+
+drm_public int drm_tegra_bo_get_name(struct drm_tegra_bo *bo, uint32_t *name)
+{
+    struct drm_tegra *drm = bo->drm;
+    struct drm_gem_flink args;
+    int err;
+
+    memset(&args, 0, sizeof(args));
+    args.handle = bo->handle;
+
+    err = drmIoctl(drm->fd, DRM_IOCTL_GEM_FLINK, &args);
+    if (err < 0)
+        return err;
+
+    if (name)
+        *name = args.name;
+
+    return 0;
+}
+
+drm_public int
+drm_tegra_bo_open(struct drm_tegra *drm, uint32_t name, uint32_t flags,
+                  struct drm_tegra_bo **bop)
+{
+    struct drm_gem_open args;
+    struct drm_tegra_bo *bo;
+    int err;
+
+    bo = drm_tegra_bo_alloc(drm, 0, flags, 0);
+    if (!bo)
+        return -ENOMEM;
+
+    memset(&args, 0, sizeof(args));
+    args.name = name;
+
+    err = drmIoctl(drm->fd, DRM_IOCTL_GEM_OPEN, &args);
+    if (err < 0)
+        goto free;
+
+    bo->handle = args.handle;
+    bo->size = args.size;
+
+    *bop = bo;
+
+    return 0;
+
+free:
+    free(bo);
+    return err;
+}
diff --git a/tegra/tegra.h b/tegra/tegra.h
index c6b4f984de45..333690f23118 100644
--- a/tegra/tegra.h
+++ b/tegra/tegra.h
@@ -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__ */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-17 20:02   ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-17 20:02 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, Michał Mirosław

17.02.2022 22:16, Thierry Reding пишет:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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(-)


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


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-17 20:02   ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-17 20:02 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Michał Mirosław, dri-devel, linux-tegra

17.02.2022 22:16, Thierry Reding пишет:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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(-)


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


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-17 20:02   ` Dmitry Osipenko
@ 2022-02-17 21:37     ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 21:37 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: linux-tegra, dri-devel, Michał Mirosław

[-- Attachment #1: Type: text/plain, Size: 4613 bytes --]

On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
> 17.02.2022 22:16, Thierry Reding пишет:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > 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(-)
> 
> 
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-17 21:37     ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-17 21:37 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: Michał Mirosław, dri-devel, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 4613 bytes --]

On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
> 17.02.2022 22:16, Thierry Reding пишет:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > 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(-)
> 
> 
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-17 19:16 ` Thierry Reding
@ 2022-02-18  9:31   ` Mikko Perttunen
  -1 siblings, 0 replies; 32+ messages in thread
From: Mikko Perttunen @ 2022-02-18  9:31 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Michał Mirosław, Dmitry Osipenko, dri-devel, linux-tegra

On 2/17/22 21:16, Thierry Reding wrote:
> ...

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

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.

Cheers,
Mikko


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-18  9:31   ` Mikko Perttunen
  0 siblings, 0 replies; 32+ messages in thread
From: Mikko Perttunen @ 2022-02-18  9:31 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

On 2/17/22 21:16, Thierry Reding wrote:
> ...

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

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.

Cheers,
Mikko


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-17 21:37     ` Thierry Reding
@ 2022-02-18 14:16       ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-18 14:16 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Michał Mirosław, dri-devel, linux-tegra

18.02.2022 00:37, Thierry Reding пишет:
> On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
>> 17.02.2022 22:16, Thierry Reding пишет:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> 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(-)
>>
>>
>> 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?

> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-18 14:16       ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-18 14:16 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, Michał Mirosław

18.02.2022 00:37, Thierry Reding пишет:
> On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
>> 17.02.2022 22:16, Thierry Reding пишет:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> 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(-)
>>
>>
>> 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?

> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-18 14:16       ` Dmitry Osipenko
@ 2022-02-18 19:49         ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-18 19:49 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Michał Mirosław, dri-devel, linux-tegra

18.02.2022 17:16, Dmitry Osipenko пишет:
> 18.02.2022 00:37, Thierry Reding пишет:
>> On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
>>> 17.02.2022 22:16, Thierry Reding пишет:
>>>> From: Thierry Reding <treding@nvidia.com>
>>>>
>>>> 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(-)
>>>
>>>
>>> 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?
> 
>> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-18 19:49         ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-18 19:49 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, Michał Mirosław

18.02.2022 17:16, Dmitry Osipenko пишет:
> 18.02.2022 00:37, Thierry Reding пишет:
>> On Thu, Feb 17, 2022 at 11:02:53PM +0300, Dmitry Osipenko wrote:
>>> 17.02.2022 22:16, Thierry Reding пишет:
>>>> From: Thierry Reding <treding@nvidia.com>
>>>>
>>>> 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(-)
>>>
>>>
>>> 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?
> 
>> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-18  9:31   ` Mikko Perttunen
@ 2022-02-21 20:29     ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-21 20:29 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding
  Cc: Michał Mirosław, dri-devel, linux-tegra

18.02.2022 12:31, Mikko Perttunen пишет:
> On 2/17/22 21:16, Thierry Reding wrote:
>> ...
> 
> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-21 20:29     ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-21 20:29 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding
  Cc: linux-tegra, dri-devel, Michał Mirosław

18.02.2022 12:31, Mikko Perttunen пишет:
> On 2/17/22 21:16, Thierry Reding wrote:
>> ...
> 
> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-21 20:29     ` Dmitry Osipenko
@ 2022-02-22  8:41       ` Mikko Perttunen
  -1 siblings, 0 replies; 32+ messages in thread
From: Mikko Perttunen @ 2022-02-22  8:41 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding
  Cc: Michał Mirosław, dri-devel, linux-tegra

On 2/21/22 22:29, Dmitry Osipenko wrote:
> 18.02.2022 12:31, Mikko Perttunen пишет:
>> On 2/17/22 21:16, Thierry Reding wrote:
>>> ...
>>
>> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
>>
>> 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.

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

Mikko

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-22  8:41       ` Mikko Perttunen
  0 siblings, 0 replies; 32+ messages in thread
From: Mikko Perttunen @ 2022-02-22  8:41 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding
  Cc: linux-tegra, dri-devel, Michał Mirosław

On 2/21/22 22:29, Dmitry Osipenko wrote:
> 18.02.2022 12:31, Mikko Perttunen пишет:
>> On 2/17/22 21:16, Thierry Reding wrote:
>>> ...
>>
>> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
>>
>> 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.

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

Mikko

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
  2022-02-22  8:41       ` Mikko Perttunen
@ 2022-02-23 15:01         ` Thierry Reding
  -1 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-23 15:01 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: Dmitry Osipenko, Michał Mirosław, dri-devel, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Tue, Feb 22, 2022 at 10:41:05AM +0200, Mikko Perttunen wrote:
> On 2/21/22 22:29, Dmitry Osipenko wrote:
> > 18.02.2022 12:31, Mikko Perttunen пишет:
> > > On 2/17/22 21:16, Thierry Reding wrote:
> > > > ...
> > > 
> > > Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> > > 
> > > 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.
> 
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 00/25] Update Tegra support
@ 2022-02-23 15:01         ` Thierry Reding
  0 siblings, 0 replies; 32+ messages in thread
From: Thierry Reding @ 2022-02-23 15:01 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: linux-tegra, Dmitry Osipenko, dri-devel, Michał Mirosław

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Tue, Feb 22, 2022 at 10:41:05AM +0200, Mikko Perttunen wrote:
> On 2/21/22 22:29, Dmitry Osipenko wrote:
> > 18.02.2022 12:31, Mikko Perttunen пишет:
> > > On 2/17/22 21:16, Thierry Reding wrote:
> > > > ...
> > > 
> > > Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> > > 
> > > 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.
> 
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations
  2022-02-17 19:16   ` Thierry Reding
@ 2022-02-24 16:52     ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-24 16:52 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Michał Mirosław, dri-devel, linux-tegra

17.02.2022 22:16, Thierry Reding пишет:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations
@ 2022-02-24 16:52     ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-24 16:52 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, Michał Mirosław

17.02.2022 22:16, Thierry Reding пишет:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 05/25] tegra: Add flink helpers
  2022-02-17 19:16   ` Thierry Reding
@ 2022-02-24 17:18     ` Dmitry Osipenko
  -1 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-24 17:18 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Michał Mirosław, dri-devel, linux-tegra

17.02.2022 22:16, Thierry Reding пишет:
> +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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH libdrm v2 05/25] tegra: Add flink helpers
@ 2022-02-24 17:18     ` Dmitry Osipenko
  0 siblings, 0 replies; 32+ messages in thread
From: Dmitry Osipenko @ 2022-02-24 17:18 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, Michał Mirosław

17.02.2022 22:16, Thierry Reding пишет:
> +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.

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2022-02-24 17:18 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 19:16 [PATCH libdrm v2 00/25] Update Tegra support Thierry Reding
2022-02-17 19:16 ` Thierry Reding
2022-02-17 19:16 ` [PATCH libdrm v2 01/25] tegra: Indent according to .editorconfig Thierry Reding
2022-02-17 19:16   ` Thierry Reding
2022-02-17 19:16 ` [PATCH libdrm v2 02/25] tegra: Remove unused IOCTL implementations Thierry Reding
2022-02-17 19:16   ` Thierry Reding
2022-02-24 16:52   ` Dmitry Osipenko
2022-02-24 16:52     ` Dmitry Osipenko
2022-02-17 19:16 ` [PATCH libdrm v2 03/25] tegra: Extract common buffer object allocation code Thierry Reding
2022-02-17 19:16   ` Thierry Reding
2022-02-17 19:16 ` [PATCH libdrm v2 04/25] tegra: Fix mmap() of GEM buffer objects Thierry Reding
2022-02-17 19:16   ` Thierry Reding
2022-02-17 19:16 ` [PATCH libdrm v2 05/25] tegra: Add flink helpers Thierry Reding
2022-02-17 19:16   ` Thierry Reding
2022-02-24 17:18   ` Dmitry Osipenko
2022-02-24 17:18     ` Dmitry Osipenko
2022-02-17 20:02 ` [PATCH libdrm v2 00/25] Update Tegra support Dmitry Osipenko
2022-02-17 20:02   ` Dmitry Osipenko
2022-02-17 21:37   ` Thierry Reding
2022-02-17 21:37     ` Thierry Reding
2022-02-18 14:16     ` Dmitry Osipenko
2022-02-18 14:16       ` Dmitry Osipenko
2022-02-18 19:49       ` Dmitry Osipenko
2022-02-18 19:49         ` Dmitry Osipenko
2022-02-18  9:31 ` Mikko Perttunen
2022-02-18  9:31   ` Mikko Perttunen
2022-02-21 20:29   ` Dmitry Osipenko
2022-02-21 20:29     ` Dmitry Osipenko
2022-02-22  8:41     ` Mikko Perttunen
2022-02-22  8:41       ` Mikko Perttunen
2022-02-23 15:01       ` Thierry Reding
2022-02-23 15:01         ` Thierry Reding

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.