drm: implement video fence ioctl [1/3]

PD#SWPL-124599

Problem:
Unable to obtain video fence.

Solution:
implement video fence ioctl.

Verify:
t3x

Test:
DRM-OSD-65

Change-Id: Idf779bbccc05b08786ffbeebe27cd10aa80be682
Signed-off-by: chen.wang1 <chen.wang1@amlogic.com>
This commit is contained in:
chen.wang1
2023-04-28 03:01:37 +00:00
committed by gerrit autosubmit
parent 061c478f68
commit d6aa321845
5 changed files with 115 additions and 1 deletions
+37
View File
@@ -36,9 +36,46 @@ struct drm_meson_gem_create {
__u32 handle;
};
/**
* struct drm_meson_dma_buf_export_sync_file - Get a sync_file from a dma-buf
*
* Userspace can perform a DMA_BUF_IOCTL_EXPORT_SYNC_FILE to retrieve the
* current set of fences on a dma-buf file descriptor as a sync_file. CPU
* waits via poll() or other driver-specific mechanisms typically wait on
* whatever fences are on the dma-buf at the time the wait begins. This
* is similar except that it takes a snapshot of the current fences on the
* dma-buf for waiting later instead of waiting immediately. This is
* useful for modern graphics APIs such as Vulkan which assume an explicit
* synchronization model but still need to inter-operate with dma-buf.
*/
struct drm_meson_dma_buf_export_sync_file {
/**
* @flags: Read/write flags
*
* Must be DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, or both.
*
* If DMA_BUF_SYNC_READ is set and DMA_BUF_SYNC_WRITE is not set,
* the returned sync file waits on any writers of the dma-buf to
* complete. Waiting on the returned sync file is equivalent to
* poll() with POLLIN.
*
* If DMA_BUF_SYNC_WRITE is set, the returned sync file waits on
* any users of the dma-buf (read or write) to complete. Waiting
* on the returned sync file is equivalent to poll() with POLLOUT.
* If both DMA_BUF_SYNC_WRITE and DMA_BUF_SYNC_READ are set, this
* is equivalent to just DMA_BUF_SYNC_WRITE.
*/
__u32 flags;
__u32 dmabuf_fd;
/** @fd: Returned sync file descriptor */
__s32 fd;
};
/*Memory related.*/
#define DRM_IOCTL_MESON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
0x00, struct drm_meson_gem_create)
#define DRM_IOCTL_MESON_DMABUF_EXPORT_SYNC_FILE DRM_IOWR(DRM_COMMAND_BASE + \
0x02, struct drm_meson_dma_buf_export_sync_file)
/*KMS related.*/
#define DRM_IOCTL_MESON_ASYNC_ATOMIC DRM_IOWR(DRM_COMMAND_BASE + \