[PATCH drm 6/6] drm: add DRM_IOCTL_PRIME_PAGE_FLIP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: agoins <agoins@xxxxxxxxxx>

Adds DRM_IOCTL_PRIME_PAGE_FLIP, a new PRIME ioctl that uses DRM driver
function prime_page_flip() to request a DRM page flip in response to an
exclusive fence being signaled on a PRIME DMA-BUF's associated reservation
object.

drm_internal.h:
    Add declaration for drm_prime_page_flip_ioctl()

drm_ioctl.c:
    DRM_IOCTL_DEF DRM_IOCTL_PRIME_PAGE_FLIP.

drm_prime.c:
    Define drm_prime_page_flip_ioctl().

drm.h:
    Define struct drm_prime_page_flip. Parameter struct from
    DRM_IOCTL_PRIME_PAGE_FLIP.

    Define DRM_IOCTL_PRIME_PAGE_FLIP.

Signed-off-by: Alex Goins <agoins@xxxxxxxxxx>
---
 drivers/gpu/drm/drm_internal.h |  2 ++
 drivers/gpu/drm/drm_ioctl.c    |  1 +
 drivers/gpu/drm/drm_prime.c    | 20 ++++++++++++++++++++
 include/uapi/drm/drm.h         | 10 ++++++++++
 4 files changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index 43cbda3..eb82775 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -45,6 +45,8 @@ int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
 				 struct drm_file *file_priv);
 int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
 				 struct drm_file *file_priv);
+int drm_prime_page_flip_ioctl(struct drm_device *dev, void *data,
+			      struct drm_file *file_priv);
 
 void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8ce2a0c..e89bfef 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -632,6 +632,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 
 	DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
+	DRM_IOCTL_DEF(DRM_IOCTL_PRIME_PAGE_FLIP, drm_prime_page_flip_ioctl, DRM_MASTER|DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
 
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED),
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 175bf4a..094698d 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -827,6 +827,26 @@ out:
 }
 EXPORT_SYMBOL(drm_gem_prime_page_flip);
 
+int drm_prime_page_flip_ioctl(struct drm_device *dev,
+			      void *data, struct drm_file *file_priv)
+{
+	struct drm_prime_page_flip *args = data;
+
+	if (!drm_core_check_feature(dev, DRIVER_PRIME))
+		return -EINVAL;
+
+	if (!dev->driver->prime_page_flip)
+		return -ENOSYS;
+
+	/* check flags are valid */
+	if (args->flags & ~DRM_PRIME_PAGE_FLIP_FLAGS)
+		return -EINVAL;
+
+	return dev->driver->prime_page_flip(dev, file_priv,
+			args->handle, args->fb_id, args->crtc_id,
+			args->user_data, args->flags);
+}
+
 /**
  * drm_prime_pages_to_sg - converts a page array into an sg list
  * @pages: pointer to the array of page pointers to convert
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 3801584..0c2a5f4 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -679,6 +679,15 @@ struct drm_prime_handle {
 	__s32 fd;
 };
 
+#define DRM_PRIME_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_FLAGS
+struct drm_prime_page_flip {
+	__u32 handle;
+	__u32 fb_id;
+	__u32 crtc_id;
+	__u32 flags;
+	__u64 user_data;
+};
+
 #include <drm/drm_mode.h>
 
 #define DRM_IOCTL_BASE			'd'
@@ -738,6 +747,7 @@ struct drm_prime_handle {
 
 #define DRM_IOCTL_PRIME_HANDLE_TO_FD    DRM_IOWR(0x2d, struct drm_prime_handle)
 #define DRM_IOCTL_PRIME_FD_TO_HANDLE    DRM_IOWR(0x2e, struct drm_prime_handle)
+#define DRM_IOCTL_PRIME_PAGE_FLIP       DRM_IOWR(0x2f, struct drm_prime_page_flip)
 
 #define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
 #define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux