aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 574bd1c81ebd..dd731043fecd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -91,6 +91,7 @@ struct drm_device;
91#define DRM_UT_CORE 0x01 91#define DRM_UT_CORE 0x01
92#define DRM_UT_DRIVER 0x02 92#define DRM_UT_DRIVER 0x02
93#define DRM_UT_KMS 0x04 93#define DRM_UT_KMS 0x04
94#define DRM_UT_PRIME 0x08
94/* 95/*
95 * Three debug levels are defined. 96 * Three debug levels are defined.
96 * drm_core, drm_driver, drm_kms 97 * drm_core, drm_driver, drm_kms
@@ -150,6 +151,7 @@ int drm_err(const char *func, const char *format, ...);
150#define DRIVER_IRQ_VBL2 0x800 151#define DRIVER_IRQ_VBL2 0x800
151#define DRIVER_GEM 0x1000 152#define DRIVER_GEM 0x1000
152#define DRIVER_MODESET 0x2000 153#define DRIVER_MODESET 0x2000
154#define DRIVER_PRIME 0x4000
153 155
154#define DRIVER_BUS_PCI 0x1 156#define DRIVER_BUS_PCI 0x1
155#define DRIVER_BUS_PLATFORM 0x2 157#define DRIVER_BUS_PLATFORM 0x2
@@ -215,6 +217,11 @@ int drm_err(const char *func, const char *format, ...);
215 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ 217 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \
216 __func__, fmt, ##args); \ 218 __func__, fmt, ##args); \
217 } while (0) 219 } while (0)
220#define DRM_DEBUG_PRIME(fmt, args...) \
221 do { \
222 drm_ut_debug_printk(DRM_UT_PRIME, DRM_NAME, \
223 __func__, fmt, ##args); \
224 } while (0)
218#define DRM_LOG(fmt, args...) \ 225#define DRM_LOG(fmt, args...) \
219 do { \ 226 do { \
220 drm_ut_debug_printk(DRM_UT_CORE, NULL, \ 227 drm_ut_debug_printk(DRM_UT_CORE, NULL, \
@@ -238,6 +245,7 @@ int drm_err(const char *func, const char *format, ...);
238#else 245#else
239#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) 246#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
240#define DRM_DEBUG_KMS(fmt, args...) do { } while (0) 247#define DRM_DEBUG_KMS(fmt, args...) do { } while (0)
248#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0)
241#define DRM_DEBUG(fmt, arg...) do { } while (0) 249#define DRM_DEBUG(fmt, arg...) do { } while (0)
242#define DRM_LOG(fmt, arg...) do { } while (0) 250#define DRM_LOG(fmt, arg...) do { } while (0)
243#define DRM_LOG_KMS(fmt, args...) do { } while (0) 251#define DRM_LOG_KMS(fmt, args...) do { } while (0)
@@ -410,6 +418,12 @@ struct drm_pending_event {
410 void (*destroy)(struct drm_pending_event *event); 418 void (*destroy)(struct drm_pending_event *event);
411}; 419};
412 420
421/* initial implementaton using a linked list - todo hashtab */
422struct drm_prime_file_private {
423 struct list_head head;
424 struct mutex lock;
425};
426
413/** File private data */ 427/** File private data */
414struct drm_file { 428struct drm_file {
415 int authenticated; 429 int authenticated;
@@ -437,6 +451,8 @@ struct drm_file {
437 wait_queue_head_t event_wait; 451 wait_queue_head_t event_wait;
438 struct list_head event_list; 452 struct list_head event_list;
439 int event_space; 453 int event_space;
454
455 struct drm_prime_file_private prime;
440}; 456};
441 457
442/** Wait queue */ 458/** Wait queue */
@@ -652,6 +668,12 @@ struct drm_gem_object {
652 uint32_t pending_write_domain; 668 uint32_t pending_write_domain;
653 669
654 void *driver_private; 670 void *driver_private;
671
672 /* dma buf exported from this GEM object */
673 struct dma_buf *export_dma_buf;
674
675 /* dma buf attachment backing this object */
676 struct dma_buf_attachment *import_attach;
655}; 677};
656 678
657#include "drm_crtc.h" 679#include "drm_crtc.h"
@@ -890,6 +912,20 @@ struct drm_driver {
890 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); 912 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
891 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 913 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
892 914
915 /* prime: */
916 /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */
917 int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv,
918 uint32_t handle, uint32_t flags, int *prime_fd);
919 /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */
920 int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv,
921 int prime_fd, uint32_t *handle);
922 /* export GEM -> dmabuf */
923 struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
924 struct drm_gem_object *obj, int flags);
925 /* import dmabuf -> GEM */
926 struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
927 struct dma_buf *dma_buf);
928
893 /* vga arb irq handler */ 929 /* vga arb irq handler */
894 void (*vgaarb_irq)(struct drm_device *dev, bool state); 930 void (*vgaarb_irq)(struct drm_device *dev, bool state);
895 931
@@ -1509,6 +1545,32 @@ extern int drm_vblank_info(struct seq_file *m, void *data);
1509extern int drm_clients_info(struct seq_file *m, void* data); 1545extern int drm_clients_info(struct seq_file *m, void* data);
1510extern int drm_gem_name_info(struct seq_file *m, void *data); 1546extern int drm_gem_name_info(struct seq_file *m, void *data);
1511 1547
1548
1549extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
1550 struct drm_file *file_priv, uint32_t handle, uint32_t flags,
1551 int *prime_fd);
1552extern int drm_gem_prime_fd_to_handle(struct drm_device *dev,
1553 struct drm_file *file_priv, int prime_fd, uint32_t *handle);
1554
1555extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
1556 struct drm_file *file_priv);
1557extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
1558 struct drm_file *file_priv);
1559
1560extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages);
1561extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
1562
1563
1564void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
1565void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
1566int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle);
1567int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle);
1568void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf);
1569
1570int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj);
1571int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf,
1572 struct drm_gem_object **obj);
1573
1512#if DRM_DEBUG_CODE 1574#if DRM_DEBUG_CODE
1513extern int drm_vma_info(struct seq_file *m, void *data); 1575extern int drm_vma_info(struct seq_file *m, void *data);
1514#endif 1576#endif