On Feb 12, 2008 6:20 PM, Denis Oliver Kropp <[EMAIL PROTECTED]> wrote:
> Which driver are you using?

The one installed in an embedded Syabas NMT

Sorry this code is pretty rough, as I said I am just learning but I am
hope you can make sense of it.

{
        DFBCHECK(DirectFBInit( &argc, &argv ));
        DFBCHECK(DirectFBCreate( &dfb ));
        dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
        DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
        layer->GetConfiguration (layer, &layer_config);
        memset( &dsc, 0, sizeof(DFBSurfaceDescription) );
        dsc.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT;
        dsc.width = layer_config.width;
        dsc.height = layer_config.height;
        dsc.caps = DSCAPS_PRIMARY;

        DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary ));

        DFBCHECK(dfb->GetDisplayLayer( dfb, 1, &layer1 ));
        DFBCHECK(layer1->SetCooperativeLevel(layer1, DLSCL_EXCLUSIVE));
        DFBCHECK(layer1->GetSurface(layer1, &second));

        memset( &dsc, 0, sizeof(DFBSurfaceDescription) );
        layer1->GetConfiguration (layer1, &layer_config);
        dsc.flags = DSDESC_CAPS|DSDESC_PIXELFORMAT|DSDESC_WIDTH|DSDESC_HEIGHT;

        dsc.width = layer_config.width;
        dsc.height = layer_config.height;
        dsc.caps = DSCAPS_NONE;
        dsc.pixelformat = DSPF_UYVY;

        DFBCHECK(dfb->CreateSurface(dfb, &dsc, &second ));

        primary->Clear(primary,0,0,0,0);
// no display

        u16 *dst;
        if (second->Lock(second, DSLF_WRITE, (void**)(&dst), &pitch) ==DFB_OK) {
                int i,j;
                unsigned char   y0,y1,u,v;
                unsigned char *ptr1 = buf1;
                unsigned char *ptr2 = buf2;
                for (i=0;i<h;i++) {
                        for (j=0;j<pitch/2;j+=2) {
                                y0 = *ptr1++;
                                y1 = *ptr1++;
                                u = *ptr2++;
                                v = *ptr2++;
                                *(dst+j) = PIXEL_UYVY(y0,u,v);
                                *(dst+j+1) = PIXEL_UYVY(y1,u,v);
                        }
                        dst += pitch ;
                }
                second->Unlock (second);
                primary->Blit(primary,second,NULL,0,0);
        }
}

working on the primary only this works

{
// this works

        char *dst;
        if (primary->Lock(primary, DSLF_WRITE, (void**)(&dst), &pitch) 
==DFB_OK) {
                int i,j;
                unsigned char   y1,y2,u,v,r,g,b;
                unsigned char *ptr1 = buf1;
                unsigned char *ptr2 = buf2;
                for (i=0;i<h;i++) {
                        for (j=0+y;j<pitch;j+=8) {
                                y0 = *ptr1++;
                                y1 = *ptr1++;
                                u = *ptr2++;
                                v = *ptr2++;
                                yuv2rgb(y0,u,v, &r, &g, &b);
                                *(dst+j) = b;
                                *(dst+j+1) = g;
                                *(dst+j+2) = r;
                                *(dst+j+3) = 0xff;
                                yuv2rgb(y1,u,v, &r, &g, &b);
                                *(dst+j+4) = b;
                                *(dst+j+5) = g;
                                *(dst+j+6) = r;
                                *(dst+j+7) = 0xff;
                        }
                        dst += pitch ;
                }
                primary->Unlock (primary);
        }
}

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to