当前位置: 技术问答>linux和unix
linux+qt移植颜色偏色,感觉可能是驱动问题
来源: 互联网 发布时间:2016-09-13
本文导语: Linux+Qt移植画线偏色的问题 硬件:微控电子at91sam9261 显示屏:友善lcd2vga 支持1024*768 70H +液晶显示器 Linux内核:linux-2.6.34 内核设置: Device Drivers --->Graphics support---> AT91/AT32 LCD Controller support -[] Frame Buffer in internal...
Linux+Qt移植画线偏色的问题
硬件:微控电子at91sam9261
显示屏:友善lcd2vga 支持1024*768 70H +液晶显示器
Linux内核:linux-2.6.34
内核设置:
Device Drivers --->Graphics support--->
AT91/AT32 LCD Controller support
-[] Frame Buffer in internal SRAM
-[*] Use a STN display with AT91/AT32 LCD Controller
Device Drivers --->Graphics support--->Bootu logo --->
---Boot logo
-[*] Standard black and white Linux logo
-[*] Standard 16-color Linux logo
-[*] Standard 224-color Linux logo Linux logo
驱动设置:
vim arch/arm/mach-at91/board-sam9261ek.c
static struct fb_videomode at91_stn_modes[] = {
{
.name = "SP06Q002 @ 75",
.refresh = 70,
.xres = 1024, .yres = 768,
.pixclock = KHZ2PICOS(28000),
.left_margin = 1, .right_margin = 1,
.upper_margin = 1, .lower_margin = 1,
.hsync_len = 96, .vsync_len = 2,
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
.vmode = FB_VMODE_NONINTERLACED,
},
};
static struct fb_monspecs at91fb_default_stn_monspecs = {
.manufacturer = "HIT",
.monitor = "SP06Q002",
.modedb = at91_stn_modes,
.modedb_len = ARRAY_SIZE(at91_stn_modes),
#if 1
.hfmin = 15000,
.hfmax = 64000,
.vfmin = 50,
.vfmax = 150,
#endif
};
#define AT91SAM9261_DEFAULT_STN_LCDCON2 (
ATMEL_LCDC_MEMOR_LITTLE
| ATMEL_LCDC_DISTYPE_TFT
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE )
static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN,
.default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
.default_monspecs = &at91fb_default_stn_monspecs,
.atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
.guard_time = 1,
//#if defined(CONFIG_MACH_AT91SAM9G10EK)
.lcd_wiring_mode = ATMEL_LCDC_WIRING_BGR,
//.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
//#endif
};
按照以上修改,一开始发现红蓝颜色颠倒,Linux启动的时候小企鹅的脚是蓝色的。
查网上说是要转换成bgr555
微控电子的说是做个个转换线
然后我修改/drivers/video/atmel_lcdfb.c
vim /drivers/video/atmel_lcdfb.c
修改static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)函数,在最后加入
var->blue.offset = 0;
var->green.length = 5;
var->red.offset = 10;
var->green.offset = 5;
var->red.length = 5;
var->blue.length = 5;
重新编译后,发现Linux启动的时候小企鹅的脚变成了黄色,
本以为颜色已正常,之后做Qt移植,用Qt预定义的颜色画线测试,发现黑、白、红、蓝、青、绿、黄、紫颜色是正常的,但其他颜色,都偏色。
测试语句
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.setBrush(QBrush(Qt::green,Qt::SolidPattern));
for(int i=0;i
硬件:微控电子at91sam9261
显示屏:友善lcd2vga 支持1024*768 70H +液晶显示器
Linux内核:linux-2.6.34
内核设置:
Device Drivers --->Graphics support--->
AT91/AT32 LCD Controller support
-[] Frame Buffer in internal SRAM
-[*] Use a STN display with AT91/AT32 LCD Controller
Device Drivers --->Graphics support--->Bootu logo --->
---Boot logo
-[*] Standard black and white Linux logo
-[*] Standard 16-color Linux logo
-[*] Standard 224-color Linux logo Linux logo
驱动设置:
vim arch/arm/mach-at91/board-sam9261ek.c
static struct fb_videomode at91_stn_modes[] = {
{
.name = "SP06Q002 @ 75",
.refresh = 70,
.xres = 1024, .yres = 768,
.pixclock = KHZ2PICOS(28000),
.left_margin = 1, .right_margin = 1,
.upper_margin = 1, .lower_margin = 1,
.hsync_len = 96, .vsync_len = 2,
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
.vmode = FB_VMODE_NONINTERLACED,
},
};
static struct fb_monspecs at91fb_default_stn_monspecs = {
.manufacturer = "HIT",
.monitor = "SP06Q002",
.modedb = at91_stn_modes,
.modedb_len = ARRAY_SIZE(at91_stn_modes),
#if 1
.hfmin = 15000,
.hfmax = 64000,
.vfmin = 50,
.vfmax = 150,
#endif
};
#define AT91SAM9261_DEFAULT_STN_LCDCON2 (
ATMEL_LCDC_MEMOR_LITTLE
| ATMEL_LCDC_DISTYPE_TFT
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE )
static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
.default_bpp = 16,
.default_dmacon = ATMEL_LCDC_DMAEN,
.default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
.default_monspecs = &at91fb_default_stn_monspecs,
.atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
.guard_time = 1,
//#if defined(CONFIG_MACH_AT91SAM9G10EK)
.lcd_wiring_mode = ATMEL_LCDC_WIRING_BGR,
//.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
//#endif
};
按照以上修改,一开始发现红蓝颜色颠倒,Linux启动的时候小企鹅的脚是蓝色的。
查网上说是要转换成bgr555
微控电子的说是做个个转换线
然后我修改/drivers/video/atmel_lcdfb.c
vim /drivers/video/atmel_lcdfb.c
修改static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)函数,在最后加入
var->blue.offset = 0;
var->green.length = 5;
var->red.offset = 10;
var->green.offset = 5;
var->red.length = 5;
var->blue.length = 5;
重新编译后,发现Linux启动的时候小企鹅的脚变成了黄色,
本以为颜色已正常,之后做Qt移植,用Qt预定义的颜色画线测试,发现黑、白、红、蓝、青、绿、黄、紫颜色是正常的,但其他颜色,都偏色。
测试语句
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.setBrush(QBrush(Qt::green,Qt::SolidPattern));
for(int i=0;i