From patchwork Tue Aug 13 19:38:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2843974 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C18909F239 for ; Tue, 13 Aug 2013 19:44:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB0042045E for ; Tue, 13 Aug 2013 19:44:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E2EC020457 for ; Tue, 13 Aug 2013 19:44:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3DA7E7C3C for ; Tue, 13 Aug 2013 12:44:44 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f169.google.com (mail-ea0-f169.google.com [209.85.215.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 64C80E7C64 for ; Tue, 13 Aug 2013 12:39:56 -0700 (PDT) Received: by mail-ea0-f169.google.com with SMTP id z7so4375767eaf.0 for ; Tue, 13 Aug 2013 12:39:55 -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=KW9bvJjx84cYI0m99MR8ZGP5W6Qe+WvFIUONgyi7XZU=; b=FoXWseu8R0S+c3BALI3vA3P2+8HziIEB/rPVAXWIv3LZuKvPiNw8e5IUyLmhQeqWPI DSk84i82uYENDl+VKU00CN/roxb6rXHzz3a9nh0+IplheiLdT3Fz/dBPpsujcMAAfQEj p4rPrb2o7OfYogUfaEQk7LXxOYRAsLjTY+tOJi4eY8xowdBnqTtCDOI/UN3BFDQdHEYI 7GyMtgHL668DH73uGm1kSpBE0CyBgpaBsMWFO1tcDn7g9Ia4MMVURNffI15hlY0NcCVB NN6PhvehdK8sH+Zf2QrTaR+uC+i+1MNmX8EU6hvL+BS755xTBIsyDEM7rYgff3HGCZfw Tx6Q== X-Received: by 10.14.225.199 with SMTP id z47mr8720812eep.24.1376422795579; Tue, 13 Aug 2013 12:39:55 -0700 (PDT) Received: from localhost.localdomain (stgt-5f71b8eb.pool.mediaWays.net. [95.113.184.235]) by mx.google.com with ESMTPSA id a1sm68812938eem.1.2013.08.13.12.39.54 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 12:39:54 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 02/16] drm/ast: implement mmap access managament Date: Tue, 13 Aug 2013 21:38:23 +0200 Message-Id: <1376422717-12229-3-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1376422717-12229-1-git-send-email-dh.herrmann@gmail.com> References: <1376422717-12229-1-git-send-email-dh.herrmann@gmail.com> Cc: Dave Airlie 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 X-Spam-Status: No, score=-6.9 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 Correctly allow and revoke buffer access on each open/close via the new VMA offset manager. Cc: Dave Airlie Signed-off-by: David Herrmann --- drivers/gpu/drm/ast/ast_drv.c | 2 ++ drivers/gpu/drm/ast/ast_drv.h | 4 ++++ drivers/gpu/drm/ast/ast_main.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index a144fb0..bc6f2c5 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -214,6 +214,8 @@ static struct drm_driver driver = { .gem_init_object = ast_gem_init_object, .gem_free_object = ast_gem_free_object, + .gem_open_object = ast_gem_open_object, + .gem_close_object = ast_gem_close_object, .dumb_create = ast_dumb_create, .dumb_map_offset = ast_dumb_mmap_offset, .dumb_destroy = drm_gem_dumb_destroy, diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index 796dbb2..e6ab966 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -325,6 +325,10 @@ extern int ast_dumb_create(struct drm_file *file, extern int ast_gem_init_object(struct drm_gem_object *obj); extern void ast_gem_free_object(struct drm_gem_object *obj); +extern int ast_gem_open_object(struct drm_gem_object *obj, + struct drm_file *file_priv); +extern void ast_gem_close_object(struct drm_gem_object *obj, + struct drm_file *file_priv); extern int ast_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev, uint32_t handle, diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 7f6152d..b7b4b16 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -477,6 +477,21 @@ void ast_gem_free_object(struct drm_gem_object *obj) ast_bo_unref(&ast_bo); } +int ast_gem_open_object(struct drm_gem_object *obj, + struct drm_file *file_priv) +{ + struct ast_bo *ast_bo = gem_to_ast_bo(obj); + + return drm_vma_node_allow(&ast_bo->bo.vma_node, file_priv->filp); +} + +void ast_gem_close_object(struct drm_gem_object *obj, + struct drm_file *file_priv) +{ + struct ast_bo *ast_bo = gem_to_ast_bo(obj); + + drm_vma_node_revoke(&ast_bo->bo.vma_node, file_priv->filp); +} static inline u64 ast_bo_mmap_offset(struct ast_bo *bo) {