Commit 0e9f25d0 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/atomic: Handle picture_aspect_ratio in atomic core

This is only used in i915, which had used its own non-atomic way to
deal with the picture aspect ratio. Move selected aspect_ratio to
atomic state and use the atomic state in the affected i915 connectors.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170501133804.8116-2-maarten.lankhorst@linux.intel.com
[mlankhorst: taomic -> atomic thanks to Manasi's input]
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent af33a919
...@@ -1188,6 +1188,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, ...@@ -1188,6 +1188,8 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
*/ */
if (state->link_status != DRM_LINK_STATUS_GOOD) if (state->link_status != DRM_LINK_STATUS_GOOD)
state->link_status = val; state->link_status = val;
} else if (property == config->aspect_ratio_property) {
state->picture_aspect_ratio = 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);
...@@ -1264,6 +1266,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, ...@@ -1264,6 +1266,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
*val = state->tv.hue; *val = state->tv.hue;
} else if (property == config->link_status_property) { } else if (property == config->link_status_property) {
*val = state->link_status; *val = state->link_status;
} else if (property == config->aspect_ratio_property) {
*val = state->picture_aspect_ratio;
} 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);
......
...@@ -869,7 +869,6 @@ struct intel_hdmi { ...@@ -869,7 +869,6 @@ struct intel_hdmi {
bool has_audio; bool has_audio;
enum hdmi_force_audio force_audio; enum hdmi_force_audio force_audio;
bool rgb_quant_range_selectable; bool rgb_quant_range_selectable;
enum hdmi_picture_aspect aspect_ratio;
struct intel_connector *attached_connector; struct intel_connector *attached_connector;
void (*write_infoframe)(struct drm_encoder *encoder, void (*write_infoframe)(struct drm_encoder *encoder,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
......
...@@ -1403,7 +1403,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, ...@@ -1403,7 +1403,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
} }
/* Set user selected PAR to incoming mode's member */ /* Set user selected PAR to incoming mode's member */
adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio; adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
pipe_config->lane_count = 4; pipe_config->lane_count = 4;
...@@ -1649,19 +1649,7 @@ intel_hdmi_set_property(struct drm_connector *connector, ...@@ -1649,19 +1649,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
} }
if (property == connector->dev->mode_config.aspect_ratio_property) { if (property == connector->dev->mode_config.aspect_ratio_property) {
switch (val) { connector->state->picture_aspect_ratio = val;
case DRM_MODE_PICTURE_ASPECT_NONE:
intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
break;
case DRM_MODE_PICTURE_ASPECT_4_3:
intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_4_3;
break;
case DRM_MODE_PICTURE_ASPECT_16_9:
intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_16_9;
break;
default:
return -EINVAL;
}
goto done; goto done;
} }
...@@ -1823,7 +1811,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c ...@@ -1823,7 +1811,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
intel_attach_broadcast_rgb_property(connector); intel_attach_broadcast_rgb_property(connector);
intel_hdmi->color_range_auto = true; intel_hdmi->color_range_auto = true;
intel_attach_aspect_ratio_property(connector); intel_attach_aspect_ratio_property(connector);
intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE; connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
} }
/* /*
......
...@@ -106,11 +106,6 @@ struct intel_sdvo { ...@@ -106,11 +106,6 @@ struct intel_sdvo {
uint32_t color_range; uint32_t color_range;
bool color_range_auto; bool color_range_auto;
/**
* HDMI user specified aspect ratio
*/
enum hdmi_picture_aspect aspect_ratio;
/** /**
* This is set if we're going to treat the device as TV-out. * This is set if we're going to treat the device as TV-out.
* *
...@@ -1186,7 +1181,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, ...@@ -1186,7 +1181,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
/* Set user selected PAR to incoming mode's member */ /* Set user selected PAR to incoming mode's member */
if (intel_sdvo->is_hdmi) if (intel_sdvo->is_hdmi)
adjusted_mode->picture_aspect_ratio = intel_sdvo->aspect_ratio; adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio;
return true; return true;
} }
...@@ -2067,19 +2062,7 @@ intel_sdvo_set_property(struct drm_connector *connector, ...@@ -2067,19 +2062,7 @@ intel_sdvo_set_property(struct drm_connector *connector,
} }
if (property == connector->dev->mode_config.aspect_ratio_property) { if (property == connector->dev->mode_config.aspect_ratio_property) {
switch (val) { connector->state->picture_aspect_ratio = val;
case DRM_MODE_PICTURE_ASPECT_NONE:
intel_sdvo->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
break;
case DRM_MODE_PICTURE_ASPECT_4_3:
intel_sdvo->aspect_ratio = HDMI_PICTURE_ASPECT_4_3;
break;
case DRM_MODE_PICTURE_ASPECT_16_9:
intel_sdvo->aspect_ratio = HDMI_PICTURE_ASPECT_16_9;
break;
default:
return -EINVAL;
}
goto done; goto done;
} }
...@@ -2418,7 +2401,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo, ...@@ -2418,7 +2401,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo,
intel_sdvo->color_range_auto = true; intel_sdvo->color_range_auto = true;
} }
intel_attach_aspect_ratio_property(&connector->base.base); intel_attach_aspect_ratio_property(&connector->base.base);
intel_sdvo->aspect_ratio = HDMI_PICTURE_ASPECT_NONE; connector->base.base.state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
} }
static struct intel_sdvo_connector *intel_sdvo_connector_alloc(void) static struct intel_sdvo_connector *intel_sdvo_connector_alloc(void)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/hdmi.h>
#include <drm/drm_mode_object.h> #include <drm/drm_mode_object.h>
#include <uapi/drm/drm_mode.h> #include <uapi/drm/drm_mode.h>
...@@ -326,6 +327,15 @@ struct drm_connector_state { ...@@ -326,6 +327,15 @@ struct drm_connector_state {
struct drm_atomic_state *state; struct drm_atomic_state *state;
struct drm_tv_connector_state tv; struct drm_tv_connector_state tv;
/**
* @picture_aspect_ratio: Connector property to control the
* HDMI infoframe aspect ratio setting.
*
* The DRM_MODE_PICTURE_ASPECT_\* values much match the
* values for &enum hdmi_picture_aspect
*/
enum hdmi_picture_aspect picture_aspect_ratio;
}; };
/** /**
......
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