From patchwork Sun Sep 7 21:30:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 4859501 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 EF6F0C0338 for ; Sun, 7 Sep 2014 21:31:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5766E20117 for ; Sun, 7 Sep 2014 21:31:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A113920122 for ; Sun, 7 Sep 2014 21:31:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6E796E173; Sun, 7 Sep 2014 14:31:45 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) by gabe.freedesktop.org (Postfix) with ESMTP id E5F176E208 for ; Sun, 7 Sep 2014 14:31:43 -0700 (PDT) Received: by mail-we0-f174.google.com with SMTP id t60so303204wes.33 for ; Sun, 07 Sep 2014 14:31:43 -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=tsqhNi8NTPlMZHLZPzoF9Xogl/T5dWbqngWWs65+9cE=; b=WSdOapR2ooDG+Hk1yn+j7TRIELow2HSYqn0bnz3n7GmxaUdIhUxz4Ee3qT23ljFtwN t31wR6R7XD+EjPqtYteF5MW0Mb3kSYRytzxIR8UhoKDLjYg4Wq6odiO5At1sA41BwaVQ LcDl1h7Sogy4awvZXwVu/7vl6FBq7qZz1xFV52ebSu6msuGmK3uxmPbZDP4PWvKW/P// l39W7dmkTAC0t2F99ozHWKPaazezpahwunkJBNp06vgi45DEsfJ6GfyRdsjt4YGmtyi9 YWOxdDDc3TPhG3KfMzg2UBqi49IOcSIja1AFL1UFzzjnzHx0hhNkLcGAXNmclXRecRUA fyEg== X-Received: by 10.194.21.234 with SMTP id y10mr19385478wje.42.1410125503226; Sun, 07 Sep 2014 14:31:43 -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.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Sep 2014 14:31:42 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 18/18] intel: use drm_mmap/drm_munmap wrappers Date: Sun, 7 Sep 2014 22:30:13 +0100 Message-Id: <1410125413-19465-19-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 --- intel/intel_bufmgr_gem.c | 15 +++++++-------- intel/test_decode.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 0e1cb0d..a527f41 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -955,11 +954,11 @@ drm_intel_gem_bo_free(drm_intel_bo *bo) DRMLISTDEL(&bo_gem->vma_list); if (bo_gem->mem_virtual) { VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_virtual, 0)); - munmap(bo_gem->mem_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; } if (bo_gem->gtt_virtual) { - munmap(bo_gem->gtt_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); bufmgr_gem->vma_count--; } @@ -1044,12 +1043,12 @@ static void drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem) DRMLISTDELINIT(&bo_gem->vma_list); if (bo_gem->mem_virtual) { - munmap(bo_gem->mem_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size); bo_gem->mem_virtual = NULL; bufmgr_gem->vma_count--; } if (bo_gem->gtt_virtual) { - munmap(bo_gem->gtt_virtual, bo_gem->bo.size); + drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size); bo_gem->gtt_virtual = NULL; bufmgr_gem->vma_count--; } @@ -1271,9 +1270,9 @@ map_gtt(drm_intel_bo *bo) } /* and mmap it */ - bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE, - MAP_SHARED, bufmgr_gem->fd, - mmap_arg.offset); + bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, + MAP_SHARED, bufmgr_gem->fd, + mmap_arg.offset); if (bo_gem->gtt_virtual == MAP_FAILED) { bo_gem->gtt_virtual = NULL; ret = -errno; diff --git a/intel/test_decode.c b/intel/test_decode.c index bef9d99..d7025f0 100644 --- a/intel/test_decode.c +++ b/intel/test_decode.c @@ -32,9 +32,9 @@ #include #include #include -#include #include +#include "libdrm.h" #include "intel_bufmgr.h" #include "intel_chipset.h" @@ -64,7 +64,7 @@ read_file(const char *filename, void **ptr, size_t *size) errx(1, "couldn't stat `%s'", filename); *size = st.st_size; - *ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + *ptr = drm_mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); if (*ptr == MAP_FAILED) errx(1, "couldn't map `%s'", filename);