Received: by 10.213.65.68 with SMTP id h4csp2342032imn; Mon, 9 Apr 2018 01:42:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx488CBu4ZEIaUMYsn7nnm9/5j8VfeyVQ0b9YjBHfW2KQCkX5wwhmR6ARKyZL4B4K29jjG36t X-Received: by 10.99.110.6 with SMTP id j6mr23807887pgc.29.1523263330435; Mon, 09 Apr 2018 01:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523263330; cv=none; d=google.com; s=arc-20160816; b=hpfuMWZpuxNGruJvp0kjkKP50DMYqhGLgMi529OKFR3vYXJq4qj5Q31flRrtvTd/Wp TbAr4k+LxFAhxJBm9TJ1E/SVuUdKa7ca9j5yNVGLqgJQ5NkxyB3o7TXXnljvbkiqoNBt J7fGCwTEfUZuaPbFSp3hkhEONEpyntZbYuf6AQXg8zp6arWKG4VRoG1BPa/BqWZZSoTC 5CSUw/AspEYiBbpEYgC3Su6RZbl+J6skNlGbR3hd6XcBkGQM+MDsh1teiPiM7pO7PR5A n74XRMiTeRv89I0IsSk+sXGfpZCOWmLZN4r70cNQSGsXjZq/Qg/PKWyVaR33/i1yjjwH wmXQ== 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 :arc-authentication-results; bh=0ZZ7OjMCG5AvrPuRuz7gONizKNMXIohMuMmgIjWH4JY=; b=mJcgw6OmqeVlP4MmN5gGwV5vzpuGNeyofSagPU/jPfBTUPUYd39aJ556ldWoo4LdNx T9U8S/kH1DdaaAE1Gynx0XJd0pqV2m/g9wUJFuMxEQY9oJ2NagotEXL18GLNF5ujaJYk fQK409mSldyeVF90xPFhe+XQ4ZJl9NKhcytmL1izz80eiHXQNf2MFPz2cY+0ySj1Ay5l QWy5S3D0AYJIihBm736htPy33cwjMBR8sX2/ZQObzi2JqJt9JNf2ohLNq15oZBq3dUR0 vYetQE03GN7bRyjbkIfAfdznxglxuldVIZ4/CQikp366WAhuMB6GusWsrnAUrGjLygGR FwJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=bWNPbKZI; 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 l63-v6si16421787plb.466.2018.04.09.01.41.32; Mon, 09 Apr 2018 01:42:10 -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=bWNPbKZI; 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 S1752235AbeDIIi7 (ORCPT + 99 others); Mon, 9 Apr 2018 04:38:59 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54229 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348AbeDIIi6 (ORCPT ); Mon, 9 Apr 2018 04:38:58 -0400 Received: by mail-wm0-f65.google.com with SMTP id 66so10830904wmd.3 for ; Mon, 09 Apr 2018 01:38:57 -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=0ZZ7OjMCG5AvrPuRuz7gONizKNMXIohMuMmgIjWH4JY=; b=bWNPbKZIB16/N/iGyk6ThR/3L6k0CxD992G3ZgN0i6bEOTU5s8tYul7Q+/zRWgH6p/ vrgaxcoqrmFKwXRvJAWMKY8e2RquAL0rg2gem+CIvwo6EoY+0KIN2BBrey3+9HY5CXaP jPqPCv0ZJS4xmODHdFMX44mxtu0KxU6C/e5xI= 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=0ZZ7OjMCG5AvrPuRuz7gONizKNMXIohMuMmgIjWH4JY=; b=S60qIXmiSEzXseRjmrxtTBYXrjgDhi8g4LSiCzX0hQeQxyKNYTdKrsnwb9rFU3h9vX r4qoXZnO7jG4OCvPdc2bfK4aCEO1Xzmequ4CnRlM6UD5h16Vkeq7SRuFDq5R9Pv2fw7I i4EKuMsJavWb/BUEsclO6fvIHBGRN6fIP+HlEQqVQ0zo/THZHoY4rJxz8S1uLz0ueFlf 50Z15kEowkfiHOwOz0h7WtzbDHnDCA7gQhvSnIFm2QvZWoWArJWP0HsKo+rMaX3GLVAi GnHzHDpOCMgn/p/ExD06AChR61dxy8eOMYiSc6UzktzcHC87l+T//WKPdFtiYxLU6bk/ bS5A== X-Gm-Message-State: ALQs6tCnE0Y+hIG9891dbxDI00SXbHYeGYzacG7rI/EQC2E/G/dOXEGd Q4zmqjE4DbPEP4ZE8kyrt7Os0Q== X-Received: by 10.80.182.167 with SMTP id d36mr20836293ede.250.1523263136904; Mon, 09 Apr 2018 01:38:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id b36sm63042edd.81.2018.04.09.01.38.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 01:38:56 -0700 (PDT) Date: Mon, 9 Apr 2018 10:38:53 +0200 From: Daniel Vetter To: Deepak Singh Rawat Cc: Daniel Vetter , "dri-devel@lists.freedesktop.org" , Thomas Hellstrom , Sinclair Yeh , linux-graphics-maintainer , "ville.syrjala@linux.intel.com" , "lukasz.spintzyk@displaylink.com" , "noralf@tronnes.org" , "robdclark@gmail.com" , "gustavo@padovan.org" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC 3/3] drm: Add helper to validate damage during modeset_check Message-ID: <20180409083853.GO31310@phenom.ffwll.local> Mail-Followup-To: Deepak Singh Rawat , "dri-devel@lists.freedesktop.org" , Thomas Hellstrom , Sinclair Yeh , linux-graphics-maintainer , "ville.syrjala@linux.intel.com" , "lukasz.spintzyk@displaylink.com" , "noralf@tronnes.org" , "robdclark@gmail.com" , "gustavo@padovan.org" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , "linux-kernel@vger.kernel.org" References: <1522885748-67122-1-git-send-email-drawat@vmware.com> <1522885748-67122-4-git-send-email-drawat@vmware.com> <20180405075929.GR3881@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.15.0-1-amd64 User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 05, 2018 at 11:55:29PM +0000, Deepak Singh Rawat wrote: > > > > On Wed, Apr 04, 2018 at 04:49:08PM -0700, Deepak Rawat wrote: > > > This patch adds a helper which should be called by driver which enable > > > damage (by calling drm_plane_enable_damage_clips) from atomic_check > > > hook. This helper for now set the damage to NULL for the planes on crtc > > > which need full modeset. > > > > > > The driver also need to check for other crtc properties which can > > > affect damage in atomic_check hook, like gamma, ctm, etc. Plane related > > > properties which affect damage can be handled in damage iterator. > > > > > > Signed-off-by: Deepak Rawat > > > --- > > > drivers/gpu/drm/drm_atomic_helper.c | 47 > > +++++++++++++++++++++++++++++++++++++ > > > include/drm/drm_atomic_helper.h | 2 ++ > > > 2 files changed, 49 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > > b/drivers/gpu/drm/drm_atomic_helper.c > > > index 355b514..23f44ab 100644 > > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > > @@ -3987,3 +3987,50 @@ drm_atomic_helper_damage_iter_next(struct > > drm_atomic_helper_damage_iter *iter, > > > return true; > > > } > > > EXPORT_SYMBOL(drm_atomic_helper_damage_iter_next); > > > + > > > +/** > > > + * drm_atomic_helper_check_damage - validate state object for damage > > changes > > > + * @dev: DRM device > > > + * @state: the driver state object > > > + * > > > + * Check the state object if damage is required or not. In case damage is > > not > > > + * required e.g. need modeset, the damage blob is set to NULL. > > > > Why is that needed? > > > > I can imagine that drivers unconditionally upload everything for a > > modeset, and hence don't need special damage tracking. But for that it's > > imo better to have a clear_damage() helper. > > Don't we need a generic helper which all drivers can use to see if anything > in drm_atomic_state will result in full update? My intention for calling that > function from atomic_check hook was because state access can > return -EDEADLK. > > I think for now having drm_damage_helper_clear_damage helper and > calling it from atomic_check seems better option. In future once I have > clear idea, a generic function can be done. Yeah, if some of the future helpers need to e.g. allocate memory, then we need to do any necessary prep steps from ->atomic_check. But this isn't just prep, it clears stuff, so giving it a name that indicates better what it does seems like a good idea to me. Just make it clear that this should be called from ->atomic_check callbacks. > > But even for modesets (e.g. resolution changes) I'd expect that virtual > > drivers don't want to upload unecessary amounts of data. Manual upload > > hw drivers probably need to upload everything, because the panel will have > > forgotten all the old data once power cycled. > > AFAIK current vmwgfx will do full upload for resolution change. > > > > > And if you think this is really the right thing, then we need to rename > > the function to tell what it does, e.g. > > > > drm_damage_helper_clear_damage_on_modeset() > > > > drm_damage_helper because I think we should stuff this all into > > drm_damage_helper.c, see previous patch. > > > > But I think a > > > > drm_damage_helper_clear_damage(crtc_state) > > > > which you can use in your crtc->atomic_check function like > > > > crtc_atomic_check(state) > > { > > if (drm_atomic_crtc_needs_modeset(state)) > > drm_damage_helper_clear_damage(state); > > } > > > > is more flexible and useful for drivers. There might be other cases where > > clearing damage is the right thing to do. Also, there's the question of > > whether no damage clips == full damage or not, so maybe we should call > > this helper full_damage() instead. > > In my opinion if via proper documentation it is conveyed that no damage > means full-update the clear_damage makes sense. Documentation is the worst documentation. Function names, or just outright implemented behaviour is much better (e.g. runtime checks). For full damage if there's no clip rect I think the iterator should implement that for us. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch