diff options
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_gem.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_gem.h | 4 | ||||
-rw-r--r-- | include/drm/exynos_drm.h | 19 |
4 files changed, 51 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index f58a487e4425..b7a2869582f2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -211,6 +211,8 @@ static struct drm_ioctl_desc exynos_ioctls[] = { | |||
211 | DRM_AUTH), | 211 | DRM_AUTH), |
212 | DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP, | 212 | DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MMAP, |
213 | exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH), | 213 | exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH), |
214 | DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET, | ||
215 | exynos_drm_gem_get_ioctl, DRM_UNLOCKED), | ||
214 | DRM_IOCTL_DEF_DRV(EXYNOS_PLANE_SET_ZPOS, exynos_plane_set_zpos_ioctl, | 216 | DRM_IOCTL_DEF_DRV(EXYNOS_PLANE_SET_ZPOS, exynos_plane_set_zpos_ioctl, |
215 | DRM_UNLOCKED | DRM_AUTH), | 217 | DRM_UNLOCKED | DRM_AUTH), |
216 | DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION, | 218 | DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 31bb85f5d274..fc91293c4560 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -604,6 +604,32 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
604 | return 0; | 604 | return 0; |
605 | } | 605 | } |
606 | 606 | ||
607 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, | ||
608 | struct drm_file *file_priv) | ||
609 | { struct exynos_drm_gem_obj *exynos_gem_obj; | ||
610 | struct drm_exynos_gem_info *args = data; | ||
611 | struct drm_gem_object *obj; | ||
612 | |||
613 | mutex_lock(&dev->struct_mutex); | ||
614 | |||
615 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | ||
616 | if (!obj) { | ||
617 | DRM_ERROR("failed to lookup gem object.\n"); | ||
618 | mutex_unlock(&dev->struct_mutex); | ||
619 | return -EINVAL; | ||
620 | } | ||
621 | |||
622 | exynos_gem_obj = to_exynos_gem_obj(obj); | ||
623 | |||
624 | args->flags = exynos_gem_obj->flags; | ||
625 | args->size = exynos_gem_obj->size; | ||
626 | |||
627 | drm_gem_object_unreference(obj); | ||
628 | mutex_unlock(&dev->struct_mutex); | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
607 | int exynos_drm_gem_init_object(struct drm_gem_object *obj) | 633 | int exynos_drm_gem_init_object(struct drm_gem_object *obj) |
608 | { | 634 | { |
609 | DRM_DEBUG_KMS("%s\n", __FILE__); | 635 | DRM_DEBUG_KMS("%s\n", __FILE__); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index efc82527b272..14d038b6cb02 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -127,6 +127,10 @@ int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data, | |||
127 | int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | 127 | int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, |
128 | struct drm_file *file_priv); | 128 | struct drm_file *file_priv); |
129 | 129 | ||
130 | /* get buffer information to memory region allocated by gem. */ | ||
131 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, | ||
132 | struct drm_file *file_priv); | ||
133 | |||
130 | /* initialize gem object. */ | 134 | /* initialize gem object. */ |
131 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); | 135 | int exynos_drm_gem_init_object(struct drm_gem_object *obj); |
132 | 136 | ||
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 2d6eb06637bf..70c0f7e7db82 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
@@ -75,6 +75,21 @@ struct drm_exynos_gem_mmap { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * A structure to gem information. | ||
79 | * | ||
80 | * @handle: a handle to gem object created. | ||
81 | * @flags: flag value including memory type and cache attribute and | ||
82 | * this value would be set by driver. | ||
83 | * @size: size to memory region allocated by gem and this size would | ||
84 | * be set by driver. | ||
85 | */ | ||
86 | struct drm_exynos_gem_info { | ||
87 | unsigned int handle; | ||
88 | unsigned int flags; | ||
89 | uint64_t size; | ||
90 | }; | ||
91 | |||
92 | /** | ||
78 | * A structure for user connection request of virtual display. | 93 | * A structure for user connection request of virtual display. |
79 | * | 94 | * |
80 | * @connection: indicate whether doing connetion or not by user. | 95 | * @connection: indicate whether doing connetion or not by user. |
@@ -113,6 +128,7 @@ enum e_drm_exynos_gem_mem_type { | |||
113 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 | 128 | #define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 |
114 | #define DRM_EXYNOS_GEM_MMAP 0x02 | 129 | #define DRM_EXYNOS_GEM_MMAP 0x02 |
115 | /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ | 130 | /* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ |
131 | #define DRM_EXYNOS_GEM_GET 0x04 | ||
116 | #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 | 132 | #define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 |
117 | #define DRM_EXYNOS_VIDI_CONNECTION 0x07 | 133 | #define DRM_EXYNOS_VIDI_CONNECTION 0x07 |
118 | 134 | ||
@@ -125,6 +141,9 @@ enum e_drm_exynos_gem_mem_type { | |||
125 | #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ | 141 | #define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ |
126 | DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) | 142 | DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) |
127 | 143 | ||
144 | #define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \ | ||
145 | DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info) | ||
146 | |||
128 | #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ | 147 | #define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ |
129 | DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) | 148 | DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) |
130 | 149 | ||