drm/tegra: Add new syncpoint increment IOCTL

Add new syncpoint increment IOCTL in line with the new channel/
syncpoint IOCTLs, that only allows incrementing owned syncpoints.

Change-Id: Ieed11e1ba840da31ecfe7029051bfa61b88cd2b5
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3284407
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
This commit is contained in:
Mikko Perttunen
2024-10-31 04:29:11 +00:00
committed by Jon Hunter
parent 5362309e7f
commit 92ed8780d2
4 changed files with 40 additions and 0 deletions

View File

@@ -782,6 +782,8 @@ static const struct drm_ioctl_desc tegra_drm_ioctls[] = {
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(TEGRA_SYNCPOINT_EXPORT_MEMORY, tegra_drm_ioctl_syncpoint_export_memory,
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(TEGRA_SYNCPOINT_INCREMENT, tegra_drm_ioctl_syncpoint_increment,
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create, DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, DRM_RENDER_ALLOW),

View File

@@ -1107,6 +1107,17 @@ struct drm_tegra_syncpoint_export_memory {
__u32 stride;
};
struct drm_tegra_syncpoint_increment {
/**
* @id: [in]
*
* ID of syncpoint to increment. The specific syncpoint
* must be allocated through this file descriptor.
*/
__u32 id;
__u32 padding;
};
#define DRM_IOCTL_TEGRA_CHANNEL_OPEN DRM_IOWR(DRM_COMMAND_BASE + 0x10, struct drm_tegra_channel_open)
#define DRM_IOCTL_TEGRA_CHANNEL_CLOSE DRM_IOWR(DRM_COMMAND_BASE + 0x11, struct drm_tegra_channel_close)
#define DRM_IOCTL_TEGRA_CHANNEL_MAP DRM_IOWR(DRM_COMMAND_BASE + 0x12, struct drm_tegra_channel_map)
@@ -1116,6 +1127,7 @@ struct drm_tegra_syncpoint_export_memory {
#define DRM_IOCTL_TEGRA_SYNCPOINT_ALLOCATE DRM_IOWR(DRM_COMMAND_BASE + 0x20, struct drm_tegra_syncpoint_allocate)
#define DRM_IOCTL_TEGRA_SYNCPOINT_FREE DRM_IOWR(DRM_COMMAND_BASE + 0x21, struct drm_tegra_syncpoint_free)
#define DRM_IOCTL_TEGRA_SYNCPOINT_WAIT DRM_IOWR(DRM_COMMAND_BASE + 0x22, struct drm_tegra_syncpoint_wait)
#define DRM_IOCTL_TEGRA_SYNCPOINT_INCREMENT DRM_IOWR(DRM_COMMAND_BASE + 0x23, struct drm_tegra_syncpoint_increment)
#define DRM_IOCTL_TEGRA_SYNCPOINT_EXPORT_MEMORY DRM_IOWR(DRM_COMMAND_BASE + 0x24, struct drm_tegra_syncpoint_export_memory)
#if defined(__cplusplus)

View File

@@ -574,3 +574,27 @@ put_syncpts:
return err;
}
int tegra_drm_ioctl_syncpoint_increment(struct drm_device *drm, void *data,
struct drm_file *file)
{
struct drm_tegra_syncpoint_increment *args = data;
struct tegra_drm_file *fpriv = file->driver_priv;
struct host1x_syncpt *sp;
int err;
if (args->padding != 0)
return -EINVAL;
mutex_lock(&fpriv->lock);
sp = xa_load(&fpriv->syncpoints, args->id);
if (!sp) {
mutex_unlock(&fpriv->lock);
return -EINVAL;
}
err = host1x_syncpt_incr(sp);
mutex_unlock(&fpriv->lock);
return err;
}

View File

@@ -51,6 +51,8 @@ int tegra_drm_ioctl_syncpoint_free(struct drm_device *drm, void *data,
struct drm_file *file);
int tegra_drm_ioctl_syncpoint_wait(struct drm_device *drm, void *data,
struct drm_file *file);
int tegra_drm_ioctl_syncpoint_increment(struct drm_device *drm, void *data,
struct drm_file *file);
int tegra_drm_ioctl_syncpoint_export_memory(struct drm_device *drm, void *data,
struct drm_file *file);