您尚未登录。

楼主 #1 2020-01-02 09:04:29

红白机
会员
注册时间: 2020-01-02
已发帖子: 133
积分: 133

分享一个2011年在魅族M9上跑的一个framebuffer plasma 测试程序

源码下载: fbplasma.tgz

离线

楼主 #2 2020-01-02 09:05:00

红白机
会员
注册时间: 2020-01-02
已发帖子: 133
积分: 133

Re: 分享一个2011年在魅族M9上跑的一个framebuffer plasma 测试程序

cbb3840a0ec1c4b8bdc1c1fce340ded3.jpg

6fcf21ebd6c004b94fa5039d621192bc.jpg

离线

楼主 #3 2020-01-02 09:08:23

红白机
会员
注册时间: 2020-01-02
已发帖子: 133
积分: 133

Re: 分享一个2011年在魅族M9上跑的一个framebuffer plasma 测试程序

M9 直接写屏红绿蓝

编译指令:  arm-none-linux-gnueabi-gcc main.c -o test -static

#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

#define screen_height 960
#define screen_width 640

int main(void)
{
    int devfb0;
    unsigned char * fb0;
    unsigned char * framebuff;
    int i, j;

    printf("starting... ... !n");
   
    devfb0 = open("/dev/fb0", O_RDWR);

    fb0 = (char *) mmap(0, 960*640*4, PROT_READ | PROT_WRITE, MAP_SHARED, devfb0, 0);
    if ( (int) fb0 == -1)
    {
        printf ("Error: failed to map framebuffer device to memory.\n");
        exit (2);
    }
    else
    {
        printf ("The framebuffer device was mapped to memory successfully.\n");
    }


    while(1)
    {
        framebuff = fb0;
        //printf("AAAAAA........3333..............\n");
        for (i = 0; i < screen_height; ++i)
        {
         
          for (j = 0; j < screen_width; ++j)
            {
     
              /* magic transformation: color index to RGB24 */
              *framebuff ++ = 0x00;        /* blue */
              *framebuff ++ = 0x00;        /* green */
              *framebuff ++ = 0xFF;        /* red */
              *framebuff ++ = 0xFF;        /* alpha */         
            }     
        }
    }
}

离线

#4 2020-01-03 09:47:05

伍零壹
会员
注册时间: 2019-12-16
已发帖子: 157
积分: 40

Re: 分享一个2011年在魅族M9上跑的一个framebuffer plasma 测试程序

红白机 说:

M9 直接写屏红绿蓝

编译指令:  arm-none-linux-gnueabi-gcc main.c -o test -static

#include <stdio.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

#define screen_height 960
#define screen_width 640

int main(void)
{
    int devfb0;
    unsigned char * fb0;
    unsigned char * framebuff;
    int i, j;

    printf("starting... ... !n");
   
    devfb0 = open("/dev/fb0", O_RDWR);

    fb0 = (char *) mmap(0, 960*640*4, PROT_READ | PROT_WRITE, MAP_SHARED, devfb0, 0);
    if ( (int) fb0 == -1)
    {
        printf ("Error: failed to map framebuffer device to memory.\n");
        exit (2);
    }
    else
    {
        printf ("The framebuffer device was mapped to memory successfully.\n");
    }


    while(1)
    {
        framebuff = fb0;
        //printf("AAAAAA........3333..............\n");
        for (i = 0; i < screen_height; ++i)
        {
         
          for (j = 0; j < screen_width; ++j)
            {
     
              /* magic transformation: color index to RGB24 */
              *framebuff ++ = 0x00;        /* blue */
              *framebuff ++ = 0x00;        /* green */
              *framebuff ++ = 0xFF;        /* red */
              *framebuff ++ = 0xFF;        /* alpha */         
            }     
        }
    }
}

我去 这都行  怎么烧录进去的

离线

楼主 #5 2020-01-03 09:51:06

红白机
会员
注册时间: 2020-01-02
已发帖子: 133
积分: 133

Re: 分享一个2011年在魅族M9上跑的一个framebuffer plasma 测试程序

gcc 静态链接, 然后用 adb push 到一个有权限的目录, 再执行这个命令.

昨天翻邮箱, 刚好看到就传上来了。

忘记当时有没有root手机了, 按理来说 /dev/fb0 是不能执行写操作的。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn