static DFBResult uc_ovl_set_region( CoreLayer *layer, void *driver_data, void *layer_data, void *region_data, CoreLayerRegionConfig *config, CoreLayerRegionConfigFlags updated, CoreSurface *surface, CorePalette *palette ) { UcDriverData* ucdrv = (UcDriverData*) driver_data; UcOverlayData* ucovl = (UcOverlayData*) layer_data; /* get new destination rectangle */ DFBRectangle win = config->dest;; // Bounds checking if ((win.x < -8192) || (win.x > 8192) || (win.y < -8192) || (win.y > 8192) || (win.w < 32) || (win.w > 4096) || (win.h < 32) || (win.h > 4096)) { D_DEBUG("Layer size or position is out of bounds."); return DFB_INVAREA; } ucovl->v1.isenabled = true; ucovl->v1.win = win; ucovl->deinterlace = config->options & DLOP_DEINTERLACING; ucovl->surface = surface; return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface); }
static DFBResult uc_ovl_flip_region( CoreLayer *layer, void *driver_data, void *layer_data, void *region_data, CoreSurface *surface, DFBSurfaceFlipFlags flags ) { //printf("Entering %s ... \n", __PRETTY_FUNCTION__); UcDriverData* ucdrv = (UcDriverData*) driver_data; UcOverlayData* ucovl = (UcOverlayData*) layer_data; DFBResult ret; if (((flags & DSFLIP_WAITFORSYNC) == DSFLIP_WAITFORSYNC) && !dfb_config->pollvsync_after) dfb_layer_wait_vsync( layer ); dfb_surface_flip_buffers(surface, false); ucovl->field = 0; ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface); if (ret) return ret; if ((flags & DSFLIP_WAIT) && (dfb_config->pollvsync_after || !(flags & DSFLIP_ONSYNC))) dfb_layer_wait_vsync(layer); return DFB_OK; }
static DFBResult uc_ovl_set_region( CoreLayer *layer, void *driver_data, void *layer_data, void *region_data, CoreLayerRegionConfig *config, CoreLayerRegionConfigFlags updated, CoreSurface *surface, CorePalette *palette, CoreSurfaceBufferLock *lock ) { UcDriverData* ucdrv = (UcDriverData*) driver_data; UcOverlayData* ucovl = (UcOverlayData*) layer_data; DFBRectangle win; /* remember configuration */ ucovl->config = *config; /* get new destination rectangle */ win = config->dest; // Bounds checking if ((win.x < -8192) || (win.x > 8192) || (win.y < -8192) || (win.y > 8192) || (win.w < 32) || (win.w > 4096) || (win.h < 32) || (win.h > 4096)) { D_DEBUG("Layer size or position is out of bounds."); return DFB_INVAREA; } ucovl->v1.isenabled = true; ucovl->v1.win = win; ucovl->v1.dst_key = config->dst_key; ucovl->v1.dstkey_enabled = config->options & DLOP_DST_COLORKEY; if (config->options & DLOP_OPACITY) ucovl->v1.opacity = config->opacity; else ucovl->v1.opacity = 0xff; // printf("uc_overlay: color-keying is %s\n", // ucovl->v1.dstkey_enabled ? "enabled" : "disabled"); ucovl->deinterlace = config->options & DLOP_DEINTERLACING; ucovl->surface = surface; ucovl->lock = lock; if (ucdrv->canfliponvsync) { FBDev *dfb_fbdev = dfb_system_data(); int field_option = VIAFB_WAIT_FLIP; // wait for any pending flip ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option); } return uc_ovl_update(ucdrv, ucovl, UC_OVL_CHANGE, surface, lock); }
static DFBResult uc_ovl_set_input_field( CoreLayer *layer, void *driver_data, void *layer_data, void *region_data, int field ) { UcOverlayData* ucovl = (UcOverlayData*) layer_data; UcDriverData* ucdrv = (UcDriverData*) driver_data; ucovl->field = field; return uc_ovl_update(ucdrv, ucovl, UC_OVL_FIELD, ucovl->surface); }
static DFBResult uc_ovl_flip_region( CoreLayer *layer, void *driver_data, void *layer_data, void *region_data, CoreSurface *surface, DFBSurfaceFlipFlags flags, CoreSurfaceBufferLock *lock ) { //printf("Entering %s ... \n", __PRETTY_FUNCTION__); UcDriverData* ucdrv = (UcDriverData*) driver_data; UcOverlayData* ucovl = (UcOverlayData*) layer_data; DFBResult ret; FBDev *dfb_fbdev = dfb_system_data(); dfb_surface_flip(surface, false); ucovl->field = 0; ucovl->lock = lock; if (ucdrv->canfliponvsync) { if (ucovl->config.options & DLOP_FIELD_PARITY) { struct fb_flip flip; int field_option; field_option = VIAFB_WAIT_FLIP; // ensure last pending flip complete ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option); flip.device = VIAFB_FLIP_V1; flip.field = ucovl->config.parity; flip.count = 0; // until we implement this uc_ovl_map_buffer(surface->config.format, lock->offset, ucovl->v1.ox, ucovl->v1.oy, surface->config.size.w, surface->config.size.h, lock->pitch, 0, &flip.offset[0], &flip.offset[1], &flip.offset[2]); ioctl(dfb_fbdev->fd, FBIO_FLIPONVSYNC, &flip); } else { ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface, lock); if (ret) return ret; } } else { if (ucovl->config.options & DLOP_FIELD_PARITY) { int field_option; if (ucovl->config.parity == 0) // top field first? field_option = VIAFB_WAIT_BOTTOMFIELD; else field_option = VIAFB_WAIT_TOPFIELD; ioctl(dfb_fbdev->fd, FBIO_WAITFORVSYNC, &field_option); // that actually waits for VBLANK so we need a further delay // to be sure the field has started and that the flip will // take effect on the next field usleep(2500); } ret = uc_ovl_update(ucdrv, ucovl, UC_OVL_FLIP, surface, lock); if (ret) return ret; } if (flags & DSFLIP_WAIT) dfb_layer_wait_vsync(layer); return DFB_OK; }