static void savage4CheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { SVGDBG("savage4checkstate\n"); switch (state->destination->config.format) { case DSPF_ARGB1555: case DSPF_RGB16: case DSPF_RGB32: case DSPF_ARGB: case DSPF_RGB332: break; default: return; } if (DFB_DRAWING_FUNCTION( accel )) { if (state->drawingflags & ~SAVAGE4_DRAWING_FLAGS) return; state->accel |= SAVAGE4_DRAWING_FUNCTIONS; } else { if (state->source->config.format != state->destination->config.format) return; if (state->blittingflags & ~SAVAGE4_BLITTING_FLAGS) return; state->accel |= SAVAGE4_BLITTING_FUNCTIONS; } }
/* * Check for acceleration of 'accel' using the given 'state'. */ void vmwareCheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { D_DEBUG_AT( VMWare_2D, "vmwareCheckState (state %p, accel 0x%08x) <- dest %p\n", state, accel, state->destination ); /* Return if the desired function is not supported at all. */ if (accel & ~(VMWARE_SUPPORTED_DRAWINGFUNCTIONS | VMWARE_SUPPORTED_BLITTINGFUNCTIONS)) return; /* Return if the destination format is not supported. */ switch (state->destination->config.format) { case DSPF_ARGB: case DSPF_RGB32: case DSPF_RGB16: break; default: return; } /* Check if drawing or blitting is requested. */ if (DFB_DRAWING_FUNCTION( accel )) { /* Return if unsupported drawing flags are set. */ if (state->drawingflags & ~VMWARE_SUPPORTED_DRAWINGFLAGS) return; } else { /* Return if the source format is not supported. */ switch (state->source->config.format) { case DSPF_ARGB: case DSPF_RGB32: case DSPF_RGB16: /* FIXME: Currently only copying blits supported. */ if (state->source->config.format == state->destination->config.format) break; default: return; } /* Return if unsupported blitting flags are set. */ if (state->blittingflags & ~VMWARE_SUPPORTED_BLITTINGFLAGS) return; } /* Enable acceleration of the function. */ state->accel |= accel; }
static void sis_check_state(void *driver_data, void *device_data, CardState *state, DFBAccelerationMask accel) { (void)driver_data; (void)device_data; switch (state->destination->config.format) { case DSPF_LUT8: case DSPF_ARGB1555: case DSPF_RGB16: case DSPF_RGB32: case DSPF_ARGB: break; default: return; } if (DFB_DRAWING_FUNCTION(accel)) { if (state->drawingflags & ~SIS_SUPPORTED_DRAWING_FLAGS) return; if (accel & DFXL_FILLTRIANGLE) { /* this is faster. don't know why. */ state->accel = 0; return; } state->accel |= SIS_SUPPORTED_DRAWING_FUNCTIONS; } else { if (state->blittingflags & ~SIS_SUPPORTED_BLITTING_FLAGS) return; switch (state->source->config.format) { case DSPF_LUT8: case DSPF_ARGB1555: case DSPF_RGB16: case DSPF_RGB32: case DSPF_ARGB: break; default: return; } if (state->source->config.format != state->destination->config.format) return; state->accel |= SIS_SUPPORTED_BLITTING_FUNCTIONS; } }
/* * Check for acceleration of 'accel' using the given 'state'. */ void gles2CheckState(void *drv, void *dev, CardState *state, DFBAccelerationMask accel) { DFBSurfaceBlittingFlags blittingflags = state->blittingflags; D_DEBUG_AT(GLES2__2D, "%s(state %p, accel 0x%08x) <- dest %p [%lu]\n", __FUNCTION__, state, accel, state->destination, state->dst.offset); dfb_simplify_blittingflags( &blittingflags ); // Return if the desired function is not supported at all. if (accel & ~(GLES2_SUPPORTED_DRAWINGFUNCTIONS | GLES2_SUPPORTED_BLITTINGFUNCTIONS)) { D_DEBUG_AT(GLES2__2D, " -> unsupported function\n"); return; } // Check if drawing or blitting is requested. if (DFB_DRAWING_FUNCTION(accel)) { // Return if unsupported drawing flags are set. if (state->drawingflags & ~GLES2_SUPPORTED_DRAWINGFLAGS) { D_DEBUG_AT(GLES2__2D, " -> unsupported drawing flags 0x%08x\n", state->drawingflags); return; } } else { // Return if unsupported blitting flags are set. if (blittingflags & ~GLES2_SUPPORTED_BLITTINGFLAGS) { D_DEBUG_AT(GLES2__2D, " -> unsupported blit flags 0x%08x\n", blittingflags); return; } } // Enable acceleration of the function. state->accel |= accel; D_DEBUG_AT(GLES2__2D, " => OK\n"); }
static void neo2200CheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { switch (state->destination->config.format) { case DSPF_A8: case DSPF_LUT8: case DSPF_RGB332: case DSPF_ARGB1555: case DSPF_RGB16: break; case DSPF_YUY2: if (accel == DFXL_BLIT) break; default: return; } if (DFB_DRAWING_FUNCTION(accel)) { /* if the function is supported and there are no other drawing flags than the supported */ if (!(accel & ~NEO_SUPPORTED_DRAWINGFUNCTIONS) && !(state->drawingflags & ~NEO_SUPPORTED_DRAWINGFLAGS)) state->accel |= accel; } else { /* if the function is supported, there are no other blitting flags than the supported, the source and destination formats are the same and the source and dest. are different due to a blitting bug */ if (!(accel & ~NEO_SUPPORTED_BLITTINGFUNCTIONS) && !(state->blittingflags & ~NEO_SUPPORTED_BLITTINGFLAGS) && state->source->config.format == state->destination->config.format) state->accel |= accel; } }
static void sdlCheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { /* check destination format first */ switch (state->destination->config.format) { case DSPF_RGB16: case DSPF_RGB32: break; default: return; } if (DFB_DRAWING_FUNCTION( accel )) { /* if there are no other drawing flags than the supported */ if (state->drawingflags & ~SDL_DRAWING_FLAGS) return; state->accel |= SDL_DRAWING_FUNCTIONS; } else { /* if there are no other blitting flags than the supported and the source and destination formats are the same */ if (state->blittingflags & ~SDL_BLITTING_FLAGS) return; /* check source format */ switch (state->source->config.format) { case DSPF_RGB16: case DSPF_RGB32: break; default: return; } state->accel |= SDL_BLITTING_FUNCTIONS; } }
void pxa3xxCheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { D_DEBUG_AT( PXA3XX_BLT, "%s( %p, 0x%08x )\n", __FUNCTION__, state, accel ); /* Return if the desired function is not supported at all. */ if (accel & ~(PXA3XX_SUPPORTED_DRAWINGFUNCTIONS | PXA3XX_SUPPORTED_BLITTINGFUNCTIONS)) return; /* Return if the destination format is not supported. */ if (!pixel_formats[DFB_PIXELFORMAT_INDEX(state->destination->config.format)]) return; /* Check if drawing or blitting is requested. */ if (DFB_DRAWING_FUNCTION( accel )) { /* Return if unsupported drawing flags are set. */ if (state->drawingflags & ~PXA3XX_SUPPORTED_DRAWINGFLAGS) return; /* Return if blending with unsupported blend functions is requested. */ if (state->drawingflags & DSDRAW_BLEND) { /* Check blend functions. */ if (!check_blend_functions( state )) return; } /* Enable acceleration of drawing functions. */ state->accel |= PXA3XX_SUPPORTED_DRAWINGFUNCTIONS; } else { const DFBSurfaceBlittingFlags flags = state->blittingflags; /* Return if unsupported blitting flags are set. */ if (flags & ~PXA3XX_SUPPORTED_BLITTINGFLAGS) return; /* Return if the source format is not supported. */ if (!pixel_formats[DFB_PIXELFORMAT_INDEX(state->source->config.format)]) return; /* Return if blending with unsupported blend functions is requested. */ if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) { if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->config.format )) return; /* Rotated blits are not supported with blending. */ if (flags & ~(DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA | DSBLIT_COLORIZE)) return; /* Blending with alpha from color value is not supported * in combination with other blending functions. */ if (flags & DSBLIT_BLEND_COLORALPHA && flags != DSBLIT_BLEND_COLORALPHA) return; /* Check blend functions. */ if (!check_blend_functions( state )) return; } /* Colorizing is only supported for rendering ARGB glyphs. */ if (flags & DSBLIT_COLORIZE && (flags != (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE) || ! (state->source->type & CSTF_FONT))) return; /* Enable acceleration of blitting functions. */ state->accel |= PXA3XX_SUPPORTED_BLITTINGFUNCTIONS; } }
DFBResult CoreGraphicsStateClient_Update( CoreGraphicsStateClient *client, DFBAccelerationMask accel, CardState *state ) { DFBResult ret; StateModificationFlags flags = (StateModificationFlags)(SMF_TO | SMF_DESTINATION | SMF_CLIP | SMF_RENDER_OPTIONS); D_DEBUG_AT( Core_GraphicsStateClient, "%s( client %p )\n", __FUNCTION__, client ); D_MAGIC_ASSERT( client, CoreGraphicsStateClient ); D_MAGIC_ASSERT( state, CardState ); /* * dfb_gfxcard_state_check() moves flags to mod_hw, * called from IDirectFBSurface::GetAccelerationMask(). * * FIXME: Add GetAccelerationMask() to CoreGraphicsState flux * and do not load the graphics driver at slaves anymore. */ state->modified = (StateModificationFlags)(state->modified | state->mod_hw); state->mod_hw = SMF_NONE; if (state->render_options & DSRO_MATRIX) flags = (StateModificationFlags)(flags | SMF_MATRIX); if (DFB_DRAWING_FUNCTION( accel )) { flags = (StateModificationFlags)(flags | SMF_DRAWING_FLAGS | SMF_COLOR); if (state->drawingflags & DSDRAW_BLEND) flags = (StateModificationFlags)(flags | SMF_SRC_BLEND | SMF_DST_BLEND); if (state->drawingflags & DSDRAW_DST_COLORKEY) flags = (StateModificationFlags)(flags | SMF_DST_COLORKEY); } else { flags = (StateModificationFlags)(flags | SMF_BLITTING_FLAGS | SMF_FROM | SMF_SOURCE); if (accel == DFXL_BLIT2) flags = (StateModificationFlags)(flags | SMF_FROM | SMF_SOURCE2); if (state->blittingflags & (DSBLIT_BLEND_COLORALPHA | DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR)) flags = (StateModificationFlags)(flags | SMF_COLOR); if (state->blittingflags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) flags = (StateModificationFlags)(flags | SMF_SRC_BLEND | SMF_DST_BLEND); if (state->blittingflags & DSBLIT_SRC_COLORKEY) flags = (StateModificationFlags)(flags | SMF_SRC_COLORKEY); if (state->blittingflags & DSBLIT_DST_COLORKEY) flags = (StateModificationFlags)(flags | SMF_DST_COLORKEY); if (state->blittingflags & (DSBLIT_SRC_MASK_ALPHA | DSBLIT_SRC_MASK_COLOR)) flags = (StateModificationFlags)(flags | SMF_FROM | SMF_SOURCE_MASK | SMF_SOURCE_MASK_VALS); if (state->blittingflags & DSBLIT_INDEX_TRANSLATION) flags = (StateModificationFlags)(flags | SMF_INDEX_TRANSLATION); if (state->blittingflags & DSBLIT_COLORKEY_PROTECT) flags = (StateModificationFlags)(flags | SMF_COLORKEY); if (state->blittingflags & DSBLIT_SRC_CONVOLUTION) flags = (StateModificationFlags)(flags | SMF_SRC_CONVOLUTION); } ret = CoreGraphicsStateClient_SetState( client, state, (StateModificationFlags)(state->modified & flags) ); if (ret) return ret; state->modified = (StateModificationFlags)(state->modified & ~flags); return DFB_OK; }
/* * Check for acceleration of 'accel' using the given 'state'. */ void davinciCheckState( void *drv, void *dev, CardState *state, DFBAccelerationMask accel ) { D_DEBUG_AT( Davinci_2D, "%s( state %p, accel 0x%08x ) <- dest %p\n", __FUNCTION__, state, accel, state->destination ); /* Return if the desired function is not supported at all. */ if (accel & ~(DAVINCI_SUPPORTED_DRAWINGFUNCTIONS | DAVINCI_SUPPORTED_BLITTINGFUNCTIONS)) return; /* Return if the destination format is not supported. */ switch (state->destination->config.format) { case DSPF_UYVY: case DSPF_RGB16: case DSPF_RGB32: case DSPF_ARGB: break; default: return; } /* Check if drawing or blitting is requested. */ if (DFB_DRAWING_FUNCTION( accel )) { /* Return if unsupported drawing flags are set. */ if (state->drawingflags & ~DAVINCI_SUPPORTED_DRAWINGFLAGS) return; /* Limited blending support. */ if (state->drawingflags & (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY)) { if (state->destination->config.format != DSPF_ARGB) return; if (get_draw_blend_sub_function( state ) < 0) return; } } else { /* Return if unsupported blitting flags are set. */ if (state->blittingflags & ~DAVINCI_SUPPORTED_BLITTINGFLAGS) return; /* No other flags supported when color keying is used. */ if ((state->blittingflags & DSBLIT_SRC_COLORKEY) && state->blittingflags != DSBLIT_SRC_COLORKEY) return; /* Return if the source format is not supported. */ switch (state->source->config.format) { case DSPF_UYVY: case DSPF_RGB16: /* Only color keying for these formats. */ if (state->blittingflags & ~DSBLIT_SRC_COLORKEY) return; /* No format conversion supported. */ if (state->source->config.format != state->destination->config.format) return; break; case DSPF_RGB32: /* Only color keying for these formats. */ if (state->blittingflags & ~DSBLIT_SRC_COLORKEY) return; /* fall through */ case DSPF_ARGB: /* Only few blending combinations are valid. */ if ((state->blittingflags & ~DSBLIT_SRC_COLORKEY) && get_blit_blend_sub_function( state ) < 0) return; /* Only ARGB/RGB32 -> RGB16 conversion (without any flag). */ if (state->source->config.format != state->destination->config.format && (state->destination->config.format != DSPF_RGB16 || state->blittingflags)) return; break; default: return; } /* Checks per function. */ switch (accel) { case DFXL_STRETCHBLIT: /* No flags supported with StretchBlit(). */ if (state->blittingflags) return; /* Only (A)RGB at 32 bit supported. */ if (state->source->config.format != DSPF_ARGB && state->source->config.format != DSPF_RGB32) return; break; default: break; } } /* Enable acceleration of the function. */ state->accel |= accel; D_DEBUG_AT( Davinci_2D, " => accel 0x%08x\n", state->accel ); }
/* * Check for acceleration of 'accel' using the given 'state'. */ void pvr2dCheckState(void *drv, void *dev, CardState *state, DFBAccelerationMask accel) { D_DEBUG_AT(PVR2D__2D, "%s(state %p, accel 0x%08x) <- dest %p [%lu]\n", __FUNCTION__, state, accel, state->destination, state->dst.offset); // Return if the desired function is not supported at all. if (accel & ~(PVR2D_SUPPORTED_DRAWINGFUNCTIONS | PVR2D_SUPPORTED_BLITTINGFUNCTIONS)) { D_DEBUG_AT(PVR2D__2D, " -> unsupported function\n"); return; } // Return if the destination format is not supported. switch (state->destination->config.format) { case DSPF_ARGB: case DSPF_RGB32: case DSPF_RGB16: break; default: D_DEBUG_AT (PVR2D__2D, " -> unsupported destination format %s\n", dfb_pixelformat_name(state->destination->config.format)); return; } // Check if drawing or blitting is requested. if (DFB_DRAWING_FUNCTION(accel)) { // Return if unsupported drawing flags are set. if (state->drawingflags & ~PVR2D_SUPPORTED_DRAWINGFLAGS) { D_DEBUG_AT(PVR2D__2D, " -> unsupported drawing flags 0x%08x\n", state->drawingflags); return; } } else { // Return if the source format is not supported. switch (state->source->config.format) { case DSPF_A8: case DSPF_ARGB: case DSPF_RGB32: case DSPF_RGB16: break; default: D_DEBUG_AT (PVR2D__2D, " -> unsupported source format %s\n", dfb_pixelformat_name(state->source->config.format)); return; } // Return if unsupported blitting flags are set. if (state->blittingflags & ~PVR2D_SUPPORTED_BLITTINGFLAGS) { D_DEBUG_AT(PVR2D__2D, " -> unsupported blit flags 0x%08x\n", state->blittingflags); return; } if (state->blittingflags & DSBLIT_BLEND_ALPHACHANNEL) { if (state->dst_blend != DSBF_INVSRCALPHA || (state->src_blend != DSBF_SRCALPHA && state->src_blend != DSBF_ONE)) { D_DEBUG_AT(PVR2D__2D, " -> unsupported blend functions 0x%02x 0x%02x\n", state->src_blend, state->dst_blend); return; } } } // Enable acceleration of the function. state->accel |= accel; D_DEBUG_AT(PVR2D__2D, " => OK\n"); }
DFBResult GP2DEngine::CheckState( CardState *state, DFBAccelerationMask accel ) { D_DEBUG_AT( GP2D_Engine, "GP2DEngine::%s()\n", __FUNCTION__ ); /* Return if the desired function is not supported at all. */ if (accel & ~(GP2D_SUPPORTED_DRAWINGFUNCTIONS | GP2D_SUPPORTED_BLITTINGFUNCTIONS)) return DFB_UNSUPPORTED; /* Return if the destination format is not supported. */ switch (state->destination->config.format) { case DSPF_RGB16: // case DSPF_ARGB1555: break; default: return DFB_UNSUPPORTED; } /* Check if drawing or blitting is requested. */ if (DFB_DRAWING_FUNCTION( accel )) { /* Return if unsupported drawing flags are set. */ if (state->drawingflags & ~GP2D_SUPPORTED_DRAWINGFLAGS) return DFB_UNSUPPORTED; /* Return if blending with unsupported blend functions is requested. */ if (state->drawingflags & DSDRAW_BLEND) { switch (accel) { case DFXL_FILLRECTANGLE: case DFXL_FILLTRIANGLE: break; default: return DFB_UNSUPPORTED; } /* Return if blending with unsupported blend functions is requested. */ if (state->src_blend != DSBF_SRCALPHA || state->dst_blend != DSBF_INVSRCALPHA) return DFB_UNSUPPORTED; /* XOR only without blending. */ if (state->drawingflags & DSDRAW_XOR) return DFB_UNSUPPORTED; } } else { DFBSurfaceBlittingFlags flags = state->blittingflags; /* Return if unsupported blitting flags are set. */ if (flags & ~GP2D_SUPPORTED_BLITTINGFLAGS) return DFB_UNSUPPORTED; /* Return if the source format is not supported. */ if (state->source->config.format != state->destination->config.format) return DFB_UNSUPPORTED; /* Return if blending with unsupported blend functions is requested. */ if (flags & (DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) { if (state->src_blend != DSBF_SRCALPHA || state->dst_blend != DSBF_INVSRCALPHA) return DFB_UNSUPPORTED; } /* XOR only without blending etc. */ if (flags & DSBLIT_XOR && flags & ~(DSBLIT_SRC_COLORKEY | DSBLIT_ROTATE180 | DSBLIT_XOR)) return DFB_UNSUPPORTED; /* Return if colorizing for non-font surfaces is requested. */ if ((flags & DSBLIT_COLORIZE) && !(state->source->type & CSTF_FONT)) return DFB_UNSUPPORTED; /* Return if blending with both alpha channel and value is requested. */ if (D_FLAGS_ARE_SET( flags, DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_BLEND_COLORALPHA)) return DFB_UNSUPPORTED; } return DFB_OK; }