哪位大侠做过 相关方面的程序 可以指导一下 或者有相关的代码 可以发给我一份吗?zuoluozuoluozuo@163.com
5 个解决方案
#1
你可以参考一下Minigui的源码。百度一下也行哈
#2
简单流程
1、open fb设备
2、通过ioctl获取、设置fb的一些参数。
3、mmap出fb设备的显存。
4、把rgb数据写入mmap出来的地址
实际直接cat数据到fb设备就有东西显示。^_^
1、open fb设备
2、通过ioctl获取、设置fb的一些参数。
3、mmap出fb设备的显存。
4、把rgb数据写入mmap出来的地址
实际直接cat数据到fb设备就有东西显示。^_^
#3
#include <asm/types.h> /* for videodev2.h */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <linux/fb.h>
#include <sys/time.h>
static void *fbbuf;
unsigned int bpp;
unsigned int screen_size;
struct fb_var_screeninfo fbvar;
struct fb_fix_screeninfo finfo;
int openfb(char *devname)
{
int fd;
fd = open(devname, O_RDWR);
if (ioctl(fd, FBIOGET_VSCREENINFO, &fbvar) < 0)
return -1;
printf("the clock is %d\n", fbvar.pixclock);
bpp = fbvar.bits_per_pixel;
screen_size = fbvar.xres * fbvar.yres * bpp / 8;
fbbuf = mmap(0, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
return fd;
}
static inline int make_pixel(unsigned int a, unsigned int r, unsigned int g, unsigned int b)
{
return (unsigned int)(((r>>3)<<11)|((g>>2)<<5|(b>>3)));
}
static void fill_pixel(unsigned int pixel, int x0, int y0, int w, int h)
{
int i, j;
unsigned short *pbuf = (unsigned short *)fbbuf;
for (i = y0; i < h; i ++) {
for (j = x0; j < w; j ++) {
pbuf[i * 240 + j] = pixel;
}
}
}
int main () {
unsigned int r, g, b;
int fp=0;
unsigned int count;
r = 0;
g = 0;
b = 0;
fp = openfb ("/dev/fb0");
if (fp < 0){
printf("Error : Can not open framebuffer device\n");
exit(1);
}
gettimeofday(&tpstart,NULL);
while(1) {
for (count = 0; count < 100; count++) {
r = 0xff;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
for (count = 0; count < 100; count++) {
r = 0x00;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
}
return 0;
}
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <linux/fb.h>
#include <sys/time.h>
static void *fbbuf;
unsigned int bpp;
unsigned int screen_size;
struct fb_var_screeninfo fbvar;
struct fb_fix_screeninfo finfo;
int openfb(char *devname)
{
int fd;
fd = open(devname, O_RDWR);
if (ioctl(fd, FBIOGET_VSCREENINFO, &fbvar) < 0)
return -1;
printf("the clock is %d\n", fbvar.pixclock);
bpp = fbvar.bits_per_pixel;
screen_size = fbvar.xres * fbvar.yres * bpp / 8;
fbbuf = mmap(0, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
return fd;
}
static inline int make_pixel(unsigned int a, unsigned int r, unsigned int g, unsigned int b)
{
return (unsigned int)(((r>>3)<<11)|((g>>2)<<5|(b>>3)));
}
static void fill_pixel(unsigned int pixel, int x0, int y0, int w, int h)
{
int i, j;
unsigned short *pbuf = (unsigned short *)fbbuf;
for (i = y0; i < h; i ++) {
for (j = x0; j < w; j ++) {
pbuf[i * 240 + j] = pixel;
}
}
}
int main () {
unsigned int r, g, b;
int fp=0;
unsigned int count;
r = 0;
g = 0;
b = 0;
fp = openfb ("/dev/fb0");
if (fp < 0){
printf("Error : Can not open framebuffer device\n");
exit(1);
}
gettimeofday(&tpstart,NULL);
while(1) {
for (count = 0; count < 100; count++) {
r = 0xff;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
for (count = 0; count < 100; count++) {
r = 0x00;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
}
return 0;
}
#4
有OS就好办了,open /dev/fb 然后写数据就行-.-,没OS就只有自己参照SOC的文档去搞了
#5
有一个libjpig可以简单实现jpig图片的framebuffer上的显示,不然自己压缩图片多麻烦啊
#1
你可以参考一下Minigui的源码。百度一下也行哈
#2
简单流程
1、open fb设备
2、通过ioctl获取、设置fb的一些参数。
3、mmap出fb设备的显存。
4、把rgb数据写入mmap出来的地址
实际直接cat数据到fb设备就有东西显示。^_^
1、open fb设备
2、通过ioctl获取、设置fb的一些参数。
3、mmap出fb设备的显存。
4、把rgb数据写入mmap出来的地址
实际直接cat数据到fb设备就有东西显示。^_^
#3
#include <asm/types.h> /* for videodev2.h */
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <linux/fb.h>
#include <sys/time.h>
static void *fbbuf;
unsigned int bpp;
unsigned int screen_size;
struct fb_var_screeninfo fbvar;
struct fb_fix_screeninfo finfo;
int openfb(char *devname)
{
int fd;
fd = open(devname, O_RDWR);
if (ioctl(fd, FBIOGET_VSCREENINFO, &fbvar) < 0)
return -1;
printf("the clock is %d\n", fbvar.pixclock);
bpp = fbvar.bits_per_pixel;
screen_size = fbvar.xres * fbvar.yres * bpp / 8;
fbbuf = mmap(0, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
return fd;
}
static inline int make_pixel(unsigned int a, unsigned int r, unsigned int g, unsigned int b)
{
return (unsigned int)(((r>>3)<<11)|((g>>2)<<5|(b>>3)));
}
static void fill_pixel(unsigned int pixel, int x0, int y0, int w, int h)
{
int i, j;
unsigned short *pbuf = (unsigned short *)fbbuf;
for (i = y0; i < h; i ++) {
for (j = x0; j < w; j ++) {
pbuf[i * 240 + j] = pixel;
}
}
}
int main () {
unsigned int r, g, b;
int fp=0;
unsigned int count;
r = 0;
g = 0;
b = 0;
fp = openfb ("/dev/fb0");
if (fp < 0){
printf("Error : Can not open framebuffer device\n");
exit(1);
}
gettimeofday(&tpstart,NULL);
while(1) {
for (count = 0; count < 100; count++) {
r = 0xff;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
for (count = 0; count < 100; count++) {
r = 0x00;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
}
return 0;
}
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <linux/fb.h>
#include <sys/time.h>
static void *fbbuf;
unsigned int bpp;
unsigned int screen_size;
struct fb_var_screeninfo fbvar;
struct fb_fix_screeninfo finfo;
int openfb(char *devname)
{
int fd;
fd = open(devname, O_RDWR);
if (ioctl(fd, FBIOGET_VSCREENINFO, &fbvar) < 0)
return -1;
printf("the clock is %d\n", fbvar.pixclock);
bpp = fbvar.bits_per_pixel;
screen_size = fbvar.xres * fbvar.yres * bpp / 8;
fbbuf = mmap(0, screen_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
return fd;
}
static inline int make_pixel(unsigned int a, unsigned int r, unsigned int g, unsigned int b)
{
return (unsigned int)(((r>>3)<<11)|((g>>2)<<5|(b>>3)));
}
static void fill_pixel(unsigned int pixel, int x0, int y0, int w, int h)
{
int i, j;
unsigned short *pbuf = (unsigned short *)fbbuf;
for (i = y0; i < h; i ++) {
for (j = x0; j < w; j ++) {
pbuf[i * 240 + j] = pixel;
}
}
}
int main () {
unsigned int r, g, b;
int fp=0;
unsigned int count;
r = 0;
g = 0;
b = 0;
fp = openfb ("/dev/fb0");
if (fp < 0){
printf("Error : Can not open framebuffer device\n");
exit(1);
}
gettimeofday(&tpstart,NULL);
while(1) {
for (count = 0; count < 100; count++) {
r = 0xff;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
for (count = 0; count < 100; count++) {
r = 0x00;
fill_pixel(make_pixel(0, r, g, b), 0, 0, 240, 320);
}
}
return 0;
}
#4
有OS就好办了,open /dev/fb 然后写数据就行-.-,没OS就只有自己参照SOC的文档去搞了
#5
有一个libjpig可以简单实现jpig图片的framebuffer上的显示,不然自己压缩图片多麻烦啊