Пример #1
0
void mach64_set_destination( Mach64DriverData *mdrv,
                             Mach64DeviceData *mdev,
                             CardState        *state )
{
     volatile u8 *mmio          = mdrv->mmio_base;
     CoreSurface   *destination = state->destination;
     unsigned int   pitch       = state->dst.pitch / DFB_BYTES_PER_PIXEL( destination->config.format );

     mdev->pix_width &= ~DST_PIX_WIDTH;
     switch (destination->config.format) {
          case DSPF_RGB332:
               mdev->pix_width |= DST_PIX_WIDTH_8BPP;
               break;
          case DSPF_RGB555:
          case DSPF_ARGB1555:
               mdev->pix_width |= DST_PIX_WIDTH_15BPP;
               break;
          case DSPF_RGB16:
               mdev->pix_width |= DST_PIX_WIDTH_16BPP;
               break;
          case DSPF_RGB32:
          case DSPF_ARGB:
               mdev->pix_width |= DST_PIX_WIDTH_32BPP;
               break;
          default:
               D_BUG( "unexpected pixelformat!" );
               return;
     }

     mach64_waitfifo( mdrv, mdev, 1 );
     mach64_out32( mmio, DST_OFF_PITCH, (state->dst.offset/8) | ((pitch/8) << 22) );
}
Пример #2
0
static inline void savage4_validate_pbd( Savage4DriverData *sdrv,
                                         Savage4DeviceData *sdev,
                                         CardState         *state )
{
     u32 BitmapDescriptor;
     CoreSurface *source;
     int bpp;

     if (sdev->v_pbd)
          return;

     source = state->source;
     bpp = DFB_BYTES_PER_PIXEL(source->config.format);
     
     BitmapDescriptor = BCI_BD_BW_DISABLE;
     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
     BCI_BD_SET_STRIDE( BitmapDescriptor, state->src.pitch / bpp );

     
     savage4_waitidle( sdrv, sdev );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD1 );
     BCI_SEND( state->src.offset );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD2 );
     BCI_SEND( BitmapDescriptor );
     
     sdev->v_pbd = 1;
}
Пример #3
0
static inline void savage4_validate_gbd( Savage4DriverData *sdrv,
                                         Savage4DeviceData *sdev,
                                         CardState         *state )
{
     u32 BitmapDescriptor;
     CoreSurface *destination;
     int bpp;

     if (sdev->v_gbd)
          return;

     destination = state->destination;
     bpp = DFB_BYTES_PER_PIXEL(destination->config.format);
     
     BitmapDescriptor = BCI_BD_BW_DISABLE | 8 | 1;
     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
     BCI_BD_SET_STRIDE( BitmapDescriptor, state->dst.pitch / bpp );

     /* strange effects if we don't wait here for the Savage4 being idle */
     savage4_waitidle( sdrv, sdev );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD1 );
     BCI_SEND( state->dst.offset );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD2 );
     BCI_SEND( BitmapDescriptor );

     sdev->v_gbd = 1;
}
Пример #4
0
LOCAL void
dfb_drawbuffer(DFBDISPLAY *mod, struct TVRequest *req)
{
	DFBWINDOW *v = req->tvr_Op.DrawBuffer.Window;
	TINT w = req->tvr_Op.DrawBuffer.RRect[2];
	TINT h = req->tvr_Op.DrawBuffer.RRect[3];
	TINT xd = req->tvr_Op.DrawBuffer.RRect[0];
	TINT yd = req->tvr_Op.DrawBuffer.RRect[1];
	TAPTR buf = req->tvr_Op.DrawBuffer.Buf;
	if (!buf)
		return;
	TINT totw = req->tvr_Op.DrawBuffer.TotWidth;
	IDirectFBSurface *surface = NULL;
	DFBSurfaceDescription dsc;
	DFBRectangle rect = { 0, 0, w, h };

	dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT
			  | DSDESC_PREALLOCATED;
	dsc.width = w;
	dsc.height = h;
	dsc.pixelformat = DSPF_RGB32;
	dsc.preallocated[0].data = buf;
	dsc.preallocated[0].pitch = totw * DFB_BYTES_PER_PIXEL(DSPF_RGB32);

	if (mod->dfb_DFB->CreateSurface(mod->dfb_DFB, &dsc, &surface) == DFB_OK)
	{
		v->winsurface->Blit(v->winsurface, surface, &rect, xd, yd);
		surface->Release(surface);
	}
}
Пример #5
0
static inline void
pxa3xx_validate_DEST( PXA3XXDriverData *pdrv,
                      PXA3XXDeviceData *pdev,
                      CardState        *state )
{
     CoreSurfaceBuffer *buffer = state->dst.buffer;
     u32               *prep   = start_buffer( pdrv, 6 );

     D_DEBUG_AT( PXA3XX_BLT, "%s( 0x%08lx [%d] )\n", __FUNCTION__,
                 state->dst.phys, state->dst.pitch );

     pdev->dst_phys  = state->dst.phys;
     pdev->dst_pitch = state->dst.pitch;
     pdev->dst_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
     pdev->dst_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;

     /* Set destination. */
     prep[0] = 0x020000A2;
     prep[1] = pdev->dst_phys;
     prep[2] = (pixel_formats[pdev->dst_index] << 19) | (pdev->dst_pitch << 5) | pdev->dst_bpp;

     prep[3] = 0x02000012;
     prep[4] = prep[1];
     prep[5] = prep[2];

     submit_buffer( pdrv, 6 );

     /* Set the flags. */
     PXA3XX_VALIDATE( DEST );
}
Пример #6
0
void
GP2DEngine::validate_SOURCE( GP2DTask  *mytask,
                             CardState *state )
{
    __u32 *prep = mytask->start( 6 );

    CoreSurfaceBuffer *buffer = state->src.buffer;

    mytask->src_phys  = (unsigned long) state->src.handle;
    mytask->src_pitch = state->src.pitch;
    mytask->src_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
    mytask->src_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;

    /* Set source start address. */
    prep[0] = GP2D_OPCODE_WPR;
    prep[1] = 0x4c;
    prep[2] = mytask->src_phys;

    /* Set source stride. */
    prep[3] = GP2D_OPCODE_WPR;
    prep[4] = 0x58;
    prep[5] = mytask->src_pitch / mytask->src_bpp;

    mytask->submit( 6 );

    /* Set the flags. */
    GP2D_VALIDATE( SOURCE );
}
Пример #7
0
static int
DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                       const SDL_Rect * rect, const void *pixels, int pitch)
{
    DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
    DFBResult ret;
    Uint8 *dpixels;
    int dpitch;
    Uint8 *src, *dst;
    int row;
    size_t length;
    int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format));
    // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes

    SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
                                         DSLF_WRITE | DSLF_READ,
                                         ((void **) &dpixels), &dpitch));
    src = (Uint8 *) pixels;
    dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
    length = rect->w * bpp;
    for (row = 0; row < rect->h; ++row) {
        SDL_memcpy(dst, src, length);
        src += pitch;
        dst += dpitch;
    }
    SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
    return 0;
  error:
    return 1;

}
Пример #8
0
static void
print_usage (const char *prg_name)
{
     int i = 0;

     fprintf (stderr, "\nDirectFB Layer Configuration (version %s)\n\n", DIRECTFB_VERSION);
     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "   -l, --layer   <id>              Use the specified layer, default is primary\n");
     fprintf (stderr, "   -m, --mode    <width>x<height>  Change the resolution (pixels)\n");
     fprintf (stderr, "   -f, --format  <pixelformat>     Change the pixel format\n");
     fprintf (stderr, "   -b, --buffer  <buffermode>      Change the buffer mode (single/video/system)\n");
     fprintf (stderr, "   -o, --opacity <opacity>         Change the layer's opacity (0-255)\n");
     fprintf (stderr, "   -L, --level   <level>           Change the layer's level\n");
     fprintf (stderr, "   -R, --rotate  <degree>          Change the layer rotation\n");
     fprintf (stderr, "   -h, --help                      Show this help message\n");
     fprintf (stderr, "   -v, --version                   Print version information\n");
     fprintf (stderr, "\n");

     fprintf (stderr, "Known pixel formats:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          fprintf (stderr, "   %-10s %2d bits, %d bytes",
                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
                   DFB_BYTES_PER_PIXEL(format));

          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
               fprintf (stderr, "   ALPHA");

          if (DFB_PIXELFORMAT_IS_INDEXED(format))
               fprintf (stderr, "   INDEXED");

          if (DFB_PLANAR_PIXELFORMAT(format)) {
               int planes = DFB_PLANE_MULTIPLY(format, 1000);

               fprintf (stderr, "   PLANAR (x%d.%03d)",
                        planes / 1000, planes % 1000);
          }

          fprintf (stderr, "\n");

          ++i;
     }
     fprintf (stderr, "\n");

     fprintf (stderr, "Valid buffer modes:\n");
     fprintf (stderr, "   FRONTONLY     or 'single'\n");
     fprintf (stderr, "   BACKVIDEO     or 'video'\n");
     fprintf (stderr, "   BACKSYSTEM    or 'system'\n");
     fprintf (stderr, "   TRIPLE\n");
     fprintf (stderr, "   WINDOWS\n");

     fprintf (stderr, "\n");
     fprintf (stderr, "Specifying neither mode nor format just displays the current configuration.\n");
     fprintf (stderr, "\n");
}
Пример #9
0
static int
DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                       const SDL_Rect * rect, const void *pixels, int pitch)
{
    DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata;
    Uint8 *dpixels;
    int dpitch;
    Uint8 *src, *dst;
    int row;
    size_t length;
    int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
    /* FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes */

    DirectFB_ActivateRenderer(renderer);

    if ((texture->format == SDL_PIXELFORMAT_YV12) ||
        (texture->format == SDL_PIXELFORMAT_IYUV)) {
        bpp = 1;
    }

    SDL_DFB_CHECKERR(data->surface->Lock(data->surface,
                                         DSLF_WRITE | DSLF_READ,
                                         ((void **) &dpixels), &dpitch));
    src = (Uint8 *) pixels;
    dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp;
    length = rect->w * bpp;
    for (row = 0; row < rect->h; ++row) {
        SDL_memcpy(dst, src, length);
        src += pitch;
        dst += dpitch;
    }
    /* copy other planes for 3 plane formats */
    if ((texture->format == SDL_PIXELFORMAT_YV12) ||
        (texture->format == SDL_PIXELFORMAT_IYUV)) {
        src = (Uint8 *) pixels + texture->h * pitch;
        dst = (Uint8 *) dpixels + texture->h * dpitch + rect->y * dpitch / 4 + rect->x * bpp / 2;
        for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
            SDL_memcpy(dst, src, length / 2);
            src += pitch / 2;
            dst += dpitch / 2;
        }
        src = (Uint8 *) pixels + texture->h * pitch + texture->h * pitch / 4;
        dst = (Uint8 *) dpixels + texture->h * dpitch + texture->h * dpitch / 4 + rect->y * dpitch / 4 + rect->x * bpp / 2;
        for (row = 0; row < rect->h / 2 + (rect->h & 1); ++row) {
            SDL_memcpy(dst, src, length / 2);
            src += pitch / 2;
            dst += dpitch / 2;
        }
    }
    SDL_DFB_CHECKERR(data->surface->Unlock(data->surface));
    data->isDirty = 0;
    return 0;
  error:
    return 1;

}
Пример #10
0
static void
gxCheckState(void *drv,
             void *dev, CardState *state, DFBAccelerationMask accel)
{
#if NSC_ACCEL
   NSCDriverData *gxdrv = (NSCDriverData *) drv;
   NSCDeviceData *gxdev = (NSCDeviceData *) dev;

   if(state->destination->config.format != DSPF_RGB16)
      return;

   if (DFB_BLITTING_FUNCTION(accel)) {

	   if(state->source->config.format != DSPF_RGB16)
		  return;
      if (gxdrv->cpu) {
         /* GU2 - if there are no other blitting flags than the supported
          * and the source and destination formats are the same 
          */
         if (!(state->blittingflags & ~GX_SUPPORTED_BLITTINGFLAGS) &&
             state->source && state->source->config.format != DSPF_RGB24) {
            state->accel |= GX_SUPPORTED_BLITTINGFUNCTIONS;
         }
      } else{
         /* GU1 - source width must match frame buffer strid
          */
         if(state->source) {
            int src_pitch = 0;
            int dst_pitch = 0;

            if(state->source) {
               src_pitch = state->source->config.size.w * DFB_BYTES_PER_PIXEL(state->source->config.format);
            }

            if (state->modified & SMF_DESTINATION) {
               if(state->destination && state->dst.buffer)
                  dst_pitch = state->dst.pitch;
            }
            if(dst_pitch == 0) {
               dst_pitch = gxdev->dst_pitch;
            }
       
            if(src_pitch == dst_pitch && state->source) {
               state->accel |= GX_SUPPORTED_BLITTINGFUNCTIONS;
            }
         }
      }
   } else {
      /* if there are no other drawing flags than the supported */
      if (!(state->drawingflags & ~GX_SUPPORTED_DRAWINGFLAGS)) {
         state->accel |= GX_SUPPORTED_DRAWINGFUNCTIONS;
      }
   }
#endif /* NSC_ACCEL */
}
Пример #11
0
/*
 * Called by vmwareSetState() to ensure that the destination registers are properly set
 * for execution of rendering functions.
 */
static inline void
vmware_validate_DESTINATION( VMWareDeviceData *vdev,
                             CardState        *state )
{
     /* Remember destination parameters for usage in rendering functions. */
     vdev->dst_addr   = state->dst.addr;
     vdev->dst_pitch  = state->dst.pitch;
     vdev->dst_format = state->dst.buffer->format;
     vdev->dst_bpp    = DFB_BYTES_PER_PIXEL( vdev->dst_format );

     /* Set the flag. */
     VMWARE_VALIDATE( DESTINATION );
}
Пример #12
0
/*
 * Called by vmwareSetState() to ensure that the source registers are properly set
 * for execution of blitting functions.
 */
static inline void
vmware_validate_SOURCE( VMWareDeviceData *vdev,
                        CardState        *state )
{
     /* Remember source parameters for usage in rendering functions. */
     vdev->src_addr   = state->src.addr;
     vdev->src_pitch  = state->src.pitch;
     vdev->src_format = state->src.buffer->format;
     vdev->src_bpp    = DFB_BYTES_PER_PIXEL( vdev->src_format );

     /* Set the flag. */
     VMWARE_VALIDATE( SOURCE );
}
Пример #13
0
static int
print_usage( const char *prg )
{
     int i = 0;

     fprintf (stderr, "\n");
     fprintf (stderr, "== DirectFB Blitting Test (version %s) ==\n", DIRECTFB_VERSION);
     fprintf (stderr, "\n");
     fprintf (stderr, "Known pixel formats:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          fprintf (stderr, "   %-10s %2d bits, %d bytes",
                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
                   DFB_BYTES_PER_PIXEL(format));

          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
               fprintf (stderr, "   ALPHA");

          if (DFB_PIXELFORMAT_IS_INDEXED(format))
               fprintf (stderr, "   INDEXED");

          if (DFB_PLANAR_PIXELFORMAT(format)) {
               int planes = DFB_PLANE_MULTIPLY(format, 1000);

               fprintf (stderr, "   PLANAR (x%d.%03d)",
                        planes / 1000, planes % 1000);
          }

          fprintf (stderr, "\n");

          ++i;
     }

     fprintf (stderr, "\n");

     fprintf (stderr, "\n");
     fprintf (stderr, "Usage: %s [options]\n", prg);
     fprintf (stderr, "\n");
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "  -h, --help                        Show this help message\n");
     fprintf (stderr, "  -v, --version                     Print version information\n");
     fprintf (stderr, "  -s, --source    <pixelformat>     Source pixel format\n");
     fprintf (stderr, "  -d, --dest      <pixelformat>     Destination pixel format\n");
     fprintf (stderr, "  -r, --resize                      Set destination from source size\n");
     fprintf (stderr, "  -b, --benchmark                   Enable benchmarking mode\n");
     fprintf (stderr, "  -R, --rerender                    Rerender before every blit (benchmark)\n");

     return -1;
}
Пример #14
0
static int
print_usage( const char *prg )
{
     int i = 0;

     fprintf (stderr, "\n");
     fprintf (stderr, "== DirectFB Font Test (version %s) ==\n", DIRECTFB_VERSION);
     fprintf (stderr, "\n");
     fprintf (stderr, "Known pixel formats:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          fprintf (stderr, "   %-10s %2d bits, %d bytes",
                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
                   DFB_BYTES_PER_PIXEL(format));

          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
               fprintf (stderr, "   ALPHA");

          if (DFB_PIXELFORMAT_IS_INDEXED(format))
               fprintf (stderr, "   INDEXED");

          if (DFB_PLANAR_PIXELFORMAT(format)) {
               int planes = DFB_PLANE_MULTIPLY(format, 1000);

               fprintf (stderr, "   PLANAR (x%d.%03d)",
                        planes / 1000, planes % 1000);
          }

          fprintf (stderr, "\n");

          ++i;
     }

     fprintf (stderr, "\n");

     fprintf (stderr, "\n");
     fprintf (stderr, "Usage: %s [options] <file>\n", prg);
     fprintf (stderr, "\n");
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "  -h,  --help                        Show this help message\n");
     fprintf (stderr, "  -v,  --version                     Print version information\n");
     fprintf (stderr, "  -o,  --outline                     Render outlined fonts\n");
     fprintf (stderr, "  -ow, --outline-width   <width>     Change outline width (default 1)\n");
     fprintf (stderr, "  -oo, --outline-opacity <opacity>   Change outline opacity (default 255)\n");

     return -1;
}
Пример #15
0
static int
print_usage( const char *prg )
{
     int i = 0;

     fprintf (stderr, "\n");
     fprintf (stderr, "== DirectFB Fill Rectangle Test (version %s) ==\n", DIRECTFB_VERSION);
     fprintf (stderr, "\n");
     fprintf (stderr, "Known pixel formats:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          fprintf (stderr, "   %-10s %2d bits, %d bytes",
                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
                   DFB_BYTES_PER_PIXEL(format));

          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
               fprintf (stderr, "   ALPHA");

          if (DFB_PIXELFORMAT_IS_INDEXED(format))
               fprintf (stderr, "   INDEXED");

          if (DFB_PLANAR_PIXELFORMAT(format)) {
               int planes = DFB_PLANE_MULTIPLY(format, 1000);

               fprintf (stderr, "   PLANAR (x%d.%03d)",
                        planes / 1000, planes % 1000);
          }

          fprintf (stderr, "\n");

          ++i;
     }

     fprintf (stderr, "\n");

     fprintf (stderr, "\n");
     fprintf (stderr, "Usage: %s [options]\n", prg);
     fprintf (stderr, "\n");
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "  -h, --help                        Show this help message\n");
     fprintf (stderr, "  -v, --version                     Print version information\n");
     fprintf (stderr, "  -d, --dest      <pixelformat>     Destination pixel format\n");
     fprintf (stderr, "  -s, --static                      Use DSCAPS_STATIC_ALLOC\n");

     return -1;
}
Пример #16
0
/*
 * Called by davinciSetState() to ensure that the source registers are properly set
 * for execution of blitting functions.
 */
static inline void
davinci_validate_SOURCE( DavinciDeviceData *ddev,
                         CardState         *state )
{
     /* Remember source parameters for usage in rendering functions. */
     ddev->src_addr   = state->src.addr;
     ddev->src_phys   = state->src.phys;
     ddev->src_pitch  = state->src.pitch;
     ddev->src_format = state->src.buffer->format;
     ddev->src_bpp    = DFB_BYTES_PER_PIXEL( ddev->src_format );

     D_DEBUG_AT( Davinci_2D, "  => SOURCE: 0x%08lx\n", ddev->src_phys );

     /* Set the flag. */
     DAVINCI_VALIDATE( SOURCE );
}
Пример #17
0
static DFBResult
sh7722InitLayer( CoreLayer                  *layer,
                 void                       *driver_data,
                 void                       *layer_data,
                 DFBDisplayLayerDescription *description,
                 DFBDisplayLayerConfig      *config,
                 DFBColorAdjustment         *adjustment )
{
     SH7722DriverData *sdrv = driver_data;
     SH7722DeviceData *sdev = sdrv->dev;
     SH7722LayerData  *data = layer_data;

     D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );

     /* initialize layer data */
     data->layer = SH7722_LAYER_INPUT1 + sdrv->num_inputs++;

     /* set capabilities and type */
     description->caps = DLCAPS_SURFACE | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY |
                         DLCAPS_SCREEN_POSITION | DLCAPS_SRC_COLORKEY;

     description->type = DLTF_STILL_PICTURE | DLTF_GRAPHICS | DLTF_VIDEO;

     /* set name */
     snprintf( description->name, DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "Input %d", sdrv->num_inputs );

     /* fill out the default configuration */
     config->flags       = DLCONF_WIDTH       | DLCONF_HEIGHT |
                           DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE | DLCONF_OPTIONS;
     config->width       = sdev->lcd_width;
     config->height      = sdev->lcd_height;
     config->pixelformat = DSPF_RGB16;
     config->buffermode  = DLBM_FRONTONLY;
     config->options     = DLOP_ALPHACHANNEL;
     
     /* libshbeu */
     sdev->shbeu_src[data->layer].s.w = sdev->lcd_width;
     sdev->shbeu_src[data->layer].s.h = sdev->lcd_height;
     sdev->shbeu_src[data->layer].s.pitch = sdev->lcd_pitch/DFB_BYTES_PER_PIXEL(config->pixelformat);
     sdev->shbeu_src[data->layer].s.format = REN_RGB565;
     sdev->shbeu_src[data->layer].alpha = 0xff;
     sdev->shbeu_src[data->layer].x = 0;
     sdev->shbeu_src[data->layer].y = 0;


     return DFB_OK;
}
Пример #18
0
static inline void neo2200_validate_src( Neo2200DriverData     *ndrv,
                                         Neo2200DeviceData     *ndev,
                                         CoreSurface           *src,
                                         CoreSurfaceBufferLock *lock )
{
  if (ndev->n_src)
    return;

  ndev->srcOrg = lock->offset;
  ndev->srcPitch = lock->pitch;
  ndev->srcPixelWidth = DFB_BYTES_PER_PIXEL(src->config.format);

  neo2200_waitfifo( ndrv, ndev, 1 );
  ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff);

  ndev->n_src = 1;
}
Пример #19
0
/*
 * Called by davinciSetState() to ensure that the destination registers are properly set
 * for execution of rendering functions.
 */
static inline void
davinci_validate_DESTINATION( DavinciDeviceData *ddev,
                              CardState         *state )
{
     /* Remember destination parameters for usage in rendering functions. */
     ddev->dst_addr   = state->dst.addr;
     ddev->dst_phys   = state->dst.phys;
     ddev->dst_size   = state->dst.allocation->size;
     ddev->dst_pitch  = state->dst.pitch;
     ddev->dst_format = state->dst.buffer->format;
     ddev->dst_bpp    = DFB_BYTES_PER_PIXEL( ddev->dst_format );

     D_DEBUG_AT( Davinci_2D, "  => DESTINATION: 0x%08lx\n", ddev->dst_phys );

     /* Set the flag. */
     DAVINCI_VALIDATE( DESTINATION );
}
Пример #20
0
void mach64gt_set_destination( Mach64DriverData *mdrv,
                               Mach64DeviceData *mdev,
                               CardState        *state )
{
     volatile u8 *mmio         = mdrv->mmio_base;
     CoreSurface  *destination = state->destination;
     unsigned int  pitch       = state->dst.pitch / DFB_BYTES_PER_PIXEL( destination->config.format );

     mdev->pix_width &= ~DST_PIX_WIDTH;
     switch (destination->config.format) {
          case DSPF_RGB332:
               mdev->pix_width |= DST_PIX_WIDTH_RGB332;
               break;
          case DSPF_RGB555:
          case DSPF_ARGB1555:
               mdev->pix_width |= DST_PIX_WIDTH_ARGB1555;
               break;
          case DSPF_RGB444:
          case DSPF_ARGB4444:
               mdev->pix_width |= DST_PIX_WIDTH_ARGB4444;
               break;
          case DSPF_RGB16:
               mdev->pix_width |= DST_PIX_WIDTH_RGB565;
               break;
          case DSPF_RGB32:
          case DSPF_ARGB:
               mdev->pix_width |= DST_PIX_WIDTH_ARGB8888;
               break;
          default:
               D_BUG( "unexpected pixelformat!" );
               return;
     }

     mdev->draw_blend &= ~DITHER_EN;
     mdev->blit_blend &= ~DITHER_EN;
     if (DFB_COLOR_BITS_PER_PIXEL( destination->config.format ) < 24) {
          mdev->draw_blend |= DITHER_EN;
          mdev->blit_blend |= DITHER_EN;
     }

     mach64_waitfifo( mdrv, mdev, 1 );
     mach64_out32( mmio, DST_OFF_PITCH, (state->dst.offset/8) | ((pitch/8) << 22) );
}
Пример #21
0
static void
print_usage (const char *prg_name)
{
     int i = 0;

     fprintf (stderr, "\nDirectFB Render Test (version %s)\n\n", DIRECTFB_VERSION);
     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "   -m, --mode    <width>x<height>  Set test surface size (default 800x600)\n");
     fprintf (stderr, "   -f, --format  <pixelformat>     Change the pixel format\n");
     fprintf (stderr, "   -h, --help                      Show this help message\n");
     fprintf (stderr, "   -v, --version                   Print version information\n");
     fprintf (stderr, "\n");

     fprintf (stderr, "Known pixel formats:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          fprintf (stderr, "   %-10s %2d bits, %d bytes",
                   format_names[i].name, DFB_BITS_PER_PIXEL(format),
                   DFB_BYTES_PER_PIXEL(format));

          if (DFB_PIXELFORMAT_HAS_ALPHA(format))
               fprintf (stderr, "   ALPHA");

          if (DFB_PIXELFORMAT_IS_INDEXED(format))
               fprintf (stderr, "   INDEXED");

          if (DFB_PLANAR_PIXELFORMAT(format)) {
               int planes = DFB_PLANE_MULTIPLY(format, 1000);

               fprintf (stderr, "   PLANAR (x%d.%03d)",
                        planes / 1000, planes % 1000);
          }

          fprintf (stderr, "\n");

          ++i;
     }
     fprintf (stderr, "\n");
}
Пример #22
0
static unsigned char *
directfb_fb_init_driver (unsigned char *param, unsigned char *display)
{
  DFBDisplayLayerConfig  config;
  DFBResult              ret;

  /*if (dfb)
    return NULL;

  DirectFBInit (&g_argc, (char ***) &g_argv);
  ret = DirectFBCreate (&dfb);

  if (ret)
    {
      char message[128];

      snprintf (message, sizeof (message), "%s\n", DirectFBErrorString (ret));
      return stracpy (message);
    }*/

  dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer);

  layer->GetConfiguration (layer, &config);

  pixelformat = config.pixelformat;

  directfb_driver.depth = (((DFB_BYTES_PER_PIXEL (pixelformat) & 0x7)) |
                           ((DFB_BITS_PER_PIXEL  (pixelformat) & 0x1F) << 3));

  /* endian test */
  if (htons (0x1234) == 0x1234)
    directfb_driver.depth |= 0x100;

  directfb_driver.x = config.width;
  directfb_driver.y = config.height;

  memset (directfb_hash_table, 0, sizeof (directfb_hash_table));

  arrow = NULL;

  return NULL;
}
Пример #23
0
static void
print_usage (const char *prg_name)
{
     int i = 0;

     fprintf (stderr, "\nDirectFB Glyph Image File Format Tool (version %s)\n\n", DIRECTFB_VERSION);
     fprintf (stderr, "Usage: %s [options]\n\n", prg_name);
     fprintf (stderr, "Options:\n");
     fprintf (stderr, "   -f, --format   <pixelformat>   Choose the pixel format (default ARGB)\n");
     fprintf (stderr, "   -s, --sizes    <s1>[,s2...]    Choose sizes to generate glyph images for\n");
     fprintf (stderr, "   -h, --help                     Show this help message\n");
     fprintf (stderr, "   -v, --version                  Print version information\n");
     fprintf (stderr, "\n");

     fprintf (stderr, "Known pixel formats with alpha:\n");

     while (format_names[i].format != DSPF_UNKNOWN) {
          DFBSurfacePixelFormat format = format_names[i].format;

          if (DFB_PIXELFORMAT_HAS_ALPHA(format)) {
               fprintf (stderr, "   %-10s %2d bits, %d bytes",
                        format_names[i].name, DFB_BITS_PER_PIXEL(format),
                        DFB_BYTES_PER_PIXEL(format));

               if (DFB_PIXELFORMAT_IS_INDEXED(format))
                    fprintf (stderr, "   INDEXED");

               if (DFB_PLANAR_PIXELFORMAT(format)) {
                    int planes = DFB_PLANE_MULTIPLY(format, 1000);

                    fprintf (stderr, "   PLANAR (x%d.%03d)",
                             planes / 1000, planes % 1000);
               }

               fprintf (stderr, "\n");
          }

          ++i;
     }
     fprintf (stderr, "\n");
}
Пример #24
0
void mach64gt_set_source( Mach64DriverData *mdrv,
                          Mach64DeviceData *mdev,
                          CardState        *state )
{
     volatile u8 *mmio     = mdrv->mmio_base;
     CoreSurface   *source = state->source;
     unsigned int   pitch  = state->src.pitch / DFB_BYTES_PER_PIXEL( source->config.format );

     if (MACH64_IS_VALID( m_source ))
          return;

     mdev->pix_width &= ~SRC_PIX_WIDTH;
     switch (source->config.format) {
          case DSPF_RGB332:
               mdev->pix_width |= SRC_PIX_WIDTH_RGB332;
               break;
          case DSPF_RGB555:
          case DSPF_ARGB1555:
               mdev->pix_width |= SRC_PIX_WIDTH_ARGB1555;
               break;
          case DSPF_RGB444:
          case DSPF_ARGB4444:
               mdev->pix_width |= SRC_PIX_WIDTH_ARGB4444;
               break;
          case DSPF_RGB16:
               mdev->pix_width |= SRC_PIX_WIDTH_RGB565;
               break;
          case DSPF_RGB32:
          case DSPF_ARGB:
               mdev->pix_width |= SRC_PIX_WIDTH_ARGB8888;
               break;
          default:
               D_BUG( "unexpected pixelformat!" );
               return;
     }

     mach64_waitfifo( mdrv, mdev, 1 );
     mach64_out32( mmio, SRC_OFF_PITCH, (state->src.offset/8) | ((pitch/8) << 22) );

     MACH64_VALIDATE( m_source );
}
Пример #25
0
static inline void neo2200_validate_bltMode_dst( Neo2200DriverData     *ndrv,
                                                 Neo2200DeviceData     *ndev,
                                                 CoreSurface           *dst,
                                                 CoreSurfaceBufferLock *lock )
{
  int bltMode = 0;

  if (ndev->n_bltMode_dst)
    return;

  switch (dst->config.format)
    {
    case DSPF_A8:
    case DSPF_LUT8:
    case DSPF_RGB332:
      bltMode |= NEO_MODE1_DEPTH8;
      break;
    case DSPF_ARGB1555:
    case DSPF_RGB16:
    case DSPF_YUY2:
      bltMode |= NEO_MODE1_DEPTH16;
      break;
    default:
      D_BUG( "unexpected pixelformat!" );
      break;
    }

  ndev->dstOrg = lock->offset;
  ndev->dstPitch = lock->pitch;
  ndev->dstPixelWidth = DFB_BYTES_PER_PIXEL(dst->config.format);


  neo2200_waitfifo( ndrv, ndev, 2 );

  ndrv->neo2200->bltStat = bltMode << 16;
  ndrv->neo2200->pitch = (ndev->dstPitch << 16) | (ndev->srcPitch & 0xffff);


  ndev->n_bltMode_dst = 1;
}
Пример #26
0
static int
DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                     const SDL_Rect * rect, void **pixels, int *pitch)
{
    DirectFB_TextureData *texturedata =
        (DirectFB_TextureData *) texture->driverdata;

    DirectFB_ActivateRenderer(renderer);

#if 0
    if (markDirty) {
        SDL_AddDirtyRect(&texturedata->dirty, rect);
    }
#endif

    if (texturedata->display) {
        void *fdata;
        int fpitch;

        SDL_DFB_CHECKERR(texturedata->surface->Lock(texturedata->surface,
                                                    DSLF_WRITE | DSLF_READ,
                                                    &fdata, &fpitch));
        *pitch = fpitch;
        *pixels = fdata;
    } else {
        *pixels =
            (void *) ((Uint8 *) texturedata->pixels +
                      rect->y * texturedata->pitch +
                      rect->x * DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format)));
        *pitch = texturedata->pitch;
        texturedata->isDirty = 1;
    }
    return 0;

  error:
    return -1;
}
Пример #27
0
static inline void
pxa3xx_validate_SOURCE( PXA3XXDriverData *pdrv,
                        PXA3XXDeviceData *pdev,
                        CardState        *state )
{
     CoreSurfaceBuffer *buffer = state->src.buffer;
     u32               *prep   = start_buffer( pdrv, 3 );

     pdev->src_phys  = state->src.phys;
     pdev->src_pitch = state->src.pitch;
     pdev->src_bpp   = DFB_BYTES_PER_PIXEL( buffer->format );
     pdev->src_index = DFB_PIXELFORMAT_INDEX( buffer->format ) % DFB_NUM_PIXELFORMATS;
     pdev->src_alpha = DFB_PIXELFORMAT_HAS_ALPHA( buffer->format );

     /* Set source. */
     prep[0] = 0x02000002;
     prep[1] = pdev->src_phys;
     prep[2] = (pixel_formats[pdev->src_index] << 19) | (pdev->src_pitch << 5) | pdev->src_bpp;

     submit_buffer( pdrv, 3 );

     /* Set the flag. */
     PXA3XX_VALIDATE( SOURCE );
}
Пример #28
0
static void
print_usage (const char *prg_name)
{
    int i = 0;

    fprintf (stderr, "\n");
    fprintf (stderr, "== DirectFB Window Test (version %s) ==\n", DIRECTFB_VERSION);
    fprintf (stderr, "\n");
    fprintf (stderr, "Known pixel formats:\n");

    while (format_names[i].format != DSPF_UNKNOWN) {
        DFBSurfacePixelFormat format = format_names[i].format;

        fprintf (stderr, "   %-10s %2d bits, %d bytes",
                 format_names[i].name, DFB_BITS_PER_PIXEL(format),
                 DFB_BYTES_PER_PIXEL(format));

        if (DFB_PIXELFORMAT_HAS_ALPHA(format))
            fprintf (stderr, "   ALPHA");

        if (DFB_PIXELFORMAT_IS_INDEXED(format))
            fprintf (stderr, "   INDEXED");

        if (DFB_PLANAR_PIXELFORMAT(format)) {
            int planes = DFB_PLANE_MULTIPLY(format, 1000);

            fprintf (stderr, "   PLANAR (x%d.%03d)",
                     planes / 1000, planes % 1000);
        }

        fprintf (stderr, "\n");

        ++i;
    }

    fprintf (stderr, "\n");
    fprintf (stderr, "Known window capabilities:\n");

    for (i=0; caps_names[i].capability != DWCAPS_NONE; i++)
        fprintf (stderr, "   %s\n", caps_names[i].name);

    fprintf (stderr, "\n");
    fprintf (stderr, "Known window options:\n");

    for (i=0; options_names[i].option != DWOP_NONE; i++)
        fprintf (stderr, "   %s\n", options_names[i].name);

    fprintf (stderr, "\n");

    fprintf (stderr, "\n");
    fprintf (stderr, "Usage: %s [options]\n", prg_name);
    fprintf (stderr, "\n");
    fprintf (stderr, "Options:\n");
    fprintf (stderr, "  -h, --help                            Show this help message\n");
    fprintf (stderr, "  -v, --version                         Print version information\n");
    fprintf (stderr, "  -T, --top-level     <toplevel_id>     WindowID (skips top creation)\n");
    fprintf (stderr, "  -W, --wait-at-end                     Wait at the end (don't exit)\n");
    fprintf (stderr, "\n");
    fprintf (stderr, "Top window:\n");
    fprintf (stderr, "  -r, --run           <test>            Run test (see list below)\n");
    fprintf (stderr, "  -p, --pos           <posx>,<posy>     Position     (%d,%d)\n", m_desc_top.posx, m_desc_top.posy);
    fprintf (stderr, "  -s, --size          <width>x<height>  Size         (%dx%d)\n", m_desc_top.width, m_desc_top.height);
    fprintf (stderr, "  -f, --format        <pixelformat>     Pixel Format (%s)\n",    dfb_pixelformat_name(m_desc_top.pixelformat));
    fprintf (stderr, "  -c, --caps          <window_caps>     Capabilities (NONE)\n");
    fprintf (stderr, "  -l, --color         <aarrggbb>        Fixed Color  (NONE)\n");
    fprintf (stderr, "  -o, --option        <window_option>   Options      (NONE)\n");
    fprintf (stderr, "  -a, --associate     <parent_id>       Association  (N/A)\n");
    fprintf (stderr, "\n");
    fprintf (stderr, "Sub window:\n");
    fprintf (stderr, "  -R, --sub-run       <test>            Run test (see list below)\n");
    fprintf (stderr, "  -P, --sub-pos       <posx>,<posy>     Position     (%d,%d)\n", m_desc_sub.posx, m_desc_sub.posy);
    fprintf (stderr, "  -S, --sub-size      <width>x<height>  Size         (%dx%d)\n", m_desc_sub.width, m_desc_sub.height);
    fprintf (stderr, "  -F, --sub-format    <pixelformat>     Format       (%s)\n",    dfb_pixelformat_name(m_desc_sub.pixelformat));
    fprintf (stderr, "  -C, --sub-caps      <window_caps>     Capabilities (NONE)\n");
    fprintf (stderr, "  -L, --sub-color     <aarrggbb>        Fixed Color  (NONE)\n");
    fprintf (stderr, "  -O, --sub-option    <window_option>   Options      (NONE)\n");
    fprintf (stderr, "  -A, --sub-associate <parent_id>       Association  (N/A)\n");
    fprintf (stderr, "\n");

    fprintf (stderr, "Available tests:\n");

    for (i=0; i<D_ARRAY_SIZE(m_tests); i++)
        fprintf (stderr, "   %s\n", m_tests[i].name);

    fprintf (stderr, "\n");
}
Пример #29
0
static int
DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
    SDL_Window *window = renderer->window;
    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    SDL_DFB_DEVICEDATA(display->device);
    DirectFB_TextureData *data;
    DFBSurfaceDescription dsc;
    DFBSurfacePixelFormat pixelformat;

    DirectFB_ActivateRenderer(renderer);

    SDL_DFB_ALLOC_CLEAR(data, sizeof(*data));
    texture->driverdata = data;

    /* find the right pixelformat */
    pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format);
    if (pixelformat == DSPF_UNKNOWN) {
        SDL_SetError("Unknown pixel format %d\n", data->format);
        goto error;
    }

    data->format = texture->format;
    data->pitch = texture->w * DFB_BYTES_PER_PIXEL(pixelformat);

    if (DirectFB_AcquireVidLayer(renderer, texture) != 0) {
        /* fill surface description */
        dsc.flags =
            DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
        dsc.width = texture->w;
        dsc.height = texture->h;
        if(texture->format == SDL_PIXELFORMAT_YV12 ||
           texture->format == SDL_PIXELFORMAT_IYUV) {
           /* dfb has problems with odd sizes -make them even internally */
           dsc.width += (dsc.width % 2);
           dsc.height += (dsc.height % 2);
        }
        /* <1.2 Never use DSCAPS_VIDEOONLY here. It kills performance
         * No DSCAPS_SYSTEMONLY either - let dfb decide
         * 1.2: DSCAPS_SYSTEMONLY boosts performance by factor ~8
         * Depends on other settings as well. Let dfb decide.
         */
        dsc.caps = DSCAPS_PREMULTIPLIED;
#if 0
        if (texture->access == SDL_TEXTUREACCESS_STREAMING)
            dsc.caps |= DSCAPS_SYSTEMONLY;
        else
            dsc.caps |= DSCAPS_VIDEOONLY;
#endif

        dsc.pixelformat = pixelformat;
        data->pixels = NULL;

        /* Create the surface */
        SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
                                                     &data->surface));
        if (SDL_ISPIXELFORMAT_INDEXED(data->format)
            && !SDL_ISPIXELFORMAT_FOURCC(data->format)) {
#if 1
            SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, &data->palette));
#else
            /* DFB has issues with blitting LUT8 surfaces.
             * Creating a new palette does not help.
             */
            DFBPaletteDescription pal_desc;
            pal_desc.flags = DPDESC_SIZE; /* | DPDESC_ENTRIES */
            pal_desc.size = 256;
            SDL_DFB_CHECKERR(devdata->dfb->CreatePalette(devdata->dfb, &pal_desc,&data->palette));
            SDL_DFB_CHECKERR(data->surface->SetPalette(data->surface, data->palette));
#endif
        }

    }
#if (DFB_VERSION_ATLEAST(1,2,0))
    data->render_options = DSRO_NONE;
#endif
    if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
        /* 3 plane YUVs return 1 bpp, but we need more space for other planes */
        if(texture->format == SDL_PIXELFORMAT_YV12 ||
           texture->format == SDL_PIXELFORMAT_IYUV) {
            SDL_DFB_ALLOC_CLEAR(data->pixels, (texture->h * data->pitch  + ((texture->h + texture->h % 2) * (data->pitch + data->pitch % 2) * 2) / 4));
        } else {
            SDL_DFB_ALLOC_CLEAR(data->pixels, texture->h * data->pitch);
        }
    }

    return 0;

  error:
    SDL_DFB_RELEASE(data->palette);
    SDL_DFB_RELEASE(data->surface);
    SDL_DFB_FREE(texture->driverdata);
    return -1;
}
Пример #30
0
static int
DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
                    const SDL_Rect * srcrect, const SDL_FRect * dstrect)
{
    DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
    IDirectFBSurface *destsurf = data->target;
    DirectFB_TextureData *texturedata =
        (DirectFB_TextureData *) texture->driverdata;
    Uint8 alpha, r, g, b;
    DFBRegion clip_region;
    DFBRectangle sr, dr;

    DirectFB_ActivateRenderer(renderer);

    SDLtoDFBRect(srcrect, &sr);
    SDLtoDFBRect_Float(dstrect, &dr);

    destsurf->GetClip(destsurf, &clip_region);
    dr.x += clip_region.x1;
    dr.y += clip_region.y1;

    if (texturedata->display) {
        int px, py;
        SDL_Window *window = renderer->window;
        IDirectFBWindow *dfbwin = get_dfb_window(window);
        SDL_DFB_WINDOWDATA(window);
        SDL_VideoDisplay *display = texturedata->display;
        DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;

        SDL_DFB_CHECKERR(dispdata->
                         vidlayer->SetSourceRectangle(dispdata->vidlayer,
                                                      sr.x, sr.y, sr.w, sr.h));
        dfbwin->GetPosition(dfbwin, &px, &py);
        px += windata->client.x;
        py += windata->client.y;
        SDL_DFB_CHECKERR(dispdata->
                         vidlayer->SetScreenRectangle(dispdata->vidlayer,
                                                      px + dr.x,
                                                      py + dr.y,
                                                      dr.w,
                                                      dr.h));
    } else {
        DFBSurfaceBlittingFlags flags = 0;

#if 0
        if (texturedata->dirty.list) {
            SDL_DirtyRect *dirty;
            void *pixels;
            int bpp = DFB_BYTES_PER_PIXEL(DirectFB_SDLToDFBPixelFormat(texture->format));
            int pitch = texturedata->pitch;

            for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
                SDL_Rect *rect = &dirty->rect;
                pixels =
                    (void *) ((Uint8 *) texturedata->pixels +
                              rect->y * pitch + rect->x * bpp);
                DirectFB_UpdateTexture(renderer, texture, rect,
                                       pixels,
                                       texturedata->pitch);
            }
            SDL_ClearDirtyRects(&texturedata->dirty);
        }
#endif
        if (texturedata->isDirty)
        {
            SDL_Rect rect;

            rect.x = 0;
            rect.y = 0;
            rect.w = texture->w;
            rect.h = texture->h;

            DirectFB_UpdateTexture(renderer, texture, &rect, texturedata->pixels, texturedata->pitch);
        }

        alpha = r = g = b = 0xff;
        if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA){
            alpha = texture->a;
            flags |= DSBLIT_BLEND_COLORALPHA;
        }

        if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
            r = texture->r;
            g = texture->g;
            b = texture->b;
            flags |= DSBLIT_COLORIZE;
        }
        SDL_DFB_CHECKERR(destsurf->
                         SetColor(destsurf, r, g, b, alpha));

        /* ???? flags |= DSBLIT_SRC_PREMULTCOLOR; */

        SetBlendMode(data, texture->blendMode, texturedata);

        SDL_DFB_CHECKERR(destsurf->SetBlittingFlags(destsurf,
                                                    data->blitFlags | flags));

#if (DFB_VERSION_ATLEAST(1,2,0))
        SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf,
                                                    texturedata->
                                                    render_options));
#endif

        if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
            SDL_DFB_CHECKERR(destsurf->Blit(destsurf,
                                            texturedata->surface,
                                            &sr, dr.x, dr.y));
        } else {
            SDL_DFB_CHECKERR(destsurf->StretchBlit(destsurf,
                                                   texturedata->surface,
                                                   &sr, &dr));
        }
    }
    return 0;
  error:
    return -1;
}