From patchwork Fri Dec 12 05:44:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyungwon Hwang X-Patchwork-Id: 5478981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EA073BEEA8 for ; Fri, 12 Dec 2014 05:45:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF0FC20122 for ; Fri, 12 Dec 2014 05:45:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3027F200DB for ; Fri, 12 Dec 2014 05:44:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8DEE6E252; Thu, 11 Dec 2014 21:44:56 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id F27406E252 for ; Thu, 11 Dec 2014 21:44:54 -0800 (PST) Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGG00MIYFYT4PD0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 12 Dec 2014 14:44:53 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.116]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 7A.BB.18167.5D08A845; Fri, 12 Dec 2014 14:44:53 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-70-548a80d506a1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 11.40.20081.5D08A845; Fri, 12 Dec 2014 14:44:53 +0900 (KST) Received: from localhost.localdomain ([10.88.98.185]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGG00CWJFYQ7MF0@mmp1.samsung.com>; Fri, 12 Dec 2014 14:44:53 +0900 (KST) From: Hyungwon Hwang To: dri-devel@lists.freedesktop.org Subject: [PATCH RESEND 1/2] exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls Date: Fri, 12 Dec 2014 14:44:39 +0900 Message-id: <1418363080-11638-1-git-send-email-human.hwang@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGLMWRmVeSWpSXmKPExsWyRsSkRPdqQ1eIwYlv4hZXvr5ns1g6o4/V YtL9CSwWL+5dZHFg8bjffZzJo2/LKsYApigum5TUnMyy1CJ9uwSujDk7djAVfBOu2Pmvm7mB sV+gi5GDQ0LAROLufesuRk4gU0ziwr31bF2MXBxCAksZJX7v/M0EkTCRuLiyESqxiFFixbRj jBBOK5PE3mufGUGq2AT0JBZc+8EOYosIKEv8nbgKLM4sECvx7M1TsEnCAuES057sB6thEVCV uHXkIBuIzSvgLrH06mFGiG1yEiePTWYFWSAhcJlN4syMN6wQDQIS3yYfYoE4W1Zi0wFmiHpJ iYMrbrBMYBRcwMiwilE0tSC5oDgpvchErzgxt7g0L10vOT93EyMw+E7/ezZhB+O9A9aHGAU4 GJV4eF+kdoUIsSaWFVfmHmI0BdowkVlKNDkfGOJ5JfGGxmZGFqYmpsZG5pZmSuK8r6V+BgsJ pCeWpGanphakFsUXleakFh9iZOLglGpg5AyZNmPanzd/f6+e0xvWN//aEW3z839eqj0qdv0w R/AoJ/tRph9pC22Db9s8nGLe7OxRdWvbNKWJ8rcPr2jJXeZ/cv+9/x+z/uhH/7k3Ie7edpUr P9c813+vdy5W6zW/HN/tZ+V7ypw9d+6RPuAWZJDXPkErtv1j0i4lMXajgjU6cfrTmEtEZymx FGckGmoxFxUnAgAB1MxaOQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsVy+t9jAd2rDV0hBjOmClhc+fqezWLpjD5W i0n3J7BYvLh3kcWBxeN+93Emj74tqxgDmKIaGG0yUhNTUosUUvOS81My89JtlbyD453jTc0M DHUNLS3MlRTyEnNTbZVcfAJ03TJzgFYpKZQl5pQChQISi4uV9O0wTQgNcdO1gGmM0PUNCYLr MTJAAwlrGDPm7NjBVPBNuGLnv27mBsZ+gS5GTg4JAROJiysb2SBsMYkL99YD2VwcQgKLGCVW TDvGCOG0MknsvfaZEaSKTUBPYsG1H+wgtoiAssTfiavA4swCsRLP3jxlArGFBcIlpj3ZD1bD IqAqcevIQbANvALuEkuvHmaE2CYncfLYZNYJjNwLGBlWMYqmFiQXFCel5xrqFSfmFpfmpesl 5+duYgQH9zOpHYwrGywOMQpwMCrx8L5I7QoRYk0sK67MPcQowcGsJML7NwooxJuSWFmVWpQf X1Sak1p8iNEUaPtEZinR5Hxg5OWVxBsam5gZWRqZG1oYGZsrifMq2beFCAmkJ5akZqemFqQW wfQxcXBKNTBKTq3eL3xW765/SIrptTs1eQF7PLw+/5wXIrjN8YxKvOfVBXWebYUblA8qmvSH Ti1S4NV++YPHQ9vh/owj7vP1Dwh8en1NsvZn2fNHyt9WPr1huK+tRrsrNHPy5V1lZdfbtWYp R62oDJ5wWoJDMsZar8HrVMsut6/8J5ZNZOOe/3MTw5HiW7JKLMUZiYZazEXFiQCSQKhzhAIA AA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: Hyungwon Hwang X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ioctl DRM_EXYNOS_GEM_MAP_OFFSET and DRM_EXYNOS_GEM_MMAP are removed from the linux kernel. This patch modifies libdrm and libkms to use drm generic ioctls instead of the removed ioctls. Signed-off-by: Hyungwon Hwang Signed-off-by: Inki Dae --- exynos/exynos_drm.c | 24 +++++++++++++----------- libkms/exynos.c | 7 ++++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c index 4c7dd13..4cb6a6d 100644 --- a/exynos/exynos_drm.c +++ b/exynos/exynos_drm.c @@ -283,20 +283,22 @@ drm_public void *exynos_bo_map(struct exynos_bo *bo) { if (!bo->vaddr) { struct exynos_device *dev = bo->dev; - struct drm_exynos_gem_mmap req = { - .handle = bo->handle, - .size = bo->size, - }; + struct drm_mode_map_dumb arg; + void *map = NULL; int ret; - ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_MMAP, &req); - if (ret) { - fprintf(stderr, "failed to mmap[%s].\n", - strerror(errno)); - return NULL; - } + memset(&arg, 0, sizeof(arg)); + arg.handle = bo->handle; + + ret = drmIoctl(dev->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg); + if (ret) + return ret; - bo->vaddr = (void *)(uintptr_t)req.mapped; + map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, + dev->fd, arg.offset); + + if (map == MAP_FAILED) + return NULL; } return bo->vaddr; diff --git a/libkms/exynos.c b/libkms/exynos.c index 92e329c..1123482 100644 --- a/libkms/exynos.c +++ b/libkms/exynos.c @@ -25,6 +25,7 @@ #include #include "xf86drm.h" +#include "libdrm.h" #include "exynos_drm.h" struct exynos_bo @@ -124,7 +125,7 @@ static int exynos_bo_map(struct kms_bo *_bo, void **out) { struct exynos_bo *bo = (struct exynos_bo *)_bo; - struct drm_exynos_gem_map_off arg; + struct drm_mode_map_dumb arg; void *map = NULL; int ret; @@ -137,11 +138,11 @@ exynos_bo_map(struct kms_bo *_bo, void **out) memset(&arg, 0, sizeof(arg)); arg.handle = bo->base.handle; - ret = drmCommandWriteRead(bo->base.kms->fd, DRM_EXYNOS_GEM_MAP_OFFSET, &arg, sizeof(arg)); + ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg); if (ret) return ret; - map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); + map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); if (map == MAP_FAILED) return -errno;