@@ -95,7 +95,6 @@ dm_dp_mst_connector_destroy(struct drm_connector *connector)
95
95
{
96
96
struct amdgpu_dm_connector * aconnector =
97
97
to_amdgpu_dm_connector (connector );
98
- struct amdgpu_encoder * amdgpu_encoder = aconnector -> mst_encoder ;
99
98
100
99
if (aconnector -> dc_sink ) {
101
100
dc_link_remove_remote_sink (aconnector -> dc_link ,
@@ -105,8 +104,6 @@ dm_dp_mst_connector_destroy(struct drm_connector *connector)
105
104
106
105
kfree (aconnector -> edid );
107
106
108
- drm_encoder_cleanup (& amdgpu_encoder -> base );
109
- kfree (amdgpu_encoder );
110
107
drm_connector_cleanup (connector );
111
108
drm_dp_mst_put_port_malloc (aconnector -> port );
112
109
kfree (aconnector );
@@ -243,7 +240,11 @@ static struct drm_encoder *
243
240
dm_mst_atomic_best_encoder (struct drm_connector * connector ,
244
241
struct drm_connector_state * connector_state )
245
242
{
246
- return & to_amdgpu_dm_connector (connector )-> mst_encoder -> base ;
243
+ struct drm_device * dev = connector -> dev ;
244
+ struct amdgpu_device * adev = dev -> dev_private ;
245
+ struct amdgpu_crtc * acrtc = to_amdgpu_crtc (connector_state -> crtc );
246
+
247
+ return & adev -> dm .mst_encoders [acrtc -> crtc_id ].base ;
247
248
}
248
249
249
250
static int
@@ -306,31 +307,27 @@ static const struct drm_encoder_funcs amdgpu_dm_encoder_funcs = {
306
307
.destroy = amdgpu_dm_encoder_destroy ,
307
308
};
308
309
309
- static struct amdgpu_encoder *
310
- dm_dp_create_fake_mst_encoder (struct amdgpu_dm_connector * connector )
310
+ void
311
+ dm_dp_create_fake_mst_encoders (struct amdgpu_device * adev )
311
312
{
312
- struct drm_device * dev = connector -> base .dev ;
313
- struct amdgpu_device * adev = dev -> dev_private ;
314
- struct amdgpu_encoder * amdgpu_encoder ;
315
- struct drm_encoder * encoder ;
316
-
317
- amdgpu_encoder = kzalloc (sizeof (* amdgpu_encoder ), GFP_KERNEL );
318
- if (!amdgpu_encoder )
319
- return NULL ;
313
+ struct drm_device * dev = adev -> ddev ;
314
+ int i ;
320
315
321
- encoder = & amdgpu_encoder -> base ;
322
- encoder -> possible_crtcs = amdgpu_dm_get_encoder_crtc_mask (adev );
316
+ for (i = 0 ; i < adev -> dm .display_indexes_num ; i ++ ) {
317
+ struct amdgpu_encoder * amdgpu_encoder = & adev -> dm .mst_encoders [i ];
318
+ struct drm_encoder * encoder = & amdgpu_encoder -> base ;
323
319
324
- drm_encoder_init (
325
- dev ,
326
- & amdgpu_encoder -> base ,
327
- & amdgpu_dm_encoder_funcs ,
328
- DRM_MODE_ENCODER_DPMST ,
329
- NULL );
320
+ encoder -> possible_crtcs = amdgpu_dm_get_encoder_crtc_mask (adev );
330
321
331
- drm_encoder_helper_add (encoder , & amdgpu_dm_encoder_helper_funcs );
322
+ drm_encoder_init (
323
+ dev ,
324
+ & amdgpu_encoder -> base ,
325
+ & amdgpu_dm_encoder_funcs ,
326
+ DRM_MODE_ENCODER_DPMST ,
327
+ NULL );
332
328
333
- return amdgpu_encoder ;
329
+ drm_encoder_helper_add (encoder , & amdgpu_dm_encoder_helper_funcs );
330
+ }
334
331
}
335
332
336
333
static struct drm_connector *
@@ -343,6 +340,7 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
343
340
struct amdgpu_device * adev = dev -> dev_private ;
344
341
struct amdgpu_dm_connector * aconnector ;
345
342
struct drm_connector * connector ;
343
+ int i ;
346
344
347
345
aconnector = kzalloc (sizeof (* aconnector ), GFP_KERNEL );
348
346
if (!aconnector )
@@ -369,9 +367,10 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
369
367
master -> dc_link ,
370
368
master -> connector_id );
371
369
372
- aconnector -> mst_encoder = dm_dp_create_fake_mst_encoder (master );
373
- drm_connector_attach_encoder (& aconnector -> base ,
374
- & aconnector -> mst_encoder -> base );
370
+ for (i = 0 ; i < adev -> dm .display_indexes_num ; i ++ ) {
371
+ drm_connector_attach_encoder (& aconnector -> base ,
372
+ & adev -> dm .mst_encoders [i ].base );
373
+ }
375
374
376
375
connector -> max_bpc_property = master -> base .max_bpc_property ;
377
376
if (connector -> max_bpc_property )
0 commit comments