mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-30 03:08:12 +08:00
modify sigmastar 202 input_linux,add tp rotate
This commit is contained in:
parent
529fa10d61
commit
e487dd9bb3
@ -1,7 +1,8 @@
|
||||
project (sigma C CXX)
|
||||
|
||||
set(SIGMA_SRCS ../common/cdlog.cc
|
||||
mediaplayer.c input_linux.cc )
|
||||
#mediaplayer.c
|
||||
input_linux.cc )
|
||||
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(poll.h HAVE_POLL_H)
|
||||
@ -31,8 +32,8 @@ endif()
|
||||
link_directories(${PROJECT_SOURCE_DIR}/libs)
|
||||
list(APPEND SIGMA_LIBS pthread
|
||||
-L${PROJECT_SOURCE_DIR}/libs -lmi_common -lmi_sys -lmi_gfx
|
||||
-lmi_disp -lmi_ai -lmi_ao -lmi_vdec -lmi_divp -lmi_panel
|
||||
-lhvplayer -lavformat -lavcodec -lavutil -lswresample -lswscale)
|
||||
)#-lmi_disp -lmi_ai -lmi_ao -lmi_vdec -lmi_divp -lmi_panel
|
||||
#-lhvplayer -lavformat -lavcodec -lavutil -lswresample -lswscale)
|
||||
#mi_common mi_sys mi_gfx)
|
||||
include_directories(./
|
||||
../common ./inc ../include
|
||||
|
@ -63,11 +63,16 @@ DWORD GFXInit(){
|
||||
LOGI("fb solution=%dx%d accel_flags=0x%x",dev.var.xres,dev.var.yres,dev.var.accel_flags);
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
#define ROTATE_90 1
|
||||
DWORD GFXGetScreenSize(UINT*width,UINT*height){
|
||||
LOGI_IF(width==NULL||height==NULL,"Params Error");
|
||||
#ifndef ROTATE_90
|
||||
*width=dev.var.xres;
|
||||
*height=dev.var.yres;
|
||||
#else
|
||||
*width=dev.var.yres;
|
||||
*height=dev.var.xres;
|
||||
#endif
|
||||
LOGI("screensize=%dx%d",*width,*height);
|
||||
return E_OK;
|
||||
}
|
||||
@ -183,8 +188,6 @@ static int setfbinfo(FBSURFACE*surf){
|
||||
#define ALIGN(x,y) ((x&~(y))|y)
|
||||
DWORD GFXCreateSurface(HANDLE*surface,UINT width,UINT height,INT format,BOOL hwsurface){
|
||||
FBSURFACE*surf=(FBSURFACE*)malloc(sizeof(FBSURFACE));
|
||||
static int created=0;
|
||||
char name[128];
|
||||
surf->width=width;
|
||||
surf->height=height;
|
||||
surf->format=format;
|
||||
@ -192,10 +195,24 @@ DWORD GFXCreateSurface(HANDLE*surface,UINT width,UINT height,INT format,BOOL hws
|
||||
surf->pitch=width*4;
|
||||
surf->kbuffer=NULL;
|
||||
surf->msize=(surf->pitch*height);//sizeof dword
|
||||
sprintf(name,"#mmap_name%d",created++);
|
||||
|
||||
MI_PHY phaddr;
|
||||
MI_S32 ret=MI_SYS_MMA_Alloc(name,surf->msize,&phaddr);
|
||||
MI_PHY phaddr=dev.fix.smem_start;
|
||||
MI_S32 ret=0;
|
||||
if(!hwsurface){
|
||||
int i=0;
|
||||
ret=MI_SYS_MMA_Alloc("mma_heap_name0",surf->msize,&phaddr);
|
||||
while((i++<3)&&(phaddr==dev.fix.smem_start)){
|
||||
ret=MI_SYS_MMA_Alloc("mma_heap_name0",surf->msize,&phaddr);
|
||||
LOGI("[%d]=%x ret=%d",i,phaddr,ret);
|
||||
}
|
||||
}
|
||||
#ifdef ROTATE_90
|
||||
if(hwsurface){
|
||||
surf->width=height;
|
||||
surf->height=width;
|
||||
surf->pitch=height*4;
|
||||
}
|
||||
#endif
|
||||
if(ret==0){
|
||||
surf->kbuffer=(char*)phaddr;
|
||||
MI_SYS_Mmap(phaddr, surf->msize, (void**)&surf->buffer, FALSE);
|
||||
@ -203,7 +220,7 @@ DWORD GFXCreateSurface(HANDLE*surface,UINT width,UINT height,INT format,BOOL hws
|
||||
}
|
||||
if(hwsurface) setfbinfo(surf);
|
||||
surf->ishw=hwsurface;
|
||||
LOGI("surface=%x buf=%p/%p size=%dx%d hw=%d\r\n",surf,surf->buffer,surf->kbuffer,width,height,hwsurface);
|
||||
LOGI("Surface=%x buf=%p/%p size=%dx%d hw=%d\r\n",surf,surf->buffer,surf->kbuffer,width,height,hwsurface);
|
||||
*surface=surf;
|
||||
return E_OK;
|
||||
}
|
||||
@ -254,8 +271,11 @@ DWORD GFXBlit(HANDLE dstsurface,int dx,int dy,HANDLE srcsurface,const GFXRect*sr
|
||||
opt.eSrcDfbBldOp = E_MI_GFX_DFB_BLD_ONE;
|
||||
opt.eDstDfbBldOp = E_MI_GFX_DFB_BLD_ZERO;
|
||||
opt.eMirror = E_MI_GFX_MIRROR_NONE;
|
||||
opt.eRotate = E_MI_GFX_ROTATE_0;
|
||||
|
||||
#ifdef ROTATE_90
|
||||
opt.eRotate = E_MI_GFX_ROTATE_90;
|
||||
#else
|
||||
opt.eRotate = E_MI_GFX_ROTATE_0;
|
||||
#endif
|
||||
stSrcRect.s32Xpos = rs.x;
|
||||
stSrcRect.s32Ypos = rs.y;
|
||||
stSrcRect.u32Width = rs.w;
|
||||
@ -276,7 +296,8 @@ DWORD GFXDestroySurface(HANDLE surface){
|
||||
LOGI("GFXDestroySurface %p/%p",surf,surf->buffer);
|
||||
if(surf->kbuffer){
|
||||
MI_SYS_Munmap(surf->buffer,surf->msize);
|
||||
MI_SYS_MMA_Free((MI_PHY)surf->kbuffer);
|
||||
if(surf->ishw==0)
|
||||
MI_SYS_MMA_Free((MI_PHY)surf->kbuffer);
|
||||
}else if(surf->buffer){
|
||||
free(surf->buffer);
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ INT InputInjectEvents(const INPUTEVENT*es,UINT count,DWORD timeout){
|
||||
return count;
|
||||
}
|
||||
|
||||
#define ROTATE90 1
|
||||
INT InputGetEvents(INPUTEVENT*outevents,UINT max,DWORD timeout){
|
||||
int rc,count=0;
|
||||
struct timeval tv;
|
||||
@ -161,14 +162,24 @@ INT InputGetEvents(INPUTEVENT*outevents,UINT max,DWORD timeout){
|
||||
clock_gettime(CLOCK_MONOTONIC,&ts);
|
||||
rc=read(dev.fds[i],events, sizeof(events)/sizeof(struct input_event));
|
||||
for(int j=0;j<rc/sizeof(struct input_event)&&(count<max);j++,e++,count++){
|
||||
e->tv_sec =events[j].time.tv_sec;
|
||||
e->tv_usec=events[j].time.tv_usec;
|
||||
e->tv_sec =ts.tv_sec;//events[j].time.tv_sec;
|
||||
e->tv_usec=ts.tv_nsec/10000+j*100;//events[j].time.tv_usec;
|
||||
e->type = events[j].type;
|
||||
e->code = events[j].code;
|
||||
e->value= events[j].value;
|
||||
e->device=dev.fds[i];
|
||||
LOGV_IF(e->type<EV_SW,"fd:%d [%s]%x,%x,%x ",dev.fds[i],
|
||||
type2name[e->type],e->type,e->code,e->value);
|
||||
#ifdef ROTATE90
|
||||
if(e->type==EV_ABS){
|
||||
if((e->code==0)||(e->code==53)){
|
||||
e->code++;
|
||||
e->value=600-e->value;
|
||||
}else if((e->code==54)||(e->code==1)){
|
||||
e->code--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
LOGV_IF(e->type<EV_SW,"fd:%d [%s]%02x,%02x,%02x time=%ld.%ld",dev.fds[i],
|
||||
type2name[e->type],e->type,e->code,e->value,e->tv_sec,e->tv_usec);
|
||||
}
|
||||
}else{//for pipe
|
||||
rc=read(dev.fds[i],e, (max-count)*sizeof(INPUTEVENT));
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <cdtypes.h>
|
||||
#include <ngl_os.h>
|
||||
#include <ngl_graph.h>
|
||||
#include <cdgraph.h>
|
||||
#include <cdlog.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
Loading…
Reference in New Issue
Block a user