⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osd_inf_test.c

📁 IBM source for pallas/vulcan/vesta
💻 C
📖 第 1 页 / 共 3 页
字号:
        if(rtn < 0)    {        gfx_osi_destroy_surface(&osd_fb_surface);        PFATAL("Failed to config graphics surface parameters!\n");        return -EPERM;    }        PINFOE("Clear Surface \n");    osd_inf_clear_fb(&osd_fb_surface, 0);    PINFOE("The video buffer is now filled with vertical bar pattern for 5 seconds!\n");    osd_inf_debug_fill_fb(&osd_fb_surface);        rtn = osd_osi_attach_comp_gfx_surface(osd_fb_device, &osd_fb_surface);    if(rtn < 0)    {        gfx_osi_destroy_surface(&osd_fb_surface);        PFATAL("Failed to attach graphics surface to gfx device!\n");        return -EPERM;    }            PINFOE("%s: framebuffer at 0x%8.8x, mapped to 0x%8.8x\n",        osd_fb_dev_name, osd_fb_surface.plane[0].uBMLA, (UINT)osd_fb_surface.plane[0].pBuffer);        osd_inf_delay(500);        {        #if 1   // simple fill        PINFOE("\nTest fill solid rects\n");        PINFOE("  Single command mode, 250 filles\n");        oldjiff = jiffies;        for(i=0; i<250; i++)        {            UINT x = osd_inf_rand()%osd_scr_x;            UINT y = osd_inf_rand()%osd_scr_y;            UINT h = osd_inf_rand()%osd_scr_x;            UINT w = osd_inf_rand()%osd_scr_y;            UINT c = osd_inf_rand()%255 | (osd_inf_rand()%255<<8) | (osd_inf_rand()%255<<16) | (osd_inf_rand()%255<<24);                        // PINFOE("Fill (x,y,w,h, c) %d %d %d %d 0x%8.8x\n", x, y, w, h, c);            gfx_osi_fillBLT(&osd_fb_surface, x, y, w, h, c);            gfx_osi_run_engine(1);        }        //        PINFOE("Now Start fill\n");        PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);        osd_inf_delay(500);#endif        #if 1       // pattern fill                {            GFX_SURFACE_T  mask;            gfx_osi_init_surface_t(&mask);            rtn = gfx_osi_create_surface(&mask, GFX_VDEV_NULL,                 GFX_SURFACE_RAW1BPP, osd_buf_x, osd_buf_y);            if(rtn < 0)            {                PFATAL("Failed to create mask surface, test stopped!\n");                return 0;            }            {                // make pattern 4x4                UINT bpl, y, i;                BYTE pat=0xf0;                                bpl = mask.plane[0].uBytePerLine;                 y = mask.plane[0].uAllocHeight;                                //memset(mask.plane[0].pBuffer, 0xff, y*bpl);                                                for(i=0; i<y-3; i+=4, pat = ~pat)                {                    memset(mask.plane[0].pBuffer+i*bpl, pat, 4*bpl);                }            }                        PINFOE("\nTest fill pattern rects\n");            {                gfx_osi_advancedFillBLT(&osd_fb_surface, 1, 1, 16, 16, 0xffffffff,                    &mask, 1, 1,  GFX_ROP_DISABLE, 0, 0x00ff0000, 0, 0xf0f0f0f0);                                PINFOE("  Single command mode, 250 filles\n");                                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%osd_scr_x+1;                    UINT y = osd_inf_rand()%osd_scr_y;                    UINT h = osd_inf_rand()%osd_scr_x;                    UINT w = osd_inf_rand()%osd_scr_y;                    UINT c = osd_inf_rand()%255 | (osd_inf_rand()%255<<8) | (osd_inf_rand()%255<<16) | (osd_inf_rand()%255<<24);                                        //           PINFOE("Fill (x,y,w,h, c) %d %d %d %d 0x%8.8x\n", x, y, w, h, c);                    gfx_osi_advancedFillBLT(&osd_fb_surface, x, y, w, h, c,                        &mask, 0, 0,  GFX_ROP_DISABLE, 0, 0x00ff0000, 0, 0xf0f0f0f0);                                        gfx_osi_run_engine(1);                }                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);            }            gfx_osi_destroy_surface(&mask);            osd_inf_delay(500);        }#endif                                #if 1   // more test                #define TST_HEIGHT   256#define TST_WIDTH   256        #define YUV_DEV GFX_VDEV_OSDIMG        #define YUV_FMT GFX_SURFACE_YCBCR_422_888                        {            GFX_SURFACE_T  yuv, rgb, rgb_bl, rgb_8, yuv_8;            ALPHA_SELECT alps;                                    gfx_osi_init_surface_t(&yuv);            gfx_osi_init_surface_t(&rgb);            gfx_osi_init_surface_t(&rgb_bl);            gfx_osi_init_surface_t(&yuv_8);            gfx_osi_init_surface_t(&rgb_8);            if(osd_gfx_bpp < 16)  // clut            {                rtn = gfx_osi_create_surface(&yuv, YUV_DEV,     // put YUV on still                     GFX_SURFACE_CLUT8BPP_AYCBCR, TST_WIDTH, TST_HEIGHT);                rtn = gfx_osi_create_surface(&rgb, GFX_VDEV_NULL,                    GFX_SURFACE_CLUT8BPP_ARGB, TST_WIDTH, TST_HEIGHT);                osd_inf_fill_8bit_pattern(&yuv);                osd_inf_fill_8bit_pattern(&rgb);            }            else            {                rtn = gfx_osi_create_surface(&yuv, YUV_DEV,     // put YUV on still                     YUV_FMT, TST_WIDTH, TST_HEIGHT);                rtn = gfx_osi_create_surface(&rgb, GFX_VDEV_NULL,                    GFX_SURFACE_ARGB_8888, TST_WIDTH, TST_HEIGHT);                osd_inf_fill_color_bar(&yuv);                osd_inf_fill_color_bar(&rgb);                rtn = gfx_osi_create_surface(&rgb_bl, GFX_VDEV_NULL,                    GFX_SURFACE_ARGB_8888, TST_WIDTH, TST_HEIGHT);                osd_inf_fill_8bit_pattern(&rgb_bl);                rtn = gfx_osi_create_surface(&yuv_8, YUV_DEV,                        GFX_SURFACE_CLUT8BPP_AYCBCR, TST_WIDTH, TST_HEIGHT);                rtn = gfx_osi_create_surface(&rgb_8, YUV_DEV,                        GFX_SURFACE_CLUT8BPP_ARGB, TST_WIDTH, TST_HEIGHT);                osd_inf_fill_8bit_pattern(&yuv_8);                osd_inf_fill_8bit_pattern(&rgb_8);            }            if(rtn < 0)            {                PFATAL("Failed to create new surface, test stopped!\n");                //fixme: may lost allocated surfaces here                return 0;            }                                    // fill color bar                                    PINFOE("  Showing the YUV test color bar\n");            osd_osi_set_comp_gfx_surface_parm(&yuv, OSD_GRAPH_SURFACE_SCREEN_OFFSET, 0 /*100+osd_tv_left*/, 0/*100+osd_tv_left*/);            osd_osi_detach_comp_gfx_surface(osd_fb_device, &osd_fb_surface);            osd_osi_attach_comp_gfx_surface(YUV_DEV, &yuv);            osd_inf_delay(200);            osd_osi_attach_comp_gfx_surface(osd_fb_device, &osd_fb_surface);            osd_osi_detach_comp_gfx_surface(YUV_DEV, &yuv);                        // show it            PINFOE("  Showing the RGB test color bar\n");            gfx_osi_fillBLT(&osd_fb_surface, 0,0, osd_scr_x, osd_scr_y, 0xff000000);            gfx_osi_bitBLT(&osd_fb_surface, 0,0, TST_WIDTH, TST_HEIGHT, &rgb, 0,0, NULL, 0);            osd_inf_delay(200);            osd_inf_debug_fill_fb(&osd_fb_surface);                            if(osd_gfx_bpp >= 16)  // directcolor            {                // show it                PINFOE("  Showing the RGB blend test pattern\n");                gfx_osi_fillBLT(&osd_fb_surface, 0,0, osd_scr_x, osd_scr_y, 0xff000000);                gfx_osi_bitBLT(&osd_fb_surface, 0,0, TST_WIDTH, TST_HEIGHT, &rgb_bl, 0,0, NULL, 0);                osd_inf_delay(200);                osd_inf_debug_fill_fb(&osd_fb_surface);                // show it                PINFOE("  Showing the YUV 8 bit pattern\n");                osd_osi_attach_comp_gfx_surface(osd_fb_device, &yuv_8);                osd_inf_delay(200);                osd_osi_detach_comp_gfx_surface(osd_fb_device, &yuv_8);                PINFOE("  Showing the RGB 8 bit pattern\n");                osd_osi_attach_comp_gfx_surface(osd_fb_device, &rgb_8);                osd_inf_delay(200);                osd_osi_detach_comp_gfx_surface(osd_fb_device, &rgb_8);            }#if 0   // bitblt            PINFOE("\nTest bitblt / color convert\n");            alps.globalAlphaValue = 128;            alps.storedAlphaSelect = GFX_DEST_ALPHA_FROM_GIVEN;                        PINFOE("  bitBLT YUV->YUV, 250 ops\n");            oldjiff = jiffies;            for(i=0; i<250; i++)            {                UINT x = osd_inf_rand()%osd_scr_x;                UINT y = osd_inf_rand()%osd_scr_y;                UINT h = osd_inf_rand()%TST_HEIGHT;                UINT w = osd_inf_rand()%TST_WIDTH;                UINT sx = osd_inf_rand()%TST_HEIGHT;                UINT sy = osd_inf_rand()%TST_WIDTH;                if(gfx_osi_bitBLT(&osd_fb_surface, x, y, w, h,                    &yuv,  sx,  sy, &alps, 0))                {                    PDEBUG("bitBLT failed\n");                    break;                }            }            gfx_osi_run_engine(1);            PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);            osd_inf_delay(500);            osd_inf_debug_fill_fb(&osd_fb_surface);                        if(osd_gfx_bpp >= 16)  // directcolor            {                PINFOE("  bitBLT  RGB -> YUV, 250 ops\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%osd_scr_x;                    UINT y = osd_inf_rand()%osd_scr_y;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&osd_fb_surface, x, y, w, h,                        &rgb,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }                }                gfx_osi_run_engine(1);                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);                osd_inf_delay(500);                osd_inf_debug_fill_fb(&osd_fb_surface);                                PINFOE("  bitBLT YUV -> RGB, 250 ops, result will be shown after finish\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%TST_WIDTH;                    UINT y = osd_inf_rand()%TST_HEIGHT;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&rgb_bl, x, y, w, h,                        &yuv,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }                }                gfx_osi_run_engine(1);                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);                gfx_osi_bitBLT(&osd_fb_surface, 0,0, TST_WIDTH, TST_HEIGHT, &rgb_bl, 0,0, NULL, 0);                osd_inf_debug_fill_fb(&rgb_bl);                osd_inf_delay(500);                osd_inf_debug_fill_fb(&osd_fb_surface);                PINFOE("  bitBLT with YUV palette to YUV expansion, 250 ops\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%osd_scr_x;                    UINT y = osd_inf_rand()%osd_scr_y;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&osd_fb_surface, x, y, w, h,                        &yuv_8,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }                }                gfx_osi_run_engine(1);                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);                osd_inf_delay(500);                osd_inf_debug_fill_fb(&osd_fb_surface);                PINFOE("  bitBLT with RGB palette to YUV expansion, 250 ops\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%osd_scr_x;                    UINT y = osd_inf_rand()%osd_scr_y;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&osd_fb_surface, x, y, w, h,                        &rgb_8,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }                }                gfx_osi_run_engine(1);                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);                osd_inf_delay(500);                osd_inf_debug_fill_fb(&osd_fb_surface);                PINFOE("  bitBLT with RGB palette to RGB conversion, 250 ops\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%TST_WIDTH;                    UINT y = osd_inf_rand()%TST_HEIGHT;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&rgb_bl, x, y, w, h,                        &rgb_8,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }                }                gfx_osi_run_engine(1);                PINFOE("    Time = %ld jiffies\n", jiffies - oldjiff);                gfx_osi_bitBLT(&osd_fb_surface, 0,0, TST_WIDTH, TST_HEIGHT, &rgb_bl, 0,0, NULL, 0);                osd_inf_debug_fill_fb(&rgb_bl);                osd_inf_delay(500);                                PINFOE("  bitBLT with YUV palette to RGB conversion, 250 ops\n");                oldjiff = jiffies;                for(i=0; i<250; i++)                {                    UINT x = osd_inf_rand()%TST_WIDTH;                    UINT y = osd_inf_rand()%TST_HEIGHT;                    UINT h = osd_inf_rand()%TST_HEIGHT;                    UINT w = osd_inf_rand()%TST_WIDTH;                    UINT sx = osd_inf_rand()%TST_HEIGHT;                    UINT sy = osd_inf_rand()%TST_WIDTH;                    if(gfx_osi_bitBLT(&rgb_bl, x, y, w, h,                        &yuv_8,  sx,  sy, &alps, 0))                    {                        PDEBUG("bitBLT failed\n");                        break;                    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -