From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Kieran Bingham <kieran.bingham+renesas@ideas>,
linux-tegra@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Anthony Koo <Anthony.Koo@amd.com>,
Thomas Hellstrom <thellstrom@vmware.com>,
Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>,
David Francis <David.Francis@amd.com>,
amd-gfx@lists.freedesktop.org,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-rockchip@lists.infradead.org,
Ludovic Desroches <ludovic.desroches@microchip.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Mali DP Maintainers <malidp@foss.arm.com>,
Ben Skeggs <bskeggs@redhat.com>,
nouveau@lists.freedesktop.org,
VMware Graphics <linux-graphics-maintainer@vmware.co>
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
Date: Mon, 12 Nov 2018 20:21:27 +0200 [thread overview]
Message-ID: <20181112182127.GV9144@intel.com> (raw)
In-Reply-To: <20181112150114.18395-2-maarten.lankhorst@linux.intel.com>
On Mon, Nov 12, 2018 at 04:01:14PM +0100, Maarten Lankhorst wrote:
> We already have __drm_atomic_helper_connector_reset() and
> __drm_atomic_helper_plane_reset(), extend this to crtc as well.
>
> Most drivers already have a gpu reset hook, correct it.
> Nouveau already implemented its own __drm_atomic_helper_crtc_reset(),
> convert it to the common one.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Cc: Brian Starkey <brian.starkey@arm.com>
> Cc: Mali DP Maintainers <malidp@foss.arm.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> Cc: Sandy Huang <hjc@rock-chips.com>
> Cc: "Heiko Stübner" <heiko@sntech.de>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Cc: Tony Cheng <Tony.Cheng@amd.com>
> Cc: Shirish S <shirish.s@amd.com>
> Cc: Mikita Lipski <mikita.lipski@amd.com>
> Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
> Cc: David Francis <David.Francis@amd.com>
> Cc: Anthony Koo <Anthony.Koo@amd.com>
> Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
> Cc: Jordan Crouse <jcrouse@codeaurora.org>
> Cc: Bruce Wang <bzwang@chromium.org>
> Cc: Sravanthi Kollukuduru <skolluku@codeaurora.org>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Steve Kowalik <steven@wedontsleep.org>
> Cc: Carsten Behling <carsten.behling@googlemail.com>
> Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-mediatek@lists.infradead.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: nouveau@lists.freedesktop.org
> Cc: linux-renesas-soc@vger.kernel.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-tegra@vger.kernel.org
> ---
> .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--
> drivers/gpu/drm/arm/malidp_crtc.c | 5 +--
> .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 5 +--
> drivers/gpu/drm/drm_atomic_state_helper.c | 31 ++++++++++++++++---
> drivers/gpu/drm/i915/intel_display.c | 2 +-
> drivers/gpu/drm/imx/ipuv3-crtc.c | 5 +--
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 5 +--
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 ++-----
> drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 6 +---
> drivers/gpu/drm/nouveau/dispnv50/head.c | 13 ++------
> drivers/gpu/drm/omapdrm/omap_crtc.c | 7 ++---
> drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 +--
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 7 +++--
> drivers/gpu/drm/tegra/dc.c | 5 +--
> drivers/gpu/drm/vc4/vc4_crtc.c | 8 ++---
> drivers/gpu/drm/vkms/vkms_crtc.c | 7 +----
> drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 9 +-----
> include/drm/drm_atomic_state_helper.h | 2 ++
> 18 files changed, 56 insertions(+), 81 deletions(-)
>
<snip>
> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> index 3ba996069d69..3eee1ca33fc5 100644
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> @@ -55,6 +55,29 @@
> * for these functions.
> */
>
> +/**
> + * __drm_atomic_helper_crtc_reset - reset state on CRTC
> + * @crtc: drm CRTC
> + * @crtc_state: CRTC state to assign
> + *
> + * Initializes the newly allocated @crtc_state and assigns it to
> + * the &drm_conector->state pointer of @crtc, usually required when
> + * initializing the drivers or when called from the &drm_crtc_funcs.reset
> + * hook.
> + *
> + * This is useful for drivers that subclass the CRTC state.
> + */
> +void
> +__drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
> + struct drm_crtc_state *crtc_state)
> +{
> + if (crtc_state)
> + crtc_state->crtc = crtc;
So apparently crtc and connector reset expect a NULL state, but plane
reset does not. That seems a bit inconsistent. Migth be nice to get
them all to agree on what is the correct behaviour.
> +
> + crtc->state = crtc_state;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_crtc_reset);
> +
> /**
> * drm_atomic_helper_crtc_reset - default &drm_crtc_funcs.reset hook for CRTCs
> * @crtc: drm CRTC
> @@ -64,14 +87,14 @@
> */
> void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
> {
> + struct drm_crtc_state *crtc_state =
> + kzalloc(sizeof(*crtc->state), GFP_KERNEL);
> +
> if (crtc->state)
> __drm_atomic_helper_crtc_destroy_state(crtc->state);
>
> kfree(crtc->state);
> - crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
> -
> - if (crtc->state)
> - crtc->state->crtc = crtc;
> + __drm_atomic_helper_crtc_reset(crtc, crtc_state);
> }
> EXPORT_SYMBOL(drm_atomic_helper_crtc_reset);
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index f383417571ec..907ffeb64781 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15457,7 +15457,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>
> __drm_atomic_helper_crtc_destroy_state(&crtc_state->base);
> memset(crtc_state, 0, sizeof(*crtc_state));
> - crtc_state->base.crtc = &crtc->base;
> + __drm_atomic_helper_crtc_reset(&crtc->base, &crtc_state->base);
intel_crtc_init() could use the same treatment.
And intel_create_plane_state() could use the plane reset. In fact it
looks like we aren't intializing plane constant alpha at all. So it'll
start out as zero which probably isn't what most people would expect.
I also wonder if this patch shouldn't be split up more. Just in case
there's some unforseen regression somewhere I'd hate to see the
entire thing get reverted.
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-11-12 18:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181112150114.18395-1-maarten.lankhorst@linux.intel.com>
2018-11-12 15:01 ` [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere Maarten Lankhorst
2018-11-12 15:36 ` Heiko Stuebner
[not found] ` <20181112150114.18395-2-maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-11-12 15:11 ` Boris Brezillon
2018-11-12 15:23 ` Li, Sun peng (Leo)
2018-11-12 15:36 ` Thierry Reding
2018-11-12 16:02 ` Wentland, Harry
2018-11-12 16:11 ` Sean Paul
2018-11-12 17:33 ` Maarten Lankhorst
2018-11-12 20:01 ` Liviu Dudau
2018-11-18 13:31 ` Rodrigo Siqueira
2018-11-21 18:41 ` Lyude Paul
2018-11-12 18:21 ` Ville Syrjälä [this message]
2018-11-20 7:08 ` CK Hu
2018-11-20 9:30 ` Philipp Zabel
2018-11-21 21:06 ` Kieran Bingham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181112182127.GV9144@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=Anthony.Koo@amd.com \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=David.Francis@amd.com \
--cc=airlied@linux.ie \
--cc=alexandre.belloni@bootlin.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bskeggs@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kieran.bingham+renesas@ideas \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-graphics-maintainer@vmware.co \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-tegra@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=malidp@foss.arm.com \
--cc=nouveau@lists.freedesktop.org \
--cc=thellstrom@vmware.com \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox