From patchwork Sun Sep 7 21:30:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 4859481 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 4500AC0338 for ; Sun, 7 Sep 2014 21:31:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70A1420117 for ; Sun, 7 Sep 2014 21:31:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CD71720125 for ; Sun, 7 Sep 2014 21:31:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B88F6E213; Sun, 7 Sep 2014 14:31:44 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f169.google.com (mail-we0-f169.google.com [74.125.82.169]) by gabe.freedesktop.org (Postfix) with ESMTP id BF76E6E173 for ; Sun, 7 Sep 2014 14:31:42 -0700 (PDT) Received: by mail-we0-f169.google.com with SMTP id k48so14034435wev.14 for ; Sun, 07 Sep 2014 14:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X1PcuocEQQkwIddT1NYIY08R1SmogSHHWOX5Ia4xFc0=; b=CAjY6SnZuAIdPVso0h1Ma3ko3NZ1EGQ/uZ5V1LsvcVM/42BiJyKhg49hNJTI4q3P27 Iz/rgjMEoynC9kYK+jKMEX1IbqmLlMLL62Xb9mQ670eUi1kgeW3ov+4tmVbmKC68HEwV KHbx9oo3sjWOUbQ3TWkLAUK7x+hBiAyAO/FBYOl+EalTJfL92YWVBrHKmpfO1qaU+/O6 QvYCU+fx/wP3WvPcDx0BuB20FHfv4h9gVVgbrUQxD4Crz9OO2ZffkAcEsPQcf7dVxY5B ffDr/4Kupcs91xL3D9wDpAPG+efGgYYsEBy0wf2C59683cKr+y5NRf5AzArCZ033J63H +wsg== X-Received: by 10.194.82.106 with SMTP id h10mr29944688wjy.37.1410125502097; Sun, 07 Sep 2014 14:31:42 -0700 (PDT) Received: from localhost.localdomain (cpc20-stap10-2-0-cust563.12-2.cable.virginm.net. [82.20.130.52]) by mx.google.com with ESMTPSA id ub19sm9644662wib.9.2014.09.07.14.31.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Sep 2014 14:31:41 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 17/18] freedreno: use drm_mmap/drm_munmap wrappers Date: Sun, 7 Sep 2014 22:30:12 +0100 Message-Id: <1410125413-19465-18-git-send-email-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1410125413-19465-1-git-send-email-emil.l.velikov@gmail.com> References: <1410125413-19465-1-git-send-email-emil.l.velikov@gmail.com> Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-5.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Signed-off-by: Emil Velikov --- freedreno/freedreno_bo.c | 4 ++-- freedreno/freedreno_priv.h | 1 - freedreno/kgsl/kgsl_bo.c | 2 +- freedreno/kgsl/kgsl_ringbuffer.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 3a2e464..89d3330 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -288,7 +288,7 @@ out: static void bo_del(struct fd_bo *bo) { if (bo->map) - munmap(bo->map, bo->size); + drm_munmap(bo->map, bo->size); /* TODO probably bo's in bucket list get removed from * handle table?? @@ -351,7 +351,7 @@ drm_public void * fd_bo_map(struct fd_bo *bo) return NULL; } - bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, + bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->dev->fd, offset); if (bo->map == MAP_FAILED) { ERROR_MSG("mmap failed: %s", strerror(errno)); diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 416a3b3..48bff13 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index c868097..4e492dd 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -186,7 +186,7 @@ fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size) * thinks the buffer hasn't be allocate and fails */ if (bo) { - void *fbmem = mmap(NULL, size, PROT_READ | PROT_WRITE, + void *fbmem = drm_mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0); struct kgsl_map_user_mem req = { .memtype = KGSL_USER_MEM_TYPE_ADDR, diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c index dc3c9c2..da99741 100644 --- a/freedreno/kgsl/kgsl_ringbuffer.c +++ b/freedreno/kgsl/kgsl_ringbuffer.c @@ -60,7 +60,7 @@ static void kgsl_rb_bo_del(struct kgsl_rb_bo *bo) }; int ret; - munmap(bo->hostptr, bo->size); + drm_munmap(bo->hostptr, bo->size); ret = ioctl(bo->pipe->fd, IOCTL_KGSL_SHAREDMEM_FREE, &req); if (ret) { @@ -93,7 +93,7 @@ static struct kgsl_rb_bo * kgsl_rb_bo_new(struct kgsl_pipe *pipe, uint32_t size) bo->pipe = pipe; bo->gpuaddr = req.gpuaddr; bo->size = size; - bo->hostptr = mmap(NULL, size, PROT_WRITE|PROT_READ, + bo->hostptr = drm_mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED, pipe->fd, req.gpuaddr); return bo;