linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Daniel Vetter <daniel@ffwll.ch>, Hans de Goede <j.w.r.degoede@gmail.com>
Cc: linux-fbdev@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	David Airlie <airlied@linux.ie>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	Daniel Drake <drake@endlessm.com>,
	dri-devel@lists.freedesktop.org,
	Bastien Nocera <hadess@hadess.net>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [Intel-gfx] [PATCH v3 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation
Date: Sat, 04 Nov 2017 13:13:21 +0000	[thread overview]
Message-ID: <e3845905-ded6-1b2c-c38c-bd6d2b6ee4ee@redhat.com> (raw)
In-Reply-To: <20171030095345.663btb7tq2qpnzys@phenom.ffwll.local>

Hi,

On 30-10-17 10:53, Daniel Vetter wrote:
> On Mon, Oct 23, 2017 at 09:14:24AM +0200, Hans de Goede wrote:
>> On some hardware the LCD panel is not mounted upright in the casing,
>> but rotated by 90 degrees. In this case we want the console to
>> automatically be rotated to compensate.
>>
>> The drm subsys has a quirk table for this, use the
>> drm_get_panel_orientation_quirk function to get the panel orientation
>> and set info->fbcon_rotate_hint based on this, so that the fbcon console
>> on top of efifb gets automatically rotated to compensate for the panel
>> orientation.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/video/fbdev/Kconfig |  1 +
>>   drivers/video/fbdev/efifb.c | 21 ++++++++++++++++++++-
>>   2 files changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
>> index 5e58f5ec0a28..c4a90c497839 100644
>> --- a/drivers/video/fbdev/Kconfig
>> +++ b/drivers/video/fbdev/Kconfig
>> @@ -772,6 +772,7 @@ config FB_VESA
>>   config FB_EFI
>>   	bool "EFI-based Framebuffer Support"
>>   	depends on (FB = y) && !IA64 && EFI
>> +	select DRM_PANEL_ORIENTATION_QUIRKS
>>   	select FB_CFB_FILLRECT
>>   	select FB_CFB_COPYAREA
>>   	select FB_CFB_IMAGEBLIT
>> diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
>> index 3a010641f630..8c7f6aeee205 100644
>> --- a/drivers/video/fbdev/efifb.c
>> +++ b/drivers/video/fbdev/efifb.c
>> @@ -15,6 +15,8 @@
>>   #include <linux/screen_info.h>
>>   #include <video/vga.h>
>>   #include <asm/efi.h>
>> +#include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
>> +#include <drm/drm_mode.h>  /* For DRM_MODE_PANEL_ORIENTATION_* */
>>   
>>   static bool request_mem_succeeded = false;
>>   static bool nowc = false;
>> @@ -156,7 +158,7 @@ static u64 bar_offset;
>>   static int efifb_probe(struct platform_device *dev)
>>   {
>>   	struct fb_info *info;
>> -	int err;
>> +	int err, orientation;
>>   	unsigned int size_vmode;
>>   	unsigned int size_remap;
>>   	unsigned int size_total;
>> @@ -328,6 +330,23 @@ static int efifb_probe(struct platform_device *dev)
>>   	info->fix = efifb_fix;
>>   	info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE;
>>   
>> +	orientation = drm_get_panel_orientation_quirk(efifb_defined.xres,
>> +						      efifb_defined.yres);
> 
> Oh right, that's the reason for the separate function. Still ugh.
> 
> Maybe add a comment in the kernel-doc for why it is what it is ...

Actually the drm_get_panel_orientation_quirk() function was missing
a kernel-doc comment documenting it altogether. For v5 of this
patch-set I've added a kernel-doc comment and I've added this bit
to that kernel-doc comment to explain why drm_get_panel_orientation_quirk()
lives in a separate .ko target:

  * Note this function is also used outside of the drm-subsys, by for example
  * the efifb code. Because of this this function gets compiled into its own
  * kernel-module when built as a module.

Regards,

Hans



> -Daniel
> 
>> +	switch (orientation) {
>> +	default:
>> +		info->fbcon_rotate_hint = FB_ROTATE_UR;
>> +		break;
>> +	case DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP:
>> +		info->fbcon_rotate_hint = FB_ROTATE_UD;
>> +		break;
>> +	case DRM_MODE_PANEL_ORIENTATION_LEFT_UP:
>> +		info->fbcon_rotate_hint = FB_ROTATE_CCW;
>> +		break;
>> +	case DRM_MODE_PANEL_ORIENTATION_RIGHT_UP:
>> +		info->fbcon_rotate_hint = FB_ROTATE_CW;
>> +		break;
>> +	}
>> +
>>   	err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
>>   	if (err) {
>>   		pr_err("efifb: cannot add sysfs attrs\n");
>> -- 
>> 2.14.2
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

  parent reply	other threads:[~2017-11-04 13:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23  7:14 [PATCH v3 0/7] drm/fbdev: Panel orientation connector property support Hans de Goede
2017-10-23  7:14 ` [PATCH v3 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Hans de Goede
2017-10-23 12:43   ` Sebastian Reichel
2017-10-23 13:54     ` Hans de Goede
2017-10-23  7:14 ` [PATCH v3 2/7] drm: Add panel orientation quirks Hans de Goede
2017-10-30  9:39   ` [Intel-gfx] " Daniel Vetter
2017-10-30 10:52     ` Hans de Goede
2017-10-23  7:14 ` [PATCH v3 3/7] drm: Add support for a panel-orientation connector property Hans de Goede
2017-10-30  9:43   ` [Intel-gfx] " Daniel Vetter
2017-10-30 10:57     ` Hans de Goede
2017-10-31 10:07       ` Daniel Vetter
2017-10-23  7:14 ` [PATCH v3 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary plane Hans de Goede
2017-10-30  9:52   ` [Intel-gfx] [PATCH v3 4/7] drm/fb-helper: Apply panel orientation connector prop to the primary Daniel Vetter
2017-10-30 11:09     ` Hans de Goede
2017-10-31 10:14       ` Daniel Vetter
2017-10-31 10:24         ` Hans de Goede
2017-10-31 10:40           ` Daniel Vetter
2017-10-23  7:14 ` [PATCH v3 5/7] drm/i915: Add "panel orientation" property to the panel connector Hans de Goede
2017-10-23  7:14 ` [PATCH v3 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation_quirk Hans de Goede
2017-10-30  9:53   ` [Intel-gfx] [PATCH v3 6/7] efifb: Set info->fbcon_rotate_hint based on drm_get_panel_orientation Daniel Vetter
2017-10-30 11:10     ` Hans de Goede
2017-11-04 13:13     ` Hans de Goede [this message]
2017-10-23  7:14 ` [PATCH v3 7/7] fbcon: Remove dmi quirk table Hans de Goede
2017-10-30  9:58 ` [Intel-gfx] [PATCH v3 0/7] drm/fbdev: Panel orientation connector property support Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3845905-ded6-1b2c-c38c-bd6d2b6ee4ee@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=airlied@linux.ie \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.vetter@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=drake@endlessm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hadess@hadess.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=j.w.r.degoede@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).