//setting srceen window(x,y,width,height) __s32 BSP_disp_sprite_block_set_screen_win(__u32 sel, __s32 hid, __disp_rect_t * scn_win) { __s32 id = 0; list_head_t * node = NULL; __disp_rect_t cur_scn; __u32 cpu_sr; id = Sprite_Hid_To_Id(sel, hid); if(gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) { if((scn_win->width != 8) && (scn_win->width != 16) && (scn_win->width != 32) && (scn_win->width != 64) && (scn_win->width != 128) && (scn_win->width != 256) && (scn_win->width != 512)) { DE_WRN("BSP_disp_sprite_block_set_screen_win,scn_win width invalid:%d\n",scn_win->width); return DIS_PARA_FAILED; } if((scn_win->height != 8) && (scn_win->height != 16) && (scn_win->height != 32) && (scn_win->height != 64) && (scn_win->height != 128) && (scn_win->height != 256) && (scn_win->height != 512) && (scn_win->height != 1024)) { DE_WRN("BSP_disp_sprite_block_set_screen_win,scn_win height invalid:%d\n",scn_win->height); return DIS_PARA_FAILED; } node = List_Find_Sprite_Block(sel, id); if(node == NULL) { return DIS_PARA_FAILED; } cur_scn.x = scn_win->x; cur_scn.y = scn_win->y; cur_scn.width = scn_win->width; cur_scn.height = scn_win->height; if(node->data->enable == FALSE) { cur_scn.y = -2000; } DE_BE_Sprite_Block_Set_Pos(sel, id,cur_scn.x,cur_scn.y); DE_BE_Sprite_Block_Set_Size(sel, id,cur_scn.width,cur_scn.height); OSAL_IrqLock(&cpu_sr); node->data->scn_win.x = scn_win->x; node->data->scn_win.y = scn_win->y; node->data->scn_win.width = scn_win->width; node->data->scn_win.height = scn_win->height; OSAL_IrqUnLock(cpu_sr); return DIS_SUCCESS; } else { return DIS_OBJ_NOT_INITED; } }
__s32 BSP_disp_sprite_block_get_srceen_win(__u32 sel, __s32 hid, __disp_rect_t *scn_win) { __s32 id = 0; list_head_t *node = NULL; id = Sprite_Hid_To_Id(sel, hid); if (gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) { node = List_Find_Sprite_Block(sel, id); scn_win->x = node->data->scn_win.x; scn_win->y = node->data->scn_win.y; scn_win->width = node->data->scn_win.width; scn_win->height = node->data->scn_win.height; return DIS_SUCCESS; } else { return DIS_OBJ_NOT_INITED; } }
//setting source x/y offset __s32 BSP_disp_sprite_block_set_src_win(__u32 sel, __s32 hid, __disp_rect_t * src_win) { __s32 id = 0; list_head_t * node = NULL; __u32 cpu_sr; __u32 bpp, addr; id = Sprite_Hid_To_Id(sel, hid); if(gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) { node = List_Find_Sprite_Block(sel, id); bpp = de_format_to_bpp(gsprite[sel].format); addr = DE_BE_Offset_To_Addr(node->data->address, node->data->size.width, src_win->x, src_win->y, bpp); DE_BE_Sprite_Block_Set_fb(sel, id,(__u32)OSAL_VAtoPA((void*)addr),node->data->size.width*(bpp>>3)); OSAL_IrqLock(&cpu_sr); node->data->src_win.x = src_win->x; node->data->src_win.y = src_win->y; OSAL_IrqUnLock(cpu_sr); return DIS_SUCCESS; }
/* * setting source x/y offset */ __s32 BSP_disp_sprite_block_set_src_win(__u32 sel, __s32 hid, __disp_rect_t *src_win) { __s32 id = 0; list_head_t *node = NULL; __u32 bpp, addr; id = Sprite_Hid_To_Id(sel, hid); if (gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) { node = List_Find_Sprite_Block(sel, id); bpp = DE_BE_Format_To_Bpp(gsprite[sel].format); addr = DE_BE_Offset_To_Addr(node->data->address, node->data->size.width, src_win->x, src_win->y, bpp); DE_BE_Sprite_Block_Set_fb(sel, id, __phys_to_bus(addr), node->data->size.width * (bpp >> 3)); node->data->src_win.x = src_win->x; node->data->src_win.y = src_win->y; return DIS_SUCCESS; } else {
__s32 BSP_disp_sprite_block_release(__u32 sel, __s32 hid) { __s32 id = 0,pre_id = 0,next_id = 0; list_head_t * node = NULL, *next_node=NULL, *pre_node=NULL; __s32 release_id = 0; __u32 cpu_sr; id = Sprite_Hid_To_Id(sel, hid); if(gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) { node = List_Find_Sprite_Block(sel, id); pre_node = node->prev; next_node = node->next; pre_id = node->prev->data->id; next_id = node->next->data->id; release_id = List_Delete_Free_Sprite_Block(sel, node); if(id == pre_id)//release the only block { __disp_sprite_block_para_t para; para.fb.addr[0] = 0; para.fb.size.width = 8; para.fb.format = DISP_FORMAT_ARGB8888; para.src_win.x = 0; para.src_win.y = 0; para.scn_win.x = 0; para.scn_win.y = -2000; para.scn_win.width = 8; para.scn_win.height = 8; sprite_set_sprite_block_para(sel, id,0,¶); } else if(id == 0)//release the first block { __disp_sprite_block_para_t para; para.fb.addr[0] = next_node->data->address; para.fb.size.width = next_node->data->size.width; para.src_win.x = next_node->data->src_win.x; para.src_win.y = next_node->data->src_win.y; para.scn_win.x = next_node->data->scn_win.x; if(next_node->data->enable == FALSE) { para.scn_win.y = -2000; } else { para.scn_win.y = next_node->data->scn_win.y; } para.scn_win.width = next_node->data->scn_win.width; para.scn_win.height = next_node->data->scn_win.height; sprite_set_sprite_block_para(sel, 0,next_node->next->data->id,¶); para.fb.addr[0] = 0; para.fb.size.width= 8; para.src_win.x = 0; para.src_win.y = 0; para.scn_win.x = 0; para.scn_win.y = -2000; para.scn_win.width = 8; para.scn_win.height = 8; sprite_set_sprite_block_para(sel, next_id,0,¶); } else { __disp_sprite_block_para_t para; para.fb.addr[0] = pre_node->data->address; para.fb.size.width= pre_node->data->size.width; para.src_win.x = pre_node->data->src_win.x; para.src_win.y = pre_node->data->src_win.y; para.scn_win.x = pre_node->data->scn_win.x; if(node->data->enable == FALSE) { para.scn_win.y = -2000; } else { para.scn_win.y = pre_node->data->scn_win.y; } para.scn_win.width = pre_node->data->scn_win.width; para.scn_win.height = pre_node->data->scn_win.height; sprite_set_sprite_block_para(sel, pre_id,next_id,¶); para.fb.addr[0] = 0; para.fb.size.width = 8; para.src_win.x = 0; para.src_win.y = 0; para.scn_win.x = 0; para.scn_win.y = -2000; para.scn_win.width = 8; para.scn_win.height = 8; sprite_set_sprite_block_para(sel, id,0,¶); } OSAL_IrqLock(&cpu_sr); gsprite[sel].block_status[release_id] &= SPRITE_BLOCK_USED_MASK; gsprite[sel].block_num --; OSAL_IrqUnLock(cpu_sr); return DIS_SUCCESS; } else { return DIS_OBJ_NOT_INITED; } }
__s32 BSP_disp_sprite_set_order(__u32 sel, __s32 hid,__s32 dst_hid)//todo { __s32 id = 0, dst_id = 0; list_head_t * node = NULL, * dst_node = NULL, *chg_node0 = NULL, *chg_node1 = NULL; __disp_sprite_block_para_t para; id = Sprite_Hid_To_Id(sel, hid); dst_id = Sprite_Hid_To_Id(sel, dst_hid); if((gsprite[sel].block_status[id] & SPRITE_BLOCK_USED) && (dst_id == -1 || (gsprite[sel].block_status[dst_id] & SPRITE_BLOCK_USED))) { if(id == dst_id)//same block,not need to move { return DIS_SUCCESS; } if(dst_id != -1) { dst_node = List_Find_Sprite_Block(sel, dst_id); if(dst_node->next->data->id == id && id != 0)//it is the order,not need to move { return DIS_SUCCESS; } } else { dst_node = NULL; } node = List_Find_Sprite_Block(sel, id); if(id == 0)//the block is the first block { chg_node0 = node->next; } else { chg_node0 = node->prev; } if(dst_id == -1)//move to the front of the list { chg_node1 = gsprite[sel].header; } else { chg_node1 = List_Find_Sprite_Block(sel, dst_id); } List_Delete_Sprite_Block(sel, node); List_Assert_Sprite_Block(sel, dst_node,node); para.fb.addr[0] = node->data->address; para.fb.size.width = node->data->size.width; para.src_win.x = node->data->src_win.x; para.src_win.y = node->data->src_win.y; memcpy(¶.scn_win,&node->data->scn_win,sizeof(__disp_rect_t)); if(node->data->enable == FALSE) { para.scn_win.y = -2000; } sprite_set_sprite_block_para(sel, node->data->id,node->next->data->id,¶); para.fb.addr[0] = chg_node0->data->address; para.fb.size.width = chg_node0->data->size.width; para.src_win.x = chg_node0->data->src_win.x; para.src_win.y = chg_node0->data->src_win.y; memcpy(¶.scn_win,&chg_node0->data->scn_win,sizeof(__disp_rect_t)); if(chg_node0->data->enable == FALSE) { para.scn_win.y = -2000; } sprite_set_sprite_block_para(sel, chg_node0->data->id,chg_node0->next->data->id,¶); para.fb.addr[0] = chg_node1->data->address; para.fb.size.width = chg_node1->data->size.width; para.src_win.x = chg_node1->data->src_win.x; para.src_win.y = chg_node1->data->src_win.y; memcpy(¶.scn_win,&chg_node1->data->scn_win,sizeof(__disp_rect_t)); if(chg_node1->data->enable == FALSE) { para.scn_win.y = -2000; } sprite_set_sprite_block_para(sel, chg_node1->data->id,chg_node1->next->data->id,¶); return DIS_SUCCESS; } else { return DIS_OBJ_NOT_INITED; } }