mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
83 lines
2.6 KiB
Diff
83 lines
2.6 KiB
Diff
|
From b27886692e427117c9dd270bbf6ea423761f293a Mon Sep 17 00:00:00 2001
|
||
|
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
||
|
Date: Mon, 9 Oct 2023 16:32:45 +0100
|
||
|
Subject: [PATCH 0678/1085] fbdev: Allow client to request a particular
|
||
|
/dev/fbN node
|
||
|
|
||
|
Add a flag custom_fb_num to denote that the client has
|
||
|
requested a specific fbdev node number via node.
|
||
|
|
||
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
||
|
---
|
||
|
drivers/video/fbdev/core/fbmem.c | 19 ++++++++++++++-----
|
||
|
include/linux/fb.h | 2 ++
|
||
|
2 files changed, 16 insertions(+), 5 deletions(-)
|
||
|
|
||
|
--- a/drivers/video/fbdev/core/fbmem.c
|
||
|
+++ b/drivers/video/fbdev/core/fbmem.c
|
||
|
@@ -49,6 +49,7 @@ struct class *fb_class;
|
||
|
DEFINE_MUTEX(registration_lock);
|
||
|
struct fb_info *registered_fb[FB_MAX] __read_mostly;
|
||
|
int num_registered_fb __read_mostly;
|
||
|
+int min_dynamic_fb __read_mostly;
|
||
|
#define for_each_registered_fb(i) \
|
||
|
for (i = 0; i < FB_MAX; i++) \
|
||
|
if (!registered_fb[i]) {} else
|
||
|
@@ -938,10 +939,12 @@ static int do_register_framebuffer(struc
|
||
|
return -ENXIO;
|
||
|
|
||
|
num_registered_fb++;
|
||
|
- for (i = 0 ; i < FB_MAX; i++)
|
||
|
- if (!registered_fb[i])
|
||
|
- break;
|
||
|
- fb_info->node = i;
|
||
|
+ if (!fb_info->custom_fb_num || fb_info->node >= FB_MAX || registered_fb[fb_info->node]) {
|
||
|
+ for (i = min_dynamic_fb ; i < FB_MAX; i++)
|
||
|
+ if (!registered_fb[i])
|
||
|
+ break;
|
||
|
+ fb_info->node = i;
|
||
|
+ }
|
||
|
refcount_set(&fb_info->count, 1);
|
||
|
mutex_init(&fb_info->lock);
|
||
|
mutex_init(&fb_info->mm_lock);
|
||
|
@@ -976,7 +979,7 @@ static int do_register_framebuffer(struc
|
||
|
|
||
|
fb_var_to_videomode(&mode, &fb_info->var);
|
||
|
fb_add_videomode(&mode, &fb_info->modelist);
|
||
|
- registered_fb[i] = fb_info;
|
||
|
+ registered_fb[fb_info->node] = fb_info;
|
||
|
|
||
|
#ifdef CONFIG_GUMSTIX_AM200EPD
|
||
|
{
|
||
|
@@ -1037,6 +1040,12 @@ static void do_unregister_framebuffer(st
|
||
|
put_fb_info(fb_info);
|
||
|
}
|
||
|
|
||
|
+void fb_set_lowest_dynamic_fb(int min_fb_dev)
|
||
|
+{
|
||
|
+ min_dynamic_fb = min_fb_dev;
|
||
|
+}
|
||
|
+EXPORT_SYMBOL(fb_set_lowest_dynamic_fb);
|
||
|
+
|
||
|
/**
|
||
|
* register_framebuffer - registers a frame buffer device
|
||
|
* @fb_info: frame buffer info structure
|
||
|
--- a/include/linux/fb.h
|
||
|
+++ b/include/linux/fb.h
|
||
|
@@ -501,6 +501,7 @@ struct fb_info {
|
||
|
void *par;
|
||
|
|
||
|
bool skip_vt_switch; /* no VT switch on suspend/resume required */
|
||
|
+ bool custom_fb_num; /* Use value in node as the preferred node number */
|
||
|
};
|
||
|
|
||
|
/* This will go away
|
||
|
@@ -589,6 +590,7 @@ extern ssize_t fb_sys_write(struct fb_in
|
||
|
.fb_imageblit = sys_imageblit
|
||
|
|
||
|
/* fbmem.c */
|
||
|
+extern void fb_set_lowest_dynamic_fb(int min_fb_dev);
|
||
|
extern int register_framebuffer(struct fb_info *fb_info);
|
||
|
extern void unregister_framebuffer(struct fb_info *fb_info);
|
||
|
extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
|