mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[dm][graphic] support dm mode
1. Add backlight framework for graphic. 2. Add framebuffer and plane, power, EDID for graphic framework 3. Add boot logo render for graphic 4. Update lcd.h Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
config RT_USING_LCD
|
||||
bool "Using LCD graphic drivers"
|
||||
bool "Using LCD graphic drivers" if !RT_USING_DM
|
||||
default n
|
||||
|
||||
menuconfig RT_USING_GRAPHIC
|
||||
bool "Using Graphics device drivers"
|
||||
depends on RT_USING_DM
|
||||
default n
|
||||
|
||||
if RT_USING_GRAPHIC
|
||||
rsource "backlight/Kconfig"
|
||||
rsource "framebuffer/Kconfig"
|
||||
rsource "logo/Kconfig"
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
from building import *
|
||||
|
||||
group = []
|
||||
objs = []
|
||||
|
||||
if not GetDepend(['RT_USING_GRAPHIC']):
|
||||
Return('group')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
list = os.listdir(cwd)
|
||||
CPPPATH = [cwd + '/../include']
|
||||
|
||||
src = ['graphic.c', 'graphic_primary.c', 'graphic_simple.c']
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(d, 'SConscript'))
|
||||
objs = objs + group
|
||||
|
||||
Return('objs')
|
||||
@@ -0,0 +1,7 @@
|
||||
menuconfig RT_GRAPHIC_BACKLIGHT
|
||||
bool "Backlight support"
|
||||
default n
|
||||
|
||||
if RT_GRAPHIC_BACKLIGHT
|
||||
osource "$(SOC_DM_GRAPHIC_BACKLIGHT_DIR)/Kconfig"
|
||||
endif
|
||||
@@ -0,0 +1,14 @@
|
||||
from building import *
|
||||
|
||||
group = []
|
||||
|
||||
if not GetDepend(['RT_GRAPHIC_BACKLIGHT']):
|
||||
Return('group')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd + '/../../include']
|
||||
|
||||
src = ['backlight.c']
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
Return('group')
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
menuconfig RT_GRAPHIC_FB
|
||||
bool "LCD and Frame buffer support"
|
||||
select RT_USING_LCD
|
||||
default y
|
||||
|
||||
if RT_GRAPHIC_FB
|
||||
osource "$(SOC_DM_GRAPHIC_FB_DIR)/Kconfig"
|
||||
endif
|
||||
@@ -0,0 +1,16 @@
|
||||
from building import *
|
||||
|
||||
group = []
|
||||
|
||||
if not GetDepend(['RT_GRAPHIC_FB']):
|
||||
Return('group')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
list = os.listdir(cwd)
|
||||
CPPPATH = [cwd + '/../../include']
|
||||
|
||||
src = []
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
logo.inc
|
||||
@@ -0,0 +1,31 @@
|
||||
menuconfig RT_GRAPHIC_LOGO
|
||||
bool "Startup Logo"
|
||||
select RT_GRAPHIC_FB
|
||||
default y
|
||||
|
||||
choice
|
||||
prompt "Rendering image(ppm)"
|
||||
default RT_GRAPHIC_LOGO_RT_THREAD_CLUT224
|
||||
depends on RT_GRAPHIC_LOGO
|
||||
|
||||
config RT_GRAPHIC_LOGO_NONE
|
||||
bool "None logo (Change in runtime)"
|
||||
|
||||
osource "$(SOC_DM_GRAPHIC_LOGO_DIR)/Kconfig"
|
||||
endchoice
|
||||
|
||||
# Provide the logos path for the BSP path:
|
||||
#
|
||||
# RT_GRAPHIC_LOGO_<XYZ> in Kconfig:
|
||||
#
|
||||
# config RT_GRAPHIC_LOGO_<XYZ>
|
||||
# bool "<XYZ> logo"
|
||||
#
|
||||
# RT_GRAPHIC_LOGO_<XYZ>_PATH in Kconfig.path:
|
||||
#
|
||||
# if RT_GRAPHIC_LOGO_<XYZ>
|
||||
# config RT_GRAPHIC_LOGO_<XYZ>_PATH
|
||||
# string
|
||||
# default "dm/graphic/logo/[filename].ppm"
|
||||
# endif
|
||||
osource "$(SOC_DM_GRAPHIC_LOGO_DIR)/Kconfig.path"
|
||||
@@ -0,0 +1,84 @@
|
||||
from building import *
|
||||
import os, re
|
||||
|
||||
group = []
|
||||
|
||||
if not GetDepend(['RT_GRAPHIC_LOGO']):
|
||||
Return('group')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
CPPPATH = [cwd + '/../../include']
|
||||
CPPDEFINES = []
|
||||
|
||||
src = ['logo.c']
|
||||
|
||||
logo_path = None
|
||||
logo_width = 0
|
||||
logo_height = 0
|
||||
logo_max_val = 0
|
||||
|
||||
if logo_path == None:
|
||||
# Find in BSP
|
||||
paths = None
|
||||
for key in BuildOptions.keys():
|
||||
if re.match(r'RT_GRAPHIC_LOGO_.*_PATH', key):
|
||||
paths = BuildOptions[key]
|
||||
break
|
||||
|
||||
if paths != None and len(paths) > 0:
|
||||
logo_path = Dir('#').abspath + '/' + paths[1:-1]
|
||||
if not os.path.exists(logo_path):
|
||||
print("Logo file '{}' not found!".format(logo_path))
|
||||
exit(-1)
|
||||
|
||||
if logo_path != None:
|
||||
with open(logo_path, 'rb') as ppm:
|
||||
data = ppm.read().split(b'\n')
|
||||
|
||||
# PPM: <magic number>
|
||||
magic = data[0].decode('utf-8')
|
||||
|
||||
# PPM: <comment>
|
||||
offset = 1
|
||||
while True:
|
||||
comment = str(data[offset].decode('utf-8'))
|
||||
if comment[0] != '#':
|
||||
break
|
||||
offset += 1
|
||||
|
||||
# PPM: <width> <height>
|
||||
logo_width, logo_height = map(int, data[offset].split())
|
||||
|
||||
# PPM: <max pixel value>
|
||||
logo_max_val = int(data[offset + 1])
|
||||
|
||||
# PPM: <data>
|
||||
ppm.seek(0)
|
||||
pixels = b''.join(ppm.readlines()[offset + 2:])
|
||||
ppm.close()
|
||||
|
||||
if magic == 'P1' or magic == 'P2' or magic == 'P3':
|
||||
# ASCII
|
||||
pixels = re.sub(b'\\s+', b'\n', pixels.strip()).decode('utf-8').split('\n')
|
||||
|
||||
logo = open(cwd + '/logo.inc', "w")
|
||||
|
||||
for dy in range(logo_height):
|
||||
for dx in range(logo_width):
|
||||
index = (dy * logo_width + dx) * 3
|
||||
# Red
|
||||
logo.write(str(pixels[index]).rjust(4) + ",")
|
||||
# Green
|
||||
logo.write(str(pixels[index + 1]).rjust(4) + ",")
|
||||
# Blue
|
||||
logo.write(str(pixels[index + 2]).rjust(4) + ",")
|
||||
logo.write("\n")
|
||||
|
||||
logo.close()
|
||||
|
||||
CPPDEFINES += ['__STARTUP_LOGO_WIDTH__=' + str(logo_width)]
|
||||
CPPDEFINES += ['__STARTUP_LOGO_HEIGHT__=' + str(logo_height)]
|
||||
CPPDEFINES += ['__STARTUP_LOGO_COLOR_MAX__=' + str(logo_max_val)]
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
|
||||
Return('group')
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,8 @@
|
||||
#ifndef RT_LCD_H__
|
||||
#define RT_LCD_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* ioctls
|
||||
0x46 is 'F' */
|
||||
|
||||
@@ -109,4 +111,35 @@ struct fb_fix_screeninfo
|
||||
uint16_t reserved[2]; /* Reserved for future compatibility */
|
||||
};
|
||||
|
||||
struct fb_cmap
|
||||
{
|
||||
uint32_t start; /* First entry */
|
||||
uint32_t len; /* Number of entries */
|
||||
uint16_t *red; /* Red values */
|
||||
uint16_t *green;
|
||||
uint16_t *blue;
|
||||
uint16_t *transp; /* transparency, can be NULL */
|
||||
};
|
||||
|
||||
struct fb_con2fbmap
|
||||
{
|
||||
uint32_t console;
|
||||
uint32_t framebuffer;
|
||||
};
|
||||
|
||||
/* VESA Blanking Levels */
|
||||
#define VESA_NO_BLANKING 0
|
||||
#define VESA_VSYNC_SUSPEND 1
|
||||
#define VESA_HSYNC_SUSPEND 2
|
||||
#define VESA_POWERDOWN 3
|
||||
|
||||
enum
|
||||
{
|
||||
FB_BLANK_UNBLANK = VESA_NO_BLANKING, /* screen: unblanked, hsync: on, vsync: on */
|
||||
FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, /* screen: blanked, hsync: on, vsync: on */
|
||||
FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, /* screen: blanked, hsync: on, vsync: off */
|
||||
FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, /* screen: blanked, hsync: off, vsync: on */
|
||||
FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1, /* screen: blanked, hsync: off, vsync: off */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user