Skip to content

Commit cf936af

Browse files
committed
parisc/stifb: Implement fb_is_primary_device()
Implement fb_is_primary_device() function, so that fbcon detects if this framebuffer belongs to the default graphics card which was used to start the system. Signed-off-by: Helge Deller <[email protected]> Cc: [email protected] # v5.10+
1 parent 6ba6883 commit cf936af

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

arch/parisc/include/asm/fb.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
1212
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
1313
}
1414

15+
#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI)
16+
int fb_is_primary_device(struct fb_info *info);
17+
#else
1518
static inline int fb_is_primary_device(struct fb_info *info)
1619
{
1720
return 0;
1821
}
22+
#endif
1923

2024
#endif /* _ASM_FB_H_ */

drivers/video/console/sticore.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <asm/pdc.h>
3131
#include <asm/cacheflush.h>
3232
#include <asm/grfioctl.h>
33+
#include <asm/fb.h>
3334

3435
#include "../fbdev/sticore.h"
3536

@@ -1127,6 +1128,22 @@ int sti_call(const struct sti_struct *sti, unsigned long func,
11271128
return ret;
11281129
}
11291130

1131+
/* check if given fb_info is the primary device */
1132+
int fb_is_primary_device(struct fb_info *info)
1133+
{
1134+
struct sti_struct *sti;
1135+
1136+
sti = sti_get_rom(0);
1137+
1138+
/* if no built-in graphics card found, allow any fb driver as default */
1139+
if (!sti)
1140+
return true;
1141+
1142+
/* return true if it's the default built-in framebuffer driver */
1143+
return (sti->info == info);
1144+
}
1145+
EXPORT_SYMBOL(fb_is_primary_device);
1146+
11301147
MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
11311148
MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
11321149
MODULE_LICENSE("GPL v2");

drivers/video/fbdev/stifb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,11 +1358,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
13581358
goto out_err3;
13591359
}
13601360

1361+
/* save for primary gfx device detection & unregister_framebuffer() */
1362+
sti->info = info;
13611363
if (register_framebuffer(&fb->info) < 0)
13621364
goto out_err4;
13631365

1364-
sti->info = info; /* save for unregister_framebuffer() */
1365-
13661366
fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n",
13671367
fix->id,
13681368
var->xres,

0 commit comments

Comments
 (0)