From patchwork Mon Jan 25 21:16:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8115661 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 8355CBEEE5 for ; Mon, 25 Jan 2016 21:17:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9553820380 for ; Mon, 25 Jan 2016 21:17:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C34D920379 for ; Mon, 25 Jan 2016 21:17:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E72566E558; Mon, 25 Jan 2016 13:17:09 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE2D86E194 for ; Mon, 25 Jan 2016 13:17:04 -0800 (PST) Received: by mail-wm0-f68.google.com with SMTP id u188so13692473wmu.0 for ; Mon, 25 Jan 2016 13:17:04 -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=LSCvA9ZzE0LqSQ5GGKPfnhUaKpHSRwcC2saX9E/orMs=; b=WalIxuduhoVP5kmeeVfR+JKjv9zjX2yJHzD6HDU8lsTqbPm8DmgGcV5RdEHJQ9i8q1 +Cr9REDkHfL+asl2hpxtnSFuAVvPLCFqMshKVKTZNImwkChruDwLpZc3ePUSkfSeWEAl hPaReUxyFpOrZkrIY2/ZaKFy/DNBl8Xw0i7ao= 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=LSCvA9ZzE0LqSQ5GGKPfnhUaKpHSRwcC2saX9E/orMs=; b=irSNxVrI8KfaahoAQEgNEHs77GAdrZ8VclVWHEGhUmV/mV8KHdgPf4DHo+aiVqJZZp 1ZjQndzPpiNdJLc2KlO3UpMmh5nFOYUrPx52SA1selUbep1dxcUUglq8wGrLxXuhnNoI LZTZQ73siJkAnZ+qnLgSEFpiHdrYbg9uTy8KCU/M+HLsDZ1eMdYOlVPvwDbJKh+uQz9Q n/XaRml7PvRwE4sbTD1oAbMcuFyz3GmY71Ftz5C81+k3SERyAwVTyyFj4PDOkEpeBkTb jnDubKYnQUg1Ed5vrBTg2UfbQ6N2M0nF7sxXFQwgXNqDTaVB4OMB/qQOXEmmaQRWMzvN Jpvg== X-Gm-Message-State: AG10YOTbOu1EZITqSHYQ+tT6bduRkn8JBzSUP5rSfiR/BCcvmQQnFm0TLjSpdoA4pk7PYw== X-Received: by 10.28.210.143 with SMTP id j137mr20070212wmg.13.1453756623496; Mon, 25 Jan 2016 13:17:03 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:56c9:0:22cf:30ff:fe4c:37d6]) by smtp.gmail.com with ESMTPSA id y124sm515441wmg.3.2016.01.25.13.17.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jan 2016 13:17:02 -0800 (PST) From: Daniel Vetter To: DRI Development , Intel Graphics Development Subject: [PATCH 07/15] drm/imx: Unconfuse preclose logic Date: Mon, 25 Jan 2016 22:16:48 +0100 Message-Id: <1453756616-28942-7-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <1453756616-28942-1-git-send-email-daniel.vetter@ffwll.ch> References: <1453756616-28942-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , 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 Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-15-git-send-email-daniel.vetter@ffwll.ch Acked-by: Philipp Zabel Signed-off-by: Daniel Vetter --- 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 2f57d7967417..7c4d1250e071 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, @@ -463,7 +451,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,