DFBResult
CoreGraphicsStateClient_StretchBlit( CoreGraphicsStateClient *client,
                                     const DFBRectangle      *srects,
                                     const DFBRectangle      *drects,
                                     unsigned int             num )
{
     D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client );

     D_MAGIC_ASSERT( client, CoreGraphicsStateClient );
     D_ASSERT( srects != NULL );
     D_ASSERT( drects != NULL );

     if (num == 0)
          return DFB_OK;

     if (num != 1)
          D_UNIMPLEMENTED();

     if (dfb_core_is_master( client->core ) || !fusion_config->secure_fusion) {
          // FIXME: will overwrite rects
          dfb_gfxcard_stretchblit( (DFBRectangle*) srects, (DFBRectangle*) drects, client->state );
     }
     else {
          DFBResult ret;

          CoreGraphicsStateClient_Update( client, DFXL_STRETCHBLIT, client->state );

          ret = CoreGraphicsState_StretchBlit( client->gfx_state, srects, drects, num );
          if (ret)
               return ret;
     }

     return DFB_OK;
}
Ejemplo n.º 2
0
int
direct_strncasecmp( const char *a, const char *b, size_t bytes )
{
     D_UNIMPLEMENTED();

     return strncmp( a, b, bytes );
}
Ejemplo n.º 3
0
DirectResult
direct_signal_handler_remove( DirectSignalHandler *handler )
{
     D_UNIMPLEMENTED();

     return DR_OK;
}
Ejemplo n.º 4
0
DirectResult
fusion_ref_catch (FusionRef *ref)
{
     D_UNIMPLEMENTED();

     return DR_OK;
}
Ejemplo n.º 5
0
DirectResult
fusion_ref_throw (FusionRef *ref, FusionID catcher)
{
     D_UNIMPLEMENTED();

     return DR_OK;
}
Ejemplo n.º 6
0
DirectResult
fusion_call_add_permissions( FusionCall            *call,
                             FusionID               fusion_id,
                             FusionCallPermissions  call_permissions )
{
     D_UNIMPLEMENTED();

     return DR_UNIMPLEMENTED;
}
Ejemplo n.º 7
0
DirectResult
fusion_ref_add_permissions( FusionRef            *ref,
                            FusionID              fusion_id,
                            FusionRefPermissions  ref_permissions )
{
     D_UNIMPLEMENTED();

     return DR_UNIMPLEMENTED;
}
Ejemplo n.º 8
0
DirectResult
fusion_ref_inherit (FusionRef *ref, FusionRef *from)
{
     D_ASSERT( ref != NULL );
     D_ASSERT( from != NULL );

     D_UNIMPLEMENTED();
     
     return fusion_ref_up( ref, true );
}
Ejemplo n.º 9
0
DirectResult
direct_signal_handler_add( int                       num,
                           DirectSignalHandlerFunc   func,
                           void                     *ctx,
                           DirectSignalHandler     **ret_handler )
{
     D_UNIMPLEMENTED();

     return DR_OK;
}
Ejemplo n.º 10
0
/*
 * Fetch one entry from the kernel keymap.
 */
static DFBResult
driver_get_keymap_entry( CoreInputDevice           *device,
                         void                      *driver_data,
                         DFBInputDeviceKeymapEntry *entry )
{
     D_DEBUG_AT( Input_Hub, "%s( ID %u )\n", __FUNCTION__, dfb_input_device_id(device) );

     D_UNIMPLEMENTED();

     return DFB_UNIMPLEMENTED;
}
Ejemplo n.º 11
0
DFBResult
unique_decoration_update( UniqueDecoration *decoration,
                          const DFBRegion  *region )
{
     D_MAGIC_ASSERT( decoration, UniqueDecoration );

     DFB_REGION_ASSERT_IF( region );

     D_UNIMPLEMENTED();

     return DFB_UNIMPLEMENTED;
}
Ejemplo n.º 12
0
/*
 * Obtain information about an axis (only absolute axis so far).
 */
static DFBResult
driver_get_axis_info( CoreInputDevice              *device,
                      void                         *driver_data,
                      DFBInputDeviceAxisIdentifier  axis,
                      DFBInputDeviceAxisInfo       *ret_info )
{
     D_DEBUG_AT( Input_Hub, "%s( ID %u, axis %u )\n", __FUNCTION__, dfb_input_device_id(device), axis );

     D_UNIMPLEMENTED();

     return DFB_UNIMPLEMENTED;
}
Ejemplo n.º 13
0
static DFBResult
crtc2TestOutputConfig( CoreScreen                  *screen,
                       void                        *driver_data,
                       void                        *screen_data,
                       int                          output,
                       const DFBScreenOutputConfig *config,
                       DFBScreenOutputConfigFlags  *failed )
{
     D_UNIMPLEMENTED();

     return DFB_UNIMPLEMENTED;
}
Ejemplo n.º 14
0
Archivo: clock.c Proyecto: kuii/dfbNEON
long long
direct_clock_get_time( DirectClockType type )
{
     long long       micros;
     struct timespec spec;

     switch (type) {
          case DIRECT_CLOCK_REALTIME:
               ktime_get_real_ts( &spec );
               break;

          case DIRECT_CLOCK_SESSION:
          case DIRECT_CLOCK_MONOTONIC:
//               ktime_get_ts( &spec );
               ktime_get_real_ts( &spec );
               break;

          case DIRECT_CLOCK_PROCESS_CPUTIME_ID:
               D_UNIMPLEMENTED();
               return DR_UNIMPLEMENTED;

          case DIRECT_CLOCK_THREAD_CPUTIME_ID:
               D_UNIMPLEMENTED();
               return DR_UNIMPLEMENTED;

          default:
               D_BUG( "invalid clock type %d", type );
               return DR_INVARG;
     }

     micros = spec.tv_sec * 1000000LL + spec.tv_nsec / 1000LL;

     if (type == DIRECT_CLOCK_SESSION)
          micros -= session_clock_offset;

     return micros;
}
Ejemplo n.º 15
0
void
direct_thread_testcancel( DirectThread *thread )
{
     D_MAGIC_ASSERT( thread, DirectThread );
     D_ASSERT( thread->handle.thread != -1 );
     D_ASSERT( pthread_equal( thread->handle.thread, pthread_self() ) );

     /* Quick check before calling the pthread function. */
#ifndef DIRECT_BUILD_NO_PTHREAD_CANCEL
     if (thread->canceled)
          pthread_testcancel();
#else
     D_UNIMPLEMENTED();
#endif
}
Ejemplo n.º 16
0
static DFBResult
wm_set_cursor_position( CoreWindow      *window,
                        void            *wm_data,
                        void            *window_data,
                        int              x,
                        int              y )
{
     D_ASSERT( window != NULL );
     D_ASSERT( wm_data != NULL );
     D_ASSERT( window_data != NULL );

     D_UNIMPLEMENTED();

     return DFB_UNIMPLEMENTED;
}
Ejemplo n.º 17
0
void
_fusion_shmpool_process( FusionWorld          *world,
                         int                   pool_id,
                         FusionSHMPoolMessage *msg )
{
     int              i;
     DirectResult     ret;
     FusionSHM       *shm;
     FusionSHMShared *shared;

     D_DEBUG_AT( Fusion_SHMPool, "%s( %p, %d, %p )\n", __FUNCTION__, world, pool_id, msg );

     D_MAGIC_ASSERT( world, FusionWorld );

     shm = &world->shm;

     D_MAGIC_ASSERT( shm, FusionSHM );

     shared = shm->shared;

     D_MAGIC_ASSERT( shared, FusionSHMShared );

     ret = fusion_skirmish_prevail( &shared->lock );
     if (ret)
          return;

     for (i=0; i<FUSION_SHM_MAX_POOLS; i++) {
          if (shm->pools[i].attached) {
               D_MAGIC_ASSERT( &shm->pools[i], FusionSHMPool );

               if (shm->pools[i].pool_id == pool_id) {
                    switch (msg->type) {
                         case FSMT_REMAP:
                              break;

                         case FSMT_UNMAP:
                              D_UNIMPLEMENTED();
                              break;
                    }

                    break;
               }
          }
     }

     fusion_skirmish_dismiss( &shared->lock );
}
Ejemplo n.º 18
0
void
direct_thread_cancel( DirectThread *thread )
{
     D_MAGIC_ASSERT( thread, DirectThread );
     D_ASSERT( thread->handle.thread != -1 );
     D_ASSERT( !pthread_equal( thread->handle.thread, pthread_self() ) );

     D_ASSUME( !thread->canceled );

     D_DEBUG_AT( Direct_Thread, "%s( %p, '%s' %d )\n", __FUNCTION__, thread->main, thread->name, thread->tid );

     thread->canceled = true;
#ifndef DIRECT_BUILD_NO_PTHREAD_CANCEL
     pthread_cancel( thread->handle.thread );
#else
     D_UNIMPLEMENTED();
#endif
}
Ejemplo n.º 19
0
static void
write_glyph( DGIFFGlyphInfo *glyph, const DFBSurfaceDescription &desc, void *dst, int pitch )
{
     D_DEBUG_AT( mkdgiff, "%s( %p, %p, %d ) <- size %ux%u\n",
                 __FUNCTION__, glyph, dst, pitch, desc.width, desc.height );

     switch (m_format) {
          case DSPF_ARGB:
               dfb_convert_to_argb( desc.pixelformat, desc.preallocated[0].data, desc.preallocated[0].pitch,
                                    NULL, 0, NULL, 0,
                                    desc.height, (u32*) dst, pitch, desc.width, desc.height );
               break;

          default:
               D_UNIMPLEMENTED();
               break;
     }
}
Ejemplo n.º 20
0
Archivo: clock.c Proyecto: kuii/dfbNEON
DirectResult
direct_clock_set_time( DirectClockType type,
                       long long       micros )
{
     DirectResult    ret = DR_OK;
     struct timespec spec;
     clockid_t       clock_id;

     D_UNIMPLEMENTED();
     return DR_UNIMPLEMENTED;

     switch (type) {
          case DIRECT_CLOCK_SESSION:
          case DIRECT_CLOCK_REALTIME:
               clock_id = CLOCK_REALTIME;
               break;

          case DIRECT_CLOCK_MONOTONIC:
               clock_id = CLOCK_MONOTONIC;
               break;

          case DIRECT_CLOCK_PROCESS_CPUTIME_ID:
               clock_id = CLOCK_PROCESS_CPUTIME_ID;
               break;

          case DIRECT_CLOCK_THREAD_CPUTIME_ID:
               clock_id = CLOCK_THREAD_CPUTIME_ID;
               break;

          default:
               D_BUG( "invalid clock type %d", type );
               return DR_INVARG;
     }

     spec.tv_sec  = micros / 1000000LL;
     spec.tv_nsec = micros % 1000000LL * 1000LL;

     if (1/*(ret = clock_settime( clock_id, &spec )) < 0*/) {
          D_ERROR( "Direct/Clock: Could not set clock with id %d!\n", clock_id );
     }

     return ret;
}
Ejemplo n.º 21
0
DirectResult
direct_tgkill( int tgid, int tid, int sig )
{
     int ret;

     D_UNIMPLEMENTED();
     return DR_UNIMPLEMENTED;
//     sys_rt_sigqueueinfo( direct_getpid(), SIGKILL, &info );
//     ret = sys_tgkill( tgid, tid, sig );
     switch (ret) {
          case -ESRCH:
               return DR_TASK_NOT_FOUND;

          default:
               return errno2result( -ret );

          case 0:
               break;
     }

     return DR_OK;
}
Ejemplo n.º 22
0
void gBlit( CardState *state, DFBRectangle *rect, int dx, int dy )
{
     GenefxState    *gfxs = state->gfxs;
     int             h;
     XopAdvanceFunc  Aop_advance;
     XopAdvanceFunc  Bop_advance;
     int             Aop_X;
     int             Aop_Y;
     int             Bop_X;
     int             Bop_Y;

     DFBSurfaceBlittingFlags rotflip_blittingflags = state->blittingflags;

     dfb_simplify_blittingflags( &rotflip_blittingflags );
     rotflip_blittingflags &= (DSBLIT_FLIP_HORIZONTAL | DSBLIT_FLIP_VERTICAL | DSBLIT_ROTATE90 );

     D_ASSERT( gfxs != NULL );

     if (dfb_config->software_warn) {
          D_WARN( "Blit          (%4d,%4d-%4dx%4d) %6s, flags 0x%08x, funcs %d/%d, color 0x%02x%02x%02x%02x, source (%4d,%4d) %6s",
                  dx, dy, rect->w, rect->h, dfb_pixelformat_name(gfxs->dst_format), state->blittingflags,
                  state->src_blend, state->dst_blend,
                  state->color.a, state->color.r, state->color.g, state->color.b, rect->x, rect->y,
                  dfb_pixelformat_name(gfxs->src_format) );
     }

     D_ASSERT( state->clip.x1 <= dx );
     D_ASSERT( state->clip.y1 <= dy );
     D_ASSERT( (rotflip_blittingflags & DSBLIT_ROTATE90) || state->clip.x2 >= (dx + rect->w - 1) );
     D_ASSERT( (rotflip_blittingflags & DSBLIT_ROTATE90) || state->clip.y2 >= (dy + rect->h - 1) );
     D_ASSERT( !(rotflip_blittingflags & DSBLIT_ROTATE90) || state->clip.x2 >= (dx + rect->h - 1) );
     D_ASSERT( !(rotflip_blittingflags & DSBLIT_ROTATE90) || state->clip.y2 >= (dy + rect->w - 1) );

     CHECK_PIPELINE();

     if (!Genefx_ABacc_prepare( gfxs, rect->w ))
          return;


     switch (gfxs->src_format) {
          case DSPF_A4:
          case DSPF_YUY2:
          case DSPF_UYVY:
               rect->x &= ~1;
               break;
          default:
               break;
     }

     switch (gfxs->dst_format) {
          case DSPF_A4:
          case DSPF_YUY2:
          case DSPF_UYVY:
               dx &= ~1;
               break;
          default:
               break;
     }

     gfxs->length = rect->w;


     if (gfxs->src_org[0] == gfxs->dst_org[0] && dy == rect->y && dx > rect->x)
          /* we must blit from right to left */
          gfxs->Astep = gfxs->Bstep = -1;
     else
          /* we must blit from left to right*/
          gfxs->Astep = gfxs->Bstep = 1;


     if (rotflip_blittingflags == (DSBLIT_FLIP_HORIZONTAL | DSBLIT_FLIP_VERTICAL)) { // 180 deg
          gfxs->Astep *= -1;

          Aop_X = dx + rect->w - 1;
          Aop_Y = dy;

          Bop_X = rect->x;
          Bop_Y = rect->y + rect->h - 1;

          Aop_advance = Genefx_Aop_next;
          Bop_advance = Genefx_Bop_prev;
     }
     else if (rotflip_blittingflags == DSBLIT_FLIP_HORIZONTAL) {
          gfxs->Astep *= -1;

          Aop_X = dx + rect->w - 1;
          Aop_Y = dy;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_next;
          Bop_advance = Genefx_Bop_next;
     }
     else if (rotflip_blittingflags == DSBLIT_FLIP_VERTICAL) {
          Aop_X = dx;
          Aop_Y = dy + rect->h - 1;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_prev;
          Bop_advance = Genefx_Bop_next;
     }
     else if (rotflip_blittingflags == (DSBLIT_ROTATE90 | DSBLIT_FLIP_HORIZONTAL | DSBLIT_FLIP_VERTICAL)) { // 270 deg ccw
          if (gfxs->dst_bpp == 0) {
               D_UNIMPLEMENTED();
               return;
          }

          gfxs->Astep *= gfxs->dst_pitch / gfxs->dst_bpp;

          Aop_X = dx;
          Aop_Y = dy;

          Bop_X = rect->x;
          Bop_Y = rect->y + rect->h - 1;

          Aop_advance = Genefx_Aop_crab;
          Bop_advance = Genefx_Bop_prev;
     }
     else if (rotflip_blittingflags == DSBLIT_ROTATE90) { // 90 deg ccw
          if (gfxs->dst_bpp == 0) {
               D_UNIMPLEMENTED();
               return;
          }

          gfxs->Astep *= -gfxs->dst_pitch / gfxs->dst_bpp;

          Aop_X = dx;
          Aop_Y = dy + rect->w - 1;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_crab;
          Bop_advance = Genefx_Bop_next;
     }
     else if (rotflip_blittingflags == (DSBLIT_ROTATE90 | DSBLIT_FLIP_VERTICAL)) {
          if (gfxs->dst_bpp == 0) {
               D_UNIMPLEMENTED();
               return;
          }

          gfxs->Astep *= -gfxs->dst_pitch / gfxs->dst_bpp;

          Aop_X = dx + rect->h - 1;
          Aop_Y = dy + rect->w - 1;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_prev_crab;
          Bop_advance = Genefx_Bop_next;
     }
     else if (rotflip_blittingflags == (DSBLIT_ROTATE90 | DSBLIT_FLIP_HORIZONTAL)) {
          if (gfxs->dst_bpp == 0) {
               D_UNIMPLEMENTED();
               return;
          }

          gfxs->Astep *= gfxs->dst_pitch / gfxs->dst_bpp;

          Aop_X = dx;
          Aop_Y = dy;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_crab;
          Bop_advance = Genefx_Bop_next;
     }
     else if (gfxs->src_org[0] == gfxs->dst_org[0] && dy > rect->y && !(state->blittingflags & DSBLIT_DEINTERLACE)) {
          /* we must blit from bottom to top */
          Aop_X = dx;
          Aop_Y = dy + rect->h - 1;

          Bop_X = rect->x;
          Bop_Y = rect->y + rect->h - 1;

          Aop_advance = Genefx_Aop_prev;
          Bop_advance = Genefx_Bop_prev;
     }
     else {
          /* we must blit from top to bottom */
          Aop_X = dx;
          Aop_Y = dy;

          Bop_X = rect->x;
          Bop_Y = rect->y;

          Aop_advance = Genefx_Aop_next;
          Bop_advance = Genefx_Bop_next;
     }



     Genefx_Aop_xy( gfxs, Aop_X, Aop_Y );
     Genefx_Bop_xy( gfxs, Bop_X, Bop_Y );

     if (state->blittingflags & DSBLIT_DEINTERLACE) {
          if (state->source->field) {
               Aop_advance( gfxs );
               Bop_advance( gfxs );
               rect->h--;
          }

          for (h = rect->h/2; h; h--) {
               RUN_PIPELINE();

               Aop_advance( gfxs );

               RUN_PIPELINE();

               Aop_advance( gfxs );

               Bop_advance( gfxs );
               Bop_advance( gfxs );
          }
     } /* ! DSBLIT_DEINTERLACE */
     else {
          for (h = rect->h; h; h--) {
               RUN_PIPELINE();

               Aop_advance( gfxs );
               Bop_advance( gfxs );
          }
     }

     Genefx_ABacc_flush( gfxs );
}
Ejemplo n.º 23
0
static DirectResult
SendReceive( VoodooLink  *link,
             VoodooChunk *sends,
             size_t       num_send,
             VoodooChunk *recvs,
             size_t       num_recv )
{
     Link    *l = link->priv;
     size_t   i;
     ssize_t  ret;
     DWORD    wait_result;

//     direct_mutex_lock( &l->lock );

     for (i=0; i<num_send; i++) {
          //printf("writing %d\n",sends[i].length);
          ret = send( l->socket, sends[i].ptr, sends[i].length, 0 );
          //printf("wrote %d/%d\n",ret,sends[i].length);
          if (ret < 0) {
               if (WSAGetLastError() == 10035) {
                    break;
               }
               D_PERROR( "Voodoo/Link: Failed to send() data error %d!\n", WSAGetLastError() );
          }
          else {
               sends[i].done = (size_t) ret;

               if (sends[i].done != sends[i].length) {
                    D_UNIMPLEMENTED();
               //               direct_mutex_unlock( &l->lock );
                    return DR_UNIMPLEMENTED;
               }

               return DR_OK;
          }
     }


     while (true) {
          LONG events = 0;
          WSANETWORKEVENTS WsaNetworkEvents;

          if (num_recv) {
               //printf("wait for recv\n");
               events |= FD_READ;
          }

          if (num_send) {
               //printf("wait for send\n");
               events |= FD_WRITE;
          }

          WSAEventSelect( l->socket, l->event, events );

          wait_result = WSAWaitForMultipleEvents( 1, &l->event, FALSE, 10, FALSE );
          switch (wait_result) {
               case WSA_WAIT_EVENT_0:
                    WSAResetEvent( l->event );

                    WSAEnumNetworkEvents(l->socket, l->event, &WsaNetworkEvents);
                    //printf("<-- events 0x%08x\n",WsaNetworkEvents.lNetworkEvents);

                    if (!WsaNetworkEvents.lNetworkEvents)
                         return DR_INTERRUPTED;

                    if (WsaNetworkEvents.lNetworkEvents & FD_WRITE) {
                         //printf("<-- event write\n");

                         for (i=0; i<num_send; i++) {
                              //printf("writing %d\n",sends[i].length);
                              ret = send( l->socket, sends[i].ptr, sends[i].length, 0 );
                              //printf("wrote %d/%d\n",ret,sends[i].length);
                              if (ret < 0) {
                                   if (WSAGetLastError() == 10035) {
                                        break;
                                   }
                                   D_PERROR( "Voodoo/Link: Failed to send() data error %d!\n", WSAGetLastError() );
                                   return DR_IO;
                              }
                              else {
                                   sends[i].done = (size_t) ret;
                         
                                   if (sends[i].done != sends[i].length) {
                                        D_UNIMPLEMENTED();
                                   //               direct_mutex_unlock( &l->lock );
                                        return DR_UNIMPLEMENTED;
                                   }
                         
                                   return DR_OK;
                              }
                         }
                    }
     
                    if (WsaNetworkEvents.lNetworkEvents & FD_READ) {
                         //printf("<-- event read\n");

                         for (i=0; i<num_recv; i++) {
                              ret = recv( l->socket, recvs[i].ptr, recvs[i].length, 0 );
                              //printf("read %d\n",ret);
                              if (ret < 0) {
                                   if (WSAGetLastError() == 10035) {
                                        break;
                                   }
                                   D_PERROR( "Voodoo/Link: Failed to recv() data error %d!\n", WSAGetLastError() );
                    //               direct_mutex_unlock( &l->lock );
                                   return DR_IO;
                              }
          
                              recvs[i].done = (size_t) ret;
          
                              if (recvs[i].done < recvs[i].length)
                                   return DR_OK;

                              return DR_OK;
                         }
                    }
                    break;
     
               case WSA_WAIT_TIMEOUT:
                    //printf("<-- timeout\n");
                    return DR_TIMEOUT;
                    break;
     
               default:
                    D_ERROR( "Voodoo/Link: WaitForMultipleObjects() failed!\n" );
                    return DR_FAILURE;
          }
     }

//     direct_mutex_unlock( &l->lock );

     return DR_OK;
}
Ejemplo n.º 24
0
void
direct_signals_block_all( void )
{
     D_UNIMPLEMENTED();
}
Ejemplo n.º 25
0
DFBResult
dfb_surface_create( CoreDFB                  *core,
                    const CoreSurfaceConfig  *config,
                    CoreSurfaceTypeFlags      type,
                    unsigned long             resource_id,
                    CorePalette              *palette,
                    CoreSurface             **ret_surface )
{
     DFBResult    ret = DFB_BUG;
     int          i, data_size;
     int          buffers;
     CoreSurface *surface;
     char         buf[64];

     D_ASSERT( core != NULL );
     D_FLAGS_ASSERT( type, CSTF_ALL );
     D_MAGIC_ASSERT_IF( palette, CorePalette );
     D_ASSERT( ret_surface != NULL );

     D_DEBUG_AT( Core_Surface, "dfb_surface_create( %p, %p, %p )\n", core, config, ret_surface );

     surface = dfb_core_create_surface( core );
     if (!surface)
          return DFB_FUSION;

     surface->data = NULL;

     if (config) {
          D_FLAGS_ASSERT( config->flags, CSCONF_ALL );

          surface->config.flags = config->flags;

          if (config->flags & CSCONF_SIZE) {
               D_DEBUG_AT( Core_Surface, "  -> %dx%d\n", config->size.w, config->size.h );

               surface->config.size = config->size;
          }

          if (config->flags & CSCONF_FORMAT) {
               D_DEBUG_AT( Core_Surface, "  -> %s\n", dfb_pixelformat_name( config->format ) );

               surface->config.format = config->format;
          }

          if (config->flags & CSCONF_CAPS) {
               D_DEBUG_AT( Core_Surface, "  -> caps 0x%08x\n", config->caps );

               if (config->caps & DSCAPS_ROTATED)
                    D_UNIMPLEMENTED();

               surface->config.caps = config->caps & ~DSCAPS_ROTATED;
          }

          if (config->flags & CSCONF_PREALLOCATED) {
               D_DEBUG_AT( Core_Surface, "  -> prealloc %p [%d]\n",
                           config->preallocated[0].addr,
                           config->preallocated[0].pitch );

               direct_memcpy( surface->config.preallocated, config->preallocated, sizeof(config->preallocated) );

               surface->config.preallocated_pool_id = config->preallocated_pool_id;

               type |= CSTF_PREALLOCATED;
          }
     }

     if (surface->config.caps & DSCAPS_SYSTEMONLY)
          surface->type = (type & ~CSTF_EXTERNAL) | CSTF_INTERNAL;
     else if (surface->config.caps & DSCAPS_VIDEOONLY)
          surface->type = (type & ~CSTF_INTERNAL) | CSTF_EXTERNAL;
     else
          surface->type = type & ~(CSTF_INTERNAL | CSTF_EXTERNAL);

     if (surface->config.caps & DSCAPS_SHARED)
          surface->type |= CSTF_SHARED;

     surface->resource_id = resource_id;

     if (surface->config.caps & DSCAPS_TRIPLE)
          buffers = 3;
     else if (surface->config.caps & DSCAPS_DOUBLE)
          buffers = 2;
     else {
          buffers = 1;

          surface->config.caps &= ~DSCAPS_ROTATED;
     }

     surface->notifications = CSNF_ALL & ~CSNF_FLIP;

     surface->alpha_ramp[0] = 0x00;
     surface->alpha_ramp[1] = 0x55;
     surface->alpha_ramp[2] = 0xaa;
     surface->alpha_ramp[3] = 0xff;


     if (surface->config.caps & DSCAPS_STATIC_ALLOC)
          surface->config.min_size = surface->config.size;

     surface->shmpool = dfb_core_shmpool( core );

     direct_serial_init( &surface->serial );

     snprintf( buf, sizeof(buf), "Surface %dx%d %s", surface->config.size.w,
               surface->config.size.h, dfb_pixelformat_name(surface->config.format) );

     fusion_ref_set_name( &surface->object.ref, buf );

     fusion_skirmish_init2( &surface->lock, buf, dfb_core_world(core), fusion_config->secure_fusion );

//     fusion_skirmish_add_permissions( &surface->lock, 0, FUSION_SKIRMISH_PERMIT_PREVAIL | FUSION_SKIRMISH_PERMIT_DISMISS );

     D_MAGIC_SET( surface, CoreSurface );


     if (dfb_config->warn.flags & DCWF_CREATE_SURFACE &&
         dfb_config->warn.create_surface.min_size.w <= surface->config.size.w &&
         dfb_config->warn.create_surface.min_size.h <= surface->config.size.h)
          D_WARN( "create-surface  %4dx%4d %6s, buffers %d, caps 0x%08x, type 0x%08x",
                  surface->config.size.w, surface->config.size.h, dfb_pixelformat_name(surface->config.format),
                  buffers, surface->config.caps, surface->type );


     if (palette) {
          dfb_surface_set_palette( surface, palette );
     }
     else if (DFB_PIXELFORMAT_IS_INDEXED( surface->config.format )) {
          ret = dfb_surface_init_palette( core, surface );
          if (ret)
               goto error;
     }

     /* Create the system driver specific surface data information */
     data_size = dfb_system_surface_data_size();

     if (data_size) {
          surface->data = SHCALLOC( surface->shmpool, 1, data_size );
          if (!surface->data) {
              ret = D_OOSHM();
              goto error;
          }
     }

     dfb_system_surface_data_init(surface,surface->data);

     dfb_surface_lock( surface );

     /* Create the Surface Buffers. */
     for (i=0; i<buffers; i++) {
          ret = dfb_surface_buffer_create( core, surface, CSBF_NONE, &surface->buffers[i] );
          if (ret) {
               D_DERROR( ret, "Core/Surface: Error creating surface buffer!\n" );
               goto error;
          }

          surface->num_buffers++;

          dfb_surface_buffer_globalize( surface->buffers[i] );

          switch (i) {
               case 0:
                    surface->buffer_indices[CSBR_FRONT] = i;
               case 1:
                    surface->buffer_indices[CSBR_BACK] = i;
               case 2:
                    surface->buffer_indices[CSBR_IDLE] = i;
          }
     }

     dfb_surface_unlock( surface );


     CoreSurface_Init_Dispatch( core, surface, &surface->call );

     fusion_object_activate( &surface->object );

     *ret_surface = surface;

     return DFB_OK;

error:
     for (i=0; i<MAX_SURFACE_BUFFERS; i++) {
          if (surface->buffers[i])
               dfb_surface_buffer_decouple( surface->buffers[i] );
     }

     /* release the system driver specific surface data */
     if (surface->data) {
         dfb_system_surface_data_destroy( surface, surface->data );
         SHFREE( surface->shmpool, surface->data );
         surface->data = NULL;
     }

     fusion_skirmish_destroy( &surface->lock );

     direct_serial_deinit( &surface->serial );

     D_MAGIC_CLEAR( surface );

     fusion_object_destroy( &surface->object );

     return ret;
}
Ejemplo n.º 26
0
DFBResult
dfb_surface_reconfig( CoreSurface             *surface,
                      const CoreSurfaceConfig *config )
{
     int i, buffers;
     DFBResult ret;
     CoreSurfaceConfig new_config;

     D_DEBUG_AT( Core_Surface, "%s( %p, %dx%d %s -> %dx%d %s )\n", __FUNCTION__, surface,
                 surface->config.size.w, surface->config.size.h, dfb_pixelformat_name( surface->config.format ),
                 (config->flags & CSCONF_SIZE) ? config->size.w : surface->config.size.w,
                 (config->flags & CSCONF_SIZE) ? config->size.h : surface->config.size.h,
                 (config->flags & CSCONF_FORMAT) ? dfb_pixelformat_name( config->format ) :
                                                   dfb_pixelformat_name( surface->config.format ) );

     D_MAGIC_ASSERT( surface, CoreSurface );
     D_ASSERT( config != NULL );

     if (config->flags & CSCONF_PREALLOCATED)
          return DFB_UNSUPPORTED;

     if (fusion_skirmish_prevail( &surface->lock ))
          return DFB_FUSION;

     if (surface->type & CSTF_PREALLOCATED) {
          fusion_skirmish_dismiss( &surface->lock );
          return DFB_UNSUPPORTED;
     }

     if (  (config->flags == CSCONF_SIZE ||
          ((config->flags == (CSCONF_SIZE | CSCONF_FORMAT)) && (config->format == surface->config.format)))  &&
         config->size.w <= surface->config.min_size.w &&
         config->size.h <= surface->config.min_size.h)
     {
          surface->config.size = config->size;

          fusion_skirmish_dismiss( &surface->lock );
          return DFB_OK;
     }

     new_config = surface->config;

     if (config->flags & CSCONF_SIZE)
          new_config.size = config->size;

     if (config->flags & CSCONF_FORMAT)
          new_config.format = config->format;

     if (config->flags & CSCONF_CAPS) {
          if (config->caps & DSCAPS_ROTATED)
               D_UNIMPLEMENTED();

          new_config.caps = config->caps & ~DSCAPS_ROTATED;
     }

     if (new_config.caps & DSCAPS_SYSTEMONLY)
          surface->type = (surface->type & ~CSTF_EXTERNAL) | CSTF_INTERNAL;
     else if (new_config.caps & DSCAPS_VIDEOONLY)
          surface->type = (surface->type & ~CSTF_INTERNAL) | CSTF_EXTERNAL;
     else
          surface->type = surface->type & ~(CSTF_INTERNAL | CSTF_EXTERNAL);

     if (new_config.caps & DSCAPS_TRIPLE)
          buffers = 3;
     else if (new_config.caps & DSCAPS_DOUBLE)
          buffers = 2;
     else {
          buffers = 1;

          new_config.caps &= ~DSCAPS_ROTATED;
     }

     ret = Core_Resource_CheckSurfaceUpdate( surface, &new_config );
     if (ret)
          return ret;

     /* Destroy the Surface Buffers. */
     for (i=0; i<surface->num_buffers; i++) {
          dfb_surface_buffer_decouple( surface->buffers[i] );
          surface->buffers[i] = NULL;
     }

     surface->num_buffers = 0;

     Core_Resource_UpdateSurface( surface, &new_config );

     surface->config = new_config;

     /* Recreate the Surface Buffers. */
     for (i=0; i<buffers; i++) {
          CoreSurfaceBuffer *buffer;

          ret = dfb_surface_buffer_create( core_dfb, surface, CSBF_NONE, &buffer );
          if (ret) {
               D_DERROR( ret, "Core/Surface: Error creating surface buffer!\n" );
               goto error;
          }

          dfb_surface_buffer_globalize( buffer );

          surface->buffers[surface->num_buffers++] = buffer;

          switch (i) {
               case 0:
                    surface->buffer_indices[CSBR_FRONT] = i;
               case 1:
                    surface->buffer_indices[CSBR_BACK] = i;
               case 2:
                    surface->buffer_indices[CSBR_IDLE] = i;
          }
     }

     dfb_surface_notify( surface, CSNF_SIZEFORMAT );

     fusion_skirmish_dismiss( &surface->lock );

     return DFB_OK;

error:
     D_UNIMPLEMENTED();

     fusion_skirmish_dismiss( &surface->lock );

     return ret;
}