Skip to content

Commit cbf1a95

Browse files
mripardpelwell
authored andcommitted
Revert "drm/vc4: Rework the encoder retrieval code"
This reverts commit 3cf3d39. This commit was making the assumption that we had a 1:1 mapping between the encoders and their CRTC. While this is true for the HDMI controllers on the BCM2711, this isn't true for the other encoders (DSI0 and DPI share the PixelValve 0, and DSI1 and SMI share the PixelValve1), and this isn't true at all on the older SoCs, effectively breaking the encoder retrieval logic. Signed-off-by: Maxime Ripard <[email protected]>
1 parent adba557 commit cbf1a95

File tree

3 files changed

+2
-69
lines changed

3 files changed

+2
-69
lines changed

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,6 @@ static u32 vc4_crtc_get_fifo_full_level_bits(struct vc4_crtc *vc4_crtc,
272272
PV_CONTROL_FIFO_LEVEL);
273273
}
274274

275-
static struct drm_encoder *vc4_get_connector_encoder(struct drm_connector *connector)
276-
{
277-
struct drm_encoder *encoder;
278-
279-
if (drm_WARN_ON(connector->dev, hweight32(connector->possible_encoders) != 1))
280-
return NULL;
281-
282-
drm_connector_for_each_possible_encoder(connector, encoder)
283-
return encoder;
284-
285-
return NULL;
286-
}
287-
288275
/*
289276
* Returns the encoder attached to the CRTC.
290277
*
@@ -299,17 +286,9 @@ static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc)
299286

300287
drm_connector_list_iter_begin(crtc->dev, &conn_iter);
301288
drm_for_each_connector_iter(connector, &conn_iter) {
302-
struct drm_encoder *encoder;
303-
struct vc4_encoder *vc4_encoder;
304-
305-
encoder = vc4_get_connector_encoder(connector);
306-
if (!encoder)
307-
continue;
308-
309-
vc4_encoder = to_vc4_encoder(encoder);
310-
if (vc4_encoder->crtc == crtc) {
289+
if (connector->state->crtc == crtc) {
311290
drm_connector_list_iter_end(&conn_iter);
312-
return encoder;
291+
return connector->encoder;
313292
}
314293
}
315294
drm_connector_list_iter_end(&conn_iter);

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -226,41 +226,6 @@ static int compare_dev(struct device *dev, void *data)
226226
return dev == data;
227227
}
228228

229-
static struct drm_crtc *vc4_drv_find_crtc(struct drm_device *drm,
230-
struct drm_encoder *encoder)
231-
{
232-
struct drm_crtc *crtc;
233-
234-
if (WARN_ON(hweight32(encoder->possible_crtcs) != 1))
235-
return NULL;
236-
237-
drm_for_each_crtc(crtc, drm) {
238-
if (!drm_encoder_crtc_ok(encoder, crtc))
239-
continue;
240-
241-
return crtc;
242-
}
243-
244-
return NULL;
245-
}
246-
247-
static void vc4_drv_set_encoder_data(struct drm_device *drm)
248-
{
249-
struct drm_encoder *encoder;
250-
251-
drm_for_each_encoder(encoder, drm) {
252-
struct vc4_encoder *vc4_encoder;
253-
struct drm_crtc *crtc;
254-
255-
crtc = vc4_drv_find_crtc(drm, encoder);
256-
if (WARN_ON(!crtc))
257-
return;
258-
259-
vc4_encoder = to_vc4_encoder(encoder);
260-
vc4_encoder->crtc = crtc;
261-
}
262-
}
263-
264229
static void vc4_match_add_drivers(struct device *dev,
265230
struct component_match **match,
266231
struct platform_driver *const *drivers,
@@ -343,7 +308,6 @@ static int vc4_drm_bind(struct device *dev)
343308
ret = component_bind_all(dev, drm);
344309
if (ret)
345310
return ret;
346-
vc4_drv_set_encoder_data(drm);
347311

348312
if (!vc4->firmware_kms) {
349313
ret = vc4_plane_create_additional_planes(drm);

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,6 @@ enum vc4_encoder_type {
445445

446446
struct vc4_encoder {
447447
struct drm_encoder base;
448-
449-
/*
450-
* At boot time, we need to be able to retrieve the CRTC for a given
451-
* connector in order to run the disable hooks below to avoid the stuck
452-
* pixel issue. Unfortunately the drm_connector->encoder pointer is
453-
* NULL at that time so we can't move up the chain, so we'll store it
454-
* ourselves here.
455-
*/
456-
struct drm_crtc *crtc;
457-
458448
enum vc4_encoder_type type;
459449
u32 clock_select;
460450

0 commit comments

Comments
 (0)