From patchwork Wed Mar 13 09:04:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 2262461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 16A1A3FD8C for ; Wed, 13 Mar 2013 09:09:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D69A6E6830 for ; Wed, 13 Mar 2013 02:09:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D73EE6828 for ; Wed, 13 Mar 2013 02:04:19 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJL003E5D6OA950@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 13 Mar 2013 18:04:19 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.45]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 27.AB.05174.31140415; Wed, 13 Mar 2013 18:04:19 +0900 (KST) X-AuditID: cbfee68f-b7f4a6d000001436-e8-514041130727 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id CB.84.17838.31140415; Wed, 13 Mar 2013 18:04:19 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.8.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJL00EZID762J30@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 13 Mar 2013 18:04:19 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH 6/7] drm/exynos: Add a new function to get gem buffer size Date: Wed, 13 Mar 2013 18:04:18 +0900 Message-id: <1363165458-7550-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t8zXV1hR4dAg1uf+CyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxoG5j5kK5gpUvPqwi72B8QhvFyMnh4SAicTc3TvYIWwxiQv3 1rN1MXJxCAksY5TofreHGaao9cl7ZojEIkaJp3tesUI465gkPvQ+ZgOpYhNQlZi44j6YLSJg KtExaSkLiM0skCbx/ftesBXCAl4Sty+9ZgKxWYDqt8yfCFbDK+As0TzzMyPENgWJBffegp0h IbCDTaL39jRWiAYBiW+TDwE1cAAlZCU2HYC6TlLi4IobLBMYBRcwMqxiFE0tSC4oTkovMtYr TswtLs1L10vOz93ECAmr/h2Mdw9YH2JMBho3kVlKNDkfGJZ5JfGGxmZGFqYmpsZG5pZmpAkr ifOqtVgHCgmkJ5akZqemFqQWxReV5qQWH2Jk4uCUamD0+i/v0mdl0Mya1dqfXHGx0/PogxT9 l9lLWh8fOTy1RTGlhXXLngXxj4tqAursdz0Lvrvl5oHrXxRD1xfMyWfMl1pldtN0+7rvqm4O MmaPj7s2hmSpeF5aPX199IYrL+Lzl7SKru8XqF6rIXF4oe/iC+dqt12N2+dTdN2ktu3XTqVV K72ZNfyUWIozEg21mIuKEwEoESg5QQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xgK6wo0OgwZR77BZXvr5nc2D0uN99 nCmAMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH aKySQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCOMePA3MdMBXMFKl592MXe wHiEt4uRk0NCwESi9cl7ZghbTOLCvfVsXYxcHEICixglnu55xQrhrGOS+ND7mA2kik1AVWLi ivtgtoiAqUTHpKUsIDazQJrE9+972UFsYQEviduXXjOB2CxA9VvmTwSr4RVwlmie+ZkRYpuC xIJ7b9kmMHIvYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iREctM+kdjCubLA4xCjAwajE wyvw1T5QiDWxrLgy9xCjBAezkgjvNxuHQCHelMTKqtSi/Pii0pzU4kOMyUDbJzJLiSbnAyMq ryTe0NjEzMjSyMzYxNzYmDRhJXHeA63WgUIC6YklqdmpqQWpRTBbmDg4pRoYlWXWyzLM/HW7 ptvu+tuLJ1i7RfPsFjHavFQ7WqKdmvSmRexJpI6avcKbb9JHIyZsyNartD23RHD5qo+x/zuP 6CRaS8yY/zzFxS/Z+djZH0/v3C3Z5MqiWv7qZLJTZdeJX2ce3/hxKHnWJPEHFV5xzsrb7+2X K5iXfUNLaefk758ml3a8483qUmIpzkg01GIuKk4EAIuf5bueAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org This patch adds a new function to get gem buffer size. And this funtion could be used for g2d driver or others can get gem buffer size to check if the buffer is valid or not. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 21 +++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_gem.h | 5 +++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 67e17ce..0e6fe00 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -164,6 +164,27 @@ out: exynos_gem_obj = NULL; } +unsigned long exynos_drm_gem_get_size(struct drm_device *dev, + unsigned int gem_handle, + struct drm_file *file_priv) +{ + struct exynos_drm_gem_obj *exynos_gem_obj; + struct drm_gem_object *obj; + + obj = drm_gem_object_lookup(dev, file_priv, gem_handle); + if (!obj) { + DRM_ERROR("failed to lookup gem object.\n"); + return 0; + } + + exynos_gem_obj = to_exynos_gem_obj(obj); + + drm_gem_object_unreference_unlocked(obj); + + return exynos_gem_obj->buffer->size; +} + + struct exynos_drm_gem_obj *exynos_drm_gem_init(struct drm_device *dev, unsigned long size) { diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 35ebac4..468766b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -130,6 +130,11 @@ int exynos_drm_gem_userptr_ioctl(struct drm_device *dev, void *data, int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); +/* get buffer size to gem handle. */ +unsigned long exynos_drm_gem_get_size(struct drm_device *dev, + unsigned int gem_handle, + struct drm_file *file_priv); + /* initialize gem object. */ int exynos_drm_gem_init_object(struct drm_gem_object *obj);