Skip to content

Commit fd890cf

Browse files
committed
drm/vc4: txp: add implementation of the missing connector reset custom function
In the previous commit, we added a rotation parameter to be used in the connector, but because we are still using the default reset function without implementing a custom reset function to properly initialize it, the rotation variable remains NULL until it is initialized directly in userspace. To prevent this, you must implement a custom reset function that properly initializes the rotation parameter. Fixes: 30c7044 ("drm: Add a rotation parameter to connectors.") Signed-off-by: Jeongjun Park <[email protected]>
1 parent baa2d14 commit fd890cf

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ extern struct platform_driver vc4_vec_driver;
10871087

10881088
/* vc4_txp.c */
10891089
extern struct platform_driver vc4_txp_driver;
1090+
void vc4_txp_connector_reset(struct drm_connector *connector);
10901091

10911092
/* vc4_irq.c */
10921093
void vc4_irq_enable(struct drm_device *dev);

drivers/gpu/drm/vc4/vc4_txp.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,34 @@ vc4_txp_connector_detect(struct drm_connector *connector, bool force)
390390
return connector_status_connected;
391391
}
392392

393+
void vc4_txp_connector_reset(struct drm_connector *connector)
394+
{
395+
struct drm_connector_state *state = connector->state;
396+
uint64_t rotation = DRM_MODE_ROTATE_0;
397+
398+
if (connector->state)
399+
__drm_atomic_helper_connector_destroy_state(connector->state);
400+
401+
kfree(state);
402+
403+
state = kzalloc(sizeof(struct drm_connector_state), GFP_KERNEL);
404+
405+
if (state) {
406+
if (connector->rotation_property)
407+
drm_object_property_get_default_value(&connector->base,
408+
connector->rotation_property,
409+
&rotation);
410+
state->rotation = rotation;
411+
}
412+
413+
__drm_atomic_helper_connector_reset(connector, state);
414+
}
415+
393416
static const struct drm_connector_funcs vc4_txp_connector_funcs = {
394417
.detect = vc4_txp_connector_detect,
395418
.fill_modes = drm_helper_probe_single_connector_modes,
396419
.destroy = drm_connector_cleanup,
397-
.reset = drm_atomic_helper_connector_reset,
420+
.reset = vc4_txp_connector_reset,
398421
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
399422
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
400423
};

0 commit comments

Comments
 (0)