drm: Switch drivers to drm_mode_config_create_initial_state
Subsystems (70)
Maxime Ripard
maintainerv2 cover drm: Switch drivers to drm_mode_config_create_initial_state
drm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles. However, the two roles need different behaviors, notably for objects like drm_private_obj that must persist across suspend/resume and are excluded from drm_mode_config_reset() by design.
Previous series introduced drm_mode_config_create_initial_state() to handle only the initial state creation at probe time, including drm_private_obj. Unlike drm_mode_config_reset(), it returns an error code, allowing drivers to properly handle allocation failures.
This series switches all drivers calling drm_mode_config_reset() at probe time to drm_mode_config_create_initial_state(). The conversion was done using a Coccinelle semantic patch.
This is part, and the final piece, of a larger transition to remove the overloaded reset semantics from the KMS subsystem, following similar series for planes, CRTCs, connectors, and bridges.
---
Changes in v2:
- Fix some sashiko issues
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Maxime Ripard (64):
drm/adp: Switch to drm_mode_config_create_initial_state
drm/amdgpu: Switch to drm_mode_config_create_initial_state
drm/hdlcd: Fix drm_atomic_helper_shutdown() on the probe error path drm/hdlcd: Switch to drm_mode_config_create_initial_state
drm/armada: Switch to drm_mode_config_create_initial_state
drm/ast: Switch to drm_mode_config_create_initial_state
drm/exynos: Switch to drm_mode_config_create_initial_state drm/fsl-dcu: Switch to drm_mode_config_create_initial_state drm/hisilicon/hibmc: Remove hibmc_unload() from the load error path drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state drm/hyperv: Switch to drm_mode_config_create_initial_state drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state drm/ingenic: Move the private object creation before the reset drm/ingenic: Switch to drm_mode_config_create_initial_state
drm/kmb: Switch to drm_mode_config_create_initial_state
drm/logicvc: Switch to drm_mode_config_create_initial_state drm/loongson: Switch to drm_mode_config_create_initial_state drm/mediatek: Switch to drm_mode_config_create_initial_state drm/mgag200: Switch to drm_mode_config_create_initial_state
drm/msm: Switch to drm_mode_config_create_initial_state
drm/nouveau: Switch to drm_mode_config_create_initial_state
drm/omap: Switch to drm_mode_config_create_initial_state
drm/qxl: Destroy the monitors object on the modeset init error path drm/qxl: Switch to drm_mode_config_create_initial_state
drm/rcar-du: Switch to drm_mode_config_create_initial_state
drm/rz-du: Switch to drm_mode_config_create_initial_state drm/shmobile: Switch to drm_mode_config_create_initial_state drm/st7571: Switch to drm_mode_config_create_initial_state
drm/st7586: Switch to drm_mode_config_create_initial_state drm/st7735r: Switch to drm_mode_config_create_initial_state drm/st7920: Switch to drm_mode_config_create_initial_state
drm/sprd: Switch to drm_mode_config_create_initial_state
drm/sti: Fix drm_atomic_helper_shutdown() on the bind error paths drm/sti: Move drm_mode_config_create_initial_state() before drm_dev_register() drm/stm: Switch to drm_mode_config_create_initial_state
drm/sun4i: Switch to drm_mode_config_create_initial_state
drm/tegra: Switch to drm_mode_config_create_initial_state
drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_bridge_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state drm/tidss: Switch to drm_mode_config_create_initial_state
drm/tilcdc: Switch to drm_mode_config_create_initial_state
drm/arcpgu: Switch to drm_mode_config_create_initial_state
drm/bochs: Switch to drm_mode_config_create_initial_state drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state drm/gm12u320: Switch to drm_mode_config_create_initial_state drm/hx8357d: Switch to drm_mode_config_create_initial_state drm/ili9163: Switch to drm_mode_config_create_initial_state drm/ili9225: Switch to drm_mode_config_create_initial_state drm/ili9341: Switch to drm_mode_config_create_initial_state drm/ili9486: Switch to drm_mode_config_create_initial_state drm/mi0283qt: Switch to drm_mode_config_create_initial_state drm/panel-mipi-dbi: Switch to drm_mode_config_create_initial_state drm/pixpaper: Switch to drm_mode_config_create_initial_state drm/repaper: Switch to drm_mode_config_create_initial_state drm/sharp-memory: Switch to drm_mode_config_create_initial_state drm/udl: Switch to drm_mode_config_create_initial_state
drm/vboxvideo: Switch to drm_mode_config_create_initial_state drm/verisilicon: Switch to drm_mode_config_create_initial_state drm/virtio: Switch to drm_mode_config_create_initial_state
drm/vmwgfx: Switch to drm_mode_config_create_initial_state
drm/xen: Switch to drm_mode_config_create_initial_state
drm/xlnx: Switch to drm_mode_config_create_initial_state
drivers/gpu/drm/adp/adp_drv.c | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 +++- .../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 3 ++- .../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 +++- drivers/gpu/drm/arm/hdlcd_drv.c | 9 +++++---- drivers/gpu/drm/armada/armada_drv.c | 4 +++- drivers/gpu/drm/ast/ast_mode.c | 4 +++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 +++- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 7 ++++--- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 22 +++++++++++++--------- drivers/gpu/drm/kmb/kmb_drv.c | 3 +-- drivers/gpu/drm/logicvc/logicvc_mode.c | 4 +++- drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +++++++- drivers/gpu/drm/mgag200/mgag200_g200.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh5.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 4 +++- drivers/gpu/drm/msm/msm_kms.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +++- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++- drivers/gpu/drm/qxl/qxl_display.c | 11 +++++++++-- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4 +++- drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 4 +++- drivers/gpu/drm/sitronix/st7571.c | 4 +++- drivers/gpu/drm/sitronix/st7586.c | 4 +++- drivers/gpu/drm/sitronix/st7735r.c | 4 +++- drivers/gpu/drm/sitronix/st7920.c | 4 +--- drivers/gpu/drm/sprd/sprd_drm.c | 6 ++++-- drivers/gpu/drm/sti/sti_drv.c | 10 ++++------ drivers/gpu/drm/stm/drv.c | 6 +++++- drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 6 +++--- drivers/gpu/drm/sun4i/sun4i_framebuffer.h | 2 +- drivers/gpu/drm/tegra/drm.c | 4 +++- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 3 ++- drivers/gpu/drm/tests/drm_atomic_test.c | 4 +++- drivers/gpu/drm/tests/drm_bridge_test.c | 12 +++++++++--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 3 ++- drivers/gpu/drm/tidss/tidss_drv.c | 6 +++++- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +++- drivers/gpu/drm/tiny/arcpgu.c | 4 +++- drivers/gpu/drm/tiny/bochs.c | 4 +--- drivers/gpu/drm/tiny/cirrus-qemu.c | 4 +++- drivers/gpu/drm/tiny/gm12u320.c | 4 +++- drivers/gpu/drm/tiny/hx8357d.c | 4 +++- drivers/gpu/drm/tiny/ili9163.c | 4 +++- drivers/gpu/drm/tiny/ili9225.c | 4 +++- drivers/gpu/drm/tiny/ili9341.c | 4 +++- drivers/gpu/drm/tiny/ili9486.c | 4 +++- drivers/gpu/drm/tiny/mi0283qt.c | 4 +++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++- drivers/gpu/drm/tiny/pixpaper.c | 4 +++- drivers/gpu/drm/tiny/repaper.c | 4 +++- drivers/gpu/drm/tiny/sharp-memory.c | 4 +++- drivers/gpu/drm/udl/udl_modeset.c | 4 +++- drivers/gpu/drm/vboxvideo/vbox_mode.c | 5 ++++- drivers/gpu/drm/verisilicon/vs_drm.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 +++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 --- drivers/gpu/drm/xen/xen_drm_front_kms.c | 4 +++- drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 ++++-- 74 files changed, 243 insertions(+), 115 deletions(-)
---
base-commit: a8670a2ab1a81dc3fc30093e47c23b83244ca4d0
change-id: 20260712-drm-no-more-config-reset-1ea89f56693d
Best regards,
Signature · 1 line
Maxime Ripard <[email protected]>
Maxime Ripard
maintainerPATCH v2 1/64 drm/adp: Switch to drm_mode_config_create_initial_state
drm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Janne Grunau <[email protected]>
Cc: Sasha Finkelstein <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/adp/adp_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/adp/adp_drv.c +1 -3
@@ -448,13 +448,11 @@ static int adp_setup_mode_config(struct adp_drv_private *adp)if (ret <0 ) {drm_err (drm,"failed to initialize vblank" );return ret; } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }static int adp_parse_of (struct platform_device *pdev,struct adp_drv_private *adp) {struct device *dev = &pdev->dev;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 2/64 drm/amdgpu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: "Christian König" <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 +++- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c | 3 ++- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -1
@@ -359,11 +359,13 @@ static int amdgpu_vkms_output_init(struct drm_device *dev, structif (ret) {DRM_ERROR ("Failed to attach connector to encoder\n" ); goto err_attach; } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_attach;return 0 ; err_attach:drm_encoder_cleanup (encoder);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +2 -1
@@ -9963,11 +9963,12 @@ dm_test_force_ctx_alloc(struct kunit *test, const struct drm_connector_funcs *fudrmm_encoder_init (ctx->drm, encoder,NULL , DRM_MODE_ENCODER_TMDS, NULL), 0); encoder->crtc = crtc; ctx->aconnector->base.encoder = encoder; -drm_mode_config_reset (ctx->drm); +KUNIT_ASSERT_EQ (test, +drm_mode_config_create_initial_state (ctx->drm),0 );drm_modeset_acquire_init (&ctx->acquire_ctx,0 ); ctx->drm->mode_config.acquire_ctx = &ctx->acquire_ctx;KUNIT_ASSERT_EQ (test,kunit_add_action_or_reset (test, dm_test_force_drop_locks, ctx),0 );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +3 -1
@@ -3791,11 +3791,13 @@ dm_mst_test_alloc_dsc_link_ctx(struct kunit *test, int total_avail_slots)KUNIT_ASSERT_NOT_NULL (test, ctx->aconnector);KUNIT_ASSERT_EQ (test,drmm_connector_init (ctx->drm, &ctx->aconnector->base, &dm_mst_test_dsc_link_conn_funcs, DRM_MODE_CONNECTOR_DisplayPort,NULL ),0 ); -drm_mode_config_reset (ctx->drm); + +KUNIT_ASSERT_EQ (test, +drm_mode_config_create_initial_state (ctx->drm),0 );KUNIT_ASSERT_EQ (test,drm_dp_mst_topology_mgr_init (&ctx->aconnector->mst_mgr, ctx->drm, &ctx->aconnector->dm_dp_aux.aux,16 ,4 , ctx->aconnector->base.base.id),0 );
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 3/64 drm/hdlcd: Fix drm_atomic_helper_shutdown() on the probe error path
In reply to Maxime RipardThe hdlcd_probe() error paths for pm_runtime_set_active() and drm_vblank_init() fall through to the err_pm_active label, which calls drm_atomic_helper_shutdown().
However, both calls happen before drm_mode_config_reset(), so the CRTC state is still NULL at that point. drm_atomic_helper_shutdown() will then go through drm_atomic_helper_disable_all() and drm_atomic_get_crtc_state() to drm_atomic_helper_crtc_duplicate_state(), which trips its WARN_ON(!crtc->state) and returns an error.
Move drm_atomic_helper_shutdown() to the err_register label, the only error path where drm_mode_config_reset() has run and thus where shutting the device down makes sense. This also brings the error path closer to hdlcd_remove(), which calls drm_atomic_helper_shutdown() while runtime PM is still enabled.
The pm_runtime_set_active() error path now jumps directly toerr_unload: runtime PM hasn't been enabled at that point, so calling pm_runtime_disable() there wasn't needed either.
It will also be needed when drm_mode_config_reset() gets replaced by drm_mode_config_create_initial_state(), whose state allocation can fail.
--- drivers/gpu/drm/arm/hdlcd_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/arm/hdlcd_drv.c +2 -3
@@ -297,11 +297,11 @@ static int hdlcd_probe(struct platform_device *pdev) goto err_unload; } ret =pm_runtime_set_active (dev);if (ret) - goto err_pm_active; + goto err_unload;pm_runtime_enable (dev); ret =drm_vblank_init (drm, drm->mode_config.num_crtc);if (ret <0 ) {
@@ -333,14 +333,13 @@ static int hdlcd_probe(struct platform_device *pdev)return 0 ; err_register:drm_kms_helper_poll_fini (drm); +drm_atomic_helper_shutdown (drm); err_vblank:pm_runtime_disable (drm->dev); -err_pm_active: -drm_atomic_helper_shutdown (drm); err_unload:hdlcd_irq_uninstall (hdlcd);of_reserved_mem_device_release (drm->dev); err_free:dev_set_drvdata (dev,NULL );
Signature · 1 line
2.56.1
Re: [PATCH v2 03/64] drm/hdlcd: Fix drm_atomic_helper_shutdown() on the probe error path
Quoted 20 lines · Maxime Ripard
The
hdlcd_probe()error paths forpm_runtime_set_active()anddrm_vblank_init()fall through to theerr_pm_activelabel, which callsdrm_atomic_helper_shutdown().However, both calls happen before
drm_mode_config_reset(), so the CRTC state is still NULL at that point.drm_atomic_helper_shutdown()will then go throughdrm_atomic_helper_disable_all()anddrm_atomic_get_crtc_state()todrm_atomic_helper_crtc_duplicate_state(), which trips itsWARN_ON(!crtc->state)and returns an error.Move
drm_atomic_helper_shutdown()to theerr_registerlabel, the only error path wheredrm_mode_config_reset()has run and thus where shutting the device down makes sense. This also brings the error path closer tohdlcd_remove(), which callsdrm_atomic_helper_shutdown()while runtime PM is still enabled.The
pm_runtime_set_active()error path now jumps directly toerr_unload: runtime PM hasn't been enabled at that point, so callingpm_runtime_disable()there wasn't needed either.
Quoted 8 lines
It will also be needed when
drm_mode_config_reset()gets replaced bydrm_mode_config_create_initial_state(), whose state allocation can fail.Fixes d664b851eb2bc ("drm/arm/hdlcd: Reject atomic commits that disable only the plane")Reported-by [email protected]Signed-off-by Maxime Ripard <[email protected]>
Something seems to have broken down in your setup as I've only been Cc-ed on patch 04/64, discovered this one during a search.
Best regards,
Liviu
Quoted 41 lines
--- drivers/gpu/drm/arm/hdlcd_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/arm/hdlcd_drv.c +2
-3@@ -297,11 +297,11 @@ static int hdlcd_probe(struct platform_device *pdev) goto err_unload; } ret =pm_runtime_set_active (dev);if (ret) - goto err_pm_active; + goto err_unload;pm_runtime_enable (dev); ret =drm_vblank_init (drm, drm->mode_config.num_crtc);if (ret <0 ) {@@ -333,14 +333,13 @@ static int hdlcd_probe(struct platform_device *pdev)return 0 ; err_register:drm_kms_helper_poll_fini (drm); +drm_atomic_helper_shutdown (drm); err_vblank:pm_runtime_disable (drm->dev); -err_pm_active: -drm_atomic_helper_shutdown (drm); err_unload:hdlcd_irq_uninstall (hdlcd);of_reserved_mem_device_release (drm->dev); err_free:dev_set_drvdata (dev,NULL );Signature · 2 lines
-- 2.56.1
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
maintainerPATCH v2 4/64 drm/hdlcd: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Liviu Dudau <[email protected]>
--- drivers/gpu/drm/arm/hdlcd_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/hdlcd_drv.c +3 -1
@@ -316,11 +316,13 @@ static int hdlcd_probe(struct platform_device *pdev)if (hdlcd_read (hdlcd,HDLCD_REG_COMMAND )) {hdlcd_write (hdlcd,HDLCD_REG_COMMAND ,0 );aperture_remove_all_conflicting_devices (hdlcd_driver.name); } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank;drm_kms_helper_poll_init (drm);#ifdef CONFIG_DEBUG_FS drm_debugfs_add_files (drm, hdlcd_debugfs_list,ARRAY_SIZE (hdlcd_debugfs_list));#endif
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 5/64 drm/armada: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Russell King <[email protected]>
--- drivers/gpu/drm/armada/armada_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/armada/armada_drv.c +3 -1
@@ -124,11 +124,13 @@ static int armada_drm_bind(struct device *dev) ret =drm_vblank_init (&priv->drm, priv->drm.mode_config.num_crtc);if (ret) goto err_comp; -drm_mode_config_reset (&priv->drm); + ret =drm_mode_config_create_initial_state (&priv->drm); +if (ret) + goto err_comp;drm_kms_helper_poll_init (&priv->drm); ret =drm_dev_register (&priv->drm,0 );if (ret)
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 6/64 drm/ast: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Jocelyn Falempe <[email protected]>
--- drivers/gpu/drm/ast/ast_mode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +3 -1
@@ -1071,10 +1071,12 @@ int ast_mode_config_init(struct ast_device *ast)break ; }if (ret)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 7/64 drm/exynos: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alim Akhtar <[email protected]>
Cc: Inki Dae <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Peter Griffin <[email protected]>
Cc: Seung-Woo Kim <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -1
@@ -275,11 +275,13 @@ static int exynos_drm_bind(struct device *dev) ret =drm_vblank_init (drm, drm->mode_config.num_crtc);if (ret) goto err_unbind_all; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_unbind_all;/* init kms poll for handling hpd */ drm_kms_helper_poll_init (drm);/* register the DRM device */
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 8/64 drm/fsl-dcu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alison Wang <[email protected]>
Cc: Stefan Agner <[email protected]>
--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +3 -1
@@ -40,11 +40,13 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) ret =fsl_dcu_create_outputs (fsl_dev);if (ret) goto err; -drm_mode_config_reset (fsl_dev->drm); + ret =drm_mode_config_create_initial_state (fsl_dev->drm); +if (ret) + goto err;drm_kms_helper_poll_init (fsl_dev->drm);return 0 ; err:
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 9/64 drm/hisilicon/hibmc: Remove hibmc_unload() from the load error path
In reply to Maxime RipardThe error path of hibmc_load() calls hibmc_unload(), which only calls drm_atomic_helper_shutdown().
However, all the failures handled there (hibmc_kms_init(), drm_vblank_init() and hibmc_msi_init()) happen before drm_mode_config_reset() has run, so the CRTC state is still NULL at that point. drm_atomic_helper_shutdown() will then go through drm_atomic_helper_disable_all() and drm_atomic_get_crtc_state() to drm_atomic_helper_crtc_duplicate_state(), which trips its WARN_ON(!crtc->state) and returns an error.
Since the device hasn't been registered and no atomic commit ever ran when hibmc_load() fails, there's nothing to shut down in the first place. Remove that call.
hibmc_unload() is still called by hibmc_pci_probe() and hibmc_pci_remove(), where the initial state has been created.
It will also be needed when drm_mode_config_reset() gets replaced by drm_mode_config_create_initial_state(), whose state allocation can fail.
--- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +0 -1
@@ -417,11 +417,10 @@ static int hibmc_load(struct drm_device *dev)drmm_kms_helper_poll_init (dev);return 0 ; err: -hibmc_unload (dev);drm_err (dev,"failed to initialize drm driver: %d\n" , ret);return ret; } static int hibmc_pci_probe(struct pci_dev *pdev,
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 10/64 drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Tian Tao <[email protected]>
Cc: Xinwei Kong <[email protected]>
Cc: Yongbang Shi <[email protected]>
--- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +4 -2
@@ -409,12 +409,14 @@ static int hibmc_load(struct drm_device *dev)if (ret) {drm_err (dev,"hibmc msi init failed, ret:%d\n" , ret); goto err; } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (dev); +/* Create all the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err;drmm_kms_helper_poll_init (dev);return 0 ;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 11/64 drm/hyperv: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dexuan Cui <[email protected]>
Cc: Long Li <[email protected]>
Cc: Saurabh Sengar <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +1 -3
@@ -500,9 +500,7 @@ int hv_drm_mode_config_init(struct hv_drm_device *hv) ret =drm_vblank_init (dev,1 );if (ret)return ret; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
Signature · 1 line
2.56.1
Re: [PATCH v2 11/64] drm/hyperv: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 28 lines
---
Cc: Dexuan Cui <[email protected]>
Cc: Long Li <[email protected]>
Cc: Saurabh Sengar <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +1
-3@@ -500,9 +500,7 @@ int hv_drm_mode_config_init(struct hv_drm_device *hv) ret =drm_vblank_init (dev,1 );if (ret)return ret; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }Signature · 2 lines
-- 2.56.1
Maxime Ripard
maintainerPATCH v2 12/64 drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +3 -1
@@ -242,11 +242,13 @@ static int imx_drm_bind(struct device *dev)/* Now try and bind all our sub-components */ ret =component_bind_all (dev, drm);if (ret) goto err_kms; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_poll_fini;/* * All components are now initialised, so setup the fb helper. * The fb helper takes copies of key hardware information, so the * crtcs/connectors/encoders must not change after this point.
Signature · 1 line
2.56.1
Re: [PATCH v2 12/64] drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state
Quoted 28 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +0
-0
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c static int imx_drm_bind(struct device *dev) · line 249
Quoted 9 lines
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +3
-1@@ -242,11 +242,13 @@ static int imx_drm_bind(struct device *dev)/* Now try and bind all our sub-components */ ret =component_bind_all (dev, drm);if (ret) goto err_kms; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_poll_fini;
This is ok because drm_kms_helper_poll_fini() just returns when drm_kms_helper_poll_init() hasn't been called yet.
Still, I think it would be clearer to add a err_mode_config goto target between drm_kms_helper_poll_fini() and component_unbind_all().
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c static int imx_drm_bind(struct device *dev) · line 254
Quoted 4 lines
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +0
-0/* * All components are now initialised, so setup the fb helper. * The fb helper takes copies of key hardware information, so the * crtcs/connectors/encoders must not change after this point.
Either way,
regards
Philipp
Maxime Ripard
maintainerPATCH v2 13/64 drm/ingenic: Move the private object creation before the reset
In reply to Maxime Ripardingenic_drm_bind() calls drm_atomic_private_obj_init() late in the bind sequence, without checking its return value.
drm_atomic_private_obj_init() registers the object on the drm->mode_config.privobj_list and then allocates its initial state through the atomic_create_state hook. If that allocation fails, it returns an error but leaves the object registered with a NULL state. Since the return value isn't checked, the probe would continue and the first atomic commit would then crash in drm_atomic_get_private_obj_state() -> ingenic_drm_duplicate_state(), which does a kmemdup() of that NULL state.
Check the drm_atomic_private_obj_init() return value, and move it and its drmm cleanup action before drm_mode_config_reset().
This will also be needed when drm_mode_config_reset() gets replaced by drm_mode_config_create_initial_state(), which creates the initial state of the drm_private_obj instances registered so far: the private object will already have its state by then, so drm_mode_config_create_initial_state() will skip it.
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +10 -8
@@ -1352,10 +1352,20 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)if (ret) {dev_err (dev,"Failed calling drm_vblank_init()\n" ); goto err_drvdata; } + ret =drm_atomic_private_obj_init (drm, &priv->private_obj, + &ingenic_drm_private_state_funcs); +if (ret) + goto err_drvdata; + + ret =drmm_add_action_or_reset (drm, ingenic_drm_atomic_private_obj_fini, + &priv->private_obj); +if (ret) + goto err_drvdata; +drm_mode_config_reset (drm); ret =clk_prepare_enable (priv->pix_clk);if (ret) {dev_err (dev,"Unable to start pixel clock\n" );
@@ -1399,18 +1409,10 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)if (ret) {dev_err (dev,"Unable to register clock notifier\n" ); goto err_devclk_disable; } -drm_atomic_private_obj_init (drm, &priv->private_obj, - &ingenic_drm_private_state_funcs); - - ret =drmm_add_action_or_reset (drm, ingenic_drm_atomic_private_obj_fini, - &priv->private_obj); -if (ret) - goto err_clk_notifier_unregister; - ret =drm_dev_register (drm,0 );if (ret) {dev_err (dev,"Failed to register DRM driver\n" ); goto err_clk_notifier_unregister; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 14/64 drm/ingenic: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Paul Cercueil <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3 -1
@@ -1362,11 +1362,13 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) ret =drmm_add_action_or_reset (drm, ingenic_drm_atomic_private_obj_fini, &priv->private_obj);if (ret) goto err_drvdata; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_drvdata; ret =clk_prepare_enable (priv->pix_clk);if (ret) {dev_err (dev,"Unable to start pixel clock\n" ); goto err_drvdata;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 15/64 drm/kmb: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Anitha Chrisanthus <[email protected]>
--- drivers/gpu/drm/kmb/kmb_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/kmb/kmb_drv.c +1 -2
@@ -196,12 +196,11 @@ static int kmb_setup_mode_config(struct drm_device *drm)drm_err (drm,"failed to initialize vblank\n" );pm_runtime_disable (drm->dev);return ret; } -drm_mode_config_reset (drm); -return 0 ; +return drm_mode_config_create_initial_state (drm); }static irqreturn_t handle_lcd_irq (struct drm_device *dev) {unsigned long status, val, val1;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 16/64 drm/logicvc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Paul Kocialkowski <[email protected]>
--- drivers/gpu/drm/logicvc/logicvc_mode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/logicvc/logicvc_mode.c +3 -1
@@ -59,11 +59,13 @@ int logicvc_mode_init(struct logicvc_drm *logicvc) mode_config->min_height =1 ; mode_config->max_height =2048 ; mode_config->preferred_depth = preferred_depth; mode_config->funcs = &logicvc_mode_config_funcs; -drm_mode_config_reset (drm_dev); + ret =drm_mode_config_create_initial_state (drm_dev); +if (ret) +return ret;drm_kms_helper_poll_init (drm_dev);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 17/64 drm/loongson: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Huacai Chen <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jianmin Lv <[email protected]>
Cc: Mingcong Bai <[email protected]>
Cc: Qianhai Wu <[email protected]>
Cc: Xi Ruoyao <[email protected]>
--- drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/loongson/lsdc_drv.c +3 -1
@@ -245,11 +245,13 @@ lsdc_create_device(struct pci_dev *pdev, ret =lsdc_modeset_init (ldev, descp->num_of_crtc, descp->funcs, loongson_vblank);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ERR_PTR (ret);return ldev; }/* For multiple GPU driver instance co-exixt in the system */
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 17/64] drm/loongson: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/loongson: skipped CRTC and encoder hardware reset in lsdc_create_device() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] drm/loongson: skipped CRTC and encoder hardware reset in lsdc_create_device()
--
commit 8beeb01686f101cdce0b7603e2b5e7c72cefba29
Author: Maxime Ripard <[email protected]>
drm/loongson: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() during device creation in lsdc_create_device().
Quoted 5 lines
drivers/gpu/drm/loongson/lsdc_drv.c +0
-0
drivers/gpu/drm/loongson/lsdc_drv.c lsdc_create_device(struct pci_dev *pdev, · line 255
Quoted 10 lines
drivers/gpu/drm/loongson/lsdc_drv.c +3
-1@@ -247,7 +247,9 @@ lsdc_create_device(struct pci_dev *pdev,if (ret)return ERR_PTR (ret); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ERR_PTR (ret);return ldev; }
[Severity: High]
Does replacing drm_mode_config_reset() with drm_mode_config_create_initial_state() skip hardware initialization that this driver relies on during probe?
Unlike drm_mode_config_reset(), drm_mode_config_create_initial_state() does not call crtc->helper_private->hw_reset() or encoder->funcs->reset():
drivers/gpu/drm/loongson/lsdc_output_7a2000.c:ls7a2000_hdmi0_encoder_reset() {
...
val = PHY_CLOCK_POL | PHY_CLOCK_EN | PHY_DATA_EN;
lsdc_wreg32(ldev, LSDC_CRTC0_DVO_CONF_REG, val);
/* using software gpio emulated i2c */
val = lsdc_rreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG);
val &= ~HW_I2C_EN;
lsdc_wreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG, val);
/* help the hdmi phy to get out of reset state */
lsdc_wreg32(ldev, LSDC_HDMI0_PHY_CTRL_REG, HDMI_PHY_RESET_N);
...
}On both LS7A1000 and LS7A2000, the encoder reset callbacks are the only places in the driver that program LSDC_CRTC0_DVO_CONF_REG and LSDC_CRTC1_DVO_CONF_REG. On LS7A2000, skipping encoder reset also leaves the HDMI PHY in reset and HW_I2C_EN set, breaking software GPIO I2C for connector detection and EDID reads before an atomic enable runs. In addition, skipping lsdc_crtc_hw_reset() leaves LSDC_CRTC0_CFG_REG and LSDC_CRTC1_CFG_REG with firmware settings across read-modify-write modeset updates instead of initializing them to CFG_RESET_N | LSDC_PF_XRGB8888.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=17
Maxime Ripard
maintainerPATCH v2 18/64 drm/mediatek: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: Chun-Kuang Hu <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Philipp Zabel <[email protected]>
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +7 -1
@@ -577,14 +577,20 @@ static int mtk_drm_kms_init(struct drm_device *drm) ret =drm_vblank_init (drm,MAX_CRTC );if (ret <0 ) goto err_component_unbind;drm_kms_helper_poll_init (drm); -drm_mode_config_reset (drm); + + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_fini_poll;return 0 ; +err_fini_poll: +drm_kms_helper_poll_fini (drm); + err_component_unbind:for (i =0 ; i < private->data->mmsys_dev_num; i++)component_unbind_all (private->all_drm_private[i]->dev, drm);return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 19/64 drm/mgag200: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Jocelyn Falempe <[email protected]>
--- drivers/gpu/drm/mgag200/mgag200_g200.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh5.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/mgag200/mgag200_g200.c +3 -1
@@ -399,10 +399,12 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct ret =mgag200_g200_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200eh.c +3 -1
@@ -271,10 +271,12 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const stru ret =mgag200_g200eh_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200eh3.c +3 -1
@@ -176,10 +176,12 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, ret =mgag200_g200eh3_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200eh5.c +3 -1
@@ -196,10 +196,12 @@ struct mga_device *mgag200_g200eh5_device_create(struct pci_dev *pdev, ret =mgag200_g200eh5_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200er.c +3 -1
@@ -304,10 +304,12 @@ struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const stru ret =mgag200_g200er_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200ev.c +3 -1
@@ -309,10 +309,12 @@ struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const stru ret =mgag200_g200ev_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200ew3.c +3 -1
@@ -194,10 +194,12 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, ret =mgag200_g200ew3_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200se.c +3 -1
@@ -516,10 +516,12 @@ struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const stru ret =mgag200_g200se_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
drivers/gpu/drm/mgag200/mgag200_g200wb.c +3 -1
@@ -318,10 +318,12 @@ struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const stru ret =mgag200_g200wb_pipeline_init (mdev);if (ret)return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);return mdev; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 20/64 drm/msm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Abhinav Kumar <[email protected]>
Cc: Dmitry Baryshkov <[email protected]>
Cc: Jessica Zhang <[email protected]>
Cc: Marijn Suijten <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/gpu/drm/msm/msm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_kms.c +3 -1
@@ -329,11 +329,13 @@ int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv)if (ret <0 ) {DRM_DEV_ERROR (dev,"failed to install IRQ handler\n" ); goto err_msm_uninit; } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto err_msm_uninit;return 0 ; err_msm_uninit:return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 21/64 drm/nouveau: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Danilo Krummrich <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_display.c +3 -1
@@ -708,11 +708,13 @@ nouveau_display_create(struct drm_device *dev) }if (ret) goto disp_create_err; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto vblank_err;if (dev->mode_config.num_crtc) { ret =drm_vblank_init (dev, dev->mode_config.num_crtc);if (ret) goto vblank_err;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 22/64 drm/omap: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_drv.c +3 -1
@@ -533,11 +533,13 @@ static int omap_modeset_init(struct drm_device *dev) dev->mode_config.normalize_zpos = true; dev->mode_config.funcs = &omap_mode_config_funcs; dev->mode_config.helper_private = &omap_mode_config_helper_funcs; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;omap_drm_irq_install (dev);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 23/64 drm/qxl: Destroy the monitors object on the modeset init error path
In reply to Maxime Ripardqxl_modeset_init() calls qxl_create_monitors_object() early on: it allocates, pins and vmaps the monitors_config_bo buffer object, and points qdev->ram_header->monitors_config to its physical address.
If drm_vblank_init() fails later on, qxl_modeset_init() returns an error and qxl_pci_probe() jumps to the unload label, which calls qxl_device_fini(). qxl_gem_fini() then force-frees the still pinned and mapped monitors_config_bo, and iounmap() unmaps the RAM header.
The devres cleanup of the DRM device later calls qxl_drm_release(), which in turn calls qxl_modeset_fini() and qxl_destroy_monitors_object(). Those write to the unmapped RAM header, and unmap and unreference the freed buffer object.
Destroy the monitors object on the error path, so that qxl_destroy_monitors_object() has nothing left to do when it runs again during the device release.
It will also be needed when drm_mode_config_reset() gets replaced by drm_mode_config_create_initial_state(), whose state allocation can fail.
--- drivers/gpu/drm/qxl/qxl_display.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_display.c +5 -1
@@ -1308,14 +1308,18 @@ int qxl_modeset_init(struct qxl_device *qdev)qxl_display_read_client_monitors_config (qdev); ret =drm_vblank_init (&qdev->ddev, qxl_num_crtc);if (ret) -return ret; + goto destroy_monitors_object;drm_mode_config_reset (&qdev->ddev);return 0 ; + +destroy_monitors_object: +qxl_destroy_monitors_object (qdev); +return ret; }void qxl_modeset_fini (struct qxl_device *qdev) {if (qdev->dumb_shadow_bo) {
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 24/64 drm/qxl: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/gpu/drm/qxl/qxl_display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_display.c +4 -1
@@ -1310,11 +1310,14 @@ int qxl_modeset_init(struct qxl_device *qdev) ret =drm_vblank_init (&qdev->ddev, qxl_num_crtc);if (ret) goto destroy_monitors_object; -drm_mode_config_reset (&qdev->ddev); + ret =drm_mode_config_create_initial_state (&qdev->ddev); +if (ret) + goto destroy_monitors_object; +return 0 ; destroy_monitors_object:qxl_destroy_monitors_object (qdev);return ret;
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 24/64] drm/qxl: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=24
Maxime Ripard
maintainerPATCH v2 25/64 drm/rcar-du: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Geert Uytterhoeven <[email protected]>
Cc: Kieran Bingham <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +3 -1
@@ -1000,11 +1000,13 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)* DPAD0. */ dpad0_sources = rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0 ].possible_crtcs; rcdu->dpad0_source =ffs (dpad0_sources) -1 ; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);return 0 ; }
Signature · 1 line
2.56.1
Re: [PATCH v2 25/64] drm/rcar-du: Switch to drm_mode_config_create_initial_state
Hi Maxime,
Thank you for the patch.
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 30 lines
---
Cc: Geert Uytterhoeven <[email protected]>
Cc: Kieran Bingham <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +3
-1@@ -1000,11 +1000,13 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)* DPAD0. */ dpad0_sources = rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0 ].possible_crtcs; rcdu->dpad0_source =ffs (dpad0_sources) -1 ; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);return 0 ; }
Signature · 3 lines
Regards, Laurent Pinchart
Maxime Ripard
maintainerPATCH v2 26/64 drm/rz-du: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Biju Das <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c +3 -1
@@ -469,11 +469,13 @@ int rzg2l_du_modeset_init(struct rzg2l_du_device *rcdu) encoder->possible_crtcs = route->possible_outputs; encoder->possible_clones = (1 << num_encoders) -1 ; } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 27/64 drm/shmobile: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Geert Uytterhoeven <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c +3 -1
@@ -173,11 +173,13 @@ int shmob_drm_modeset_init(struct shmob_drm_device *sdev) ret =shmob_drm_connector_create (sdev, &sdev->encoder);if (ret <0 )return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev); sdev->ddev.mode_config.min_width =0 ; sdev->ddev.mode_config.min_height =0 ;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 28/64 drm/st7571: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Marcus Folkesson <[email protected]>
--- drivers/gpu/drm/sitronix/st7571.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7571.c +3 -1
@@ -865,11 +865,13 @@ struct st7571_device *st7571_probe(struct device *dev,if (ret <0 ) {dev_err (st7571->dev,"Failed to initialize connector\n" );return ERR_PTR (ret); } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret); ret =drm_dev_register (drm,0 );if (ret) {dev_err (st7571->dev,"Failed to register DRM device\n" );return ERR_PTR (ret);
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 29/64 drm/st7586: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/sitronix/st7586.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7586.c +3 -1
@@ -453,11 +453,13 @@ static int st7586_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Re: [PATCH v2 29/64] drm/st7586: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Maxime Ripard
maintainerPATCH v2 30/64 drm/st7735r: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/sitronix/st7735r.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7735r.c +3 -1
@@ -333,11 +333,13 @@ static int st7735r_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Re: [PATCH v2 30/64] drm/st7735r: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Maxime Ripard
maintainerPATCH v2 31/64 drm/st7920: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Iker Pedrosa <[email protected]>
--- drivers/gpu/drm/sitronix/st7920.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/sitronix/st7920.c +1 -3
@@ -782,13 +782,11 @@ static int st7920_init_modeset(struct st7920_device *st7920)if (ret) {drm_err (drm,"DRM attach connector to encoder failed: %d\n" , ret);return ret; } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }static int st7920_probe (struct spi_device *spi) {struct st7920_device *st7920;
Signature · 1 line
2.56.1
Re: [PATCH v2 31/64] drm/st7920: Switch to drm_mode_config_create_initial_state
Hi Maxime,
The ST7920 driver changes look correct to me.
Quoted 42 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Iker Pedrosa <[email protected]>--- drivers/gpu/drm/sitronix/st7920.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/sitronix/st7920.c +1
-4@@ -782,13 +782,11 @@ static int st7920_init_modeset(struct st7920_device *st7920)if (ret) {drm_err (drm,"DRM attach connector to encoder failed: %d\n" , ret);return ret; } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }static int st7920_probe (struct spi_device *spi) {struct st7920_device *st7920; --2.56.1
Maxime Ripard
maintainerPATCH v2 32/64 drm/sprd: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Baolin Wang <[email protected]>
Cc: Chunyan Zhang <[email protected]>
Cc: Orson Zhai <[email protected]>
--- drivers/gpu/drm/sprd/sprd_drm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/sprd/sprd_drm.c +4 -2
@@ -93,12 +93,14 @@ static int sprd_drm_bind(struct device *dev)if (ret) {drm_err (drm,"failed to initialize vblank.\n" ); goto err_unbind_all; } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (drm); +/* Create the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_unbind_all;/* init kms poll for handling hpd */ drm_kms_helper_poll_init (drm); ret =drm_dev_register (drm,0 );
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 33/64 drm/sti: Fix drm_atomic_helper_shutdown() on the bind error paths
In reply to Maxime Ripardsti_cleanup() is shared between sti_unbind() and the sti_bind() error paths, and calls drm_atomic_helper_shutdown().
However, on the error paths the initial state may not have been created yet: when component_bind_all() or drm_dev_register() fails, drm_mode_config_reset() hasn't run and the CRTC state is still NULL. drm_atomic_helper_shutdown() will then go through drm_atomic_helper_disable_all() and drm_atomic_get_crtc_state() to drm_atomic_helper_crtc_duplicate_state(), which trips its WARN_ON(!crtc->state) and returns an error.
Move drm_atomic_helper_shutdown() out of sti_cleanup() and into sti_unbind(), so that it's only ever called on a fully initialized device. It still runs after drm_dev_unregister() and before drm_mode_config_cleanup(), as it did before.
It will also be needed when drm_mode_config_reset() gets replaced by drm_mode_config_create_initial_state(), whose state allocation can fail.
--- drivers/gpu/drm/sti/sti_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_drv.c +1 -1
@@ -171,11 +171,10 @@ static int sti_init(struct drm_device *ddev)static void sti_cleanup (struct drm_device *ddev) {struct sti_private *private = ddev->dev_private;drm_kms_helper_poll_fini (ddev); -drm_atomic_helper_shutdown (ddev);drm_mode_config_cleanup (ddev);component_unbind_all (ddev->dev, ddev);dev_set_drvdata (ddev->dev,NULL );kfree (private); ddev->dev_private =NULL ;
@@ -222,10 +221,11 @@ static int sti_bind(struct device *dev)static void sti_unbind (struct device *dev) {struct drm_device *ddev =dev_get_drvdata (dev);drm_dev_unregister (ddev); +drm_atomic_helper_shutdown (ddev);sti_cleanup (ddev);drm_dev_put (ddev); }static const struct component_master_ops sti_ops = {
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 34/64 drm/sti: Move drm_mode_config_create_initial_state() before drm_dev_register()
In reply to Maxime Ripardsti_bind() calls drm_dev_register() before drm_mode_config_create_initial_state(), so the device is exposed to userspace, through its device node and its connectors sysfs attributes, while the plane, CRTC and connector states are still NULL. A process opening the device in that window could then hit a NULL pointer dereference.
Move drm_mode_config_create_initial_state() before drm_dev_register().
--- drivers/gpu/drm/sti/sti_drv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +3 -5
@@ -195,24 +195,22 @@ static int sti_bind(struct device *dev) ret =component_bind_all (ddev->dev, ddev);if (ret) goto err_cleanup; - ret =drm_dev_register (ddev,0 ); + ret =drm_mode_config_create_initial_state (ddev);if (ret) goto err_cleanup; - ret =drm_mode_config_create_initial_state (ddev); + ret =drm_dev_register (ddev,0 );if (ret) - goto err_unregister; + goto err_cleanup;drm_client_setup (ddev,NULL );return 0 ; -err_unregister: -drm_dev_unregister (ddev); err_cleanup:sti_cleanup (ddev); err_drm_dev_put:drm_dev_put (ddev);return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 35/64 drm/stm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alexandre Torgue <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Raphael Gallais-Pou <[email protected]>
Cc: Yannick Fertre <[email protected]>
--- drivers/gpu/drm/stm/drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/drv.c +5 -1
@@ -102,11 +102,15 @@ static int drv_load(struct drm_device *ddev) ret =ltdc_load (ddev);if (ret)return ret; -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) { +ltdc_unload (ddev); +return ret; + }drm_kms_helper_poll_init (ddev);platform_set_drvdata (pdev, ddev);return 0 ;
Signature · 1 line
2.56.1
Re: [PATCH v2 35/64] drm/stm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 4 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Hi Maxime,
Thanks,
Best regards,
Raphaël
Maxime Ripard
maintainerPATCH v2 36/64 drm/sun4i: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Chen-Yu Tsai <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 6 +++--- drivers/gpu/drm/sun4i/sun4i_framebuffer.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/sun4i/sun4i_drv.c +3 -1
@@ -102,11 +102,13 @@ static int sun4i_drv_bind(struct device *dev)/* Remove early framebuffers (ie. simplefb) */ ret =aperture_remove_all_conflicting_devices (sun4i_drv_driver.name);if (ret) goto unbind_all; -sun4i_framebuffer_init (drm); + ret =sun4i_framebuffer_init (drm); +if (ret) + goto unbind_all;/* Enable connectors polling */ drm_kms_helper_poll_init (drm); ret =drm_dev_register (drm,0 );
drivers/gpu/drm/sun4i/sun4i_framebuffer.c +3 -3
@@ -22,16 +22,16 @@ static const struct drm_mode_config_funcs sun4i_de_mode_config_funcs = {static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers = { .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, }; -void sun4i_framebuffer_init (struct drm_device *drm) +int sun4i_framebuffer_init (struct drm_device *drm) { -drm_mode_config_reset (drm); - drm->mode_config.max_width =8192 ; drm->mode_config.max_height =8192 ; drm->mode_config.normalize_zpos = true; drm->mode_config.funcs = &sun4i_de_mode_config_funcs; drm->mode_config.helper_private = &sun4i_de_mode_config_helpers; + +return drm_mode_config_create_initial_state (drm); }
drivers/gpu/drm/sun4i/sun4i_framebuffer.h +1 -1
@@ -7,8 +7,8 @@*/ #ifndef _SUN4I_FRAMEBUFFER_H_#define _SUN4I_FRAMEBUFFER_H_ -void sun4i_framebuffer_init (struct drm_device *drm); +int sun4i_framebuffer_init (struct drm_device *drm);#endif /* _SUN4I_FRAMEBUFFER_H_ */
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 37/64 drm/tegra: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tegra/drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/drm.c +3 -1
@@ -1243,11 +1243,13 @@ static int host1x_drm_probe(struct host1x_device *dev) err =drm_vblank_init (drm, drm->mode_config.num_crtc);if (err <0 ) goto hub; -drm_mode_config_reset (drm); + err =drm_mode_config_create_initial_state (drm); +if (err) + goto hub;/* * Only take over from a potential firmware framebuffer if any CRTCs * have been registered. This must not be a fatal error because there * are other accelerators that are exposed via this driver.
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 38/64 drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_atomic_commit_test.c +3 -1
@@ -132,11 +132,13 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors)drm_connector_attach_encoder (conn, &priv->encoders[i]); } done: -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; } static int set_up_atomic_state(struct kunit *test,
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 38/64] drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/tests: ERR_PTR dereference after drm_atomic_test_init_drm_components() - [Low] drm/tests…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] drm/tests: ERR_PTR dereference after drm_atomic_test_init_drm_components()
- [Low] drm/tests: commit subject uses stale drm_atomic_state_test prefix
--
commit 764d6a07d978e1acc8e6005af10238d412ddeb08
Author: Maxime Ripard <[email protected]>
drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
This commit switches drm_atomic_test_init_drm_components() from drm_mode_config_reset() to drm_mode_config_create_initial_state() for initial KMS state creation.
Quoted 1 line
drm/tests:
drm_atomic_state_test: Switch todrm_mode_config_create_initial_state
[Severity: Low]
This isn't a bug, but 5164f7e7ff8e ("drm: Rename struct drm_atomic_state to drm_atomic_commit") renamed this test file to drm_atomic_commit_test.c, so the subject prefix still refers to the old name.
Quoted 5 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +0
-0
drivers/gpu/drm/tests/drm_atomic_commit_test.c drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) · line 142
Quoted 10 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +3
-1@@ -134,7 +134,9 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) } done: -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; }
[Severity: Medium]
Can returning ERR_PTR(ret) here lead to an error pointer dereference in the callers?
Every earlier step in drm_atomic_test_init_drm_components() aborts via KUNIT_ASSERT_*, and the callers only check KUNIT_ASSERT_NOT_NULL(test, priv) before passing priv to set_up_atomic_state(), which dereferences priv->crtc:
drivers/gpu/drm/tests/drm_atomic_commit_test.c:drm_test_check_connector_changed_modeset() {
...
priv = drm_atomic_test_init_drm_components(test, true);
KUNIT_ASSERT_NOT_NULL(test, priv);
/* First, do a modeset to set the connector */
ret = set_up_atomic_state(test, priv, &priv->connectors[0], &ctx);
...
}Using KUNIT_ASSERT_EQ(test, ret, 0) here matches the rest of the helper, and it looks like that change was accidentally squashed into the following commit "drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state".
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=38
Maxime Ripard
maintainerPATCH v2 39/64 drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 3 +-- drivers/gpu/drm/tests/drm_atomic_test.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/tests/drm_atomic_commit_test.c +1 -2
@@ -133,12 +133,11 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors)drm_connector_attach_encoder (conn, &priv->encoders[i]); } done: ret =drm_mode_config_create_initial_state (drm); -if (ret) -return ERR_PTR (ret); +KUNIT_ASSERT_EQ (test, ret,0 );return priv; } static int set_up_atomic_state(struct kunit *test,
drivers/gpu/drm/tests/drm_atomic_test.c +3 -1
@@ -84,11 +84,13 @@ static struct drm_atomic_test_priv *create_device(struct kunit *test)drm_connector_helper_add (connector, &drm_atomic_init_connector_helper_funcs);drm_connector_attach_encoder (connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; }static void drm_test_drm_atomic_get_connector_for_encoder (struct kunit *test)
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 39/64] drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/tests: misplaced fixup hunk in drm_atomic_test_init_drm_components() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/tests: misplaced fixup hunk in drm_atomic_test_init_drm_components()
--
commit 4a8e39a2143161f4693081f0e4cf620a298d8f3a
Author: Maxime Ripard <[email protected]>
drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state
This commit switches create_device() in drm_atomic_test.c from drm_mode_config_reset() to drm_mode_config_create_initial_state(), and updates error handling in drm_atomic_test_init_drm_components() in drm_atomic_commit_test.c.
Quoted 5 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +0
-0
drivers/gpu/drm/tests/drm_atomic_commit_test.c drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) · line 141
Quoted 9 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +1
-2@@ -135,8 +135,7 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) done: ret =drm_mode_config_create_initial_state (drm); -if (ret) -return ERR_PTR (ret); +KUNIT_ASSERT_EQ (test, ret,0 );return priv; }
[Severity: Low]
Should this hunk be squashed into the earlier commit "drm/tests:drm_atomic_state_test: Switch to drm_mode_config_create_initial_state"?
That commit converted drm_atomic_test_init_drm_components() to return ERR_PTR(ret), even though callers such as drm_test_check_connector_changed_modeset() only check KUNIT_ASSERT_NOT_NULL(test, priv) and would dereference an error pointer at that point in the series.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=39
Maxime Ripard
maintainerPATCH v2 40/64 drm/tests: drm_bridge_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_bridge_test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/tests/drm_bridge_test.c +9 -3
@@ -420,11 +420,13 @@ drm_test_bridge_init(struct kunit *test, const struct drm_bridge_funcs *funcs) priv->connector =drm_bridge_connector_init (drm, enc);if (IS_ERR (priv->connector))return ERR_CAST (priv->connector); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; } static struct drm_bridge_chain_priv *
@@ -518,11 +520,13 @@ drm_test_bridge_chain_init(struct kunit *test, unsigned int num_bridges,if (IS_ERR (priv->connector))return ERR_CAST (priv->connector);drm_connector_attach_encoder (priv->connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);if (!has_hdmi)return priv; scoped_guard(mutex, &drm->mode_config.mutex) {
@@ -610,11 +614,13 @@ drm_test_bridge_hdmi_init(struct kunit *test, const struct drm_bridge_funcs *funif (IS_ERR (priv->connector))return ERR_CAST (priv->connector);drm_connector_attach_encoder (priv->connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; }/*
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 41/64 drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +2 -1
@@ -295,11 +295,12 @@ __connector_hdmi_init(struct kunit *test,KUNIT_ASSERT_EQ (test, ret,0 );drm_connector_helper_add (conn, &dummy_connector_helper_funcs);drm_connector_attach_encoder (conn, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +KUNIT_ASSERT_EQ (test, ret,0 );if (edid_data && edid_len) { ret =set_connector_edid (test, &priv->connector, edid_data, edid_len);KUNIT_ASSERT_GT (test, ret,0 ); }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 42/64 drm/tidss: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jyri Sarha <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/tidss/tidss_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_drv.c +5 -1
@@ -164,11 +164,15 @@ static int tidss_probe(struct platform_device *pdev) goto err_runtime_suspend; }drm_kms_helper_poll_init (ddev); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) { +dev_err (dev,"failed to create initial state: %d\n" , ret); + goto err_irq_uninstall; + } ret =drm_dev_register (ddev,0 );if (ret) {dev_err (dev,"failed to register DRM device\n" ); goto err_irq_uninstall;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 43/64 drm/tilcdc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jyri Sarha <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -1
@@ -420,11 +420,13 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)if (ret <0 ) {drm_err (ddev,"failed to install IRQ handler\n" ); goto unregister_cpufreq_notif; } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto stop_poll;drm_kms_helper_poll_init (ddev); ret =drm_dev_register (ddev,0 );if (ret)
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 43/64] drm/tilcdc: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/tilcdc: tilcdc_pdev_probe() skips tilcdc_crtc_hw_reset() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] drm/tilcdc: tilcdc_pdev_probe() skips tilcdc_crtc_hw_reset() --
commit ae76397fb05d05122d64d74fa8d16d0b22b1c809
Author: Maxime Ripard <[email protected]>
drm/tilcdc: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() in tilcdc_pdev_probe() to initialize the KMS state at probe time.
drivers/gpu/drm/tilcdc/tilcdc_drv.c static int tilcdc_pdev_probe(struct platform_device *pdev) · line 427
Quoted 12 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3
-1@@ -422,7 +422,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) goto unregister_cpufreq_notif; } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto stop_poll;
[Severity: High]
Does replacing drm_mode_config_reset() with drm_mode_config_create_initial_state() skip tilcdc_crtc_hw_reset() during probe?
tilcdc_crtc_hw_reset() is wired to drm_crtc_helper_funcs.hw_reset to turn off LCDC_RASTER_ENABLE and wait for LCDC_FRAME_DONE when the bootloader leaves the display controller active at boot, as introduced in 46a956ab3c5b ("drm/tilcdc: Turn raster off in crtc reset, if it was on in the HW") and 6e531fda1d6b ("drm/tilcdc: Move hardware reset to hw_reset hook").
Because drm_mode_config_create_initial_state() calls drm_mode_config_crtc_create_state() without invoking helper_funcs->hw_reset, hardware scanout stays enabled while the initial CRTC state is marked disabled, causing the first modeset in tilcdc_crtc_enable() to reprogram timings and DMA addresses while the raster is still running and time out loading the palette.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=43
Maxime Ripard
maintainerPATCH v2 44/64 drm/arcpgu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alexey Brodkin <[email protected]>
--- drivers/gpu/drm/tiny/arcpgu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/arcpgu.c +3 -1
@@ -414,11 +414,13 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;drm_kms_helper_poll_init (drm);platform_set_drvdata (pdev, drm);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 45/64 drm/bochs: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tiny/bochs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/tiny/bochs.c +1 -3
@@ -681,13 +681,11 @@ static int bochs_kms_init(struct bochs_device *bochs) ret =drm_vblank_init (dev,1 );if (ret)return ret; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }/* ---------------------------------------------------------------------- */ /* drm interface */
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 45/64] drm/bochs: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=45
Maxime Ripard
maintainerPATCH v2 46/64 drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tiny/cirrus-qemu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/cirrus-qemu.c +3 -1
@@ -621,11 +621,13 @@ static int cirrus_pci_probe(struct pci_dev *pdev, ret =cirrus_pipe_init (cirrus);if (ret <0 )return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;pci_set_drvdata (pdev, dev); ret =drm_dev_register (dev,0 );if (ret)return ret;
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 46/64] drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=46
Maxime Ripard
maintainerPATCH v2 47/64 drm/gm12u320: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Hans de Goede <[email protected]>
--- drivers/gpu/drm/tiny/gm12u320.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/gm12u320.c +3 -1
@@ -770,11 +770,13 @@ static int gm12u320_usb_probe(struct usb_interface *interface, ret =drm_connector_attach_encoder (&gm12u320->conn, &gm12u320->encoder);if (ret)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;usb_set_intfdata (interface, dev); ret =drm_dev_register (dev,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 48/64 drm/hx8357d: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/hx8357d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/hx8357d.c +3 -1
@@ -358,11 +358,13 @@ static int hx8357d_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 49/64 drm/ili9163: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/ili9163.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9163.c +3 -1
@@ -289,11 +289,13 @@ static int ili9163_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 50/64 drm/ili9225: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/tiny/ili9225.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9225.c +3 -1
@@ -516,11 +516,13 @@ static int ili9225_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Re: [PATCH v2 50/64] drm/ili9225: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Maxime Ripard
maintainerPATCH v2 51/64 drm/ili9341: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/ili9341.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9341.c +3 -1
@@ -320,11 +320,13 @@ static int ili9341_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 52/64 drm/ili9486: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Kamlesh Gurudasani <[email protected]>
--- drivers/gpu/drm/tiny/ili9486.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9486.c +3 -1
@@ -348,11 +348,13 @@ static int ili9486_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 53/64 drm/mi0283qt: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/mi0283qt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/mi0283qt.c +3 -1
@@ -328,11 +328,13 @@ static int mi0283qt_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 54/64 drm/panel-mipi-dbi: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/panel-mipi-dbi.c +3 -1
@@ -488,11 +488,13 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 55/64 drm/pixpaper: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: LiangCheng Wang <[email protected]>
--- drivers/gpu/drm/tiny/pixpaper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/pixpaper.c +3 -1
@@ -1116,11 +1116,13 @@ static int pixpaper_probe(struct spi_device *spi)drm_connector_helper_add (&panel->connector, &pixpaper_connector_helper_funcs);drm_connector_attach_encoder (&panel->connector, &panel->encoder); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 56/64 drm/repaper: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/repaper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/repaper.c +3 -1
@@ -1188,11 +1188,13 @@ static int repaper_probe(struct spi_device *spi) ret =drm_connector_attach_encoder (&epd->connector, &epd->encoder);if (ret)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 57/64 drm/sharp-memory: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/sharp-memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/sharp-memory.c +3 -1
@@ -618,11 +618,13 @@ static int sharp_memory_probe(struct spi_device *spi) NULL);if (ret)return dev_err_probe (dev, ret,"Failed to initialize display pipeline.\n" );drm_plane_enable_fb_damage_clips (&smd->plane); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );if (ret)return dev_err_probe (dev, ret,"Failed to register drm device.\n" );
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 58/64 drm/udl: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Sean Paul <[email protected]>
--- drivers/gpu/drm/udl/udl_modeset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_modeset.c +3 -1
@@ -538,10 +538,12 @@ int udl_modeset_init(struct udl_device *udl) ret =drm_connector_attach_encoder (connector, encoder);if (ret)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev);return 0 ; }
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 59/64 drm/vboxvideo: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Hans de Goede <[email protected]>
--- drivers/gpu/drm/vboxvideo/vbox_mode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vboxvideo/vbox_mode.c +4 -1
@@ -875,11 +875,14 @@ int vbox_mode_init(struct vbox_private *vbox) ret =vbox_connector_init (dev, vbox_crtc, encoder);if (ret) goto err_drm_mode_cleanup; } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_drm_mode_cleanup; +return 0 ; err_drm_mode_cleanup:drm_mode_config_cleanup (dev);return ret;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 60/64 drm/verisilicon: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Icenowy Zheng <[email protected]>
--- drivers/gpu/drm/verisilicon/vs_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/verisilicon/vs_drm.c +3 -1
@@ -128,11 +128,13 @@ int vs_drm_initialize(struct vs_dc *dc, struct platform_device *pdev)vs_mode_config_init (drm);/* Enable connectors polling */ drm_kms_helper_poll_init (drm); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_fini_poll; ret =drm_dev_register (drm,0 );if (ret) goto err_fini_poll;
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 61/64 drm/virtio: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Chia-I Wu <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Dmitry Osipenko <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Gurchetan Singh <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -2
@@ -394,12 +394,11 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) ret =drm_vblank_init (vgdev->ddev, vgdev->num_scanouts);if (ret)return ret; -drm_mode_config_reset (vgdev->ddev); -return 0 ; +return drm_mode_config_create_initial_state (vgdev->ddev); }void virtio_gpu_modeset_fini (struct virtio_gpu_device *vgdev) {int i;
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 61/64] drm/virtio: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=61
Maxime Ripard
maintainerPATCH v2 62/64 drm/vmwgfx: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Broadcom internal kernel review list <[email protected]>
Cc: Zack Rusin <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 +++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 --- 4 files changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13 -1
@@ -1173,15 +1173,27 @@ int vmw_kms_init(struct vmw_private *dev_priv)if (ret) { ret =vmw_kms_sou_init_display (dev_priv);if (ret)/* Fallback */ ret =vmw_kms_ldu_init_display (dev_priv); } +if (ret) +return ret; +BUILD_BUG_ON (ARRAY_SIZE (display_unit_names) != (vmw_du_max +1 ));drm_info (&dev_priv->drm,"%s display unit initialized\n" , display_unit_names[dev_priv->active_display_unit]); -return ret; +/* +* Create the initial state once, after the display unit that will +* be used has been settled on: a failure in one of the display +* unit initialization functions is used as a fallback condition to +* try the next one, and creating the state on a partially +* initialized device would both leave the KMS objects of the two +* backends on the same drm_device and trip WARN_ON() on the objects +* that don't have a state. +*/ +return drm_mode_config_create_initial_state (dev); }int vmw_kms_close (struct vmw_private *dev_priv) {int ret =0 ;
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +0 -3
@@ -537,11 +537,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)return ret; }int vmw_kms_ldu_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i, ret;int num_display_units = (dev_priv->capabilities &SVGA_CAP_MULTIMON ) ?VMWGFX_NUM_DISPLAY_UNITS :1 ;if (unlikely (dev_priv->ldu_priv)) {
@@ -565,12 +564,10 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv) goto err_free; } dev_priv->active_display_unit = vmw_du_legacy; -drm_mode_config_reset (dev); -return 0 ; err_free:kfree (dev_priv->ldu_priv); dev_priv->ldu_priv =NULL ;
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +0 -3
@@ -921,11 +921,10 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)return ret; }int vmw_kms_sou_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i;/* Screen objects won't work if GMR's aren't available */ if (!dev_priv->has_gmr)return -ENOSYS ;
@@ -937,12 +936,10 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)for (i =0 ; i <VMWGFX_NUM_DISPLAY_UNITS ; ++i)vmw_sou_init (dev_priv, i); dev_priv->active_display_unit = vmw_du_screen_object; -drm_mode_config_reset (dev); -return 0 ; }static int do_bo_define_gmrfb (struct vmw_private *dev_priv,struct vmw_framebuffer *framebuffer)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +0 -3
@@ -1683,11 +1683,10 @@ static void vmw_stdu_destroy(struct vmw_screen_target_display_unit *stdu)* RETURNS: * 0 on success, error code otherwise */ int vmw_kms_stdu_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i, ret;/* Do nothing if there's no support for MOBs */ if (!dev_priv->has_mob)
@@ -1706,9 +1705,7 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) "Failed to initialize STDU %d", i);return ret; } } -drm_mode_config_reset (dev); -return 0 ; }
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v2 62/64] drm/vmwgfx: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] drm/vmwgfx: leak of ldu_priv in vmw_kms_init() on initial state error --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] drm/vmwgfx: leak of ldu_priv in vmw_kms_init() on initial state error
--
commit 5f937b8ad11b4bd1a6956c12405bef9b28767c1f
Author: Maxime Ripard <[email protected]>
drm/vmwgfx: Switch to drm_mode_config_create_initial_state
This commit replaces the drm_mode_config_reset() calls in the individual display unit init functions with a single drm_mode_config_create_initial_state() call in vmw_kms_init().
Quoted 17 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +4
-1@@ -1175,11 +1175,23 @@ int vmw_kms_init(struct vmw_private *dev_priv)if (ret)/* Fallback */ ret =vmw_kms_ldu_init_display (dev_priv); } +if (ret) +return ret; +BUILD_BUG_ON (ARRAY_SIZE (display_unit_names) != (vmw_du_max +1 ));drm_info (&dev_priv->drm,"%s display unit initialized\n" , display_unit_names[dev_priv->active_display_unit]); -return ret; +/*
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c int vmw_kms_init(struct vmw_private *dev_priv) · line 1195
Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +9
-0+* Create the initial state once, after the display unit that will +* be used has been settled on: a failure in one of the display +* unit initialization functions is used as a fallback condition to +* try the next one, and creating the state on a partially +* initialized device would both leave the KMS objects of the two +* backends on the same drm_device and trip WARN_ON() on the objects +* that don't have a state. +*/ +return drm_mode_config_create_initial_state (dev); }
[Severity: Medium]
Does this leak dev_priv->ldu_priv if drm_mode_config_create_initial_state() fails after falling back to vmw_kms_ldu_init_display()?
vmw_kms_ldu_init_display() allocates dev_priv->ldu_priv with kmalloc_obj(), which is only freed by vmw_kms_close() -> vmw_kms_ldu_close_display(). When vmw_kms_init() returns an error here, vmw_driver_load() jumps to out_no_kms and skips vmw_kms_close().
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=62
Re: [PATCH v2 62/64] drm/vmwgfx: Switch to drm_mode_config_create_initial_state
In reply to Maxime RipardQuoted 142 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Broadcom internal kernel review list <[email protected]>
Cc: Zack Rusin <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 +++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 --- 4 files changed, 13 insertions(+), 10 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +13
-1@@ -1173,15 +1173,27 @@ int vmw_kms_init(struct vmw_private *dev_priv)if (ret) { ret =vmw_kms_sou_init_display (dev_priv);if (ret)/* Fallback */ ret =vmw_kms_ldu_init_display (dev_priv); } +if (ret) +return ret; +BUILD_BUG_ON (ARRAY_SIZE (display_unit_names) != (vmw_du_max +1 ));drm_info (&dev_priv->drm,"%s display unit initialized\n" , display_unit_names[dev_priv->active_display_unit]); -return ret; +/* +* Create the initial state once, after the display unit that will +* be used has been settled on: a failure in one of the display +* unit initialization functions is used as a fallback condition to +* try the next one, and creating the state on a partially +* initialized device would both leave the KMS objects of the two +* backends on the same drm_device and trip WARN_ON() on the objects +* that don't have a state. +*/ +return drm_mode_config_create_initial_state (dev); }int vmw_kms_close (struct vmw_private *dev_priv) {int ret =0 ;drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +0
-3@@ -537,11 +537,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)return ret; }int vmw_kms_ldu_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i, ret;int num_display_units = (dev_priv->capabilities &SVGA_CAP_MULTIMON ) ?VMWGFX_NUM_DISPLAY_UNITS :1 ;if (unlikely (dev_priv->ldu_priv)) {@@ -565,12 +564,10 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv) goto err_free; } dev_priv->active_display_unit = vmw_du_legacy; -drm_mode_config_reset (dev); -return 0 ; err_free:kfree (dev_priv->ldu_priv); dev_priv->ldu_priv =NULL ;drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +0
-3@@ -921,11 +921,10 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit)return ret; }int vmw_kms_sou_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i;/* Screen objects won't work if GMR's aren't available */ if (!dev_priv->has_gmr)return -ENOSYS ;@@ -937,12 +936,10 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv)for (i =0 ; i <VMWGFX_NUM_DISPLAY_UNITS ; ++i)vmw_sou_init (dev_priv, i); dev_priv->active_display_unit = vmw_du_screen_object; -drm_mode_config_reset (dev); -return 0 ; }static int do_bo_define_gmrfb (struct vmw_private *dev_priv,struct vmw_framebuffer *framebuffer)drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +0
-4@@ -1683,11 +1683,10 @@ static void vmw_stdu_destroy(struct vmw_screen_target_display_unit *stdu)* RETURNS: * 0 on success, error code otherwise */ int vmw_kms_stdu_init_display (struct vmw_private *dev_priv) { -struct drm_device *dev = &dev_priv->drm;int i, ret;/* Do nothing if there's no support for MOBs */ if (!dev_priv->has_mob)@@ -1706,9 +1705,7 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) "Failed to initialize STDU %d", i);return ret; } } -drm_mode_config_reset (dev); -return 0 ; } --
Quoted 2 lines
2.56.1
That's a lot nicer than the v1, thanks. Sashiko is right that it leaks in case of failure and something like:
- return drm_mode_config_create_initial_state(dev);
+ ret = drm_mode_config_create_initial_state(dev);
+ if (ret)
+ vmw_kms_close(dev_priv);
+
+ return ret;
would fix it but given that the leak happens when the screen failed to initialize and the user has to deal with blank screen and the allocation is small I would likely call it a low priority and probably would be ok submitting as is.
z
Maxime Ripard
maintainerPATCH v2 63/64 drm/xen: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Oleksandr Andrushchenko <[email protected]>
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/xen/xen_drm_front_kms.c +3 -1
@@ -449,11 +449,13 @@ int xen_drm_front_kms_init(struct xen_drm_front_drm_info *drm_info)drm_mode_config_cleanup (dev);return ret; } } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);return 0 ; }void xen_drm_front_kms_fini (struct xen_drm_front_drm_info *drm_info)
Signature · 1 line
2.56.1
Maxime Ripard
maintainerPATCH v2 64/64 drm/xlnx: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Michal Simek <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xlnx/zynqmp_kms.c +4 -2
@@ -522,12 +522,14 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)if (ret <0 ) goto err_poll_fini;drm_kms_helper_poll_init (drm); -/* Reset all components and register the DRM device. */ -drm_mode_config_reset (drm); +/* Create the initial state and register the DRM device. */ + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_poll_fini; ret =drm_dev_register (drm,0 );if (ret <0 ) goto err_poll_fini;
Signature · 1 line
2.56.1
Hi Maxime
Am 16.11.26 um 11:30 schrieb Maxime Ripard:
Quoted 16 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles. However, the two roles need different behaviors, notably for objects likedrm_private_objthat must persist across suspend/resume and are excluded fromdrm_mode_config_reset()by design.Previous series introduced
drm_mode_config_create_initial_state()to handle only the initial state creation at probe time, includingdrm_private_obj. Unlikedrm_mode_config_reset(), it returns an error code, allowing drivers to properly handle allocation failures.This series switches all drivers calling
drm_mode_config_reset()at probe time todrm_mode_config_create_initial_state(). The conversion was done using a Coccinelle semantic patch.
Quoted 5 lines
This is part, and the final piece, of a larger transition to remove the overloaded reset semantics from the KMS subsystem, following similar series for planes, CRTCs, connectors, and bridges.
Signed-off-by Maxime Ripard <[email protected]>
For the entire series:
Quoted 152 lines
---
Changes in v2:
- Fix some sashiko issues
- Link to v1: https://lore.kernel.org/r/[email protected]---
Maxime Ripard (64):
drm/adp: Switch todrm_mode_config_create_initial_state
drm/amdgpu: Switch todrm_mode_config_create_initial_state
drm/hdlcd: Fixdrm_atomic_helper_shutdown()on the probe error path drm/hdlcd: Switch todrm_mode_config_create_initial_state
drm/armada: Switch todrm_mode_config_create_initial_state
drm/ast: Switch todrm_mode_config_create_initial_state
drm/exynos: Switch todrm_mode_config_create_initial_statedrm/fsl-dcu: Switch todrm_mode_config_create_initial_statedrm/hisilicon/hibmc: Removehibmc_unload()from the load error path drm/hisilicon/hibmc: Switch todrm_mode_config_create_initial_statedrm/hyperv: Switch todrm_mode_config_create_initial_statedrm/imx/ipuv3: Switch todrm_mode_config_create_initial_statedrm/ingenic: Move the private object creation before the reset drm/ingenic: Switch todrm_mode_config_create_initial_state
drm/kmb: Switch todrm_mode_config_create_initial_state
drm/logicvc: Switch todrm_mode_config_create_initial_statedrm/loongson: Switch todrm_mode_config_create_initial_statedrm/mediatek: Switch todrm_mode_config_create_initial_statedrm/mgag200: Switch todrm_mode_config_create_initial_state
drm/msm: Switch todrm_mode_config_create_initial_state
drm/nouveau: Switch todrm_mode_config_create_initial_state
drm/omap: Switch todrm_mode_config_create_initial_state
drm/qxl: Destroy the monitors object on the modeset init error path drm/qxl: Switch todrm_mode_config_create_initial_state
drm/rcar-du: Switch todrm_mode_config_create_initial_state
drm/rz-du: Switch todrm_mode_config_create_initial_statedrm/shmobile: Switch todrm_mode_config_create_initial_statedrm/st7571: Switch todrm_mode_config_create_initial_state
drm/st7586: Switch todrm_mode_config_create_initial_statedrm/st7735r: Switch todrm_mode_config_create_initial_statedrm/st7920: Switch todrm_mode_config_create_initial_state
drm/sprd: Switch todrm_mode_config_create_initial_state
drm/sti: Fixdrm_atomic_helper_shutdown()on the bind error paths drm/sti: Movedrm_mode_config_create_initial_state()beforedrm_dev_register()drm/stm: Switch todrm_mode_config_create_initial_state
drm/sun4i: Switch todrm_mode_config_create_initial_state
drm/tegra: Switch todrm_mode_config_create_initial_state
drm/tests:drm_atomic_state_test: Switch todrm_mode_config_create_initial_statedrm/tests:drm_atomic_test: Switch todrm_mode_config_create_initial_statedrm/tests:drm_bridge_test: Switch todrm_mode_config_create_initial_statedrm/tests:drm_hdmi_state_helper_test: Switch todrm_mode_config_create_initial_statedrm/tidss: Switch todrm_mode_config_create_initial_state
drm/tilcdc: Switch todrm_mode_config_create_initial_state
drm/arcpgu: Switch todrm_mode_config_create_initial_state
drm/bochs: Switch todrm_mode_config_create_initial_statedrm/cirrus-qemu: Switch todrm_mode_config_create_initial_statedrm/gm12u320: Switch todrm_mode_config_create_initial_statedrm/hx8357d: Switch todrm_mode_config_create_initial_statedrm/ili9163: Switch todrm_mode_config_create_initial_statedrm/ili9225: Switch todrm_mode_config_create_initial_statedrm/ili9341: Switch todrm_mode_config_create_initial_statedrm/ili9486: Switch todrm_mode_config_create_initial_statedrm/mi0283qt: Switch todrm_mode_config_create_initial_statedrm/panel-mipi-dbi: Switch todrm_mode_config_create_initial_statedrm/pixpaper: Switch todrm_mode_config_create_initial_statedrm/repaper: Switch todrm_mode_config_create_initial_statedrm/sharp-memory: Switch todrm_mode_config_create_initial_statedrm/udl: Switch todrm_mode_config_create_initial_state
drm/vboxvideo: Switch todrm_mode_config_create_initial_statedrm/verisilicon: Switch todrm_mode_config_create_initial_statedrm/virtio: Switch todrm_mode_config_create_initial_state
drm/vmwgfx: Switch todrm_mode_config_create_initial_state
drm/xen: Switch todrm_mode_config_create_initial_state
drm/xlnx: Switch todrm_mode_config_create_initial_statedrivers/gpu/drm/adp/adp_drv.c | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 +++- .../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 3 ++- .../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 +++- drivers/gpu/drm/arm/hdlcd_drv.c | 9 +++++---- drivers/gpu/drm/armada/armada_drv.c | 4 +++- drivers/gpu/drm/ast/ast_mode.c | 4 +++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 +++- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 7 ++++--- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 22 +++++++++++++--------- drivers/gpu/drm/kmb/kmb_drv.c | 3 +-- drivers/gpu/drm/logicvc/logicvc_mode.c | 4 +++- drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +++++++- drivers/gpu/drm/mgag200/mgag200_g200.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh5.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 4 +++- drivers/gpu/drm/msm/msm_kms.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +++- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++- drivers/gpu/drm/qxl/qxl_display.c | 11 +++++++++-- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4 +++- drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 4 +++- drivers/gpu/drm/sitronix/st7571.c | 4 +++- drivers/gpu/drm/sitronix/st7586.c | 4 +++- drivers/gpu/drm/sitronix/st7735r.c | 4 +++- drivers/gpu/drm/sitronix/st7920.c | 4 +--- drivers/gpu/drm/sprd/sprd_drm.c | 6 ++++-- drivers/gpu/drm/sti/sti_drv.c | 10 ++++------ drivers/gpu/drm/stm/drv.c | 6 +++++- drivers/gpu/drm/sun4i/sun4i_drv.c | 4 +++- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 6 +++--- drivers/gpu/drm/sun4i/sun4i_framebuffer.h | 2 +- drivers/gpu/drm/tegra/drm.c | 4 +++- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 3 ++- drivers/gpu/drm/tests/drm_atomic_test.c | 4 +++- drivers/gpu/drm/tests/drm_bridge_test.c | 12 +++++++++--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 3 ++- drivers/gpu/drm/tidss/tidss_drv.c | 6 +++++- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +++- drivers/gpu/drm/tiny/arcpgu.c | 4 +++- drivers/gpu/drm/tiny/bochs.c | 4 +--- drivers/gpu/drm/tiny/cirrus-qemu.c | 4 +++- drivers/gpu/drm/tiny/gm12u320.c | 4 +++- drivers/gpu/drm/tiny/hx8357d.c | 4 +++- drivers/gpu/drm/tiny/ili9163.c | 4 +++- drivers/gpu/drm/tiny/ili9225.c | 4 +++- drivers/gpu/drm/tiny/ili9341.c | 4 +++- drivers/gpu/drm/tiny/ili9486.c | 4 +++- drivers/gpu/drm/tiny/mi0283qt.c | 4 +++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++- drivers/gpu/drm/tiny/pixpaper.c | 4 +++- drivers/gpu/drm/tiny/repaper.c | 4 +++- drivers/gpu/drm/tiny/sharp-memory.c | 4 +++- drivers/gpu/drm/udl/udl_modeset.c | 4 +++- drivers/gpu/drm/vboxvideo/vbox_mode.c | 5 ++++- drivers/gpu/drm/verisilicon/vs_drm.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +-- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 14 +++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 --- drivers/gpu/drm/xen/xen_drm_front_kms.c | 4 +++- drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 ++++-- 74 files changed, 243 insertions(+), 115 deletions(-)---
base-commit:a8670a2ab1a81dc3fc30093e47c23b83244ca4d0
change-id: 20260712-drm-no-more-config-reset-1ea89f56693dBest regards,
Signature · 6 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
Re: (subset) [PATCH v2 00/64] drm: Switch drivers to drm_mode_config_create_initial_state
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles. However, the two roles need different behaviors, notably for objects likedrm_private_objthat must persist across suspend/resume and are excluded fromdrm_mode_config_reset()by design.[...]
Applied to misc/kernel.git (drm-misc-next)
[03/64] drm/hdlcd: Fix drm_atomic_helper_shutdown() on the probe error path
commit: e388eae138aa9364caada0a372b5712642188c16
[11/64] drm/hyperv: Switch to drm_mode_config_create_initial_state
commit: 50b11ceaaef03d4062971db173bbddc8ac0df28b
[25/64] drm/rcar-du: Switch to drm_mode_config_create_initial_state
commit: d8b8de5c35983567a7ef78fcd9f75db46d6c26af
[29/64] drm/st7586: Switch to drm_mode_config_create_initial_state
commit: 52eb5b7764084bddd68e77c1c3e62e70ad11828f
[30/64] drm/st7735r: Switch to drm_mode_config_create_initial_state
commit: 28d10bb2421152b650329710183c1f6df1bd056e
[31/64] drm/st7920: Switch to drm_mode_config_create_initial_state
commit: b17f5f1abd5c30875d203d7690c92129d2d814d6
[35/64] drm/stm: Switch to drm_mode_config_create_initial_state
commit: d78ccdcc94eba858fd8386f0da6de4ec4cd44666
[37/64] drm/tegra: Switch to drm_mode_config_create_initial_state
commit: 0c187722c35db771276ee7390454f7de70508833
[50/64] drm/ili9225: Switch to drm_mode_config_create_initial_state
commit: 0fc18dd1409138d88089ecdda5544ea2f8785520Thanks!
Maxime
Re: (subset) [PATCH v2 00/64] drm: Switch drivers to drm_mode_config_create_initial_state
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles. However, the two roles need different behaviors, notably for objects likedrm_private_objthat must persist across suspend/resume and are excluded fromdrm_mode_config_reset()by design.[...]
Applied to misc/kernel.git (drm-misc-next)
[01/64] drm/adp: Switch to drm_mode_config_create_initial_state
commit: d636d17d3b8ecda8a3db6a77874e652aabac4eb2
[02/64] drm/amdgpu: Switch to drm_mode_config_create_initial_state
commit: 064bc83ffc6eb72ec8af2973517f130d81bcd9bb
[04/64] drm/hdlcd: Switch to drm_mode_config_create_initial_state
commit: 18becfe9b42cb828fc7fcf9703319d34675cd9f1
[05/64] drm/armada: Switch to drm_mode_config_create_initial_state
commit: 69cecb2d921b7ae098c2800cbfa67590c436c3c4
[06/64] drm/ast: Switch to drm_mode_config_create_initial_state
commit: 76dacf729a8dd4a954a5a8457ca49b221055d346
[07/64] drm/exynos: Switch to drm_mode_config_create_initial_state
commit: cbe6da900d937f0de4c73eb574c409c9e2f4a7e8
[08/64] drm/fsl-dcu: Switch to drm_mode_config_create_initial_state
commit: 6a294a6bf06ed0d71a505998bd0fd3abe1e9ea87
[09/64] drm/hisilicon/hibmc: Remove hibmc_unload() from the load error path
commit: f830550f85cd0f5bd955d5b9abdb795f95a25ff8
[10/64] drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state
commit: f935c8d2f8c6de0c4b95c5f63874ced18efe1de6
[12/64] drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state
commit: 8799786a618d2a56b8e3dc998b64fb28cb648ca6
[13/64] drm/ingenic: Move the private object creation before the reset
commit: 5cc203c0dcd3352196d8ede54531afc2175193b0
[14/64] drm/ingenic: Switch to drm_mode_config_create_initial_state
commit: 8636f44eb77f5f738708423a104ee2f225f84b97
[15/64] drm/kmb: Switch to drm_mode_config_create_initial_state
commit: f4f4fd2ae13175ef7aa851cdeaa08bf29a0f38b1
[16/64] drm/logicvc: Switch to drm_mode_config_create_initial_state
commit: 7f84f99fa2d9b068e4a51514df0e1f32ad3247aa
[18/64] drm/mediatek: Switch to drm_mode_config_create_initial_state
commit: 333cf2d79ee32c5590787eeb6df1c3c1a9ad6a48
[19/64] drm/mgag200: Switch to drm_mode_config_create_initial_state
commit: 2fb1383d1aed812e4830aec34b890547fe8d496e
[20/64] drm/msm: Switch to drm_mode_config_create_initial_state
commit: 53556096b6e5e07a8c58fe19cfdf5f3d4e1197ab
[21/64] drm/nouveau: Switch to drm_mode_config_create_initial_state
commit: 960f6b7c64cb9536c37e7995262fd465f2fc623b
[22/64] drm/omap: Switch to drm_mode_config_create_initial_state
commit: cf34a54e91f99b80623fee78ad334871a7f39858
[23/64] drm/qxl: Destroy the monitors object on the modeset init error path
commit: bf50dc68880788f9ad85f4411f2d3fa575139ceb
[24/64] drm/qxl: Switch to drm_mode_config_create_initial_state
commit: f364abef006d3867174f9defa5f79c4c6585cead
[26/64] drm/rz-du: Switch to drm_mode_config_create_initial_state
commit: 938dfe76a15263c5fac77ea1f99c265848c219f8
[27/64] drm/shmobile: Switch to drm_mode_config_create_initial_state
commit: 588132787e6df07f0267983881f437990d56c5e8
[28/64] drm/st7571: Switch to drm_mode_config_create_initial_state
commit: e03927d29003912052c64aad83df169243d43484
[32/64] drm/sprd: Switch to drm_mode_config_create_initial_state
commit: 1af982780216d568a4e8ff6790b87de29e52ab90
[33/64] drm/sti: Fix drm_atomic_helper_shutdown() on the bind error paths
commit: d3047688f4bc35ca827ee2994a014c81898d73cc
[34/64] drm/sti: Move drm_mode_config_create_initial_state() before drm_dev_register()
commit: 2798c8d86bf4e4853cbc1b3e2a248d55e714a649
[36/64] drm/sun4i: Switch to drm_mode_config_create_initial_state
commit: ad5e714a08a6d5f6fa39b589a438b40aaac9e2bf
[38/64] drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
commit: 019bfdeb119dc616303a173323fd69853fe99858
[39/64] drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state
commit: 53f0931d45c029f97c611837b8f853c9fad7a82c
[40/64] drm/tests: drm_bridge_test: Switch to drm_mode_config_create_initial_state
commit: 45472c059ac76f982e31f67ef87f9db3caef1f88
[41/64] drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state
commit: 3db9197bbe3fc859fd5b7521d1f4cedd9d62cb8c
[42/64] drm/tidss: Switch to drm_mode_config_create_initial_state
commit: d771b7c8577c0b847d401a22f49a6abc18680ed3
[44/64] drm/arcpgu: Switch to drm_mode_config_create_initial_state
commit: 620165b05363bea94b72970884f6f27ccf7cee3f
[45/64] drm/bochs: Switch to drm_mode_config_create_initial_state
commit: c67548948d8c5ebb422fa03fb5dd89e44e458f20
[46/64] drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state
commit: 10e37ab94f0f10a7fd729a063c26bf1a94e7f2b0
[47/64] drm/gm12u320: Switch to drm_mode_config_create_initial_state
commit: ce7e27979d41b94bb9a1ed66b6957a300a5a8c0a
[48/64] drm/hx8357d: Switch to drm_mode_config_create_initial_state
commit: d9abdda3a6bd4903af87a1ed6d02c1897035cf4e
[49/64] drm/ili9163: Switch to drm_mode_config_create_initial_state
commit: 6fc964d0567e8303cf72adc45dad29e9415fe76c
[51/64] drm/ili9341: Switch to drm_mode_config_create_initial_state
commit: 75269393962354820792fddfe3da359b3be85ca3
[52/64] drm/ili9486: Switch to drm_mode_config_create_initial_state
commit: c4f2890c815c5ac8d68668a072806edf4f466a7e
[53/64] drm/mi0283qt: Switch to drm_mode_config_create_initial_state
commit: dfa078305c262eae2b0449814392e429b6bd58ee
[54/64] drm/panel-mipi-dbi: Switch to drm_mode_config_create_initial_state
commit: 38b37ce4bc5fc406f1e93a90ce9b2b8531c6f5cb
[55/64] drm/pixpaper: Switch to drm_mode_config_create_initial_state
commit: d3cb39a976745195d2d388b5b9194d47bfd2eb41
[56/64] drm/repaper: Switch to drm_mode_config_create_initial_state
commit: ce380404a74260b6bb178b24dfd4125a591e1069
[57/64] drm/sharp-memory: Switch to drm_mode_config_create_initial_state
commit: d4b8b6e920779d568a085eb611c75dc4bb5805a8
[58/64] drm/udl: Switch to drm_mode_config_create_initial_state
commit: 6358c0da712b0170a3f1470c5eb75ec95340875c
[59/64] drm/vboxvideo: Switch to drm_mode_config_create_initial_state
commit: a932fa029dad6b23b4ff5b7fdb44e5819c098b6e
[60/64] drm/verisilicon: Switch to drm_mode_config_create_initial_state
commit: f3b23268607094ff4461119d623a235a2bdc8608
[61/64] drm/virtio: Switch to drm_mode_config_create_initial_state
commit: eb2c77198187b0283f12be28bdb770703da59dca
[63/64] drm/xen: Switch to drm_mode_config_create_initial_state
commit: 51b3e01a42db6100976907b95d224636e6551c98
[64/64] drm/xlnx: Switch to drm_mode_config_create_initial_state
commit: bb8391a1a8d00b11661ab692313a991456d391ddThanks!
Maxime