Commit 299a16b1 authored by Boris Brezillon's avatar Boris Brezillon Committed by Eric Anholt

drm: Add TV connector states to drm_connector_state

Some generic TV connector properties are exposed in drm_mode_config, but
they are currently handled independently in each DRM encoder driver.

Extend the drm_connector_state to store TV related states, and modify the
drm_atomic_connector_{set,get}_property() helpers to fill the connector
state accordingly.

Each driver is then responsible for checking and applying the new config
in its ->atomic_mode_{check,set}() operations.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent dee7a4fe
...@@ -986,12 +986,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, ...@@ -986,12 +986,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
* now?) atomic writes to DPMS property: * now?) atomic writes to DPMS property:
*/ */
return -EINVAL; return -EINVAL;
} else if (property == config->tv_select_subconnector_property) {
state->tv.subconnector = val;
} else if (property == config->tv_left_margin_property) {
state->tv.margins.left = val;
} else if (property == config->tv_right_margin_property) {
state->tv.margins.right = val;
} else if (property == config->tv_top_margin_property) {
state->tv.margins.top = val;
} else if (property == config->tv_bottom_margin_property) {
state->tv.margins.bottom = val;
} else if (property == config->tv_mode_property) {
state->tv.mode = val;
} else if (property == config->tv_brightness_property) {
state->tv.brightness = val;
} else if (property == config->tv_contrast_property) {
state->tv.contrast = val;
} else if (property == config->tv_flicker_reduction_property) {
state->tv.flicker_reduction = val;
} else if (property == config->tv_overscan_property) {
state->tv.overscan = val;
} else if (property == config->tv_saturation_property) {
state->tv.saturation = val;
} else if (property == config->tv_hue_property) {
state->tv.hue = val;
} else if (connector->funcs->atomic_set_property) { } else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector, return connector->funcs->atomic_set_property(connector,
state, property, val); state, property, val);
} else { } else {
return -EINVAL; return -EINVAL;
} }
return 0;
} }
EXPORT_SYMBOL(drm_atomic_connector_set_property); EXPORT_SYMBOL(drm_atomic_connector_set_property);
...@@ -1022,6 +1048,30 @@ drm_atomic_connector_get_property(struct drm_connector *connector, ...@@ -1022,6 +1048,30 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
*val = (state->crtc) ? state->crtc->base.id : 0; *val = (state->crtc) ? state->crtc->base.id : 0;
} else if (property == config->dpms_property) { } else if (property == config->dpms_property) {
*val = connector->dpms; *val = connector->dpms;
} else if (property == config->tv_select_subconnector_property) {
*val = state->tv.subconnector;
} else if (property == config->tv_left_margin_property) {
*val = state->tv.margins.left;
} else if (property == config->tv_right_margin_property) {
*val = state->tv.margins.right;
} else if (property == config->tv_top_margin_property) {
*val = state->tv.margins.top;
} else if (property == config->tv_bottom_margin_property) {
*val = state->tv.margins.bottom;
} else if (property == config->tv_mode_property) {
*val = state->tv.mode;
} else if (property == config->tv_brightness_property) {
*val = state->tv.brightness;
} else if (property == config->tv_contrast_property) {
*val = state->tv.contrast;
} else if (property == config->tv_flicker_reduction_property) {
*val = state->tv.flicker_reduction;
} else if (property == config->tv_overscan_property) {
*val = state->tv.overscan;
} else if (property == config->tv_saturation_property) {
*val = state->tv.saturation;
} else if (property == config->tv_hue_property) {
*val = state->tv.hue;
} else if (connector->funcs->atomic_get_property) { } else if (connector->funcs->atomic_get_property) {
return connector->funcs->atomic_get_property(connector, return connector->funcs->atomic_get_property(connector,
state, property, val); state, property, val);
......
...@@ -193,11 +193,41 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info, ...@@ -193,11 +193,41 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
const u32 *formats, const u32 *formats,
unsigned int num_formats); unsigned int num_formats);
/**
* struct drm_tv_connector_state - TV connector related states
* @subconnector: selected subconnector
* @margins: left/right/top/bottom margins
* @mode: TV mode
* @brightness: brightness in percent
* @contrast: contrast in percent
* @flicker_reduction: flicker reduction in percent
* @overscan: overscan in percent
* @saturation: saturation in percent
* @hue: hue in percent
*/
struct drm_tv_connector_state {
enum drm_mode_subconnector subconnector;
struct {
unsigned int left;
unsigned int right;
unsigned int top;
unsigned int bottom;
} margins;
unsigned int mode;
unsigned int brightness;
unsigned int contrast;
unsigned int flicker_reduction;
unsigned int overscan;
unsigned int saturation;
unsigned int hue;
};
/** /**
* struct drm_connector_state - mutable connector state * struct drm_connector_state - mutable connector state
* @connector: backpointer to the connector * @connector: backpointer to the connector
* @best_encoder: can be used by helpers and drivers to select the encoder * @best_encoder: can be used by helpers and drivers to select the encoder
* @state: backpointer to global drm_atomic_state * @state: backpointer to global drm_atomic_state
* @tv: TV connector state
*/ */
struct drm_connector_state { struct drm_connector_state {
struct drm_connector *connector; struct drm_connector *connector;
...@@ -213,6 +243,8 @@ struct drm_connector_state { ...@@ -213,6 +243,8 @@ struct drm_connector_state {
struct drm_encoder *best_encoder; struct drm_encoder *best_encoder;
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct drm_tv_connector_state tv;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment