亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cp_fb.c

?? Simple Cube plotting using frame buffers
?? C
字號:
// cp_fb.c //// Copyright (c) 2006, Mike Acton <macton@cellperformance.com>// // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without// limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of// the Software, and to permit persons to whom the Software is furnished to do so, subject to the following// conditions://// The above copyright notice and this permission notice shall be included in all copies or substantial// portions of the Software.//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO// EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE// OR OTHER DEALINGS IN THE SOFTWARE.// NOTES:// From Geert Uytterhoeven 2007-01-26 04:50:44, //      http://patchwork.ozlabs.org/linuxppc/patch?id=9143////     "As the actual graphics hardware cannot be accessed directly by Linux,//     ps3fb uses a virtual frame buffer in main memory. The actual screen image is//     copied to graphics memory by the GPU on every vertical blank, by making a//     hypervisor call."//#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <fcntl.h>#include <getopt.h>#include <string.h>#include <errno.h>#include <stdint.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <linux/fb.h>#include <sys/time.h>#include <asm/ps3fb.h>#include <linux/vt.h>#include <linux/kd.h>#include "cp_fb.h"static inline const char*select_error_str( int existing_error, const char* const existing_error_str, int new_error, const char* const new_error_str ){  // Only report the first error found - any error that follows is probably just a cascading effect.  const char* error_str = (char*)( (~(intptr_t)existing_error & (intptr_t)new_error & (intptr_t)new_error_str)                                 |  ((intptr_t)existing_error & (intptr_t)existing_error_str) );  return (error_str);}intcp_fb_open( cp_fb* const restrict fb ){    const char*    error_str      = NULL;    int            error          = 0;    // Open framebuffer device    const int   fb_fd             = open( "/dev/fb0", O_RDWR );    const int   open_fb_error     = (fb_fd >> ((sizeof(int)<<3)-1));    const char* open_fb_error_str = "Could not open /dev/fb0. Check permissions.";      error_str = select_error_str( error, error_str, open_fb_error, open_fb_error_str );    error     = error | open_fb_error;    // Check for vsync    struct fb_vblank vblank;    const int   get_vblank_error     = ioctl(fb_fd, FBIOGET_VBLANK, (unsigned long)&vblank);    const char* get_vblank_error_str = "Could not get vblank info (FBIOGET_VBLANK)";    error_str = select_error_str( error, error_str, get_vblank_error, get_vblank_error_str );    error     = error | get_vblank_error;    const int   has_vsync            = vblank.flags & FB_VBLANK_HAVE_VSYNC;    const int   has_vsync_error      = (~(-has_vsync|has_vsync))>>((sizeof(int)<<3)-1);    const char* has_vsync_error_str  = "No vsync available (FB_VBLANK_HAVE_VSYNC)";    error_str = select_error_str( error, error_str, has_vsync_error, has_vsync_error_str );    error     = error | has_vsync_error;    // Get screen resolution and frame count    struct ps3fb_ioctl_res res;    const int   screeninfo_error     = ioctl(fb_fd, PS3FB_IOCTL_SCREENINFO, (unsigned long)&res);    const char* screeninfo_error_str = "Could not get screen info (PS3_IOCTL_SCREENINFO)";    error_str = select_error_str( error, error_str, screeninfo_error, screeninfo_error_str );    error     = error | screeninfo_error;    const int   has_at_least_double_buffer           = (res.num_frames - 2) >> ((sizeof(res.num_frames)<<3)-1);    const int   has_at_least_double_buffer_error     = ~has_at_least_double_buffer;    const char* has_at_least_double_buffer_error_str = "Could not get screen info (PS3_IOCTL_SCREENINFO)";    error_str = select_error_str( error, error_str, has_at_least_double_buffer_error, has_at_least_double_buffer_error_str );    error     = error | has_at_least_double_buffer_error;    const uint32_t bpp                      = 4; // This is fixed for PS3 fb, and there's not a test for it.    const uint32_t frame_size               = res.xres * res.yres * bpp;    const uint32_t double_buffer_frame_size = frame_size * 2;    // const uint32_t frame_top_margin_size    = res.xres * res.yoff * bpp;    // const uint32_t frame_bottom_margin_size = frame_top_margin_size;    // const uint32_t frame_size               = frame_full_size; /* - ( frame_top_margin_size + frame_bottom_margin_size ); */    // const uint32_t double_buffer_frame_size = frame_size * 2;    const uintptr_t fb_addr           = (uintptr_t)mmap(NULL, double_buffer_frame_size, PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0);    const int       fb_mmap_error     = fb_addr >> ((sizeof(uintptr_t)<<3)-1);    const char*     fb_mmap_error_str = "Could not get mmap frame buffer";    error_str = select_error_str( error, error_str, fb_mmap_error, fb_mmap_error_str );    error     = error | fb_mmap_error;    // Take control of frame buffer from kernel    ioctl(fb_fd, PS3FB_IOCTL_ON, 0);    // yoff is the number of lines that cannot be copied to the CRT before the vblank. For the most part this represents    // unusable frame buffer space. While it is possible to draw to the area if you draw in the opposite frame buffer's    // offset space, which will (due to poor draw timing by ps3fb) be the thing that is actually drawn, it's very     // difficult to work with in practice. So:    //    //     (1)  The y offset area will be treated as "off limits".    //     (2)  An equivalent border will be created at the bottom, so the frame looks balanced even though it is    //          not entirely full screen.     // xoff is the number of lines that cannot be copied to the CRT before the hblank.    // Similar to the y offset space, the x offset space is displayed on the wrong (previous) line. So:    //    //     (1)  The x offset area will be treated as "off limits".    //     (2)  An equivalent border will be created at the right, so the frame looks balanced even though it is    //          not entirely full screen.     uintptr_t draw_start_addr = fb_addr;    uintptr_t draw_next_addr  = draw_start_addr + ( res.yres * res.xres * bpp );    uintptr_t drawable_h      = res.yres - ( 2 * res.yoff );    uintptr_t drawable_w      = res.xres - ( 2 * res.xoff );    // xoff is the number of lines that cannot be copied to the CRT before the hblank. This area is much easier to use.     // Similar to the y offset space, the x offset space is displayed on the wrong (previous) line. So:    // In principle, it is possible to steal back the x offset space by shifting back the line address to the     // start of the border of the previous line. Like so:    //    //     (1)  One additional line will be taken from the height so the a complete horizontal line can be started    //          early.    //     (2)  The frame buffer address returned in cp_fb will be offset by (xres-xoff) in order for the remaining    //          space to represent a rectangular area of drawable memory.    //    //     i.e.     //     uintptr_t draw_start_addr = fb_addr + ( ( res.xres - res.xoff ) * bpp );    //     uintptr_t draw_next_addr  = draw_start_addr + ( res.yres * res.xres * bpp );    //     uintptr_t drawable_h      = res.yres - 1 - ( 2 * res.yoff );    //     uintptr_t drawable_w      = res.xres;    //    //     But I wouldn't recommend it, since on some CRTs the effect of this would be that the frame does not appear    //     square.    fb->stride        = res.xres;    fb->w             = drawable_w;    fb->h             = drawable_h;    fb->fd            = fb_fd;    fb->start_addr    = fb_addr;    fb->size          = double_buffer_frame_size;    fb->draw_addr[0]  = draw_start_addr;    fb->draw_addr[1]  = draw_next_addr;    // Clear out the whole buffer. Any unused space is black. It's also convinient to start with a cleared frame    // buffer for the user.    memset((void*)fb_addr, 0x00, double_buffer_frame_size );    return (error);}voidcp_fb_close( const cp_fb* const restrict fb ){    // Give frame buffer control back to the kernel    ioctl(fb->fd, PS3FB_IOCTL_OFF, 0);    munmap( (void*)fb->start_addr, fb->size );    close(fb->fd);}voidcp_fb_wait_vsync( cp_fb* const restrict fb ){    unsigned long crt = 0;    ioctl(fb->fd, FBIO_WAITFORVSYNC, &crt );}voidcp_fb_flip( cp_fb* const restrict fb, unsigned long field_ndx ){    ioctl(fb->fd, PS3FB_IOCTL_FSEL,  &field_ndx );}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩专区一卡二卡| 日本一区免费视频| 高清在线观看日韩| 欧美性猛片aaaaaaa做受| 欧美亚一区二区| 欧美乱妇20p| 久久亚区不卡日本| 色妞www精品视频| 国产一区二区毛片| 亚洲欧美电影院| 久久久久国产一区二区三区四区 | 日本系列欧美系列| 欧美大胆人体bbbb| 亚洲综合在线第一页| 日本成人中文字幕在线视频| 国产黑丝在线一区二区三区| 国产自产高清不卡| 99久久伊人精品| 成人爱爱电影网址| 久久久久久久久一| 国产suv精品一区二区883| 91丝袜美女网| 91最新地址在线播放| 亚洲精品乱码久久久久久日本蜜臀| 色综合久久中文字幕| 日本亚洲电影天堂| 日本一区二区久久| 在线观看免费成人| 日韩电影在线观看网站| 久久天堂av综合合色蜜桃网| 97se狠狠狠综合亚洲狠狠| 午夜精品一区在线观看| 2021中文字幕一区亚洲| 色呦呦网站一区| 久久疯狂做爰流白浆xx| 国产精品久久看| 欧美精品三级日韩久久| 成人午夜看片网址| 午夜久久久久久久久久一区二区| 国产亚洲1区2区3区| 欧美伊人久久久久久久久影院| 久久电影网站中文字幕| 亚洲伊人色欲综合网| 国产性天天综合网| 欧美一级日韩不卡播放免费| 99re66热这里只有精品3直播| 免费成人在线影院| 一区二区三区四区av| 久久久久久97三级| 制服视频三区第一页精品| 99国产麻豆精品| 国产一区二区中文字幕| 欧美裸体一区二区三区| 日韩欧美另类在线| 国产成人免费视| 日韩国产欧美一区二区三区| 欧美精品1区2区| 成人国产精品免费观看动漫| 不卡av免费在线观看| 91视频www| 欧美久久久一区| 欧美日韩精品电影| 欧美日韩一级二级| 91.xcao| 在线观看视频欧美| 日韩精品一区二区三区swag| 欧美在线免费观看视频| 一区在线中文字幕| 日韩欧美另类在线| 中文字幕乱码日本亚洲一区二区| 国产精品私人影院| 最新国产の精品合集bt伙计| 亚洲国产视频一区| 奇米色一区二区三区四区| 国产一区高清在线| 99久久精品情趣| 欧美男生操女生| 久久新电视剧免费观看| 亚洲婷婷在线视频| 日本午夜精品一区二区三区电影| 久久成人av少妇免费| 不卡一区二区在线| 欧美日韩免费视频| 久久久久免费观看| 一区二区三区高清在线| 麻豆91精品91久久久的内涵| 成人av中文字幕| 欧美精品1区2区| 成人免费一区二区三区视频| 日韩精品一二三| 成人短视频下载| 日韩欧美中文字幕一区| 国产精品第五页| 另类小说欧美激情| 色偷偷久久一区二区三区| 精品黑人一区二区三区久久| 一区二区高清在线| 国产精品996| 在线播放日韩导航| 亚洲欧美日韩在线播放| 国产综合成人久久大片91| 欧美日韩午夜在线| 国产精品免费网站在线观看| 免费久久99精品国产| 一本一道久久a久久精品综合蜜臀| 欧美成人免费网站| 亚洲小说欧美激情另类| 国产91高潮流白浆在线麻豆| 欧美一级二级三级蜜桃| 一区二区三区在线播| 国产成人在线视频网址| 日韩网站在线看片你懂的| 亚洲黄色在线视频| 成人av午夜电影| 精品国产三级a在线观看| 亚洲国产日韩a在线播放| 成人h精品动漫一区二区三区| 欧美大片在线观看一区| 亚洲成人在线免费| 91麻豆swag| 中文字幕在线不卡一区| 国产麻豆精品在线观看| 日韩欧美在线影院| 亚洲国产aⅴ天堂久久| 一本一本大道香蕉久在线精品 | 亚洲欧美日韩国产成人精品影院 | 精品一区二区免费视频| 欧美日韩一区在线| 玉足女爽爽91| 91美女在线观看| 中文字幕一区二区三区av| 国产ts人妖一区二区| 久久久久久久久久久久久久久99 | 久久综合国产精品| 蜜臀av国产精品久久久久| 4438x成人网最大色成网站| 亚洲在线视频免费观看| 色香蕉久久蜜桃| 一区二区三区中文字幕在线观看| 91色在线porny| 亚洲婷婷综合色高清在线| 一本在线高清不卡dvd| 一区二区三区视频在线观看| 一本大道久久a久久精二百| 亚洲欧洲在线观看av| 99精品1区2区| 亚洲曰韩产成在线| 欧美在线999| 亚洲午夜国产一区99re久久| 欧美伊人久久大香线蕉综合69 | 久久亚洲精品国产精品紫薇| 久久99久久精品| 日韩一区二区免费电影| 久久成人18免费观看| 久久午夜电影网| 99精品视频在线播放观看| 亚洲精选在线视频| 欧美女孩性生活视频| 蜜臀久久99精品久久久久久9| 精品国产乱子伦一区| 99精品视频一区| 亚洲成在人线免费| 久久网这里都是精品| 成人av综合一区| 无码av免费一区二区三区试看| 日韩欧美中文一区| 本田岬高潮一区二区三区| 亚洲激情综合网| 欧美一激情一区二区三区| 国产精品一区二区男女羞羞无遮挡| 久久久久久黄色| 欧美影视一区二区三区| 老司机精品视频在线| 中文在线资源观看网站视频免费不卡| 99视频精品在线| 视频一区欧美日韩| 国产午夜亚洲精品不卡| 色老综合老女人久久久| 亚洲va在线va天堂| 2023国产精品视频| 欧美午夜在线一二页| 国产在线精品视频| 一区二区在线观看视频| 日韩欧美一二三四区| 成人在线综合网| 天堂蜜桃91精品| 国产精品久久久久久久蜜臀| 欧美老肥妇做.爰bbww视频| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 中文字幕av免费专区久久| 欧美巨大另类极品videosbest| 成人永久免费视频| 日韩和的一区二区| 中文字幕制服丝袜成人av| 欧美精选在线播放| 99久久综合99久久综合网站| 免费三级欧美电影| 亚洲愉拍自拍另类高清精品| 久久精品一区八戒影视| 欧美日本韩国一区二区三区视频|