* [PATCH] sysfb: Fix screen_info type check for VGA
@ 2025-06-03 15:48 Thomas Zimmermann
2025-06-04 10:51 ` Tzung-Bi Shih
2025-06-04 11:15 ` Javier Martinez Canillas
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2025-06-03 15:48 UTC (permalink / raw)
To: javierm
Cc: dri-devel, linux-fbdev, Thomas Zimmermann, Alex Deucher,
Tzung-Bi Shih, Helge Deller, Uwe Kleine-König, Zsolt Kajtar,
stable
Use the helper screen_info_video_type() to get the framebuffer
type from struct screen_info. Handle supported values in sorted
switch statement.
Reading orig_video_isVGA is unreliable. On most systems it is a
VIDEO_TYPE_ constant. On some systems with VGA it is simply set
to 1 to signal the presence of a VGA output. See vga_probe() for
an example. Retrieving the screen_info type with the helper
screen_info_video_type() detects these cases and returns the
appropriate VIDEO_TYPE_ constant. For VGA, sysfb creates a device
named "vga-framebuffer".
The sysfb code has been taken from vga16fb, where it likely didn't
work correctly either. With this bugfix applied, vga16fb loads for
compatible vga-framebuffer devices.
Fixes: 0db5b61e0dc0 ("fbdev/vga16fb: Create EGA/VGA devices in sysfb code")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Zsolt Kajtar <soci@c64.rulez.org>
Cc: <stable@vger.kernel.org> # v6.1+
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/firmware/sysfb.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index 7c5c03f274b9..889e5b05c739 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -143,6 +143,7 @@ static __init int sysfb_init(void)
{
struct screen_info *si = &screen_info;
struct device *parent;
+ unsigned int type;
struct simplefb_platform_data mode;
const char *name;
bool compatible;
@@ -170,17 +171,26 @@ static __init int sysfb_init(void)
goto put_device;
}
+ type = screen_info_video_type(si);
+
/* if the FB is incompatible, create a legacy framebuffer device */
- if (si->orig_video_isVGA == VIDEO_TYPE_EFI)
- name = "efi-framebuffer";
- else if (si->orig_video_isVGA == VIDEO_TYPE_VLFB)
- name = "vesa-framebuffer";
- else if (si->orig_video_isVGA == VIDEO_TYPE_VGAC)
- name = "vga-framebuffer";
- else if (si->orig_video_isVGA == VIDEO_TYPE_EGAC)
+ switch (type) {
+ case VIDEO_TYPE_EGAC:
name = "ega-framebuffer";
- else
+ break;
+ case VIDEO_TYPE_VGAC:
+ name = "vga-framebuffer";
+ break;
+ case VIDEO_TYPE_VLFB:
+ name = "vesa-framebuffer";
+ break;
+ case VIDEO_TYPE_EFI:
+ name = "efi-framebuffer";
+ break;
+ default:
name = "platform-framebuffer";
+ break;
+ }
pd = platform_device_alloc(name, 0);
if (!pd) {
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sysfb: Fix screen_info type check for VGA
2025-06-03 15:48 [PATCH] sysfb: Fix screen_info type check for VGA Thomas Zimmermann
@ 2025-06-04 10:51 ` Tzung-Bi Shih
2025-06-04 11:15 ` Javier Martinez Canillas
1 sibling, 0 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2025-06-04 10:51 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: javierm, dri-devel, linux-fbdev, Alex Deucher, Helge Deller,
Uwe Kleine-König, Zsolt Kajtar, stable
On Tue, Jun 03, 2025 at 05:48:20PM +0200, Thomas Zimmermann wrote:
> Use the helper screen_info_video_type() to get the framebuffer
> type from struct screen_info. Handle supported values in sorted
> switch statement.
>
> Reading orig_video_isVGA is unreliable. On most systems it is a
> VIDEO_TYPE_ constant. On some systems with VGA it is simply set
> to 1 to signal the presence of a VGA output. See vga_probe() for
> an example. Retrieving the screen_info type with the helper
> screen_info_video_type() detects these cases and returns the
> appropriate VIDEO_TYPE_ constant. For VGA, sysfb creates a device
> named "vga-framebuffer".
>
> The sysfb code has been taken from vga16fb, where it likely didn't
> work correctly either. With this bugfix applied, vga16fb loads for
> compatible vga-framebuffer devices.
>
> Fixes: 0db5b61e0dc0 ("fbdev/vga16fb: Create EGA/VGA devices in sysfb code")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Tzung-Bi Shih <tzungbi@kernel.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
> Cc: Zsolt Kajtar <soci@c64.rulez.org>
> Cc: <stable@vger.kernel.org> # v6.1+
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sysfb: Fix screen_info type check for VGA
2025-06-03 15:48 [PATCH] sysfb: Fix screen_info type check for VGA Thomas Zimmermann
2025-06-04 10:51 ` Tzung-Bi Shih
@ 2025-06-04 11:15 ` Javier Martinez Canillas
1 sibling, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2025-06-04 11:15 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: dri-devel, linux-fbdev, Thomas Zimmermann, Alex Deucher,
Tzung-Bi Shih, Helge Deller, Uwe Kleine-König, Zsolt Kajtar,
stable
Thomas Zimmermann <tzimmermann@suse.de> writes:
> Use the helper screen_info_video_type() to get the framebuffer
> type from struct screen_info. Handle supported values in sorted
> switch statement.
>
> Reading orig_video_isVGA is unreliable. On most systems it is a
> VIDEO_TYPE_ constant. On some systems with VGA it is simply set
> to 1 to signal the presence of a VGA output. See vga_probe() for
> an example. Retrieving the screen_info type with the helper
> screen_info_video_type() detects these cases and returns the
> appropriate VIDEO_TYPE_ constant. For VGA, sysfb creates a device
> named "vga-framebuffer".
>
> The sysfb code has been taken from vga16fb, where it likely didn't
> work correctly either. With this bugfix applied, vga16fb loads for
> compatible vga-framebuffer devices.
>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
--
Best regards,
Javier Martinez Canillas
Core Platforms
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-04 11:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 15:48 [PATCH] sysfb: Fix screen_info type check for VGA Thomas Zimmermann
2025-06-04 10:51 ` Tzung-Bi Shih
2025-06-04 11:15 ` Javier Martinez Canillas
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).