Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3934721ybh; Tue, 6 Aug 2019 03:49:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwi6z/GzpR8ywErgQikzMgGQbimqCGnVNMDgVw2CSFeuuklW+1eupANzV6wKOe0T67eCIg2 X-Received: by 2002:a65:640d:: with SMTP id a13mr2467824pgv.256.1565088577750; Tue, 06 Aug 2019 03:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565088577; cv=none; d=google.com; s=arc-20160816; b=fF+dh2aR0cAsst4CmfBJqRn6Y7rReFx/9kEotKyqQFoKOJTrDy1YMVnmj3X7C/3aQb rXpH6HLDikYvQ9PhQDw+n2QgY+Mdkc3SrFkUSEKn49YUKzWRTDXoznXET27rdIfA3mx5 P92e8vspwVYHou8K0ZCk3IWmN738lywsGVG9kJBQUZHUMt35zyLh40gdiRq302KgqedB vS8sMbPls8gtnZQ4iB5O3fol4O/u85FjFJ7VJC94usL7mHpRQHimtTBl586/+AMYnsBl aiGzWHT/cK1nRMjNJVMuxg1vjCWyB8FVzyp+85UYLhmBtueojKxSh83HMbt3fXmJnpUr dROg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=T1kl+89Kc9M+oouyoQnNS0JbqyPDAb4nG568Y6z7/Bs=; b=bXqjC8YRl/8Fj19BzSRjY4qSfpXQp4qRAupy8gN+IkRmiQ4Mr6Useo0EocH9r1Ry55 Oew2E584YeE+VNv4+A/uqObts+xGBQ/ykaiHFm0mqfqOWaMG36xRe1vnyoyqq+94X3E+ P88E0S1LDSID5gdVkaXGJskDIAVjGvTlgJmc73CC72RCFV5Vbcccen0cJFuss/j71t3L aP03nCYPWeO/jHyYVs6e09COyHw0TrcKg/rxF3r3GEXNLiuwR2T4HCM2iMGOczJOQFou 87LQaZox3++uZw7B2Otxay7b7F0hnjWRzl7zwpyTR7gM48koGNUwys8Qvr7lnREI0Y29 FCeg== 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 r200si43450899pgr.518.2019.08.06.03.49.22; Tue, 06 Aug 2019 03:49:37 -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 S1732610AbfHFKso (ORCPT + 99 others); Tue, 6 Aug 2019 06:48:44 -0400 Received: from foss.arm.com ([217.140.110.172]:60124 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728845AbfHFKso (ORCPT ); Tue, 6 Aug 2019 06:48:44 -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 6C036337; Tue, 6 Aug 2019 03:48:43 -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 427DB3F694; Tue, 6 Aug 2019 03:48:42 -0700 (PDT) From: Brian Starkey To: Liviu Dudau , "james qian wang (Arm Technology China)" , "Lowry Li (Arm Technology China)" , nd@arm.com, Daniel Vetter Cc: dri-devel@lists.freedesktop.org, LKML Subject: [PATCH v2] drm/crc-debugfs: Add notes about CRC<->commit interactions Date: Tue, 6 Aug 2019 11:48:35 +0100 Message-Id: <20190806104835.26075-1-brian.starkey@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806091233.GX7444@phenom.ffwll.local> References: <20190806091233.GX7444@phenom.ffwll.local> 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. Signed-off-by: Brian Starkey --- drivers/gpu/drm/drm_debugfs_crc.c | 17 +++++++++++++---- include/drm/drm_crtc.h | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 7ca486d750e9..77159b6e77c3 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -65,10 +65,19 @@ * it submits. In this general case, the maximum userspace can do is to compare * the reported CRCs of frames that should have the same contents. * - * On the driver side the implementation effort is minimal, drivers only need to - * implement &drm_crtc_funcs.set_crc_source. The debugfs files are automatically - * set up if that vfunc is set. CRC samples need to be captured in the driver by - * calling drm_crtc_add_crc_entry(). + * On the driver side the implementation effort is minimal, drivers only need + * to implement &drm_crtc_funcs.set_crc_source. The debugfs files are + * automatically set up if that vfunc is 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