drm/vc4: Fix memory leak during gpu reset.
Subsystems (24)
Maarten Lankhorst
maintainerPATCH 1/2 drm/vc4: Fix memory leak during gpu reset.
__drm_atomic_helper_crtc_destroy_state does not free memory, it only cleans it up. Fix this by calling the functions own destroy function.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_crtc.c +1 -1
@@ -999,7 +999,7 @@ static void vc4_crtc_reset(struct drm_crtc *crtc) {if (crtc->state) -__drm_atomic_helper_crtc_destroy_state (crtc->state); +vc4_crtc_destroy_state (crtc->state); crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state)
Signature · 6 lines
2.19.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerPATCH 2/2 drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
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.
--- .../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(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -3
@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *
drivers/gpu/drm/arm/malidp_crtc.c +1 -4
@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1 -4
@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *
drivers/gpu/drm/drm_atomic_state_helper.c +27 -4
@@ -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; + + 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);
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);
drivers/gpu/drm/imx/ipuv3-crtc.c +1 -4
@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -4
@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -10
@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1 -5
@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *
drivers/gpu/drm/nouveau/dispnv50/head.c +3 -10
@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {
@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }
drivers/gpu/drm/omapdrm/omap_crtc.c +3 -4
@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1 -3
@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4 -3
@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)
drivers/gpu/drm/tegra/dc.c +1 -4
@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }
drivers/gpu/drm/vc4/vc4_crtc.c +4 -4
@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {
drivers/gpu/drm/vkms/vkms_crtc.c +1 -6
@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -8
@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }
include/drm/drm_atomic_state_helper.h +2 -0
@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20181112150114.18395-2-maarten.lankhorst-VuQAYsv1563Yd54FQh9/[email protected]
Boris Brezillon
Acked-byRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
Quoted 72 lines · On Mon, 12 Nov 2018 16:01:14 +0100 Maarten Lankhorst…
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>
Quoted 4 lines
--- .../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 +--
For the atmel-hlcdc driver
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Li, Sun peng (Leo)
Acked-by Leo LiRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 145 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +0
-0
drivers/gpu/drm/drm_atomic_state_helper.c line 64
Quoted 10 lines
drivers/gpu/drm/drm_atomic_state_helper.c +7
-0@@ -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
^ Do you mean drm_crtc->state?
For amdgpu_dm,
Leo
Quoted 310 lines
drivers/gpu/drm/drm_atomic_state_helper.c +20
-4+* 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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +0
-0
include/drm/drm_atomic_state_helper.h struct drm_private_state; · line 44
Quoted 8 lines
include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thierry Reding
Acked-byRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 84 lines · Maarten Lankhorst
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.Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <malidp-VeJGdqYn5oNWk0Htik3J/[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <maarten.lankhorst-VuQAYsv1563Yd54FQh9/[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <jani.nikula-VuQAYsv1563Yd54FQh9/[email protected]>Cc Joonas Lahtinen <joonas.lahtinen-VuQAYsv1563Yd54FQh9/[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <ck.hu-NuS5LvNUpcJWk0Htik3J/[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>Cc Kieran Bingham <kieran.bingham+renesas-ryLnwIuWjnjg/[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <linux-graphics-maintainer-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <carsten.behling-gM/[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <daniel.vetter-/[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>Cc linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.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 ++---
Quoted 8 lines
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(-)
Looks good to me:
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Wentland, Harry
Reviewed-by Harry WentlandRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 64 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>
Quoted 8 lines
For amdgpu_dm and core changes
Harry
Quoted 393 lines
--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +0
-0
include/drm/drm_atomic_state_helper.h struct drm_private_state; · line 44
Quoted 8 lines
include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 98 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void dm_crtc_reset_state(struct drm_crtc *crtc) · line 2802
Quoted 1 line
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))
Can you give this the same treatment as the other allocation checks?
Quoted 14 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +0
-0
drivers/gpu/drm/arm/malidp_crtc.c static void malidp_crtc_reset(struct drm_crtc *crtc) · line 480
Quoted 7 lines
drivers/gpu/drm/arm/malidp_crtc.c +0
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - }
You're changing behavior slightly here. If the allocation fails in the old code, you just continue on (and presumably use-after-free on the next crtc->state access). Whereas now you're going to just deref NULL. Neither one are really desireable :)
So you probably want to continue checking the allocation and clear crtc->state if it fails. After that you can call helper_crtc_reset with &state->base.
Quoted 355 lines
drivers/gpu/drm/arm/malidp_crtc.c +1
-0+__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);Signature · 1 line
2.19.1
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
Op 12-11-18 om 17:11 schreef Sean Paul:
Quoted 94 lines · Maarten Lankhorst
Quoted 93 lines
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)
Quoted 7 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void dm_crtc_reset_state(struct drm_crtc *crtc) · line 2802
Quoted 6 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))Can you give this the same treatment as the other allocation checks?
Yeah sure, the reason I didn't was because all of the amdgpu reset functions worked like that. I'll send a preparation patch to fix that up.
~Maarten
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Liviu Dudau
Acked-byRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 114 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +0
-0@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)
drivers/gpu/drm/arm/malidp_crtc.c static void malidp_crtc_reset(struct drm_crtc *crtc) · line 480
Quoted 10 lines
drivers/gpu/drm/arm/malidp_crtc.c +1
-4kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
For the malidp changes:
Best regards,
Liviu
Quoted 355 lines
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedrenoRodrigo Siqueira
Reviewed-byRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveQuoted 427 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +0
-1@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ;
drivers/gpu/drm/vkms/vkms_crtc.c static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) · line 105
Quoted 10 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-5} vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); }
I tested the changes with IGT, and everything looks fine for VKMS.
Quoted 37 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0
-0static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);Signature · 1 line
2.19.1
Signature · 9 lines
Rodrigo Siqueira https://siqueira.tech Graduate Student Department of Computer Science University of São Paulo _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Lyude Paul
Reviewed-byRe: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to a message not in the archiveFor the nouveau and drm core changes
Quoted 498 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct
drm_crtc_state*drivers/gpu/drm/drm_atomic_state_helper.c +23
-0@@ -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; + + 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 CRTCdrivers/gpu/drm/drm_atomic_state_helper.c +4
-4@@ -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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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);drivers/gpu/drm/i915/intel_display.c +0
-0crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3- renamed from drivers/gpu/drm/imx/ipuv3-crtc.c +0
-0
crtc.c
index7d4b710b837a..8bc36f0d2b6b100644drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *imx_drm_crtc_duplicate_state(struct drm_crtc*crtc)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc*crtc)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(structdrm_crtc *crtc, static void omap_crtc_reset(struct drm_crtc *crtc) { + struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct
drm_crtc_state*drivers/gpu/drm/rcar- renamed from drivers/gpu/drm/rcar-du/rcar_du_crtc.c +0
-0
du/rcar_du_crtc.c
index17741843cf51..7beab22b4674100644drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc*crtc)
drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc, static voidvc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct
drm_crtc_funcsvc4_crtc_funcs= {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); }static struct
drm_crtc_state*drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
Signature · 7 lines
Cheers, Lyude Paul _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to Maarten LankhorstAm Montag, 12. November 2018, 16:01:14 CET schrieb Maarten Lankhorst:
Quoted 22 lines
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 <[email protected]>drivers/gpu/drm/rockchip/rockchip_drm_vop.c +3
-0@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); +if (crtc->state)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c static void vop_crtc_destroy(struct drm_crtc *crtc) · line 1084
Quoted 10 lines
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +1
-3__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (crtc->state); - crtc->state =kzalloc (sizeof (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)
for the Rockchip-part
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to Maarten LankhorstQuoted 93 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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>
Quoted 16 lines
drivers/gpu/drm/drm_atomic_state_helper.c +8
-0@@ -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
drivers/gpu/drm/drm_atomic_state_helper.c line 75
Quoted 10 lines
drivers/gpu/drm/drm_atomic_state_helper.c +10
-0+* 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.
Quoted 32 lines
drivers/gpu/drm/drm_atomic_state_helper.c +9
-4+ + 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);drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static void intel_modeset_readout_hw_state(struct drm_device *dev) · line 15460
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to Maarten LankhorstQuoted 257 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-3@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc);
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c static void dpu_crtc_reset(struct drm_crtc *crtc) · line 903
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1
-7cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }
For the mediatek drm driver,
Quoted 197 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +0
-0static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); +__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +0
-0
include/drm/drm_atomic_state_helper.h struct drm_private_state; · line 44
Quoted 8 lines
include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to Maarten LankhorstQuoted 8 lines · Maarten Lankhorst
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 <[email protected]>
[...]
Quoted 26 lines
drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +0
-0@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL );
drivers/gpu/drm/mediatek/mtk_drm_crtc.c static void mtk_drm_crtc_reset(struct drm_crtc *crtc) · line 127
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4-if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)
For the imx-drm and mediatek drivers,
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere
In reply to Maarten LankhorstQuoted 347 lines · Maarten Lankhorst
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 <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Alex Deucher <[email protected]>Cc "Christian König" <[email protected]>Cc "David (ChunMing) Zhou" <[email protected]>Cc David Airlie <[email protected]>Cc Liviu Dudau <[email protected]>Cc Brian Starkey <[email protected]>Cc Mali DP Maintainers <[email protected]>Cc Boris Brezillon <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Ludovic Desroches <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc Jani Nikula <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Rodrigo Vivi <[email protected]>Cc Philipp Zabel <[email protected]>Cc CK Hu <[email protected]>Cc Matthias Brugger <[email protected]>Cc Rob Clark <[email protected]>Cc Ben Skeggs <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Kieran Bingham <[email protected]>Cc Sandy Huang <[email protected]>Cc "Heiko Stübner" <[email protected]>Cc Thierry Reding <[email protected]>Cc Jonathan Hunter <[email protected]>Cc Eric Anholt <[email protected]>Cc VMware Graphics <[email protected]>Cc Sinclair Yeh <[email protected]>Cc Thomas Hellstrom <[email protected]>Cc Tony Cheng <[email protected]>Cc Shirish S <[email protected]>Cc Mikita Lipski <[email protected]>Cc Bhawanpreet Lakha <[email protected]>Cc David Francis <[email protected]>Cc Anthony Koo <[email protected]>Cc Jeykumar Sankaran <[email protected]>Cc Jordan Crouse <[email protected]>Cc Bruce Wang <[email protected]>Cc Sravanthi Kollukuduru <[email protected]>Cc Archit Taneja <[email protected]>Cc Steve Kowalik <[email protected]>Cc Carsten Behling <[email protected]>Cc Haneen Mohammed <[email protected]>Cc Daniel Vetter <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Mahesh Kumar <[email protected]>--- .../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(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-3@@ -2802,9 +2802,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)if (WARN_ON (!state))return ; - crtc->state = &state->base; - crtc->state->crtc = crtc; - +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/arm/malidp_crtc.c +1
-4@@ -474,10 +474,7 @@ static void malidp_crtc_reset(struct drm_crtc *crtc)kfree (state); state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static void malidp_crtc_destroy_state(struct drm_crtc *crtc,drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +1
-4@@ -412,10 +412,7 @@ static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base); } static struct drm_crtc_state *drivers/gpu/drm/drm_atomic_state_helper.c +27
-4@@ -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; + + 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);drivers/gpu/drm/i915/intel_display.c +1
-1@@ -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); crtc_state->base.active = crtc_state->base.enable = dev_priv->display.get_pipe_config (crtc, crtc_state);drivers/gpu/drm/imx/ipuv3-crtc.c +1
-4@@ -120,12 +120,9 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *imx_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1
-4@@ -119,12 +119,9 @@ static void mtk_drm_crtc_reset(struct drm_crtc *crtc)memset (state,0 ,sizeof (*state)); }else { state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (!state) -return ; - crtc->state = &state->base; } - state->base.crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &state->base); }static struct drm_crtc_state *mtk_drm_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2
-10@@ -894,20 +894,12 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)_dpu_crtc_set_suspend (crtc, false);/* remove previous state, if present */ -if (crtc->state) { +if (crtc->state)dpu_crtc_destroy_state (crtc, crtc->state); - crtc->state =0 ; - } dpu_crtc =to_dpu_crtc (crtc); cstate =kzalloc (sizeof (*cstate),GFP_KERNEL ); -if (!cstate) { -DPU_ERROR ("failed to allocate state\n" ); -return ; - } - - cstate->base.crtc = crtc; - crtc->state = &cstate->base; +__drm_atomic_helper_crtc_reset (crtc, &cstate->base); }static void dpu_crtc_handle_power_event (u32 event_type,void *arg)drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1
-5@@ -1019,11 +1019,7 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) } mdp5_cstate =kzalloc (sizeof (*mdp5_cstate),GFP_KERNEL ); - -if (mdp5_cstate) { - mdp5_cstate->base.crtc = crtc; - crtc->state = &mdp5_cstate->base; - } +__drm_atomic_helper_crtc_reset (crtc, &mdp5_cstate->base); } static struct drm_crtc_state *drivers/gpu/drm/nouveau/dispnv50/head.c +3
-10@@ -418,16 +418,6 @@ nv50_head_atomic_duplicate_state(struct drm_crtc *crtc)return &asyh->state; } -static void -__drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, -struct drm_crtc_state *state) -{ -if (crtc->state) - crtc->funcs->atomic_destroy_state (crtc, crtc->state); - crtc->state = state; - crtc->state->crtc = crtc; -} -static void nv50_head_reset (struct drm_crtc *crtc) {@@ -436,6 +426,9 @@ nv50_head_reset(struct drm_crtc *crtc)if (WARN_ON (!(asyh =kzalloc (sizeof (*asyh),GFP_KERNEL ))))return ; +if (crtc->state) + crtc->funcs->atomic_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &asyh->state); }drivers/gpu/drm/omapdrm/omap_crtc.c +3
-4@@ -554,14 +554,13 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,static void omap_crtc_reset (struct drm_crtc *crtc) { +struct omap_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 (struct omap_crtc_state ),GFP_KERNEL ); - -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); } static struct drm_crtc_state *drivers/gpu/drm/rcar-du/rcar_du_crtc.c +0
-0@@ -857,14 +857,12 @@ static void rcar_du_crtc_reset(struct drm_crtc *crtc) } state =kzalloc (sizeof (*state),GFP_KERNEL );
drivers/gpu/drm/rcar-du/rcar_du_crtc.c static void rcar_du_crtc_reset(struct drm_crtc *crtc) · line 866
Quoted 10 lines
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1
-3+__drm_atomic_helper_crtc_reset (crtc, &state->state);if (state ==NULL )return ; state->crc.source =VSP1_DU_CRC_NONE ; state->crc.index =0 ; - - crtc->state = &state->state; - crtc->state->crtc = crtc; }
For rcar-du:
Quoted 107 lines
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +0
-0static int rcar_du_crtc_enable_vblank (struct drm_crtc *crtc)drivers/gpu/drm/rockchip/rockchip_drm_vop.c +4
-3@@ -1071,13 +1071,14 @@ static void vop_crtc_destroy(struct drm_crtc *crtc)static void vop_crtc_reset (struct drm_crtc *crtc) { +struct rockchip_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 (struct rockchip_crtc_state ),GFP_KERNEL ); -if (crtc->state) - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static struct drm_crtc_state *vop_crtc_duplicate_state (struct drm_crtc *crtc)drivers/gpu/drm/tegra/dc.c +1
-4@@ -1164,10 +1164,7 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) crtc->state =NULL ; state =kzalloc (sizeof (*state),GFP_KERNEL ); -if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } +__drm_atomic_helper_crtc_reset (crtc, &state->base);drm_crtc_vblank_reset (crtc); }drivers/gpu/drm/vc4/vc4_crtc.c +4
-4@@ -998,12 +998,12 @@ static void vc4_crtc_destroy_state(struct drm_crtc *crtc,static void vc4_crtc_reset (struct drm_crtc *crtc) { -if (crtc->state) -vc4_crtc_destroy_state (crtc->state); +struct vc4_crtc_state *crtc_state = +kzalloc (sizeof (*crtc_state),GFP_KERNEL ); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL );if (crtc->state) - crtc->state->crtc = crtc; +vc4_crtc_destroy_state (crtc, crtc->state); +__drm_atomic_helper_crtc_reset (crtc, &crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {drivers/gpu/drm/vkms/vkms_crtc.c +1
-6@@ -98,15 +98,10 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc) vkms_state =to_vkms_crtc_state (crtc->state);__drm_atomic_helper_crtc_destroy_state (crtc->state);kfree (vkms_state); - crtc->state =NULL ; } vkms_state =kzalloc (sizeof (*vkms_state),GFP_KERNEL ); -if (!vkms_state) -return ; - - crtc->state = &vkms_state->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vkms_state->base); } static struct drm_crtc_state *drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1
-8@@ -633,14 +633,7 @@ void vmw_du_crtc_reset(struct drm_crtc *crtc) } vcs =kzalloc (sizeof (*vcs),GFP_KERNEL ); - -if (!vcs) { -DRM_ERROR ("Cannot allocate vmw_crtc_state\n" ); -return ; - } - - crtc->state = &vcs->base; - crtc->state->crtc = crtc; +__drm_atomic_helper_crtc_reset (crtc, &vcs->base); }include/drm/drm_atomic_state_helper.h +0
-0
include/drm/drm_atomic_state_helper.h struct drm_private_state; · line 44
Quoted 8 lines
include/drm/drm_atomic_state_helper.h +2
-0@@ -37,6 +37,8 @@ struct drm_private_state;struct drm_modeset_acquire_ctx ;struct drm_device ; +void __drm_atomic_helper_crtc_reset (struct drm_crtc *crtc, +struct drm_crtc_state *state);void drm_atomic_helper_crtc_reset (struct drm_crtc *crtc);void __drm_atomic_helper_crtc_duplicate_state (struct drm_crtc *crtc,struct drm_crtc_state *state);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
URL : https://patchwork.freedesktop.org/series/52362/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip e909a75380cb drm/vc4: Fix memory leak during gpu reset. 2ef96f23b0dd drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere -:146: WARNING:TYPO_SPELLING: 'conector' may be misspelled - perhaps 'connector'? #146: FILE: drivers/gpu/drm/drm_atomic_state_helper.c:64: + * the &drm_conector->state pointer of @crtc, usually required when
total: 0 errors, 1 warnings, 0 checks, 287 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
URL : https://patchwork.freedesktop.org/series/52362/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Sparse version: v0.5.2 Commit: drm/vc4: Fix memory leak during gpu reset. Okay!
Commit: drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3285:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static? -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4084:27: warning: expression using sizeof(void) -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4084:27: warning: expression using sizeof(void) -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4088:27: warning: expression using sizeof(void) -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4088:27: warning: expression using sizeof(void) -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4195:58: warning: Using plain integer as NULL pointer -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4904:6: warning: symbol 'set_freesync_on_stream' was not declared. Should it be static? -drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5285:26: warning: symbol 'dm_determine_update_type_for_commit' was not declared. Should it be static? +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3283:6: warning: symbol 'dm_drm_plane_destroy_state' was not declared. Should it be static? +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4082:27: warning: expression using sizeof(void) +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4082:27: warning: expression using sizeof(void) +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4086:27: warning: expression using sizeof(void) +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4086:27: warning: expression using sizeof(void) +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4193:58: warning: Using plain integer as NULL pointer +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4902:6: warning: symbol 'set_freesync_on_stream' was not declared. Should it be static? +drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5283:26: warning: symbol 'dm_determine_update_type_for_commit' was not declared. Should it be static?
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
URL : https://patchwork.freedesktop.org/series/52362/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_5121 -> Patchwork_10804 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/52362/revisions/1/mbox/
== Known issues ==
Here are the changes found in Patchwork_10804 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_coherency:
fi-gdg-551: PASS -> DMESG-FAIL (fdo#107164)
igt@drv_selftest@live_contexts:
fi-icl-u: NOTRUN -> DMESG-FAIL (fdo#108569)
igt@drv_selftest@live_hangcheck:
fi-kbl-7560u: PASS -> INCOMPLETE (fdo#108044)
igt@gem_exec_suspend@basic-s4-devices:
fi-blb-e6850: PASS -> INCOMPLETE (fdo#107718)
==== Possible fixes ====
igt@kms_flip@basic-flip-vs-modeset:
fi-hsw-4770r: DMESG-WARN (fdo#105602) -> PASS
igt@kms_pipe_crc_basic@read-crc-pipe-a:
fi-byt-clapper: FAIL (fdo#107362) -> PASS fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#108044 https://bugs.freedesktop.org/show_bug.cgi?id=108044
fdo#108569 https://bugs.freedesktop.org/show_bug.cgi?id=108569
== Participating hosts (50 -> 41) ==
Additional (1): fi-icl-u
Missing (10): fi-kbl-soraka fi-ilk-m540 fi-skl-guc fi-byt-squawks fi-bsw-cyan fi-cfl-guc fi-ctg-p8600 fi-cfl-s3 fi-pnv-d510 fi-snb-2600
== Build changes ==
* Linux: CI_DRM_5121 -> Patchwork_10804
CI_DRM_5121: e2bd5e4c200971836c4f58e5c9c6df1a2f8b5e1f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10804: 2ef96f23b0dda1eb43f653b875b111c5a32f15b2 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
2ef96f23b0dd drm/atomic: Create and use __drm_atomic_helper_crtc_reset() everywhere e909a75380cb drm/vc4: Fix memory leak during gpu reset.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10804/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/vc4: Fix memory leak during gpu reset.
URL : https://patchwork.freedesktop.org/series/52362/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_5121_full -> Patchwork_10804_full =
== Summary - SUCCESS ==
No regressions found.
== Known issues ==
Here are the changes found in Patchwork_10804_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_ppgtt@blt-vs-render-ctx0:
shard-kbl: PASS -> INCOMPLETE (fdo#103665, fdo#106887, fdo#106023)
igt@gem_wait@write-busy-bsd:
shard-snb: PASS -> INCOMPLETE (fdo#105411)
igt@kms_cursor_crc@cursor-256x256-sliding:
shard-apl: PASS -> FAIL (fdo#103232)
igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
shard-glk: NOTRUN -> FAIL (fdo#105454, fdo#106509)
igt@kms_draw_crc@draw-method-xrgb2101010-mmap-gtt-xtiled:
shard-skl: PASS -> FAIL (fdo#103184)
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
shard-apl: PASS -> FAIL (fdo#103167) +1
igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-wc:
shard-glk: PASS -> FAIL (fdo#103167) +2
igt@kms_frontbuffer_tracking@psr-suspend:
shard-skl: PASS -> INCOMPLETE (fdo#107773, fdo#104108, fdo#106978)
igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
shard-apl: PASS -> FAIL (fdo#103166) +1
igt@kms_setmode@basic:
shard-hsw: PASS -> FAIL (fdo#99912)
igt@kms_sysfs_edid_timing:
shard-skl: NOTRUN -> FAIL (fdo#100047)
igt@perf_pmu@busy-start-vcs0:
shard-kbl: PASS -> DMESG-WARN (fdo#103558, fdo#105602) +2
igt@pm_rpm@gem-execbuf-stress-extra-wait:
shard-skl: PASS -> INCOMPLETE (fdo#107807, fdo#107803)
igt@pm_rpm@system-suspend-modeset:
shard-skl: PASS -> INCOMPLETE (fdo#107807, fdo#104108)
==== Possible fixes ====
igt@gem_cpu_reloc@full:
shard-skl: INCOMPLETE (fdo#108073) -> PASS
igt@kms_cursor_crc@cursor-256x256-onscreen:
shard-skl: FAIL (fdo#103232) -> PASS
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
shard-apl: FAIL (fdo#103167) -> PASS +1
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
shard-glk: FAIL (fdo#103167) -> PASS +2
igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
shard-glk: FAIL (fdo#108145) -> PASS +1
igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
shard-skl: FAIL (fdo#107815) -> PASS
igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
shard-apl: FAIL (fdo#103166) -> PASS +1
igt@perf@short-reads:
shard-skl: FAIL (fdo#103183) -> PASS
igt@pm_rpm@universal-planes-dpms:
shard-skl: INCOMPLETE (fdo#107807) -> PASS fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103183 https://bugs.freedesktop.org/show_bug.cgi?id=103183
fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105454 https://bugs.freedesktop.org/show_bug.cgi?id=105454
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
fdo#106978 https://bugs.freedesktop.org/show_bug.cgi?id=106978
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107803 https://bugs.freedesktop.org/show_bug.cgi?id=107803
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#108073 https://bugs.freedesktop.org/show_bug.cgi?id=108073
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (6 -> 6) ==
No changes in participating hosts
== Build changes ==
* Linux: CI_DRM_5121 -> Patchwork_10804
CI_DRM_5121: e2bd5e4c200971836c4f58e5c9c6df1a2f8b5e1f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10804: 2ef96f23b0dda1eb43f653b875b111c5a32f15b2 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10804/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx