[01/21] drm/amdgpu: Remove default best_encoder hook from DC
diff mbox series

Message ID 20181004202446.22905-2-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • atomic helper cleanup, take 2
Related show

Commit Message

Daniel Vetter Oct. 4, 2018, 8:24 p.m. UTC
For atomic driver this is the default, no need to reimplement it. We
still need to keep the copypasta for not-atomic drivers though, since
no one polished the legacy crtc helpers as much as the atomic ones.

v2: amdgpu uses ->best_encoder internally, give it a local copy. It
might be a good idea to merge the connector and encoder into one
amdgpu_dm_sink structure, that might match DC internals better. At
least for non-DPMST outputs. Kudos to Ville for spotting this.

v3: Rebase onto a487411a6481 ("drm/amd/display: Use DRM helper for
best_encoder").

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Cc: Tony Cheng <Tony.Cheng@amd.com>
Cc: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Cc: Shirish S <shirish.s@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Harry Wentland Oct. 5, 2018, 3:41 p.m. UTC | #1
On 2018-10-04 04:24 PM, Daniel Vetter wrote:
> For atomic driver this is the default, no need to reimplement it. We
> still need to keep the copypasta for not-atomic drivers though, since
> no one polished the legacy crtc helpers as much as the atomic ones.
> 
> v2: amdgpu uses ->best_encoder internally, give it a local copy. It
> might be a good idea to merge the connector and encoder into one
> amdgpu_dm_sink structure, that might match DC internals better. At
> least for non-DPMST outputs. Kudos to Ville for spotting this.
> 
> v3: Rebase onto a487411a6481 ("drm/amd/display: Use DRM helper for
> best_encoder").
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Cc: Tony Cheng <Tony.Cheng@amd.com>
> Cc: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
> Cc: Shirish S <shirish.s@amd.com>

Acked-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 6a2342d72742..107e70658238 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3189,7 +3189,6 @@ amdgpu_dm_connector_helper_funcs = {
>  	 */
>  	.get_modes = get_modes,
>  	.mode_valid = amdgpu_dm_connector_mode_valid,
> -	.best_encoder = drm_atomic_helper_best_encoder
>  };
>  
>  static void dm_crtc_helper_disable(struct drm_crtc *crtc)
> @@ -3592,14 +3591,17 @@ static int to_drm_connector_type(enum signal_type st)
>  	}
>  }
>  
> +static struct drm_encoder *amdgpu_dm_connector_to_encoder(struct drm_connector *connector)
> +{
> +	return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
> +}
> +
>  static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
>  {
> -	const struct drm_connector_helper_funcs *helper =
> -		connector->helper_private;
>  	struct drm_encoder *encoder;
>  	struct amdgpu_encoder *amdgpu_encoder;
>  
> -	encoder = helper->best_encoder(connector);
> +	encoder = amdgpu_dm_connector_to_encoder(connector);
>  
>  	if (encoder == NULL)
>  		return;
> @@ -3726,14 +3728,12 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
>  
>  static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
>  {
> -	const struct drm_connector_helper_funcs *helper =
> -			connector->helper_private;
>  	struct amdgpu_dm_connector *amdgpu_dm_connector =
>  			to_amdgpu_dm_connector(connector);
>  	struct drm_encoder *encoder;
>  	struct edid *edid = amdgpu_dm_connector->edid;
>  
> -	encoder = helper->best_encoder(connector);
> +	encoder = amdgpu_dm_connector_to_encoder(connector);
>  
>  	if (!edid || !drm_edid_is_valid(edid)) {
>  		amdgpu_dm_connector->num_modes =
>
Li, Sun peng (Leo) Oct. 5, 2018, 8:13 p.m. UTC | #2
On 2018-10-05 11:41 AM, Harry Wentland wrote:
> On 2018-10-04 04:24 PM, Daniel Vetter wrote:
>> For atomic driver this is the default, no need to reimplement it. We
>> still need to keep the copypasta for not-atomic drivers though, since
>> no one polished the legacy crtc helpers as much as the atomic ones.
>>
>> v2: amdgpu uses ->best_encoder internally, give it a local copy. It
>> might be a good idea to merge the connector and encoder into one
>> amdgpu_dm_sink structure, that might match DC internals better. At
>> least for non-DPMST outputs. Kudos to Ville for spotting this.
>>
>> v3: Rebase onto a487411a6481 ("drm/amd/display: Use DRM helper for
>> best_encoder").
>>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Harry Wentland <harry.wentland@amd.com>
>> Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>> Cc: Tony Cheng <Tony.Cheng@amd.com>
>> Cc: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
>> Cc: Shirish S <shirish.s@amd.com>
> 
> Acked-by: Harry Wentland <harry.wentland@amd.com>

Thx for rebasing :)

Reviewed-by: Leo Li <sunpeng.li@amd.com>

> 
> Harry
> 
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 6a2342d72742..107e70658238 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -3189,7 +3189,6 @@ amdgpu_dm_connector_helper_funcs = {
>>   	 */
>>   	.get_modes = get_modes,
>>   	.mode_valid = amdgpu_dm_connector_mode_valid,
>> -	.best_encoder = drm_atomic_helper_best_encoder
>>   };
>>   
>>   static void dm_crtc_helper_disable(struct drm_crtc *crtc)
>> @@ -3592,14 +3591,17 @@ static int to_drm_connector_type(enum signal_type st)
>>   	}
>>   }
>>   
>> +static struct drm_encoder *amdgpu_dm_connector_to_encoder(struct drm_connector *connector)
>> +{
>> +	return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
>> +}
>> +
>>   static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
>>   {
>> -	const struct drm_connector_helper_funcs *helper =
>> -		connector->helper_private;
>>   	struct drm_encoder *encoder;
>>   	struct amdgpu_encoder *amdgpu_encoder;
>>   
>> -	encoder = helper->best_encoder(connector);
>> +	encoder = amdgpu_dm_connector_to_encoder(connector);
>>   
>>   	if (encoder == NULL)
>>   		return;
>> @@ -3726,14 +3728,12 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
>>   
>>   static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
>>   {
>> -	const struct drm_connector_helper_funcs *helper =
>> -			connector->helper_private;
>>   	struct amdgpu_dm_connector *amdgpu_dm_connector =
>>   			to_amdgpu_dm_connector(connector);
>>   	struct drm_encoder *encoder;
>>   	struct edid *edid = amdgpu_dm_connector->edid;
>>   
>> -	encoder = helper->best_encoder(connector);
>> +	encoder = amdgpu_dm_connector_to_encoder(connector);
>>   
>>   	if (!edid || !drm_edid_is_valid(edid)) {
>>   		amdgpu_dm_connector->num_modes =
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 6a2342d72742..107e70658238 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3189,7 +3189,6 @@  amdgpu_dm_connector_helper_funcs = {
 	 */
 	.get_modes = get_modes,
 	.mode_valid = amdgpu_dm_connector_mode_valid,
-	.best_encoder = drm_atomic_helper_best_encoder
 };
 
 static void dm_crtc_helper_disable(struct drm_crtc *crtc)
@@ -3592,14 +3591,17 @@  static int to_drm_connector_type(enum signal_type st)
 	}
 }
 
+static struct drm_encoder *amdgpu_dm_connector_to_encoder(struct drm_connector *connector)
+{
+	return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
+}
+
 static void amdgpu_dm_get_native_mode(struct drm_connector *connector)
 {
-	const struct drm_connector_helper_funcs *helper =
-		connector->helper_private;
 	struct drm_encoder *encoder;
 	struct amdgpu_encoder *amdgpu_encoder;
 
-	encoder = helper->best_encoder(connector);
+	encoder = amdgpu_dm_connector_to_encoder(connector);
 
 	if (encoder == NULL)
 		return;
@@ -3726,14 +3728,12 @@  static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
 
 static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
 {
-	const struct drm_connector_helper_funcs *helper =
-			connector->helper_private;
 	struct amdgpu_dm_connector *amdgpu_dm_connector =
 			to_amdgpu_dm_connector(connector);
 	struct drm_encoder *encoder;
 	struct edid *edid = amdgpu_dm_connector->edid;
 
-	encoder = helper->best_encoder(connector);
+	encoder = amdgpu_dm_connector_to_encoder(connector);
 
 	if (!edid || !drm_edid_is_valid(edid)) {
 		amdgpu_dm_connector->num_modes =