diff mbox series

[2/2] drm/i915/dp: Use BDB_GENERAL_FEATURES VBT block info for builtin panel-orientation

Message ID 20191215213307.689830-2-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/dsi: Remove readback of panel orientation on BYT / CHT | expand

Commit Message

Hans de Goede Dec. 15, 2019, 9:33 p.m. UTC
Some devices with a builtin panel have the panel mounted upside down,
this is indicated by the rotate_180 bit in the BDB_GENERAL_FEATURES VBT
block.

We store this info in dev_priv->vbt.orientation, use this to set the
connector's orientation property so that fbcon and userspace will show
the image the right way up on devices with an upside-down mounted panel.

This fixes the image being upside-down on a Teclast X89 tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ville Syrjala Dec. 16, 2019, 1:39 p.m. UTC | #1
On Sun, Dec 15, 2019 at 10:33:07PM +0100, Hans de Goede wrote:
> Some devices with a builtin panel have the panel mounted upside down,
> this is indicated by the rotate_180 bit in the BDB_GENERAL_FEATURES VBT
> block.
> 
> We store this info in dev_priv->vbt.orientation, use this to set the
> connector's orientation property so that fbcon and userspace will show
> the image the right way up on devices with an upside-down mounted panel.
> 
> This fixes the image being upside-down on a Teclast X89 tablet.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index b05b2191b919..d31c04a22976 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -7350,9 +7350,12 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	intel_connector->panel.backlight.power = intel_edp_backlight_power;
>  	intel_panel_setup_backlight(connector, pipe);
>  
> -	if (fixed_mode)
> +	if (fixed_mode) {
> +		connector->display_info.panel_orientation =
> +			dev_priv->vbt.orientation;

Do we want to set this to UNKNOWN when the VBT didn't supply the
information? IIRC the DSI code sets it to NORMAL in that case.

>  		drm_connector_init_panel_orientation_property(
>  			connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
> +	}
>  
>  	return true;
>  
> -- 
> 2.23.0
Hans de Goede Dec. 16, 2019, 6:54 p.m. UTC | #2
Hi,

On 16-12-2019 14:39, Ville Syrjälä wrote:
> On Sun, Dec 15, 2019 at 10:33:07PM +0100, Hans de Goede wrote:
>> Some devices with a builtin panel have the panel mounted upside down,
>> this is indicated by the rotate_180 bit in the BDB_GENERAL_FEATURES VBT
>> block.
>>
>> We store this info in dev_priv->vbt.orientation, use this to set the
>> connector's orientation property so that fbcon and userspace will show
>> the image the right way up on devices with an upside-down mounted panel.
>>
>> This fixes the image being upside-down on a Teclast X89 tablet.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_dp.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
>> index b05b2191b919..d31c04a22976 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>> @@ -7350,9 +7350,12 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>>   	intel_connector->panel.backlight.power = intel_edp_backlight_power;
>>   	intel_panel_setup_backlight(connector, pipe);
>>   
>> -	if (fixed_mode)
>> +	if (fixed_mode) {
>> +		connector->display_info.panel_orientation =
>> +			dev_priv->vbt.orientation;
> 
> Do we want to set this to UNKNOWN when the VBT didn't supply the
> information? IIRC the DSI code sets it to NORMAL in that case.

It is true that the DSI code sets it to normal where-as the
code filling dev_priv->vbt.orientation will set it to unknown if the
info is missing from the VBT.

Note that drm_connector_init_panel_orientation_property() will simply
omit the property if the value is unknown (and userspace treats
the property no being there as "normal").

Omitting the property when we do not know is what we have been doing
sofar for eDP panels and that does feel like the right thing to do,
I would prefer to continue doing that, as that seems the most correct
behavior, if we do not know, do not advertise any specific orientation.

Regards,

Hans



> 
>>   		drm_connector_init_panel_orientation_property(
>>   			connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
>> +	}
>>   
>>   	return true;
>>   
>> -- 
>> 2.23.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index b05b2191b919..d31c04a22976 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -7350,9 +7350,12 @@  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
 	intel_connector->panel.backlight.power = intel_edp_backlight_power;
 	intel_panel_setup_backlight(connector, pipe);
 
-	if (fixed_mode)
+	if (fixed_mode) {
+		connector->display_info.panel_orientation =
+			dev_priv->vbt.orientation;
 		drm_connector_init_panel_orientation_property(
 			connector, fixed_mode->hdisplay, fixed_mode->vdisplay);
+	}
 
 	return true;