drm: Use a nondestructive mode for output detect when polling (v2)
v2: Julien Cristau pointed out that @nondestructive results in double-negatives and confusion when trying to interpret the parameter, so use @force instead. Much easier to type as well. ;-) And fix the miscompilation of vmgfx reported by Sedat Dilek. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a41ceb1c17
commit
930a9e2835
|
@ -103,7 +103,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
|
|||
if (connector->funcs->force)
|
||||
connector->funcs->force(connector);
|
||||
} else {
|
||||
connector->status = connector->funcs->detect(connector, false);
|
||||
connector->status = connector->funcs->detect(connector, true);
|
||||
drm_kms_helper_poll_enable(dev);
|
||||
}
|
||||
|
||||
|
@ -866,7 +866,7 @@ static void output_poll_execute(struct work_struct *work)
|
|||
!(connector->polled & DRM_CONNECTOR_POLL_HPD))
|
||||
continue;
|
||||
|
||||
status = connector->funcs->detect(connector, true);
|
||||
status = connector->funcs->detect(connector, false);
|
||||
if (old_status != status)
|
||||
changed = true;
|
||||
}
|
||||
|
|
|
@ -401,8 +401,7 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
intel_crt_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_crt_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
|
@ -421,7 +420,7 @@ intel_crt_detect(struct drm_connector *connector,
|
|||
if (intel_crt_detect_ddc(encoder))
|
||||
return connector_status_connected;
|
||||
|
||||
if (nondestructive)
|
||||
if (!force)
|
||||
return connector->status;
|
||||
|
||||
/* for pre-945g platforms use load detect */
|
||||
|
|
|
@ -1386,8 +1386,7 @@ ironlake_dp_detect(struct drm_connector *connector)
|
|||
* \return false if DP port is disconnected.
|
||||
*/
|
||||
static enum drm_connector_status
|
||||
intel_dp_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_dp_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
|
||||
|
|
|
@ -222,8 +222,7 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
|
|||
* Unimplemented.
|
||||
*/
|
||||
static enum drm_connector_status
|
||||
intel_dvo_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_dvo_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder);
|
||||
|
|
|
@ -139,8 +139,7 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
intel_hdmi_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_hdmi_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
|
||||
|
|
|
@ -446,8 +446,7 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
|
|||
* needed, using lid status notification from the input layer.
|
||||
*/
|
||||
static enum drm_connector_status
|
||||
intel_lvds_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_lvds_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
enum drm_connector_status status = connector_status_connected;
|
||||
|
@ -543,7 +542,7 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
|
|||
*/
|
||||
if (connector)
|
||||
connector->status = connector->funcs->detect(connector,
|
||||
true);
|
||||
false);
|
||||
|
||||
/* Don't force modeset on machines where it causes a GPU lockup */
|
||||
if (dmi_check_system(intel_no_modeset_on_lid))
|
||||
|
|
|
@ -1417,7 +1417,7 @@ intel_analog_is_connected(struct drm_device *dev)
|
|||
if (!analog_connector)
|
||||
return false;
|
||||
|
||||
if (analog_connector->funcs->detect(analog_connector, true) ==
|
||||
if (analog_connector->funcs->detect(analog_connector, false) ==
|
||||
connector_status_disconnected)
|
||||
return false;
|
||||
|
||||
|
@ -1487,8 +1487,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
intel_sdvo_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_sdvo_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
uint16_t response;
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
|
|
|
@ -1341,8 +1341,7 @@ static void intel_tv_find_better_format(struct drm_connector *connector)
|
|||
* we have a pipe programmed in order to probe the TV.
|
||||
*/
|
||||
static enum drm_connector_status
|
||||
intel_tv_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
intel_tv_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_display_mode mode;
|
||||
struct drm_encoder *encoder = intel_attached_encoder(connector);
|
||||
|
@ -1354,7 +1353,7 @@ intel_tv_detect(struct drm_connector *connector,
|
|||
|
||||
if (encoder->crtc && encoder->crtc->enabled) {
|
||||
type = intel_tv_detect_type(intel_tv);
|
||||
} else if (nondestructive) {
|
||||
} else if (force) {
|
||||
struct drm_crtc *crtc;
|
||||
int dpms_mode;
|
||||
|
||||
|
|
|
@ -168,8 +168,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
nouveau_connector_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
nouveau_connector_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct nouveau_connector *nv_connector = nouveau_connector(connector);
|
||||
|
@ -247,8 +246,7 @@ detect_analog:
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
nouveau_connector_detect_lvds(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||
|
@ -269,7 +267,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector,
|
|||
|
||||
/* Try retrieving EDID via DDC */
|
||||
if (!dev_priv->vbios.fp_no_ddc) {
|
||||
status = nouveau_connector_detect(connector, nondestructive);
|
||||
status = nouveau_connector_detect(connector, force);
|
||||
if (status == connector_status_connected)
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -482,8 +482,7 @@ static int radeon_lvds_mode_valid(struct drm_connector *connector,
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
radeon_lvds_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
radeon_lvds_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
|
||||
struct drm_encoder *encoder = radeon_best_single_encoder(connector);
|
||||
|
@ -597,8 +596,7 @@ static int radeon_vga_mode_valid(struct drm_connector *connector,
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
radeon_vga_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
radeon_vga_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
|
||||
struct drm_encoder *encoder;
|
||||
|
@ -696,8 +694,7 @@ static int radeon_tv_mode_valid(struct drm_connector *connector,
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
radeon_tv_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
radeon_tv_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_encoder_helper_funcs *encoder_funcs;
|
||||
|
@ -755,8 +752,7 @@ static int radeon_dvi_get_modes(struct drm_connector *connector)
|
|||
* if its shared we have to set the other connector to disconnected.
|
||||
*/
|
||||
static enum drm_connector_status
|
||||
radeon_dvi_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
radeon_dvi_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
|
||||
struct drm_encoder *encoder = NULL;
|
||||
|
@ -981,8 +977,7 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
|
|||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
radeon_dp_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
radeon_dp_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
|
||||
enum drm_connector_status ret = connector_status_disconnected;
|
||||
|
|
|
@ -336,7 +336,7 @@ static void vmw_ldu_connector_restore(struct drm_connector *connector)
|
|||
|
||||
static enum drm_connector_status
|
||||
vmw_ldu_connector_detect(struct drm_connector *connector,
|
||||
bool nondestructive)
|
||||
bool force)
|
||||
{
|
||||
if (vmw_connector_to_ldu(connector)->pref_active)
|
||||
return connector_status_connected;
|
||||
|
@ -517,7 +517,7 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
|
|||
|
||||
drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_LVDS);
|
||||
connector->status = vmw_ldu_connector_detect(connector);
|
||||
connector->status = vmw_ldu_connector_detect(connector, true);
|
||||
|
||||
drm_encoder_init(dev, encoder, &vmw_legacy_encoder_funcs,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
@ -611,7 +611,7 @@ int vmw_kms_ldu_update_layout(struct vmw_private *dev_priv, unsigned num,
|
|||
ldu->pref_height = 600;
|
||||
ldu->pref_active = false;
|
||||
}
|
||||
con->status = vmw_ldu_connector_detect(con);
|
||||
con->status = vmw_ldu_connector_detect(con, true);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mode_config.mutex);
|
||||
|
|
|
@ -386,8 +386,15 @@ struct drm_connector_funcs {
|
|||
void (*dpms)(struct drm_connector *connector, int mode);
|
||||
void (*save)(struct drm_connector *connector);
|
||||
void (*restore)(struct drm_connector *connector);
|
||||
|
||||
/* Check to see if anything is attached to the connector.
|
||||
* @force is set to false whilst polling, true when checking the
|
||||
* connector due to user request. @force can be used by the driver
|
||||
* to avoid expensive, destructive operations during automated
|
||||
* probing.
|
||||
*/
|
||||
enum drm_connector_status (*detect)(struct drm_connector *connector,
|
||||
bool nondestructive);
|
||||
bool force);
|
||||
int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
|
||||
int (*set_property)(struct drm_connector *connector, struct drm_property *property,
|
||||
uint64_t val);
|
||||
|
|
Loading…
Reference in a new issue