Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2949386ybh; Mon, 5 Aug 2019 09:25:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR4ugkgNNQUCpWn1MWyLliOB95S5rQ9qELvA8e7mdpEJ+SrFOAfbifNLFglPsGKqZtPCi5 X-Received: by 2002:a17:90a:1a45:: with SMTP id 5mr19432040pjl.43.1565022345891; Mon, 05 Aug 2019 09:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565022345; cv=none; d=google.com; s=arc-20160816; b=RcKdDrm9eaHOCIyRsTRTRTWNrQDvGjpG9fUcl/p0Kp2l1H94bvliH/xPJ8tjnoXBlh nIySTmbvSttw/y5cUmF8+zVzV/kwH9hEMpMhoPV46Ifc21xCWTMhc7y4Pv6MEhpZ+YMQ ps2rBZXOVWI6PtJpJT1xp1jd6kAyeXh87aHFlhBX1uQPXC4QMHBxM/y1Yo2Er2H0jCkN 5f5a3UVwHFeKuxM4r1g4SWU81NgWs8RyR3LwLFBXjpLyj3rFDBs/6Ch3cGjuTC1hPCZL 6K+D1gBOvGsBOgUoAe4D+WQme3+TKyblGL8stySWLnveVbNzvzDN6TtpuUbwa7zOsBN7 l+bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=JXeUZYg/9AJUDSihciUvJprkRBIRGJYxSA84S9jr6q0=; b=dPZFTLRzWXGpmJ5NM8pxEpYWgLOCnyBZExRdMzdnaFOvZI8J+vgymTUNuiOSgxwauK mJvxjln6ocgKctzytEW4/SEXJwguB5XTfb9dqTWvW7/tPdBy0O/0FWu0YSzSStnZzVZU e/GDIz6Twx9/91ric1BxJIT1vCLZ66hmQvN6bhltwZZv/LFu0/5lFdIJGDVGr5pacB9Z nrCyqpS4NZw0CxzmfpqyItXSElS8YBlwNV3sNRV91mZ0NAthudGDfRODqp463nS1QLgC FP/9VCq9zxj7/k0cxxnyfAqpTCU/QRPoDvktrCDTnSLn5KSLu/gx7K6by5Aqwl5zDyhZ DDjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=XR2Db8aN; 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 r11si20701803pgp.390.2019.08.05.09.25.24; Mon, 05 Aug 2019 09:25:45 -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; dkim=fail header.i=@ffwll.ch header.s=google header.b=XR2Db8aN; 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 S1728867AbfHEQYX (ORCPT + 99 others); Mon, 5 Aug 2019 12:24:23 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43219 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbfHEQYX (ORCPT ); Mon, 5 Aug 2019 12:24:23 -0400 Received: by mail-ed1-f68.google.com with SMTP id e3so79309966edr.10 for ; Mon, 05 Aug 2019 09:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=JXeUZYg/9AJUDSihciUvJprkRBIRGJYxSA84S9jr6q0=; b=XR2Db8aNX3U0yinlF4xRpe2Z0CZc48/D6+huDhKJ1zdxAe0Vr4yoVMRR+j5xxwaCNK bvVyF3Zn1J8UC+6KdhglbaxP0Ma2sECYDkvhmhdmvZBJbKPRx35uT9pL0UFNGPN4CI3/ EBrnaGNBnFGhQt9JAjOSD0IL3HMeXhXC4jx8o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=JXeUZYg/9AJUDSihciUvJprkRBIRGJYxSA84S9jr6q0=; b=SJHL5YJZG94m9FjtKZEm+6f+0k686Zz5kp9FdueYNjcIFKA5I9/lXaTk1NcKcqYKgU o89Er8Ii8fK1VJExFIvkCWWy719eM6cv46imHz2Q1z7/oRs4NuFIDn4zBFR9Nux+atfA kyg0FCBOsJ76Esd4RSwP6KqfVV66fpWI7n3YwDfObl9zgXwpCLrbMA+sXXdsj2fpU1M7 9uC/Gswn6Zi5frfTA7Um5Y5KBEOZYs+6M0bRUELzaSEajnfgDc3rv6Vbmzk9M5TQlVgH oysp9BpdvGcYOujBBrM+RqoEL+bUEyCpQAjSGvDZlf5mHIliKdktKBm057TnyKGVLiZ3 7raA== X-Gm-Message-State: APjAAAXlHrcWTHGMBS4FGRROjoidQ+gXaPuqY/AjcCX3BBDK6ZuGxGt+ 4N0qCzx3OchOm3UqokSySFU= X-Received: by 2002:a17:907:2101:: with SMTP id qn1mr120566592ejb.3.1565022261086; Mon, 05 Aug 2019 09:24:21 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id h10sm19069052edn.86.2019.08.05.09.24.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 09:24:19 -0700 (PDT) Date: Mon, 5 Aug 2019 18:24:17 +0200 From: Daniel Vetter To: Brian Starkey Cc: Liviu Dudau , "james qian wang (Arm Technology China)" , "Lowry Li (Arm Technology China)" , nd@arm.com, Daniel Vetter , dri-devel@lists.freedesktop.org, LKML Subject: Re: [PATCH] drm/crc-debugfs: Add notes about CRC<->commit interactions Message-ID: <20190805162417.GS7444@phenom.ffwll.local> Mail-Followup-To: Brian Starkey , Liviu Dudau , "james qian wang (Arm Technology China)" , "Lowry Li (Arm Technology China)" , nd@arm.com, dri-devel@lists.freedesktop.org, LKML References: <20190802140910.GN7444@phenom.ffwll.local> <20190805151143.12317-1-brian.starkey@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190805151143.12317-1-brian.starkey@arm.com> X-Operating-System: Linux phenom 4.19.0-5-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 05, 2019 at 04:11:43PM +0100, Brian Starkey wrote: > 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 > --- > > I might have got the wrong end of the stick, but this is what I > understood from what you said. > > Cheers, > -Brian > > drivers/gpu/drm/drm_debugfs_crc.c | 15 +++++++++++---- > include/drm/drm_crtc.h | 3 +++ > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c > index 7ca486d750e9..1dff956bcc74 100644 > --- a/drivers/gpu/drm/drm_debugfs_crc.c > +++ b/drivers/gpu/drm/drm_debugfs_crc.c > @@ -65,10 +65,17 @@ > * 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). > + * > + * It's also possible that a "normal" commit via DRM_IOCTL_MODE_ATOMIC or the > + * legacy paths may interfere with CRC generation. So, in the general case, > + * userspace can't rely on the values in crtc-N/crc/data being valid > + * across a commit. It's not just the values, but the generation itself might get disabled (e.g. on i915 if you select "auto" on some chips you get the DP port sampling point, but for HDMI mode you get a different sampling ploint, and if you get the wrong one there won't be any crc for you). Also it's not just any atomic commit, only the ones with ALLOW_MODESET. Maybe something like the below text: "Please note that an atomic modeset commit with the DRM_MODE_ATOMIC_ALLOW_MODESET, or a call to the legacy SETCRTR ioctl (which amounts to the same), can destry the CRC setup due to hardware requirements. This results in inconsistent CRC values or not even any CRC values generated. Generic userspace therefore needs to re-setup the CRC after each such 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..0f7ea094a900 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -756,6 +756,8 @@ 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 a commit if necessary, to enable CRC generation. I'd clarify this as "atomic modeset commit" just to be sure. With these two comments addressed somehow: Reviewed-by: Daniel Vetter > + * > * 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 +769,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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch