Commit a487411a authored by Leo Li's avatar Leo Li Committed by Alex Deucher

drm/amd/display: Use DRM helper for best_encoder

[Why]
Our implementation is functionally identical to DRM's

Note that instead of checking if the provided id is 0, the helper
follows through with the mode object search. However, It will still
return NULL, since 0 is not a valid object id, and missed searches
will return NULL.

[How]
Remove our implementation, and replace it with
drm_atomic_helper_best_encoder.
Signed-off-by: default avatarLeo Li <sunpeng.li@amd.com>
Reviewed-by: default avatarDavid Francis <David.Francis@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0e8e4fbf
...@@ -2853,28 +2853,6 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = { ...@@ -2853,28 +2853,6 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
.atomic_get_property = amdgpu_dm_connector_atomic_get_property .atomic_get_property = amdgpu_dm_connector_atomic_get_property
}; };
static struct drm_encoder *best_encoder(struct drm_connector *connector)
{
int enc_id = connector->encoder_ids[0];
struct drm_mode_object *obj;
struct drm_encoder *encoder;
DRM_DEBUG_DRIVER("Finding the best encoder\n");
/* pick the encoder ids */
if (enc_id) {
obj = drm_mode_object_find(connector->dev, NULL, enc_id, DRM_MODE_OBJECT_ENCODER);
if (!obj) {
DRM_ERROR("Couldn't find a matching encoder for our connector\n");
return NULL;
}
encoder = obj_to_encoder(obj);
return encoder;
}
DRM_ERROR("No encoder id\n");
return NULL;
}
static int get_modes(struct drm_connector *connector) static int get_modes(struct drm_connector *connector)
{ {
return amdgpu_dm_connector_get_modes(connector); return amdgpu_dm_connector_get_modes(connector);
...@@ -2995,7 +2973,7 @@ amdgpu_dm_connector_helper_funcs = { ...@@ -2995,7 +2973,7 @@ amdgpu_dm_connector_helper_funcs = {
*/ */
.get_modes = get_modes, .get_modes = get_modes,
.mode_valid = amdgpu_dm_connector_mode_valid, .mode_valid = amdgpu_dm_connector_mode_valid,
.best_encoder = best_encoder .best_encoder = drm_atomic_helper_best_encoder
}; };
static void dm_crtc_helper_disable(struct drm_crtc *crtc) static void dm_crtc_helper_disable(struct drm_crtc *crtc)
......
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