On 14/10/26 14:27, Maxime Ripard wrote:
Recent commits renamed other reset helpers to use the state_init
suffix when they only initialize properties rather than allocate or
update the object state itself.
drm_atomic_helper_connector_tv_margins_reset() falls in the same
category: it initializes the TV margin properties from the kernel
command line without allocating any state. It also reads the
connector state through connector->state, coupling it to the reset
path.
Rename it to drm_atomic_helper_connector_tv_margins_state_init() and
pass the connector state explicitly as a parameter. This decouples
it from the reset hook and prepares for the conversion to
atomic_create_state where connector->state is not yet assigned.
Signed-off-by: Maxime Ripard <[email protected]>
Reviewed-by: Maíra Canal <[email protected]>
Best regards,
- Maíra
---
Cc: "Maíra Canal" <[email protected]>
Cc: Dave Stevenson <[email protected]>
Cc: Raspberry Pi Kernel Maintenance <[email protected]>
Cc: Ruben Wauters <[email protected]>
---
drivers/gpu/drm/drm_atomic_state_helper.c | 14 ++++++++------
drivers/gpu/drm/gud/gud_connector.c | 3 ++-
drivers/gpu/drm/vc4/vc4_hdmi.c | 3 ++-
include/drm/drm_atomic_state_helper.h | 3 ++-
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c
b/drivers/gpu/drm/drm_atomic_state_helper.c
index 406157a3660f..6238066fd5d6 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -480,26 +480,27 @@ drm_atomic_helper_connector_create_state(struct
drm_connector *connector)
return state;
}
EXPORT_SYMBOL(drm_atomic_helper_connector_create_state);
/**
- * drm_atomic_helper_connector_tv_margins_reset - Resets TV connector
properties
+ * drm_atomic_helper_connector_tv_margins_state_init - Initializes TV
connector properties
+ * @state: the DRM State object
* @connector: DRM connector
*
- * Resets the TV-related properties attached to a connector.
+ * Initializes the TV-related properties attached to a connector.
*/
-void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector
*connector)
+void drm_atomic_helper_connector_tv_margins_state_init(struct
drm_connector_state *state,
+ struct drm_connector
*connector)
{
struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
- struct drm_connector_state *state = connector->state;
state->tv.margins.left = cmdline->tv_margins.left;
state->tv.margins.right = cmdline->tv_margins.right;
state->tv.margins.top = cmdline->tv_margins.top;
state->tv.margins.bottom = cmdline->tv_margins.bottom;
}
-EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset);
+EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_state_init);
/**
* drm_atomic_helper_connector_tv_reset - Resets Analog TV connector
properties
* @connector: DRM connector
*
@@ -568,11 +569,12 @@ void drm_atomic_helper_connector_tv_reset(struct
drm_connector *connector)
if (prop)
if (!drm_object_property_get_default_value(&connector->base,
prop, &val))
state->tv.hue = val;
- drm_atomic_helper_connector_tv_margins_reset(connector);
+ drm_atomic_helper_connector_tv_margins_state_init(connector->state,
+ connector);
}
EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset);
/**
* drm_atomic_helper_connector_tv_check - Validate an analog TV connector
state
diff --git a/drivers/gpu/drm/gud/gud_connector.c
b/drivers/gpu/drm/gud/gud_connector.c
index 8141c3a1e30a..a57f2565d33e 100644
--- a/drivers/gpu/drm/gud/gud_connector.c
+++ b/drivers/gpu/drm/gud/gud_connector.c
@@ -352,11 +352,12 @@ static void gud_connector_reset(struct drm_connector
*connector)
struct gud_connector *gconn = to_gud_connector(connector);
drm_atomic_helper_connector_reset(connector);
connector->state->tv = gconn->initial_tv_state;
/* Set margins from command line */
- drm_atomic_helper_connector_tv_margins_reset(connector);
+ drm_atomic_helper_connector_tv_margins_state_init(connector->state,
+ connector);
if (gconn->initial_brightness >= 0)
connector->state->tv.brightness = gconn->initial_brightness;
}
static const struct drm_connector_funcs gud_connector_funcs = {
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 3a90dbb61f4e..cf84eff847d1 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -507,11 +507,12 @@ static int vc4_hdmi_connector_atomic_check(struct
drm_connector *connector,
static void vc4_hdmi_connector_reset(struct drm_connector *connector)
{
drm_atomic_helper_connector_reset(connector);
__drm_atomic_helper_connector_hdmi_state_init(connector,
connector->state);
- drm_atomic_helper_connector_tv_margins_reset(connector);
+ drm_atomic_helper_connector_tv_margins_state_init(connector->state,
+ connector);
}
static const struct drm_connector_funcs vc4_hdmi_connector_funcs = {
.debugfs_init = drm_hdmi_connector_debugfs_init,
.force = drm_atomic_helper_connector_hdmi_force,
diff --git a/include/drm/drm_atomic_state_helper.h
b/include/drm/drm_atomic_state_helper.h
index 4706eeab52c1..4dac741af22c 100644
--- a/include/drm/drm_atomic_state_helper.h
+++ b/include/drm/drm_atomic_state_helper.h
@@ -72,11 +72,12 @@ void drm_atomic_helper_connector_reset(struct drm_connector
*connector);
struct drm_connector_state *
drm_atomic_helper_connector_create_state(struct drm_connector *connector);
void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector);
int drm_atomic_helper_connector_tv_check(struct drm_connector *connector,
struct drm_atomic_commit *state);
-void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector
*connector);
+void drm_atomic_helper_connector_tv_margins_state_init(struct
drm_connector_state *state,
+ struct drm_connector
*connector);
void
__drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
struct drm_connector_state *state);
struct drm_connector_state *
drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector);