Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4062407ybh; Tue, 6 Aug 2019 05:47:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6FI3PWmdhmiIJw1Z1wf87PkvGHgcF+/1gCvCL+J7lil2d1xsI05qu6bKvCaSMSdMqZ80O X-Received: by 2002:a17:902:8489:: with SMTP id c9mr3065865plo.327.1565095647475; Tue, 06 Aug 2019 05:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565095647; cv=none; d=google.com; s=arc-20160816; b=rTcOqEtiof0+iK9VJAwFBFDSQ/Zh55C0+x5NN7lD9X2DNd7YgxsC5N9eLEWnMWIUUJ ZOEbISAEeeqtq0MROzGen+Xnt/QObap1/zmSIY/6qLXawDfusF1pOG5X58VnwY5/USUc 4J8LD7fhzJItfK8a7D1wXoXw7WcqucwmaYSST9mDFrvaqH0w4x/F01q4MfH2SQGumxQp o96jzGwqEiSKdWlTsp+QCqwNG+FfGSswNUGppXjQ/KjqtsMlQOWbZi11VLVrMgFs+93D eMf45tmhY8eUZ5gkbGlSfWZgOk8PN/+MD8E/6GtOlEJKCOeqDDl9FKX5j+VotoYyh1Xt tE9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=4TfMmdYTPJUyErFhdYDNTE72x2ohxGmPHvHLolKjmmc=; b=umwT7WgEPFM6IGMWEmYRpWFu7rVkzQN9NKit1k3C9zGT20oAjR9u/Cz89LSynpJr6Z RuWmefQd869gn8uSM8FXPmUzW56BsyCs38EftCWOhJGzH/2H3XDIhb2x6/Cxu2MvtbW+ C2rYHxrrgWQ1hrS3gmqqvCNpol6XDxEdhvzge++yxnE/cXlERPqRhx4qJ9fhi7bzp+HP M0jEtEkUKfCaJRY8S3T4YNb8r9Wg/JzYaEPAV8TbESjcZoUT+kTOlbWLbrU3P9xoqBK5 sqqieM/mRF8+3cPNHzYO+/YWjJZ2+NzMbHuksc7f2bINegE87yA8PqQldBHU/I8MZm9J 2Hag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t62si44623206pgd.175.2019.08.06.05.47.11; Tue, 06 Aug 2019 05:47:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731104AbfHFMqa (ORCPT + 99 others); Tue, 6 Aug 2019 08:46:30 -0400 Received: from foss.arm.com ([217.140.110.172]:32826 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728102AbfHFMqa (ORCPT ); Tue, 6 Aug 2019 08:46:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B942028; Tue, 6 Aug 2019 05:46:29 -0700 (PDT) Received: from DESKTOP-E1NTVVP.cambridge.arm.com (unknown [10.1.25.192]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 90B9B3F694; Tue, 6 Aug 2019 05:46:28 -0700 (PDT) From: Brian Starkey To: dri-devel@lists.freedesktop.org, nd@arm.com Cc: Liviu Dudau , "james qian wang (Arm Technology China)" , LKML , ayan.halder@arm.com, Daniel Vetter Subject: [PATCH v3] drm/crc-debugfs: Add notes about CRC<->commit interactions Date: Tue, 6 Aug 2019 13:46:22 +0100 Message-Id: <20190806124622.28399-1-brian.starkey@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CRC generation can be impacted by commits coming from userspace, and enabling CRC generation may itself trigger a commit. Add notes about this to the kerneldoc. Changes since v1: - Clarified that anything that would disable CRCs counts as a full modeset, and so userspace needs to reconfigure after full modesets Changes since v2: - Add these notes - Rebase onto drm-misc-next (trivial conflict in comment) Signed-off-by: Brian Starkey Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_debugfs_crc.c | 9 +++++++++ include/drm/drm_crtc.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 6604ed223160..be1b7ba92ffe 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -69,6 +69,15 @@ * implement &drm_crtc_funcs.set_crc_source and &drm_crtc_funcs.verify_crc_source. * The debugfs files are automatically set up if those vfuncs are set. CRC samples * need to be captured in the driver by calling drm_crtc_add_crc_entry(). + * Depending on the driver and HW requirements, &drm_crtc_funcs.set_crc_source + * may result in a commit (even a full modeset). + * + * CRC results must be reliable across non-full-modeset atomic commits, so if a + * commit via DRM_IOCTL_MODE_ATOMIC would disable or otherwise interfere with + * CRC generation, then the driver must mark that commit as a full modeset + * (drm_atomic_crtc_needs_modeset() should return true). As a result, to ensure + * consistent results, generic userspace must re-setup CRC generation after a + * legacy SETCRTC or an atomic commit with DRM_MODE_ATOMIC_ALLOW_MODESET. */ static int crc_control_show(struct seq_file *m, void *data) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 128d8b210621..7d14c11bdc0a 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -756,6 +756,9 @@ struct drm_crtc_funcs { * provided from the configured source. Drivers must accept an "auto" * source name that will select a default source for this CRTC. * + * This may trigger an atomic modeset commit if necessary, to enable CRC + * generation. + * * Note that "auto" can depend upon the current modeset configuration, * e.g. it could pick an encoder or output specific CRC sampling point. * @@ -767,6 +770,7 @@ struct drm_crtc_funcs { * 0 on success or a negative error code on failure. */ int (*set_crc_source)(struct drm_crtc *crtc, const char *source); + /** * @verify_crc_source: * -- 2.17.1