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().

Signed-off-by: Maxime Ripard <[email protected]>
---
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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
index 5c7e2172a372..1f8b531eb946 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
@@ -359,11 +359,13 @@ static int amdgpu_vkms_output_init(struct drm_device 
*dev, struct
        if (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);
diff --git 
a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
index 254797fa76a6..b8e1fa2378aa 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
@@ -9963,11 +9963,12 @@ dm_test_force_ctx_alloc(struct kunit *test, const 
struct drm_connector_funcs *fu
                        drmm_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);
diff --git 
a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
index 8c3e32f40a96..c9fa8308d254 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
@@ -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);

-- 
2.56.1

Reply via email to