From patchwork Thu Sep 29 03:42:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9355707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3451C60756 for ; Thu, 29 Sep 2016 03:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BAEE297D0 for ; Thu, 29 Sep 2016 03:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E762297D3; Thu, 29 Sep 2016 03:29:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E62D5297D0 for ; Thu, 29 Sep 2016 03:29:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDC026E0C7; Thu, 29 Sep 2016 03:29:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id B8CD26E0C7; Thu, 29 Sep 2016 03:29:40 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 28 Sep 2016 20:29:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,413,1470726000"; d="scan'208"; a="1047264934" Received: from skynet.jf.intel.com ([10.54.75.28]) by fmsmga001.fm.intel.com with ESMTP; 28 Sep 2016 20:29:40 -0700 From: Dhinakaran Pandiyan To: dri-devel@lists.freedesktop.org Date: Wed, 28 Sep 2016 20:42:00 -0700 Message-Id: <1475120520-20156-1-git-send-email-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.5.0 Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, Dhinakaran Pandiyan , Tomeu Vizoso , Emil Velikov Subject: [Intel-gfx] [PATCH] drm: Add frame CRC debugfs files only for drivers that have CRTC X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP vgem does not do modeset, looping through non-existent CRTC's while registering drm_minor in 'commit 48c787899882 ("drm: Add API for capturing frame CRCs")' caused kernel oops. So, let's add CRC debugfs files only for those drivers that do modeset. Signed-off-by: Dhinakaran Pandiyan Cc: Tomeu Vizoso Cc: Daniel Vetter Cc: Emil Velikov Reviewed-by: Tomeu Vizoso Reviewed-by: Emil Velikov --- drivers/gpu/drm/drm_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 70d2543..294404f 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -208,6 +208,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) struct drm_crtc *crtc; unsigned long flags; int ret; + bool is_modeset; DRM_DEBUG("\n"); @@ -221,7 +222,8 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) return ret; } - if (type == DRM_MINOR_PRIMARY) { + is_modeset = drm_core_check_feature(dev, DRIVER_MODESET); + if (type == DRM_MINOR_PRIMARY && is_modeset) { drm_for_each_crtc(crtc, dev) { ret = drm_debugfs_crtc_add(crtc); if (ret) @@ -255,12 +257,14 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type) struct drm_minor *minor; struct drm_crtc *crtc; unsigned long flags; + bool is_modeset; minor = *drm_minor_get_slot(dev, type); if (!minor || !device_is_registered(minor->kdev)) return; - if (type == DRM_MINOR_PRIMARY) { + is_modeset = drm_core_check_feature(dev, DRIVER_MODESET); + if (type == DRM_MINOR_PRIMARY && is_modeset) { drm_for_each_crtc(crtc, dev) drm_debugfs_crtc_remove(crtc); }