static int DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { Uint32 sdl_format; unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; IDirectFBSurface *winsurf = data->target; DirectFB_ActivateRenderer(renderer); winsurf->GetPixelFormat(winsurf, &dfb_format); sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format); winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch); laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) ); SDL_ConvertPixels(rect->w, rect->h, sdl_format, laypixels, laypitch, format, pixels, pitch); winsurf->Unlock(winsurf); return 0; }
static void Display(vout_display_t *vd, picture_t *picture) { vout_display_sys_t *sys = vd->sys; IDirectFBSurface *primary = sys->primary; void *pixels; int pitch; if (primary->Lock(primary, DSLF_WRITE, &pixels, &pitch) == DFB_OK) { picture_resource_t rsc; memset(&rsc, 0, sizeof(rsc)); rsc.p[0].p_pixels = pixels; rsc.p[0].i_lines = sys->height; rsc.p[0].i_pitch = pitch; picture_t *direct = picture_NewFromResource(&vd->fmt, &rsc); if (direct) { picture_Copy(direct, picture); picture_Release(direct); } if (primary->Unlock(primary) == DFB_OK) primary->Flip(primary, NULL, 0); } picture_Release(picture); }
static int directfb_get_empty_bitmap (struct bitmap *bmp) { IDirectFBSurface *surface; DFBSurfaceDescription desc; bmp->data = bmp->flags = NULL; desc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_WIDTH | DSDESC_HEIGHT); desc.width = bmp->x; desc.height = bmp->y; retry: if (dfb->CreateSurface (dfb, &desc, &surface) != DFB_OK) { if (out_of_memory(MF_GPI, NULL, 0)) goto retry; return -1; } surface->Lock (surface, (DFBSurfaceLockFlags)(DSLF_READ | DSLF_WRITE), &bmp->data, &bmp->skip); bmp->flags = surface; return 0; }
int DirectFB_LockYUVOverlay(_THIS, SDL_Overlay *overlay) { DFBResult ret; void *data; int pitch; IDirectFBSurface *surface = overlay->hwdata->surface; ret = surface->Lock (surface, DSLF_READ | DSLF_WRITE, &data, &pitch); if (ret) { SetDirectFBerror("IDirectFBSurface::Lock", ret); return -1; } /* Find the pitch and offset values for the overlay */ overlay->pitches[0] = (Uint16) pitch; overlay->pixels[0] = (Uint8*) data; switch (overlay->format) { case SDL_YV12_OVERLAY: case SDL_IYUV_OVERLAY: /* Add the two extra planes */ overlay->pitches[1] = overlay->pitches[0] / 2; overlay->pitches[2] = overlay->pitches[0] / 2; overlay->pixels[1] = overlay->pixels[0] + overlay->pitches[0] * overlay->h; overlay->pixels[2] = overlay->pixels[1] + overlay->pitches[1] * overlay->h / 2; break; default: /* Only one plane, no worries */ break; } return 0; }
static void * directfb_prepare_strip (struct bitmap *bmp, int top, int lines) { IDirectFBSurface *surface = bmp->flags; surface->Lock (surface, DSLF_READ | DSLF_WRITE, &bmp->data, &bmp->skip); return ((unsigned char *) bmp->data + top * bmp->skip); }
static void * TestThread( DirectThread *thread, void *arg ) { DFBResult ret; IDirectFBSurface *surface = arg; DFBRectangle rect = { 0, 0, 500, 1 }; while (!quit) { void *data; int pitch; ret = surface->Lock( surface, DSLF_WRITE, &data, &pitch ); if (ret) { D_DERROR( ret, "DFBTest/Resize: Lock() failed!\n" ); return NULL; } if (!data) { D_DERROR( ret, "DFBTest/Resize:invalid pointer!\n" ); return NULL; } memset( data, 0, pitch * 400 ); surface->Unlock( surface ); data = malloc( pitch ); ret = surface->Read( surface, &rect, data, pitch ); if (ret) { D_DERROR( ret, "DFBTest/Resize: Read() failed!\n" ); free (data); return NULL; } ret = surface->Write( surface, &rect, data, pitch ); if (ret) { D_DERROR( ret, "DFBTest/Resize: Write() failed!\n" ); free(data); return NULL; } free(data); } return NULL; }
//Hardcore translateion void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { #ifdef DEBUG printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); #endif IDirectFBSurface * surface = NULL; EGLSurface egl_surface = NULL; DFBResult err = 0; DFBSurfaceDescription dsc; CoreSurfaceBufferLock lock; dsc.flags = (DFBSurfaceDescriptionFlags) (DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS); dsc.caps = DSCAPS_PREMULTIPLIED; dsc.width = width; dsc.height = height; dsc.pixelformat = DSPF_ARGB; m_dfb->CreateSurface( m_dfb, &dsc, &surface); #if 0 surface->Lock (surface, DSLF_WRITE, &lock.addr, &lock.pitch); memcpy(lock.addr, pixels, width*height*4); surface->Unlock (surface); #else DFBRectangle rect; rect.x = 0; rect.y = 0; rect.w = width; rect.h = height; surface->Write(surface, &rect, pixels, 4*width); #endif egl_textures[m_bound_texture].surface = surface; #ifdef DEBUG printf("%s:%s[%d] ---------------- texture=%d (%p)\n", __FILE__, __func__, __LINE__, texturesCurrent, egl_textures[texturesCurrent].surface); #endif }
static mrb_value surface_lock(mrb_state *mrb, mrb_value self) { IDirectFBSurface* surface = mrb_directfb_surface(mrb, self); if (surface != NULL) { void* p = NULL; int pitch; DFBResult ret; mrb_int flags = 0; mrb_get_args(mrb, "i", &flags); pitch = 0; ret = surface->Lock(surface, flags, &p, &pitch); if (!ret) { mrb_value a[2]; a[0] = mrb_cptr_value(mrb, p); a[1] = mrb_fixnum_value(pitch); return mrb_ary_new_from_values(mrb, 2, a); } } return mrb_nil_value(); }
static int directfb_get_empty_bitmap (struct bitmap *bmp) { IDirectFBSurface *surface; DFBSurfaceDescription desc; bmp->data = bmp->flags = NULL; desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT; desc.width = bmp->x; desc.height = bmp->y; if (dfb->CreateSurface (dfb, &desc, &surface) != DFB_OK) return 0; surface->Lock (surface, DSLF_READ | DSLF_WRITE, &bmp->data, &bmp->skip); bmp->flags = surface; return 0; }
int main( int argc, char *argv[] ) { DFBResult ret; /* Initialize DirectFB including command line parsing. */ ret = DirectFBInit( &argc, &argv ); if (ret) { DirectFBError( "DirectFBInit() failed", ret ); return -1; } /* Parse the command line. */ if (!parse_command_line( argc, argv )) return -2; /* Create the super interface. */ ret = DirectFBCreate( &dfb ); if (ret) { DirectFBError( "DirectFBCreate() failed", ret ); return -3; } /* Get the primary display layer. */ ret = dfb->GetDisplayLayer( dfb, id, &layer ); if (ret) { if (ret == DFB_IDNOTFOUND) fprintf (stderr, "\nUnknown layer id, check 'dfbinfo' for valid values.\n\n"); else DirectFBError( "IDirectFB::GetDisplayLayer() failed", ret ); dfb->Release( dfb ); return -4; } /* Get a description of the layer. */ ret = layer->GetDescription( layer, &desc ); if (ret) { DirectFBError( "IDirectFBDisplayLayer::GetDescription() failed", ret ); layer->Release( layer ); dfb->Release( dfb ); return -5; } /* Acquire administrative cooperative level. */ ret = layer->SetCooperativeLevel( layer, DLSCL_ADMINISTRATIVE ); if (ret) { DirectFBError( "IDirectFBDisplayLayer::SetCooperativeLevel() failed", ret ); layer->Release( layer ); dfb->Release( dfb ); return -6; } /* Show/change the configuration. */ set_configuration(); /* Test Lock() on layer surface? */ if (test_lock) { IDirectFBSurface *surface; fprintf( stderr, "\nGetting layer surface...\n" ); ret = layer->GetSurface( layer, &surface ); if (ret) DirectFBError( "IDirectFBDisplayLayer::GetSurface() failed", ret ); else { void *data; int pitch; fprintf( stderr, "\nTesting Lock( %s ) on layer surface...\n", test_lock == DSLF_READ ? "read only" : test_lock == DSLF_WRITE ? "write only" : "read/write" ); ret = surface->Lock( surface, test_lock, &data, &pitch ); if (ret) DirectFBError( "IDirectFBSurface::Lock() failed", ret ); else fprintf( stderr, " => OK\n\n" ); surface->Release( surface ); } } /* Release the display layer. */ layer->Release( layer ); /* Release the super interface. */ dfb->Release( dfb ); return EXIT_SUCCESS; }
GdkCursor * gdk_cursor_new_for_display (GdkDisplay *display, GdkCursorType cursor_type) { GdkCursor *cursor; GdkDisplayDFB *dfb_display = GDK_DISPLAY_DFB (display); if (cursor_type >= sizeof (stock_cursors) / sizeof (stock_cursors[0])) return NULL; cursor = stock_cursors[cursor_type].cursor; if (!cursor) { GdkCursorDirectFB *private; DFBResult ret; IDirectFBSurface *temp; IDirectFBSurface *temp2; IDirectFBSurface *shape; int width = stock_cursors[cursor_type+1].width; int height = stock_cursors[cursor_type+1].height; temp = gdk_display_dfb_create_surface (dfb_display, DSPF_ARGB, width, height); if (!temp) { return NULL; } else { u32 *dst; int pitch; ret = temp->Lock (temp, DSLF_WRITE, (void**)&dst, &pitch); if (ret) { DirectFBError ("gdkcursor-directfb.c (gdk_cursor_new): " "temp->Lock", ret); temp->Release (temp); return NULL; } else { gint x, y; gint mx, my; gint p = ((stock_cursors[cursor_type].width + 7) / 8) * 8; gint mp = ((stock_cursors[cursor_type + 1].width + 7) / 8) * 8; const guchar *src; const guchar *mask; pitch >>= 2; src = stock_cursors[cursor_type].bits; mask = stock_cursors[cursor_type+1].bits; mx = stock_cursors[cursor_type+1].hotx - stock_cursors[cursor_type].hotx; my = stock_cursors[cursor_type+1].hoty - stock_cursors[cursor_type].hoty; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { gint bit = x-mx + (y-my) * p; gint mbit = x + y * mp; u32 color = ((x - mx) < 0 || (y - my) < 0 || (x - mx) >= stock_cursors[cursor_type].width || (y - my) >= stock_cursors[cursor_type].height) ? 0x00FFFFFF : (src[bit/8] & (1 << bit%8) ? 0 : 0x00FFFFFF); u8 a = color ? 0xE0 : 0xFF; u32 alpha = mask[mbit/8] & (1 << mbit%8) ? (a << 24) : 0; dst[x + y*pitch] = alpha | color; } } temp->Unlock (temp); } } width += 2; height += 2; temp2 = gdk_display_dfb_create_surface (dfb_display, DSPF_ARGB, width, height); if (!temp2) { temp->Release (temp); return NULL; } temp2->Clear (temp2, 0x80, 0x80, 0x80, 0); temp2->SetBlittingFlags (temp2, (DSBLIT_BLEND_COLORALPHA | DSBLIT_BLEND_ALPHACHANNEL)); temp2->SetColor (temp2, 0, 0, 0, 0x30); temp2->Blit (temp2, temp, NULL, 0, 0); temp2->Blit (temp2, temp, NULL, 0, 2); temp2->Blit (temp2, temp, NULL, 2, 0); temp2->Blit (temp2, temp, NULL, 2, 2); temp2->SetColor (temp2, 0, 0, 0, 0xA0); temp2->Blit (temp2, temp, NULL, 1, 0); temp2->Blit (temp2, temp, NULL, 0, 1); temp2->Blit (temp2, temp, NULL, 2, 1); temp2->Blit (temp2, temp, NULL, 1, 2); temp2->SetColor (temp2, 0, 0, 0, 0xE0); temp2->Blit (temp2, temp, NULL, 1, 1); temp->Release (temp); // creating stretch width = width * 2; height = height * 2; shape = gdk_display_dfb_create_surface (dfb_display, DSPF_ARGB, width, height); if (!shape) { temp2->Release (temp2); return NULL; } shape->StretchBlit(shape, temp2, NULL, NULL); temp2->Release (temp2); private = g_new0 (GdkCursorDirectFB, 1);
int main (int argc,char *argv[]) { int videofd1 = open("/dev/video0",O_RDWR); int videofd2 = open("/dev/video0",O_RDWR); IDirectFBSurface *SurfaceHandle; IDirectFBSurface *SurfaceHandle2; void *ptr,*ptr2; int pitch,pitch2; int colour_palette[256]; int colour_palette2_real[256]; /* random... */ int *colour_palette2 = colour_palette2_real; int is_lut8; is_lut8 = (argc > 1 && !strcmp (argv[1], "both")); memset(&colour_palette,0x0,4*256); //memset(&colour_palette[1],0xff,255*4); colour_palette[0] = 0xff000000; // black colour_palette[1] = 0xffff0000; // red colour_palette[2] = 0xff00ff00; // green colour_palette[3] = 0xff0000ff; // blue colour_palette[4] = 0xffffffff; // white colour_palette[5] = 0x80808000; // half-transp yellow colour_palette[6] = 0x00000000; // transp black if (videofd1 < 0) perror("Couldn't open video device 1\n"); if (videofd2 < 0) perror("Couldn't open video device 2\n"); v4l2_list_outputs (videofd1); fb_make_transparent(); init_dfb(&SurfaceHandle,is_lut8); init_dfb(&SurfaceHandle2,1); v4l2_set_output_by_name (videofd1, "RGB1"); v4l2_set_output_by_name (videofd2, "RGB2"); init_v4l(videofd1,0,0,1280,720,is_lut8); init_v4l(videofd2,0,0,1280,720,1); printf("%s:%d\n",__FUNCTION__,__LINE__); // memcpy (colour_palette, colour_palette2, sizeof (colour_palette)); colour_palette2 = colour_palette; { int coords = 60; int size = 100; // clear if (!is_lut8) SurfaceHandle->Clear (SurfaceHandle, 0x00, 0x00, 0x00, 0x00); else { SurfaceHandle->SetColorIndex (SurfaceHandle, 0x6); SurfaceHandle->FillRectangle (SurfaceHandle, 0, 0, 600, 600); } // White if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x4); else SurfaceHandle->SetColor (SurfaceHandle, 0xff, 0xff, 0xff, 0xff); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; // Red if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x1); else SurfaceHandle->SetColor (SurfaceHandle, 0xff, 0x00, 0x00, 0xff); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; // Green if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x2); else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0xff, 0x00, 0xff); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; // Blue if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x3); else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0x00, 0xff, 0xff); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; // half transp yellow if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x5); else SurfaceHandle->SetColor (SurfaceHandle, 0x80, 0x80, 0x00, 0x80); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; // transp if (is_lut8) SurfaceHandle->SetColorIndex (SurfaceHandle, 0x6); else SurfaceHandle->SetColor (SurfaceHandle, 0x00, 0x00, 0x00, 0x00); SurfaceHandle->FillRectangle (SurfaceHandle, coords, coords, size, size); coords += size; } { int xcoords = 60 + (100 * 6), ycoords = 60; int size = 100; // clear SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x6); SurfaceHandle2->FillRectangle (SurfaceHandle2, 220, 220, 440, 440); // transp SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x6); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; // half transp yellow SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x5); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; // Blue SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x3); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; // Green SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x2); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; // Red SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x1); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; // White SurfaceHandle2->SetColorIndex (SurfaceHandle2, 0x4); SurfaceHandle2->FillRectangle (SurfaceHandle2, xcoords, ycoords, size, size); xcoords -= size; ycoords += size; } DFBCHECK (SurfaceHandle->Lock (SurfaceHandle, DSLF_READ, &ptr, &pitch)); DFBCHECK (SurfaceHandle2->Lock (SurfaceHandle2, DSLF_READ, &ptr2, &pitch2)); printf("%s:%d\n",__FUNCTION__,__LINE__); zorder(videofd2,V4L2_CID_STM_Z_ORDER_RGB2,1); zorder(videofd1,V4L2_CID_STM_Z_ORDER_RGB1,2); queue_buffer( videofd1, ptr, (is_lut8 ? colour_palette : 0), 0ULL); stream_on( videofd1 ); getchar(); queue_buffer( videofd2, ptr2, colour_palette2, 0ULL); printf("%s:%d\n",__FUNCTION__,__LINE__); stream_on( videofd2 ); printf("%s:%d\n",__FUNCTION__,__LINE__); getchar(); zorder(videofd2,V4L2_CID_STM_Z_ORDER_RGB2,2); zorder(videofd1,V4L2_CID_STM_Z_ORDER_RGB1,1); fprintf(stderr,"Press Return/Enter to quit\n"); getchar(); // This seems to dequeue all buffers too, but that's what the spec says // so this is ok. stream_off( videofd1 ); stream_off( videofd2 ); deinit_dfb(); close(videofd1); return 0; }
int main( int argc, char *argv[] ) { DFBResult ret; int i; DFBSurfaceDescription desc; IDirectFB *dfb; IDirectFBSurface *dest = NULL; DFBSurfacePixelFormat dest_format = DSPF_UNKNOWN; char pixel_buffer[100*100*4]; IDirectFBSurface *source = NULL; IDirectFBEventBuffer *keybuffer; DFBInputEvent evt; bool quit = false; /* Initialize DirectFB. */ ret = DirectFBInit( &argc, &argv ); if (ret) { D_DERROR( ret, "DFBTest/PreAlloc: DirectFBInit() failed!\n" ); return ret; } /* Parse arguments. */ for (i=1; i<argc; i++) { const char *arg = argv[i]; if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0) return print_usage( argv[0] ); else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) { fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION); return false; } else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--dest") == 0) { if (++i == argc) { print_usage (argv[0]); return false; } if (!parse_format( argv[i], &dest_format )) return false; } else if (strcmp (arg, "-s") == 0 || strcmp (arg, "--static") == 0) { static_caps = DSCAPS_STATIC_ALLOC; } else return print_usage( argv[0] ); } /* Create super interface. */ ret = DirectFBCreate( &dfb ); if (ret) { D_DERROR( ret, "DFBTest/PreAlloc: DirectFBCreate() failed!\n" ); return ret; } /* Fill description for a primary surface. */ desc.flags = DSDESC_CAPS; desc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING; if (dest_format != DSPF_UNKNOWN) { desc.flags |= DSDESC_PIXELFORMAT; desc.pixelformat = dest_format; } dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); /* Create an input buffer for key events */ dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_TRUE, &keybuffer); /* Create a primary surface. */ ret = dfb->CreateSurface( dfb, &desc, &dest ); if (ret) { D_DERROR( ret, "DFBTest/PreAlloc: IDirectFB::CreateSurface() for the destination failed!\n" ); goto out; } dest->GetSize( dest, &desc.width, &desc.height ); dest->GetPixelFormat( dest, &desc.pixelformat ); D_INFO( "DFBTest/PreAlloc: Destination is %dx%d using %s\n", desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) ); /* Create a preallocated surface. */ desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS | DSDESC_PREALLOCATED; desc.width = 100; desc.height = 100; desc.pixelformat = DSPF_ARGB; desc.caps = static_caps; desc.preallocated[0].data = pixel_buffer; desc.preallocated[0].pitch = 100 * 4; ret = dfb->CreateSurface( dfb, &desc, &source ); if (ret) { D_DERROR( ret, "DFBTest/PreAlloc: IDirectFB::CreateSurface() for the preallocated source failed!\n" ); goto out; } /* Before any other operation the pixel data can be written to without locking */ gen_pixels( pixel_buffer, 100 * 4, 100 ); while (!quit) { void *ptr; int pitch; /* Lock source surface for writing before making updates to the pixel buffer */ source->Lock( source, DSLF_WRITE, &ptr, &pitch ); if (ptr == pixel_buffer) D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave original preallocated pixel buffer :-)\n" ); else { if (static_caps) D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave different pixel buffer, ERROR with static alloc!\n" ); else D_INFO( "DFBTest/PreAlloc: Locking preallocated source gave different pixel buffer, but OK (no static alloc)\n" ); } update_pixels( ptr, pitch, 100 ); /* Unlock source surface after writing, before making further Blits, to have the buffer be transfered to master again */ source->Unlock( source ); dest->Clear( dest, 0, 0, 0, 0xff ); /* First Blit from preallocated source, data will be transfered to master */ dest->Blit( dest, source, NULL, 50, 50 ); /* Second Blit from preallocated source, data is already master */ dest->Blit( dest, source, NULL, 150, 150 ); dest->Flip( dest, NULL, DSFLIP_NONE ); /* This will upload again the preallocated buffer to the master, where it is modified and outdates the preallocated buffer. Now it depends on the static alloc flag whether the next Lock will directly go into the shared memory allocation or the preallocated buffer again (with a transfer back from master to us). */ source->FillRectangle( source, 0, 0, 10, 10 ); /* Process keybuffer */ while (keybuffer->GetEvent( keybuffer, DFB_EVENT(&evt)) == DFB_OK) { if (evt.type == DIET_KEYPRESS) { switch (DFB_LOWER_CASE(evt.key_symbol)) { case DIKS_ESCAPE: case DIKS_SMALL_Q: case DIKS_BACK: case DIKS_STOP: case DIKS_EXIT: /* Quit main loop & test thread */ quit = true; break; default: break; } } } if (!quit) sleep( 5 ); } out: if (source) source->Release( source ); if (dest) dest->Release( dest ); keybuffer->Release( keybuffer ); /* Shutdown DirectFB. */ dfb->Release( dfb ); return ret; }