From patchwork Mon Jan 11 21:41:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8011761 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EF885BEEE5 for ; Mon, 11 Jan 2016 21:42:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06D672021B for ; Mon, 11 Jan 2016 21:42:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0D9EC20173 for ; Mon, 11 Jan 2016 21:42:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F13B4720B9; Mon, 11 Jan 2016 13:42:07 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id EDBF07206B for ; Mon, 11 Jan 2016 13:41:35 -0800 (PST) Received: by mail-wm0-f67.google.com with SMTP id u188so28131628wmu.0 for ; Mon, 11 Jan 2016 13:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wkOwA5EXsltKwkX19xzxaOTDcfS3FyOvqyRizTT4xWA=; b=Umm3QUWefpdZ2VX3C+7bkuUhkbvq+gBmGp+2WO1nISknUCBuz/kXRt6n6/orqXMuIe OK5m0kOBCkSkuEd5yaRQVT3dJ/xnggCyljQ5WGkWp5IhOWUJvytqlFF7JMlt+tH8ow65 lTLK2cd8mRE4yUqzxffDOhE4bXjO/dcrGqNUM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wkOwA5EXsltKwkX19xzxaOTDcfS3FyOvqyRizTT4xWA=; b=TGPNM3M8D/Zir3Pr70LKcgdM1FOJWA5bmvjAcvc/uUbxIkWrZEJIiEAuPC5SNZ17vS 4DeO1MA1ZxGDRockVB1SGHXHQD0EZuqHuzYfMLKXGAdQV3rgZuZkBdGLzcmnNGFEg8Qw KYBO7QEiZM0Nxex/OsnF8+C6BVFcY6BMUUFFz1byGU6nxHJYlrsI8tL7ahIO99MpedJY KqFGHhHY1YBWUWDvpai2WXz9z//ObWruri37Gx6kwLpzkkwdDWidexqhztxZ3FmMXGoc BOl/jxoGBn4eJpVv92eehOixRIl0lxBr6pndBJc6d9wv8za0C+bnECeNpb1fb5t8xLHZ /JjA== X-Gm-Message-State: ALoCoQl9DYMvGMLw+TUazQndaIXreL1exWAy5sdF72gZmOS1d6ulGDQ3/DiuXwJ+yb2FwJUexDo4WVRM4yCh7ALDRpBUyMonSQ== X-Received: by 10.28.183.132 with SMTP id h126mr16349483wmf.6.1452548494558; Mon, 11 Jan 2016 13:41:34 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id c203sm14629237wmd.5.2016.01.11.13.41.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 13:41:33 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 14/22] drm/imx: Unconfuse preclose logic Date: Mon, 11 Jan 2016 22:41:08 +0100 Message-Id: <1452548477-15905-15-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1452548477-15905-1-git-send-email-daniel.vetter@ffwll.ch> References: <1452548477-15905-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter 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.1 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 So this one is special, since it tries to prevent races when userspace crashes simply by disabling the vblank machinery. Well except that imx always has vblanks enabled, and the disable_vblank hook actually just tries to cancel a pending pageflip. Without any locking whatsoever. Of course this is wrong, since it'll result in the hw not actually displaying what drm thinks is the current frontbuffer. Well since the core takes care of the disappearing DRM fd now. So we can nuke all this confused code without ill side-effects. Someone else needs to audit the locking for ->newfb and ->page_flip_event and fix it up. Common approach is to reuse dev->event_lock for this. Cc: Sascha Hauer Cc: Philipp Zabel Acked-by: Daniel Stone Reviewed-by: Alex Deucher Signed-off-by: Daniel Vetter Acked-by: Philipp Zabel --- drivers/gpu/drm/imx/imx-drm-core.c | 13 ------------- drivers/gpu/drm/imx/ipuv3-crtc.c | 4 ---- 2 files changed, 17 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 7be7ac808304..ff94ca4a2c1e 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -171,18 +171,6 @@ static void imx_drm_disable_vblank(struct drm_device *drm, unsigned int pipe) imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc); } -static void imx_drm_driver_preclose(struct drm_device *drm, - struct drm_file *file) -{ - int i; - - if (!file->is_master) - return; - - for (i = 0; i < MAX_CRTC; i++) - imx_drm_disable_vblank(drm, i); -} - static const struct file_operations imx_drm_driver_fops = { .owner = THIS_MODULE, .open = drm_open, @@ -462,7 +450,6 @@ static struct drm_driver imx_drm_driver = { .load = imx_drm_driver_load, .unload = imx_drm_driver_unload, .lastclose = imx_drm_driver_lastclose, - .preclose = imx_drm_driver_preclose, .set_busid = drm_platform_set_busid, .gem_free_object = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 30a57185bdb4..846b5f558897 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c @@ -285,10 +285,6 @@ static int ipu_enable_vblank(struct drm_crtc *crtc) static void ipu_disable_vblank(struct drm_crtc *crtc) { - struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); - - ipu_crtc->page_flip_event = NULL; - ipu_crtc->newfb = NULL; } static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc,