Changeset 26471


Ignore:
Timestamp:
02/25/14 22:46:21 (9 years ago)
Author:
obi
Message:

mipsel optimize framebuffer and enable double buffering

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/fb.h

    r26467 r26471  
    225225        }
    226226
    227         printf("[Framebuffer] %dk video mem\n", fix_screeninfo.smem_len/1024);
    228227        if(!(mmapfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)))
    229228        {
     
    232231                return NULL;
    233232        }
     233
     234        debug(100, "%dk video mem", fix_screeninfo.smem_len/1024);
     235
     236        lfb = (unsigned char*)mmap(0, fix_screeninfo.smem_len, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0);
     237        if (!lfb)
     238        {
     239                perror("mmap");
     240                goto nolfb;
     241        }
     242
     243        if (checkbox("ATEMIO5000") == 1 && var_screeninfo.bits_per_pixel != 32)
     244        {
     245                debug(100, "Only 32 bit per pixel supported. Framebuffer currently use %d", var_screeninfo.bits_per_pixel);
     246                closefb();
     247                return 0;
     248        }
     249
    234250
    235251        if(devnr == 0)
     
    257273        }
    258274
    259         printf("framebuffer not available.\n");
     275        debug(100, "framebuffer not available.");
     276
    260277        return 0;
    261278// blinking work end
     
    264281void closefb()
    265282{
    266 
    267283        if(checkbox("ATEMIO5000") == 1)
    268284        {
    269285                if(lfb)
    270286                {
    271                 printf("33\n");
     287                        debug(100, "ms_sync");
    272288                        msync(lfb, fix_screeninfo.smem_len, MS_SYNC);
    273289                        munmap(lfb, fix_screeninfo.smem_len);
     
    275291                if(fb->fd >= 0)
    276292                {
    277                 printf("44\n");
     293                        debug(100, "close");
    278294                        disablemanualblit();
    279295                        close(fb->fd);
     
    320336void changefbresolution(char *value, int flag)
    321337{
     338        debug(100, "fb->colbytes: %d", fb->colbytes);
     339        if(checkbox("ATEMIO5000") == 1) return;
     340
    322341        if(ostrcmp("pal", value) == 0)
    323342        {
    324343                fb->width = 720;
    325344                fb->height = 576;
    326                 if(checkbox("ATEMIO5000") == 1)
    327                         fb->pitch = fb->width * (fb->colbytes * 8);
    328                 else
    329                         fb->pitch = fb->width * fb->colbytes;
     345                fb->pitch = fb->width * fb->colbytes;
    330346        }
    331347        else if(ostrncmp("576", value, 3) == 0)
     
    333349                fb->width = 720;
    334350                fb->height = 576;
    335                 if(checkbox("ATEMIO5000") == 1)
    336                         fb->pitch = fb->width * (fb->colbytes * 8);
    337                 else
    338                         fb->pitch = fb->width * fb->colbytes;
    339 
     351                fb->pitch = fb->width * fb->colbytes;
    340352        }
    341353        else if(ostrncmp("720", value, 3) == 0)
     
    343355                fb->width = 1280;
    344356                fb->height = 720;
    345                 if(checkbox("ATEMIO5000") == 1)
    346                         fb->pitch = fb->width * (fb->colbytes * 8);
    347                 else
    348                         fb->pitch = fb->width * fb->colbytes;
    349 
     357                fb->pitch = fb->width * fb->colbytes;
    350358        }
    351359        else if(ostrncmp("1080", value, 4) == 0)
     
    353361                fb->width = 1920;
    354362                fb->height = 1080;
    355                 if(checkbox("ATEMIO5000") == 1)
    356                         fb->pitch = fb->width * (fb->colbytes * 8);
    357                 else
    358                         fb->pitch = fb->width * fb->colbytes;
    359 
     363                fb->pitch = fb->width * fb->colbytes;
    360364        }
    361365        if(skinfb == fb)
  • titan/titan/mipselport.h

    r26464 r26471  
    1515int g_manual_blit = 0;
    1616struct fb_fix_screeninfo fix_screeninfo;
     17struct fb_var_screeninfo var_screeninfo;
    1718
    1819int setmixer(struct dvbdev* node, int left, int right)
     
    6364        if(newnode != NULL)
    6465                newnode->varfbsize = 1920 * 1080 * newnode->colbytes;
     66//              newnode->varfbsize = 1920 * 1080 * (newnode->colbytes * 8);
     67
    6568}
    6669
     
    8184        else
    8285                g_manual_blit = 0;
     86}
     87
     88void blit()
     89{
     90        if (g_manual_blit == 1) {
     91                if (ioctl(fb->fd, FBIO_BLIT) < 0)
     92                        perror("FBIO_BLIT");
     93        }
    8394}
    8495
     
    117128        var_screeninfo.yoffset = 0;
    118129        var_screeninfo.bits_per_pixel = fb->colbytes * 8;
    119 
     130       
    120131        switch(fb->colbytes)
    121132        {
     
    142153        }
    143154       
     155        debug(100, "FB: line_length %d", fix_screeninfo.line_length);
     156        debug(100, "FB: var_screeninfo.xres %d", var_screeninfo.xres);
     157        debug(100, "FB: var_screeninfo.yres %d", var_screeninfo.yres);
     158        debug(100, "FB: var_screeninfo.xres_virt %d", var_screeninfo.xres_virtual);
     159        debug(100, "FB: var_screeninfo.yres_virt %d", var_screeninfo.yres_virtual);
     160        debug(100, "FB: var_screeninfo.xoffset %d", var_screeninfo.xoffset);
     161        debug(100, "FB: var_screeninfo.yoffset %d", var_screeninfo.yoffset);
     162        debug(100, "FB: var_screeninfo.bits_per_pixel %d", var_screeninfo.bits_per_pixel);
     163        debug(100, "FB: var_screeninfo.grayscale %d", var_screeninfo.grayscale);
    144164
    145165        if(ioctl(fb->fd, FBIOPUT_VSCREENINFO, &var_screeninfo) < 0)
     
    150170                        perr("FBIOPUT_VSCREENINFO");
    151171                }
    152         }
    153 
    154         if (g_manual_blit == 1) {
    155                 if (ioctl(fb->fd, FBIO_BLIT) < 0)
    156                         perr("FBIO_BLIT");
    157         }
    158 
     172                debug(100, "FB: double buffering not available");
     173        }
     174        else
     175        {
     176                debug(100, "FB: double buffering available!");
     177        }
     178
     179        ioctl(fb->fd, FBIOGET_VSCREENINFO, &var_screeninfo);
     180//      if ((var_screeninfo.xres!=fb->width) && (var_screeninfo.yres!=fb->height) && (var_screeninfo.bits_per_pixel!=fb->colbytes))
     181//      {
     182                debug(100, "SetMode failed: wanted: %dx%dx%d, got %dx%dx%d",
     183                        fb->width, fb->height, fb->colbytes,
     184                        var_screeninfo.xres, var_screeninfo.yres, var_screeninfo.bits_per_pixel);
     185//      }
     186/*     
     187        int xRes, yRes, stride, bpp;
     188       
     189        xRes=var_screeninfo.xres;
     190        yRes=var_screeninfo.yres;
     191        bpp=var_screeninfo.bits_per_pixel;
     192//      fb_fix_screeninfo fix;
     193//      struct fb_fix_screeninfo fix_screeninfo;
     194        if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fix_screeninfo)<0)
     195        {
     196                perror("FBIOGET_FSCREENINFO");
     197                printf("fb failed\n");
     198        }
     199        stride=fix_screeninfo.line_length;
     200        memset(lfb, 0, stride*yRes);
     201*/
     202        blit();
     203       
    159204/*
    160205        int i = 0, max = 1, wstep = 0, hstep = 0, ret = 0;
Note: See TracChangeset for help on using the changeset viewer.