drm/connector: Share with non-atomic drivers the function to get the single encoder
This 3 non-atomic drivers all have the same function getting the
only encoder available in the connector, also atomic drivers have
this fallback. So moving it a common place and sharing between atomic
and non-atomic drivers.
While at it I also removed the mention of
drm_atomic_helper_best_encoder() that was renamed in
commit 297e30b5d9
("drm/atomic-helper: Unexport
drm_atomic_helper_best_encoder").
v3: moving drm_connector_get_single_encoder to drm_kms_helper module
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190913232857.389834-1-jose.souza@intel.com
This commit is contained in:

committed by
Manasi Navare

parent
37d212622a
commit
a92462d6bf
@@ -481,6 +481,17 @@ drm_crtc_helper_disable(struct drm_crtc *crtc)
|
||||
__drm_helper_disable_unused_functions(dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* For connectors that support multiple encoders, either the
|
||||
* .atomic_best_encoder() or .best_encoder() operation must be implemented.
|
||||
*/
|
||||
struct drm_encoder *
|
||||
drm_connector_get_single_encoder(struct drm_connector *connector)
|
||||
{
|
||||
WARN_ON(connector->encoder_ids[1]);
|
||||
return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_crtc_helper_set_config - set a new config from userspace
|
||||
* @set: mode set configuration
|
||||
@@ -646,7 +657,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
|
||||
new_encoder = connector->encoder;
|
||||
for (ro = 0; ro < set->num_connectors; ro++) {
|
||||
if (set->connectors[ro] == connector) {
|
||||
new_encoder = connector_funcs->best_encoder(connector);
|
||||
if (connector_funcs->best_encoder)
|
||||
new_encoder = connector_funcs->best_encoder(connector);
|
||||
else
|
||||
new_encoder = drm_connector_get_single_encoder(connector);
|
||||
|
||||
/* if we can't get an encoder for a connector
|
||||
we are setting now - then fail */
|
||||
if (new_encoder == NULL)
|
||||
|
Reference in New Issue
Block a user