From patchwork Tue Jul 16 07:12:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2827984 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 5F6BB9F9CA for ; Tue, 16 Jul 2013 07:36:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7142920142 for ; Tue, 16 Jul 2013 07:36:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7F1E42011F for ; Tue, 16 Jul 2013 07:36:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 304BDE6B44 for ; Tue, 16 Jul 2013 00:36:35 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f175.google.com (mail-ea0-f175.google.com [209.85.215.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A91DE646B for ; Tue, 16 Jul 2013 00:17:25 -0700 (PDT) Received: by mail-ea0-f175.google.com with SMTP id z7so155224eaf.20 for ; Tue, 16 Jul 2013 00:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=Qly1YY4Aqpw5I/F0g/Y/uWwTF/HpidALgSsF87bNWoM=; b=joMW3kSPXN9AOcKGfiUDPrSfhdOZ9RcKnRojn0HXQGLDIs9M/xXcER78yRH2opBbmt PoPlPQ3rb/I4ENl1XMSM95O6p2nFRksmOOsu8JNhbg1IAACoGc4IEkwN4jG12iY9DtdU whFR+J7GHr/uv2wpRzywLbpvqOKlVI3b+xpq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Qly1YY4Aqpw5I/F0g/Y/uWwTF/HpidALgSsF87bNWoM=; b=Qd4ITX6oCTFZrpMv9HurJ6Gc3TWmJOAK947u2xri8A6Jj73i62lYrFiO7Y6al1EMRW G72EasfuHFNjQL+3ctUxK+ZOASLqyTSiOqBr8eKSpxpTIGwvzrXraA8dxJ9nThdK59qq QsooMNAY5P4bVLEzAbsEMpA6plwPa+VrzR02Yb3Zcf6hrLIP6vIzZm5xE0W/wYEU9iSi XHiHVGJ4USuhioWCUtBTQ7HrL8xOpthUUVdMoPtXKoBsUZs3vr7xYMbmD+trBYjA91lk VERkZx4WY+kusUcs+0PZcubV8knsQCXDDlkkW4UAMjYSmF/syS/nbxex6W9GOMJm9kzf M2NQ== X-Received: by 10.14.29.69 with SMTP id h45mr92873eea.127.1373959044844; Tue, 16 Jul 2013 00:17:24 -0700 (PDT) Received: from aaron.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id n5sm283897eed.9.2013.07.16.00.17.23 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Jul 2013 00:17:24 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 20/20] drm/prime: Simplify drm_gem_remove_prime_handles Date: Tue, 16 Jul 2013 09:12:11 +0200 Message-Id: <1373958731-4132-21-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1373958731-4132-1-git-send-email-daniel.vetter@ffwll.ch> References: <1373958731-4132-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQlfBuz0iiP67pOGu0YCkY23tIiHivoooBIxXdmQsQVDXlffvB4vSD1i49Q9XLhBvmGt0EmI Cc: Daniel Vetter 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=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 with the reworking semantics and locking of the obj->dma_buf pointer this pointer is always set as long as there's still a gem handle around and a dma_buf associated with this gem object. Also, the per file-priv lookup-cache for dma-buf importing is also unified between foreign and native objects. Hence we don't need to special case the clean any more and can simply drop the clause which only runs for foreing objects, i.e. with obj->import_attach set. Note that with this change (actually with the previous one to always set up obj->dma_buf even for foreign objects) it is no longer required to set obj->import_attach when importing a foreing object. So update comments accordingly, too. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_gem.c | 5 ----- include/drm/drmP.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 44ee16b..a2b1470 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -200,11 +200,6 @@ EXPORT_SYMBOL(drm_gem_object_alloc); static void drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp) { - if (obj->import_attach) { - drm_prime_remove_buf_handle(&filp->prime, - obj->import_attach->dmabuf); - } - /* * Note: obj->dma_buf can't disappear as long as we still hold a * handle reference in obj->handle_count. diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c19cc2b..13fe22a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -706,6 +706,11 @@ struct drm_gem_object { * * The driver's ->gem_free_object callback is responsible for cleaning * up the dma_buf attachment and references acquired at import time. + * + * Note that the drm gem/prime core does not depend upon drivers setting + * this field any more. So for drivers where this doesn't make sense + * (e.g. virtual devices or a displaylink behind an usb bus) they can + * simply leave it as NULL. */ struct dma_buf_attachment *import_attach; };