From: Inki Dae <inki.dae@samsung.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: Inki Dae <inki.dae@samsung.com>,
kyungmin.park@samsung.com, sw0312.kim@samsung.com
Subject: [PATCH 4/4] drm/exynos: added a feature to get gem buffer information.
Date: Mon, 23 Apr 2012 22:43:14 +0900 [thread overview]
Message-ID: <1335188594-17454-5-git-send-email-inki.dae@samsung.com> (raw)
In-Reply-To: <1335188594-17454-1-git-send-email-inki.dae@samsung.com>
this patch adds a feature to get a gem buffer information and user application
can get the gem buffer information simply in runtime through gem handle.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 ++
drivers/gpu/drm/exynos/exynos_drm_gem.c | 26 ++++++++++++++++++++++++++
drivers/gpu/drm/exynos/exynos_drm_gem.h | 4 ++++
include/drm/exynos_drm.h | 21 ++++++++++++++++++++-
4 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 5bb0361..21658fa 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -213,6 +213,8 @@ static struct drm_ioctl_desc exynos_ioctls[] = {
exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_USERPTR,
exynos_drm_gem_userptr_ioctl, DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
+ exynos_drm_gem_get_ioctl, DRM_UNLOCKED),
DRM_IOCTL_DEF_DRV(EXYNOS_PLANE_SET_ZPOS, exynos_plane_set_zpos_ioctl,
DRM_UNLOCKED | DRM_AUTH),
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 b68d4ea..c3ffc9f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -864,6 +864,32 @@ err_free_buffer:
return ret;
}
+int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv)
+{ struct exynos_drm_gem_obj *exynos_gem_obj;
+ struct drm_exynos_gem_info *args = data;
+ struct drm_gem_object *obj;
+
+ mutex_lock(&dev->struct_mutex);
+
+ obj = drm_gem_object_lookup(dev, file_priv, args->handle);
+ if (!obj) {
+ DRM_ERROR("failed to lookup gem object.\n");
+ mutex_unlock(&dev->struct_mutex);
+ return -EINVAL;
+ }
+
+ exynos_gem_obj = to_exynos_gem_obj(obj);
+
+ args->flags = exynos_gem_obj->flags;
+ args->size = exynos_gem_obj->size;
+
+ drm_gem_object_unreference(obj);
+ mutex_unlock(&dev->struct_mutex);
+
+ return 0;
+}
+
int exynos_drm_gem_init_object(struct drm_gem_object *obj)
{
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 1de2241..9f5eabe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -138,6 +138,10 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
int exynos_drm_gem_userptr_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
+/* get buffer information to memory region allocated by gem. */
+int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+
/* initialize gem object. */
int exynos_drm_gem_init_object(struct drm_gem_object *obj);
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 48eda6e..63e7ee8 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -92,6 +92,21 @@ struct drm_exynos_gem_userptr {
};
/**
+ * A structure to gem information.
+ *
+ * @handle: a handle to gem object created.
+ * @flags: flag value including memory type and cache attribute and
+ * this value would be set by driver.
+ * @size: size to memory region allocated by gem and this size would
+ * be set by driver.
+ */
+struct drm_exynos_gem_info {
+ unsigned int handle;
+ unsigned int flags;
+ uint64_t size;
+};
+
+/**
* A structure for user connection request of virtual display.
*
* @connection: indicate whether doing connetion or not by user.
@@ -132,7 +147,8 @@ enum e_drm_exynos_gem_mem_type {
#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
#define DRM_EXYNOS_GEM_MMAP 0x02
#define DRM_EXYNOS_GEM_USERPTR 0x03
-/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
+#define DRM_EXYNOS_GEM_GET 0x04
+/* Reserved 0x04 ~ 0x05 for exynos specific gem ioctl */
#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
#define DRM_EXYNOS_VIDI_CONNECTION 0x07
@@ -148,6 +164,9 @@ enum e_drm_exynos_gem_mem_type {
#define DRM_IOCTL_EXYNOS_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + \
DRM_EXYNOS_GEM_USERPTR, struct drm_exynos_gem_userptr)
+#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
+
#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
--
1.7.4.1
prev parent reply other threads:[~2012-04-23 13:43 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 13:43 [PATCH 0/4] updated exynos-drm-next Inki Dae
2012-04-23 13:43 ` [PATCH 1/4] drm/exynos: added cache attribute support for gem Inki Dae
2012-04-23 13:43 ` [PATCH 2/4] drm/exynos: added drm prime feature Inki Dae
2012-04-23 13:43 ` [PATCH 3/4] drm/exynos: added userptr feature Inki Dae
2012-04-24 5:17 ` [PATCH v2 " Inki Dae
2012-04-25 10:15 ` Dave Airlie
2012-04-25 12:46 ` InKi Dae
2012-05-05 10:19 ` daeinki
2012-05-05 10:22 ` Dave Airlie
2012-05-07 18:18 ` Jerome Glisse
2012-05-08 7:59 ` Inki Dae
2012-05-08 15:05 ` Jerome Glisse
2012-05-08 6:48 ` Inki Dae
2012-05-09 6:17 ` [PATCH 0/2 v3] " Inki Dae
2012-05-09 6:17 ` [PATCH 1/2 v3] drm/exynos: added userptr limit ioctl Inki Dae
2012-05-09 6:17 ` [PATCH 2/2 v3] drm/exynos: added userptr feature Inki Dae
2012-05-09 14:45 ` Jerome Glisse
2012-05-09 18:32 ` Jerome Glisse
2012-05-10 2:44 ` Inki Dae
2012-05-10 15:05 ` Jerome Glisse
2012-05-10 15:31 ` Daniel Vetter
2012-05-10 15:52 ` Jerome Glisse
2012-05-11 1:47 ` Inki Dae
2012-05-11 2:08 ` Minchan Kim
2012-05-10 1:39 ` Inki Dae
2012-05-10 4:58 ` Minchan Kim
2012-05-10 6:53 ` KOSAKI Motohiro
2012-05-10 7:27 ` Minchan Kim
2012-05-10 7:31 ` Kyungmin Park
2012-05-10 7:56 ` Minchan Kim
2012-05-10 7:58 ` Minchan Kim
2012-05-10 6:57 ` Inki Dae
2012-05-10 7:05 ` Minchan Kim
2012-05-10 7:59 ` InKi Dae
2012-05-10 8:11 ` Minchan Kim
2012-05-10 8:44 ` Inki Dae
2012-05-10 17:53 ` KOSAKI Motohiro
2012-05-11 0:50 ` Minchan Kim
2012-05-11 2:51 ` KOSAKI Motohiro
2012-05-11 3:01 ` Jerome Glisse
2012-05-11 21:20 ` KOSAKI Motohiro
2012-05-11 22:22 ` Jerome Glisse
2012-05-11 22:59 ` KOSAKI Motohiro
2012-05-11 23:29 ` Jerome Glisse
2012-05-11 23:39 ` KOSAKI Motohiro
2012-05-12 4:48 ` InKi Dae
2012-05-14 4:29 ` Minchan Kim
2012-05-14 6:17 ` [PATCH 0/2 v4] " Inki Dae
2012-05-14 6:17 ` [PATCH 1/2 v4] drm/exynos: added userptr limit ioctl Inki Dae
2012-05-14 8:12 ` Inki Dae
2012-05-14 6:17 ` [PATCH 2/2 v4] drm/exynos: added userptr feature Inki Dae
2012-05-14 6:33 ` KOSAKI Motohiro
2012-05-14 6:52 ` Inki Dae
2012-05-14 7:04 ` KOSAKI Motohiro
2012-05-14 7:21 ` Inki Dae
2012-05-14 8:13 ` Inki Dae
2012-05-14 19:26 ` Jerome Glisse
2012-05-15 4:33 ` Inki Dae
2012-05-15 14:31 ` Jerome Glisse
2012-05-16 8:49 ` Inki Dae
2012-05-14 8:12 ` [PATCH 0/2 " Inki Dae
2012-05-15 7:34 ` [PATCH 3/4] " Rob Clark
2012-05-15 8:17 ` Inki Dae
2012-05-15 9:35 ` Rob Clark
2012-05-15 13:40 ` InKi Dae
2012-05-15 14:28 ` Rob Clark
2012-05-16 6:04 ` Inki Dae
2012-05-16 8:42 ` Rob Clark
2012-05-16 10:30 ` Inki Dae
2012-05-16 9:22 ` Dave Airlie
2012-05-16 10:20 ` Inki Dae
2012-05-16 12:12 ` Rob Clark
2012-05-16 13:27 ` Inki Dae
2012-04-23 13:43 ` Inki Dae [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1335188594-17454-5-git-send-email-inki.dae@samsung.com \
--to=inki.dae@samsung.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kyungmin.park@samsung.com \
--cc=sw0312.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox