mirror of https://gitee.com/openkylin/linux.git
drm/i915/display: Share intel_connector_needs_modeset()
intel_connector_needs_modeset() will be used outside of intel_display.c in a future patch so it would only be necessary to remove the state and add the prototype to the header file. But while at it, I simplified the arguments and moved it to a better place intel_atomic.c. No behavior changes intended here. v3: - removed digital from exported version of intel_connector_needs_modeset - rollback connector to drm type v4: - Renamed new_connector_state to new_conn_state - Going back to drm_connector_state in intel_encoders_update_prepare/complete as we also have intel_tv_connector_state Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191223010654.67037-1-jose.souza@intel.com
This commit is contained in:
parent
3446c63a0f
commit
ee36c7c0c8
|
@ -174,6 +174,24 @@ intel_digital_connector_duplicate_state(struct drm_connector *connector)
|
||||||
return &state->base;
|
return &state->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* intel_connector_needs_modeset - check if connector needs a modeset
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
intel_connector_needs_modeset(struct intel_atomic_state *state,
|
||||||
|
struct drm_connector *connector)
|
||||||
|
{
|
||||||
|
const struct drm_connector_state *old_conn_state, *new_conn_state;
|
||||||
|
|
||||||
|
old_conn_state = drm_atomic_get_old_connector_state(&state->base, connector);
|
||||||
|
new_conn_state = drm_atomic_get_new_connector_state(&state->base, connector);
|
||||||
|
|
||||||
|
return old_conn_state->crtc != new_conn_state->crtc ||
|
||||||
|
(new_conn_state->crtc &&
|
||||||
|
drm_atomic_crtc_needs_modeset(drm_atomic_get_new_crtc_state(&state->base,
|
||||||
|
new_conn_state->crtc)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* intel_crtc_duplicate_state - duplicate crtc state
|
* intel_crtc_duplicate_state - duplicate crtc state
|
||||||
* @crtc: drm crtc
|
* @crtc: drm crtc
|
||||||
|
|
|
@ -32,6 +32,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
|
||||||
struct drm_atomic_state *state);
|
struct drm_atomic_state *state);
|
||||||
struct drm_connector_state *
|
struct drm_connector_state *
|
||||||
intel_digital_connector_duplicate_state(struct drm_connector *connector);
|
intel_digital_connector_duplicate_state(struct drm_connector *connector);
|
||||||
|
bool intel_connector_needs_modeset(struct intel_atomic_state *state,
|
||||||
|
struct drm_connector *connector);
|
||||||
|
|
||||||
struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
|
struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc);
|
||||||
void intel_crtc_destroy_state(struct drm_crtc *crtc,
|
void intel_crtc_destroy_state(struct drm_crtc *crtc,
|
||||||
|
|
|
@ -6417,39 +6417,23 @@ intel_connector_primary_encoder(struct intel_connector *connector)
|
||||||
return encoder;
|
return encoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
intel_connector_needs_modeset(struct intel_atomic_state *state,
|
|
||||||
const struct drm_connector_state *old_conn_state,
|
|
||||||
const struct drm_connector_state *new_conn_state)
|
|
||||||
{
|
|
||||||
struct intel_crtc *old_crtc = old_conn_state->crtc ?
|
|
||||||
to_intel_crtc(old_conn_state->crtc) : NULL;
|
|
||||||
struct intel_crtc *new_crtc = new_conn_state->crtc ?
|
|
||||||
to_intel_crtc(new_conn_state->crtc) : NULL;
|
|
||||||
|
|
||||||
return new_crtc != old_crtc ||
|
|
||||||
(new_crtc &&
|
|
||||||
needs_modeset(intel_atomic_get_new_crtc_state(state, new_crtc)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void intel_encoders_update_prepare(struct intel_atomic_state *state)
|
static void intel_encoders_update_prepare(struct intel_atomic_state *state)
|
||||||
{
|
{
|
||||||
struct drm_connector_state *old_conn_state;
|
|
||||||
struct drm_connector_state *new_conn_state;
|
struct drm_connector_state *new_conn_state;
|
||||||
struct drm_connector *conn;
|
struct drm_connector *connector;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for_each_oldnew_connector_in_state(&state->base, conn,
|
for_each_new_connector_in_state(&state->base, connector, new_conn_state,
|
||||||
old_conn_state, new_conn_state, i) {
|
i) {
|
||||||
|
struct intel_connector *intel_connector;
|
||||||
struct intel_encoder *encoder;
|
struct intel_encoder *encoder;
|
||||||
struct intel_crtc *crtc;
|
struct intel_crtc *crtc;
|
||||||
|
|
||||||
if (!intel_connector_needs_modeset(state,
|
if (!intel_connector_needs_modeset(state, connector))
|
||||||
old_conn_state,
|
|
||||||
new_conn_state))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
encoder = intel_connector_primary_encoder(to_intel_connector(conn));
|
intel_connector = to_intel_connector(connector);
|
||||||
|
encoder = intel_connector_primary_encoder(intel_connector);
|
||||||
if (!encoder->update_prepare)
|
if (!encoder->update_prepare)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -6461,22 +6445,21 @@ static void intel_encoders_update_prepare(struct intel_atomic_state *state)
|
||||||
|
|
||||||
static void intel_encoders_update_complete(struct intel_atomic_state *state)
|
static void intel_encoders_update_complete(struct intel_atomic_state *state)
|
||||||
{
|
{
|
||||||
struct drm_connector_state *old_conn_state;
|
|
||||||
struct drm_connector_state *new_conn_state;
|
struct drm_connector_state *new_conn_state;
|
||||||
struct drm_connector *conn;
|
struct drm_connector *connector;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for_each_oldnew_connector_in_state(&state->base, conn,
|
for_each_new_connector_in_state(&state->base, connector, new_conn_state,
|
||||||
old_conn_state, new_conn_state, i) {
|
i) {
|
||||||
|
struct intel_connector *intel_connector;
|
||||||
struct intel_encoder *encoder;
|
struct intel_encoder *encoder;
|
||||||
struct intel_crtc *crtc;
|
struct intel_crtc *crtc;
|
||||||
|
|
||||||
if (!intel_connector_needs_modeset(state,
|
if (!intel_connector_needs_modeset(state, connector))
|
||||||
old_conn_state,
|
|
||||||
new_conn_state))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
encoder = intel_connector_primary_encoder(to_intel_connector(conn));
|
intel_connector = to_intel_connector(connector);
|
||||||
|
encoder = intel_connector_primary_encoder(intel_connector);
|
||||||
if (!encoder->update_complete)
|
if (!encoder->update_complete)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue