Use HWC from 5.1.1
This commit is contained in:
parent
8bf9a36de4
commit
ed534d152d
7 changed files with 135 additions and 139 deletions
|
@ -78,7 +78,7 @@
|
|||
#define SETUP_INTERVAL_TR 100000
|
||||
#define SETUP_TIMES 60
|
||||
/* mali400 power is DE 15 times*/
|
||||
#define DE_GPU_PW_FACTOR 15
|
||||
#define DE_GPU_PW_FACTOR 15
|
||||
#define DE_GPU_MEM_FACTOR 2
|
||||
|
||||
#define container_of(type, member)({\
|
||||
|
@ -97,12 +97,12 @@ typedef enum
|
|||
ASSIGN_OVERLAY,
|
||||
ASSIGN_CURSOR,
|
||||
ASSIGN_FORCE_GPU,
|
||||
|
||||
|
||||
ASSIGN_NEEDREASSIGNED,
|
||||
ASSIGN_FAILED,
|
||||
} HwcAssignStatus;
|
||||
|
||||
/*for kernel dev_composer.c*/
|
||||
/*for kernel dev_composer.c*/
|
||||
enum {
|
||||
HWC_SYNC_NEED = -2,
|
||||
HWC_SYNC_INIT = -1,
|
||||
|
@ -178,14 +178,13 @@ typedef struct{
|
|||
long long top;
|
||||
long long bottom;
|
||||
}rect64;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
unsigned int sync_cnt;
|
||||
int share_fd;//ion_handle share_fd
|
||||
int size_buffer;
|
||||
bool valid;
|
||||
bool is_secure;
|
||||
}hwc_cache_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -208,7 +207,6 @@ typedef struct {
|
|||
int share_fd;
|
||||
bool needsync;//for sw_write
|
||||
bool iscursor;
|
||||
bool is_secure;
|
||||
disp_layer_config hwc_layer_info;
|
||||
}hwc_commit_layer_t;
|
||||
|
||||
|
@ -224,7 +222,7 @@ typedef struct {
|
|||
int outbufAcquireFenceFd;
|
||||
}vir_data_t;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
list_head_t commit_head;
|
||||
list_head_t manage_head;
|
||||
|
@ -288,7 +286,6 @@ typedef struct layer_info {
|
|||
bool is3D;
|
||||
bool is_cursor;
|
||||
bool need_sync;
|
||||
bool is_secure;
|
||||
int shared_fd;
|
||||
format_info form_info;
|
||||
AssignDUETO_T info;
|
||||
|
@ -315,7 +312,8 @@ typedef struct{
|
|||
bool VsyncEnable;
|
||||
bool issecure;
|
||||
bool active;
|
||||
|
||||
bool setblank;
|
||||
|
||||
int HwChannelNum;
|
||||
int LayerNumofCH;
|
||||
int VideoCHNum;
|
||||
|
@ -333,7 +331,7 @@ typedef struct{
|
|||
unsigned char SetPersentHeight;
|
||||
unsigned char PersentWidth;
|
||||
unsigned char PersentHeight;
|
||||
|
||||
|
||||
int DisplayType;
|
||||
disp_tv_mode DisplayMode;
|
||||
__display_3d_mode Current3DMode;
|
||||
|
@ -341,7 +339,7 @@ typedef struct{
|
|||
|
||||
}DisplayInfo;
|
||||
|
||||
typedef struct{
|
||||
typedef struct{
|
||||
bool UsedFB;
|
||||
bool use_wb;
|
||||
bool fb_has_alpha;
|
||||
|
@ -356,7 +354,7 @@ typedef struct{
|
|||
unsigned char unasignedVideo;
|
||||
float WidthScaleFactor;
|
||||
float HighetScaleFactor;
|
||||
|
||||
|
||||
layer_info_t *psAllLayer;
|
||||
int malloc_layer;
|
||||
int numberofLayer;
|
||||
|
@ -374,7 +372,7 @@ typedef struct{
|
|||
/* end memory ctrl */
|
||||
}HwcDisContext_t;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
usually: display 1: LCD
|
||||
|
@ -411,7 +409,7 @@ typedef struct
|
|||
int memlimit;
|
||||
int max_mem_limit;
|
||||
|
||||
bool CanForceGPUCom;
|
||||
bool CanForceGPUCom;
|
||||
bool ForceGPUComp[NUMBEROFDISPLAY];
|
||||
bool stop_hwc;
|
||||
bool stop_rotate_hw;
|
||||
|
@ -419,9 +417,9 @@ typedef struct
|
|||
bool hot_plug;
|
||||
|
||||
int NumberofDisp;
|
||||
DisplayInfo *SunxiDisplay;// 0 is HWC_DISPLAY_PRIMARY,1 is HWC_DISPLAY_EXTERNAL,2 is HWC_DISPLAY_VIRTUAL
|
||||
DisplayInfo *SunxiDisplay;// 0 is HWC_DISPLAY_PRIMARY,1 is HWC_DISPLAY_EXTERNAL,2 is HWC_DISPLAY_VIRTUAL
|
||||
HwcDisContext_t *DisContext;//0 is the DE0, 1 is DE1,2 is HWC_DISPLAY_VIRTUAL
|
||||
|
||||
|
||||
list_head_t CommitHead;
|
||||
pthread_mutex_t HeadLock;
|
||||
|
||||
|
@ -462,11 +460,10 @@ typedef struct
|
|||
int fb_pre_mem;
|
||||
/* end mem limit */
|
||||
int unblank_flag;
|
||||
unsigned char has_secure;
|
||||
|
||||
}SUNXI_hwcdev_context_t;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
int type;// bit3:cvbs, bit2:ypbpr, bit1:vga, bit0:hdmi
|
||||
disp_tv_mode mode;
|
||||
|
@ -481,7 +478,7 @@ typedef enum
|
|||
WIDTH=2,
|
||||
HEIGHT,
|
||||
REFRESHRAE,
|
||||
|
||||
|
||||
}MODEINFO;
|
||||
|
||||
typedef enum{
|
||||
|
@ -542,7 +539,7 @@ inline void hwc_list_move(list_head_t *oldhead, list_head_t *newhead)
|
|||
|
||||
static inline bool check_video(int format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
||||
|
@ -550,7 +547,7 @@ static inline bool check_video(int format)
|
|||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline int check_usage_sw_read(struct private_handle_t *psHandle)
|
||||
|
@ -580,7 +577,7 @@ static inline bool cursor_flags(hwc_layer_1_t *layer)
|
|||
|
||||
static inline int check_cursor_format(int format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
|
@ -599,15 +596,13 @@ static inline bool check_cursor(hwc_layer_1_t *layer, int order, int count)
|
|||
|
||||
static inline int check_valid_format(int format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
//case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
//case HAL_PIXEL_FORMAT_sRGB_A_8888:
|
||||
//case HAL_PIXEL_FORMAT_sRGB_X_8888:
|
||||
case HAL_PIXEL_FORMAT_YV12:
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
|
@ -686,15 +681,13 @@ bool static inline check_3d_video(const DisplayInfo *PsDisplayInfo, hwc_layer_1_
|
|||
|
||||
static inline bool check_support_blending(int format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGB_888:
|
||||
case HAL_PIXEL_FORMAT_RGB_565:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
//case HAL_PIXEL_FORMAT_sRGB_A_8888:
|
||||
//case HAL_PIXEL_FORMAT_sRGB_X_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRX_8888:
|
||||
return 1;
|
||||
default:
|
||||
|
@ -751,11 +744,11 @@ static int inline cal_layer_mem(layer_info_t *hw_layer)
|
|||
{
|
||||
hwc_layer_1_t *psLayer = hw_layer->psLayer;
|
||||
#ifdef HWC_1_3
|
||||
return (psLayer->sourceCropf.right - psLayer->sourceCropf.left)
|
||||
* (psLayer->sourceCropf.bottom - psLayer->sourceCropf.top)
|
||||
return (psLayer->sourceCropf.right - psLayer->sourceCropf.left)
|
||||
* (psLayer->sourceCropf.bottom - psLayer->sourceCropf.top)
|
||||
* hw_layer->form_info.bpp / 8;
|
||||
#else
|
||||
return (psLayer->sourceCrop.right - psLayer->sourceCrop.left)
|
||||
return (psLayer->sourceCrop.right - psLayer->sourceCrop.left)
|
||||
* (psLayer->sourceCrop.bottom - psLayer->sourceCrop.top)
|
||||
* hw_layer->form_info.bpp / 8;
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,8 @@ typedef struct {
|
|||
ion_user_handle_t handle;
|
||||
unsigned int phys_addr;
|
||||
unsigned int size;
|
||||
}sunxi_phys_data;
|
||||
} sunxi_phys_data;
|
||||
|
||||
#define ION_IOC_SUNXI_PHYS_ADDR 7
|
||||
|
||||
ion_user_handle_t ion_alloc_buffer(int iAllocBytes, unsigned int heap_mask)
|
||||
|
|
|
@ -144,11 +144,6 @@ void hwc_down_limit(SUNXI_hwcdev_context_t *Globctx, int local_mem[NUMBEROFDISPL
|
|||
{
|
||||
HWC_UNREFERENCED_PARAMETER(local_mem);
|
||||
int i = 0, tmp_mem_thruput0 = 0;
|
||||
if(Globctx->has_secure != 0)
|
||||
{
|
||||
Globctx->memlimit = Globctx->max_mem_limit;
|
||||
return;
|
||||
}
|
||||
if(Globctx->ForceGPUComp[0] == 0 && Globctx->CanForceGPUCom && force_gpu)
|
||||
{
|
||||
if(Globctx->psHwcProcs != NULL
|
||||
|
|
|
@ -129,6 +129,8 @@ int _hwc_device_set_enhancemode(int disp, bool on_off, bool half)
|
|||
int _hwc_device_set_output_mode(int disp, int out_type, int out_mode)
|
||||
{
|
||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||
if(Globctx->SunxiDisplay[0].DisplayType == DISP_OUTPUT_TYPE_HDMI)
|
||||
disp = 0;
|
||||
DisplayInfo *PsDisplayInfo = &Globctx->SunxiDisplay[disp];
|
||||
int disp_t;
|
||||
|
||||
|
@ -147,6 +149,8 @@ int _hwc_set_persent(int disp,int para0, int para1)
|
|||
{
|
||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||
DisplayInfo *PsDisplayInfo = NULL;
|
||||
if(Globctx->SunxiDisplay[0].DisplayType == DISP_OUTPUT_TYPE_HDMI)
|
||||
disp = 0;
|
||||
|
||||
PsDisplayInfo = &Globctx->SunxiDisplay[disp];
|
||||
if(PsDisplayInfo->VirtualToHWDisplay != -1 && PsDisplayInfo->DisplayType == DISP_OUTPUT_TYPE_HDMI)
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
#include "hwc.h"
|
||||
|
||||
#define ION_HEAP_TYPE_SECURE (ION_HEAP_TYPE_CUSTOM+1)
|
||||
#define ION_HEAP_SECURE_MASK (1 << ION_HEAP_TYPE_SECURE)
|
||||
|
||||
int hwc_rotate_query(unsigned long tr_handle)
|
||||
{
|
||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||
|
@ -132,7 +129,7 @@ static rotate_cache_t *hwc_ratate_cache_manage(SUNXI_hwcdev_context_t *Globctx,
|
|||
return ratate_cache;
|
||||
}
|
||||
|
||||
static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int fd, unsigned int sync_count, bool is_secure)
|
||||
static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int fd, unsigned int sync_count)
|
||||
{
|
||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||
hwc_cache_t *tr_cache = NULL;
|
||||
|
@ -166,7 +163,7 @@ static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int
|
|||
close(tr_cache->fd);
|
||||
tr_cache->fd = -1;
|
||||
}
|
||||
if(tr_cache->share_fd >= 0 && size <= tr_cache->size_buffer && tr_cache->is_secure == is_secure)
|
||||
if(tr_cache->share_fd >= 0 && size <= tr_cache->size_buffer)
|
||||
{
|
||||
if(tr_cache->size_buffer - size > 4096)
|
||||
{
|
||||
|
@ -184,35 +181,22 @@ static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int
|
|||
}
|
||||
if(tr_cache->share_fd == -1 || tr_cache->size_buffer == 0)
|
||||
{
|
||||
if(is_secure){
|
||||
ret = ion_alloc_fd(Globctx->IonFd, size,
|
||||
4096, ION_HEAP_SECURE_MASK, 0, &tr_cache->share_fd);
|
||||
ret = ion_alloc_fd(Globctx->IonFd, size,
|
||||
4096, ION_HEAP_TYPE_DMA_MASK, 0, &tr_cache->share_fd);
|
||||
if(ret < 0)
|
||||
{
|
||||
ALOGD("alloc err from ION_HEAP_TYPE_DMA_MASK");
|
||||
ret = ion_alloc_fd(Globctx->IonFd, size,
|
||||
4096, ION_HEAP_SYSTEM_CONTIG_MASK, 0, &tr_cache->share_fd);
|
||||
if(ret < 0)
|
||||
{
|
||||
ALOGD("alloc err from ION_HEAP_SECURE_MASK");
|
||||
return NULL;
|
||||
ALOGD("alloc err from ION_HEAP_SYSTEM_CONTIG_MASK");
|
||||
tr_cache->share_fd = -1;
|
||||
tr_cache->size_buffer = 0;
|
||||
return NULL;
|
||||
}
|
||||
tr_cache->is_secure = 1;
|
||||
}else{
|
||||
ret = ion_alloc_fd(Globctx->IonFd, size,
|
||||
4096, ION_HEAP_TYPE_DMA_MASK, 0, &tr_cache->share_fd);
|
||||
if(ret < 0)
|
||||
{
|
||||
ALOGD("alloc err from ION_HEAP_TYPE_DMA_MASK");
|
||||
ret = ion_alloc_fd(Globctx->IonFd, size,
|
||||
4096, ION_HEAP_SYSTEM_CONTIG_MASK, 0, &tr_cache->share_fd);
|
||||
if(ret < 0)
|
||||
{
|
||||
ALOGD("alloc err from ION_HEAP_SYSTEM_CONTIG_MASK");
|
||||
tr_cache->share_fd = -1;
|
||||
tr_cache->size_buffer = 0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!is_secure){
|
||||
ion_sync_fd(Globctx->IonFd, tr_cache->share_fd);
|
||||
}
|
||||
}
|
||||
ion_sync_fd(Globctx->IonFd, tr_cache->share_fd);
|
||||
tr_cache->size_buffer = size;
|
||||
}
|
||||
tr_cache->sync_cnt = sync_count;
|
||||
|
@ -283,7 +267,7 @@ void hwc_rotate_cache_free(void)
|
|||
|
||||
static int inline hwc_disp_pixel_bytes(disp_pixel_format format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case DISP_FORMAT_YUV420_P:
|
||||
case DISP_FORMAT_YUV420_SP_VUVU:
|
||||
|
@ -301,13 +285,13 @@ static int inline hwc_disp_pixel_bytes(disp_pixel_format format)
|
|||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int hwc_disp_layer_plan(disp_pixel_format format)
|
||||
{
|
||||
switch(format)
|
||||
switch(format)
|
||||
{
|
||||
case DISP_FORMAT_YUV420_P:
|
||||
return 3;
|
||||
|
@ -324,7 +308,7 @@ static inline int hwc_disp_layer_plan(disp_pixel_format format)
|
|||
return 1;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline disp_pixel_format tr_to_disp(tr_pixel_format tr_format)
|
||||
|
@ -489,9 +473,9 @@ bool hwc_layer_to_tr(disp_fb_info* hw_layer, tr_info *tr_info, hwc_cache_t *tr_b
|
|||
/*tr_info->dst_frame.laddr[2] --> V*/
|
||||
if(cnt != 1)// is YUV Format
|
||||
{
|
||||
tr_info->dst_frame.laddr[2] = tr_info->dst_frame.laddr[0] +
|
||||
tr_info->dst_frame.laddr[2] = tr_info->dst_frame.laddr[0] +
|
||||
tr_info->dst_frame.pitch[0] * tr_info->dst_frame.height[0];
|
||||
tr_info->dst_frame.laddr[1] = tr_info->dst_frame.laddr[2] +
|
||||
tr_info->dst_frame.laddr[1] = tr_info->dst_frame.laddr[2] +
|
||||
tr_info->dst_frame.pitch[2] * tr_info->dst_frame.height[2];
|
||||
}
|
||||
return 1;
|
||||
|
@ -503,7 +487,7 @@ void hwc_resize_crop(disp_fb_info *hw_layer, int w_original, int h_original, tr_
|
|||
switch(mode)
|
||||
{
|
||||
case TR_HFLIP:
|
||||
w_diff = hw_layer->size[0].width - w_original;
|
||||
w_diff = hw_layer->size[0].width - w_original;
|
||||
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
|
||||
break;
|
||||
case TR_VFLIP:
|
||||
|
@ -511,7 +495,7 @@ void hwc_resize_crop(disp_fb_info *hw_layer, int w_original, int h_original, tr_
|
|||
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
|
||||
break;
|
||||
case TR_ROT_90:
|
||||
w_diff = hw_layer->size[0].width - h_original;
|
||||
w_diff = hw_layer->size[0].width - h_original;
|
||||
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
|
||||
h_diff = hw_layer->size[0].height - w_original;
|
||||
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
|
||||
|
@ -519,7 +503,7 @@ void hwc_resize_crop(disp_fb_info *hw_layer, int w_original, int h_original, tr_
|
|||
case TR_ROT_180:
|
||||
h_diff = hw_layer->size[0].height - h_original;
|
||||
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
|
||||
w_diff = hw_layer->size[0].width - w_original;
|
||||
w_diff = hw_layer->size[0].width - w_original;
|
||||
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
|
||||
break;
|
||||
case TR_ROT_270:
|
||||
|
@ -596,7 +580,7 @@ bool hwc_tr_to_layer(disp_fb_info *hw_layer, tr_info *tr_info, hwc_cache_t *tr_b
|
|||
hw_layer->addr[0] = addr;
|
||||
if(hw_layer->format == DISP_FORMAT_YUV420_P)
|
||||
{
|
||||
hw_layer->addr[2] = hw_layer->addr[0]
|
||||
hw_layer->addr[2] = hw_layer->addr[0]
|
||||
+ w_stride * h_stride ;
|
||||
hw_layer->addr[1] = hw_layer->addr[2]
|
||||
+ w_stride * h_stride / 4;
|
||||
|
@ -661,7 +645,7 @@ bool hwc_rotate_layer_tr(hwc_dispc_data_t *hwc_layer,
|
|||
goto translat_err;
|
||||
}
|
||||
tr_cache = hwc_tr_cache_get(rotate_cache, size,
|
||||
commit_data->releasefencefd[disp], hwc_layer->sync_count,commit_layer->is_secure);
|
||||
commit_data->releasefencefd[disp], hwc_layer->sync_count);
|
||||
if(tr_cache != NULL)
|
||||
{
|
||||
memset(&tr_info, 0, sizeof(tr_info));
|
||||
|
@ -736,5 +720,6 @@ translat_err:
|
|||
disp_layer->enable =0;
|
||||
ALOGE("######hwc get a rotate err#####");
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,6 @@ static bool reset_globle(SUNXI_hwcdev_context_t *Globctx,
|
|||
Globctx->currentmem = 0;
|
||||
Globctx->has_tr_mem = 0;
|
||||
Globctx->has_tr_cnt = 0;
|
||||
Globctx->has_secure = 0;
|
||||
int tmp_mem_thruput0 = 0;
|
||||
int all_mem_diff = 0, all_mem = 0, all_mem_fb = 0, ture_disp;
|
||||
for(i = 0; i < (int)NumofDisp && i < Globctx->NumberofDisp; i++)
|
||||
|
@ -925,6 +924,24 @@ static bool resize_layer(HwcDisContext_t *Localctx,
|
|||
layer_info->fb.crop.y = fb_crop->top + ((cut_top == 1) ? cut_mod:0);
|
||||
layer_info->fb.crop.height = srcdiff - cut_mod;
|
||||
}
|
||||
|
||||
#if defined(HWC_DEBUG)
|
||||
ALOGD("\nold:\n[%f,%f]#S[%lld,%lld,%lld,%lld] F[%lld,%lld,%lld,%lld]\n",
|
||||
Localctx->WidthScaleFactor, Localctx->HighetScaleFactor,
|
||||
layer_info->fb.crop.x, layer_info->fb.crop.y, layer_info->fb.crop.width,
|
||||
layer_info->fb.crop.height, layer_info->screen_win.x, layer_info->screen_win.y,
|
||||
layer_info->screen_win.width, layer_info->screen_win.height);
|
||||
#endif
|
||||
|
||||
if(gSunxiHwcDevice.SunxiDisplay[0].DisplayType == DISP_OUTPUT_TYPE_HDMI) {
|
||||
layer_info->fb.crop.x = (long long)(((long long)(psLayer->sourceCrop.left)) << 32);
|
||||
layer_info->fb.crop.width = (long long)(((long long)(psLayer->sourceCrop.right)) << 32);
|
||||
layer_info->fb.crop.width -= layer_info->fb.crop.x;
|
||||
layer_info->fb.crop.y = (long long)(((long long)(psLayer->sourceCrop.top)) << 32);
|
||||
layer_info->fb.crop.height = (long long)(((long long)(psLayer->sourceCrop.bottom)) << 32);
|
||||
layer_info->fb.crop.height -= layer_info->fb.crop.y;
|
||||
}
|
||||
|
||||
if(layer_info->b_trd_out == 1)
|
||||
{
|
||||
switch(PsDisplayInfo->Current3DMode)
|
||||
|
@ -1028,7 +1045,7 @@ ret_ok:
|
|||
HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout, int zOrder)
|
||||
{
|
||||
|
||||
bool needchannel = 1, isvideo = 0, isalpha = 0, isFB = 0, has_tr = 0, issecure = 0;
|
||||
bool needchannel = 1, isvideo = 0, isalpha = 0, isFB = 0, has_tr = 0;
|
||||
bool is3D = 0, need_sync = 0, is_cursor = 0;
|
||||
float WscalFac = 1.0, HscaleFac = 1.0;
|
||||
int CH= -1, tmCnt1 = 0, tmCnt2 = 0, addLayerCnt = 1;
|
||||
|
@ -1078,16 +1095,11 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
|||
goto assign_gpu;
|
||||
}
|
||||
|
||||
if(check_usage_protected(handle))
|
||||
if(check_usage_protected(handle) && !PsDisplayInfo->issecure)
|
||||
{
|
||||
if(!PsDisplayInfo->issecure)
|
||||
{
|
||||
ALOGV("%s:Video Protected", __func__);
|
||||
dueto = D_VIDEO_PD;
|
||||
goto assign_gpu;
|
||||
}else{
|
||||
issecure = 1;
|
||||
}
|
||||
ALOGV("%s:Video Protected", __func__);
|
||||
dueto = D_VIDEO_PD;
|
||||
goto assign_gpu;
|
||||
}
|
||||
|
||||
dueto = check_valid_layer(psLayer);
|
||||
|
@ -1227,7 +1239,7 @@ needchannel:
|
|||
}
|
||||
}
|
||||
/*check the mem thruput*/
|
||||
if(!is_cursor && (Globctx->has_secure == 0))
|
||||
if(!is_cursor)
|
||||
{
|
||||
dueto = calculate_memthruput(Localctx, &Localctx->psAllLayer[singcout],
|
||||
WscalFac, HscaleFac, Localctx->HwCHUsedCnt - CHdiff, isFB, isvideo);
|
||||
|
@ -1262,7 +1274,7 @@ needchannel:
|
|||
if(!Localctx->force_gpu
|
||||
&& (Localctx->UsedFB? isFB: ((int)singcout == Localctx->numberofLayer - 2)))
|
||||
{
|
||||
if(mem_ctrl_power_policy(Globctx, Localctx) && (Globctx->has_secure == 0))
|
||||
if(mem_ctrl_power_policy(Globctx, Localctx))
|
||||
{
|
||||
Localctx->force_gpu = 1;
|
||||
goto assigned_need_resigne;
|
||||
|
@ -1281,7 +1293,6 @@ assign_overlay:
|
|||
Globctx->has_tr_cnt += has_tr;
|
||||
Localctx->tr_mem += has_tr ? (handle->width * handle->height) : 0;
|
||||
Globctx->has_tr_mem += has_tr ? (handle->width * handle->height) : 0;
|
||||
Globctx->has_secure += issecure;
|
||||
|
||||
psCH[Localctx->HwCHUsedCnt - CHdiff].hasVideo = isvideo;
|
||||
psCH[Localctx->HwCHUsedCnt - CHdiff].iCHFormat =
|
||||
|
@ -1304,9 +1315,8 @@ assign_overlay:
|
|||
Localctx->psAllLayer[singcout].is3D = is3D;
|
||||
Localctx->psAllLayer[singcout].info = dueto;
|
||||
Localctx->psAllLayer[singcout].isvideo = isvideo;
|
||||
Localctx->psAllLayer[singcout].need_sync = issecure?0:need_sync;
|
||||
Localctx->psAllLayer[singcout].need_sync = need_sync;
|
||||
Localctx->psAllLayer[singcout].is_cursor = is_cursor;
|
||||
Localctx->psAllLayer[singcout].is_secure = issecure;
|
||||
if(is_cursor)
|
||||
{
|
||||
return ASSIGN_CURSOR;
|
||||
|
@ -1350,6 +1360,7 @@ int hwc_setup_layer(hwc_dispc_data_t *DisplayData, HwcDisContext_t *Localctx)
|
|||
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
|
||||
ChannelInfo_t *psChannelInfo = Localctx->ChannelInfo;
|
||||
struct private_handle_t *handle = NULL;
|
||||
bool enableLayer = !(PsDisplayInfo->setblank);
|
||||
|
||||
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
|
||||
if(ture_disp < 0 || ture_disp >= NUMBEROFDISPLAY)
|
||||
|
@ -1402,7 +1413,6 @@ int hwc_setup_layer(hwc_dispc_data_t *DisplayData, HwcDisContext_t *Localctx)
|
|||
}
|
||||
hw_layer_config->needsync = psHwlayer_info->need_sync;
|
||||
hw_layer_config->share_fd = dup(psHwlayer_info->shared_fd);
|
||||
hw_layer_config->is_secure = psHwlayer_info->is_secure;
|
||||
if(check_is_blending(psLayer))
|
||||
{
|
||||
layer_info->alpha_mode = 2;
|
||||
|
@ -1420,7 +1430,7 @@ int hwc_setup_layer(hwc_dispc_data_t *DisplayData, HwcDisContext_t *Localctx)
|
|||
layer_info->zorder = zOrder;
|
||||
layer_info->alpha_value = psChannelInfo[CHCnt].planeAlpha;
|
||||
|
||||
psDisconfig->enable = 1;
|
||||
psDisconfig->enable = enableLayer;
|
||||
psDisconfig->layer_id = LCnt;
|
||||
psDisconfig->channel = psChannelInfo[CHCnt].hasVideo ? VideoCnt : UiCnt;
|
||||
psHwlayer_info->hwchannel = psDisconfig->channel;
|
||||
|
@ -2023,10 +2033,11 @@ SUNXI_hwcdev_context_t* hwc_create_device(void)
|
|||
&& Globctx->SunxiDisplay[1].VirtualToHWDisplay == -EINVAL)
|
||||
{
|
||||
hwc_hotplug_switch(1, 1, DISP_TV_MODE_NUM);
|
||||
ALOGD("### init hdmi_plug: IN ###");
|
||||
}
|
||||
ALOGD("### init hdmi_plug: IN ###");
|
||||
}else{
|
||||
ALOGD("### init hdmi_plug: OUT ###");
|
||||
if(Globctx->SunxiDisplay[0].DisplayType != DISP_OUTPUT_TYPE_HDMI)
|
||||
ALOGD("### init hdmi_plug: OUT ###");
|
||||
}
|
||||
close(open_fd);
|
||||
}else{
|
||||
|
@ -2108,8 +2119,7 @@ SUNXI_hwcdev_context_t* hwc_create_device(void)
|
|||
Globctx->layer_st = -1;
|
||||
Globctx->fBeginTime = 0.0;
|
||||
Globctx->uiBeginFrame = 0;
|
||||
Globctx->unblank_flag = 0;
|
||||
Globctx->has_secure = 0;
|
||||
Globctx->unblank_flag = 0;
|
||||
|
||||
hwc_list_init(&Globctx->rotate_cache_list);
|
||||
Globctx->rotate_hold_cnt = 0;
|
||||
|
|
|
@ -146,12 +146,12 @@ int hwc_manage_display(DisplayInfo **retDisplayInfo, int DispInfo, ManageDisp mo
|
|||
|
||||
disp_tv_mode get_suitable_hdmi_mode(int select, disp_tv_mode lastmode)
|
||||
{
|
||||
ALOGI("get_suitable_hdmi_mode select=%d lastmode=%d", select, lastmode);
|
||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||
unsigned long arg[4]={0};
|
||||
arg[0] = select;
|
||||
int ret, i, j = -1;
|
||||
disp_tv_mode theMostMode = DISP_TV_MODE_NUM;
|
||||
struct disp_output para;
|
||||
i = sizeof(g_tv_para) / sizeof(g_tv_para[0]);
|
||||
if(lastmode < DISP_TV_MODE_NUM)
|
||||
{
|
||||
|
@ -164,38 +164,41 @@ disp_tv_mode get_suitable_hdmi_mode(int select, disp_tv_mode lastmode)
|
|||
}
|
||||
}
|
||||
|
||||
theMostMode = DISP_TV_MOD_1080P_60HZ;
|
||||
arg[1] = DISP_OUTPUT_TYPE_HDMI;
|
||||
arg[2] = theMostMode;
|
||||
ret = ioctl(Globctx->DisplayFd, DISP_DEVICE_SWITCH, arg);
|
||||
|
||||
return theMostMode;
|
||||
|
||||
while(i > 0)
|
||||
{
|
||||
i--;
|
||||
if(g_tv_para[i].mode == DISP_TV_MOD_1080P_60HZ)
|
||||
{
|
||||
j = i;
|
||||
}
|
||||
if(j != -1)
|
||||
{
|
||||
arg[1] = DISP_OUTPUT_TYPE_HDMI;
|
||||
arg[2] = g_tv_para[i].mode;
|
||||
ret = ioctl(Globctx->DisplayFd, DISP_DEVICE_SWITCH, arg);
|
||||
if(ret >= 0)
|
||||
if(Globctx->SunxiDisplay[0].DisplayType == DISP_OUTPUT_TYPE_HDMI)
|
||||
{
|
||||
arg[1] = (unsigned long)¶
|
||||
ret = ioctl(Globctx->DisplayFd, DISP_GET_OUTPUT, arg);
|
||||
if(ret >= 0)
|
||||
{
|
||||
theMostMode = (disp_tv_mode)para.mode;
|
||||
}
|
||||
}else{
|
||||
while(i > 0)
|
||||
{
|
||||
i--;
|
||||
if(g_tv_para[i].mode == DISP_TV_MOD_1080P_60HZ)
|
||||
{
|
||||
if(theMostMode == DISP_TV_MODE_NUM)
|
||||
{
|
||||
g_tv_para[sizeof(g_tv_para) / sizeof(g_tv_para[0])-1].support = 1<<select;
|
||||
theMostMode = g_tv_para[i].mode;
|
||||
}
|
||||
g_tv_para[i].support |= 1<<select;
|
||||
}else{
|
||||
g_tv_para[i].support &= ~(1<<select);
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(j != -1)
|
||||
{
|
||||
arg[1] = DISP_OUTPUT_TYPE_HDMI;
|
||||
arg[2] = g_tv_para[i].mode;
|
||||
ret = ioctl(Globctx->DisplayFd, DISP_DEVICE_SWITCH, arg);
|
||||
if(ret >= 0)
|
||||
{
|
||||
if(theMostMode == DISP_TV_MODE_NUM)
|
||||
{
|
||||
g_tv_para[sizeof(g_tv_para) / sizeof(g_tv_para[0])-1].support = 1<<select;
|
||||
theMostMode = g_tv_para[i].mode;
|
||||
}
|
||||
g_tv_para[i].support |= 1<<select;
|
||||
}else{
|
||||
g_tv_para[i].support &= ~(1<<select);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(theMostMode != DISP_TV_MODE_NUM)
|
||||
{
|
||||
return theMostMode;
|
||||
|
@ -210,8 +213,6 @@ int hwc_hotplug_switch(int DisplayNum, bool plug, disp_tv_mode set_mode)
|
|||
int vir_disp = -1;
|
||||
DisplayInfo *PsDisplayInfo = NULL;
|
||||
|
||||
ALOGE("hwc_hotplug_switch: displayNum=%d plug=%d set_mode=%d", DisplayNum, plug, set_mode);
|
||||
|
||||
unsigned long arg[4] = {0};
|
||||
bool AllreadyPlugin = 0;
|
||||
vir_disp = hwc_manage_display(&PsDisplayInfo, DisplayNum, FIND_HWDISPNUM);
|
||||
|
@ -234,6 +235,7 @@ int hwc_hotplug_switch(int DisplayNum, bool plug, disp_tv_mode set_mode)
|
|||
}
|
||||
if(set_mode != DISP_TV_MODE_NUM)
|
||||
{
|
||||
PsDisplayInfo->setblank = 1;
|
||||
PsDisplayInfo->VarDisplayWidth = get_info_mode(set_mode,WIDTH);
|
||||
PsDisplayInfo->VarDisplayHeight = get_info_mode(set_mode,HEIGHT);
|
||||
PsDisplayInfo->DisplayType = DISP_OUTPUT_TYPE_HDMI;
|
||||
|
@ -250,11 +252,16 @@ int hwc_hotplug_switch(int DisplayNum, bool plug, disp_tv_mode set_mode)
|
|||
PsDisplayInfo->InitDisplayWidth = PsDisplayInfo->VarDisplayWidth;
|
||||
}
|
||||
Globctx->memlimit += PsDisplayInfo->InitDisplayHeight * PsDisplayInfo->InitDisplayWidth * 4;
|
||||
Globctx->hot_plug = 1;
|
||||
if(Globctx->SunxiDisplay[0].DisplayType != DISP_OUTPUT_TYPE_HDMI)
|
||||
{
|
||||
Globctx->hot_plug = 1;
|
||||
}
|
||||
arg[0] = DisplayNum;
|
||||
arg[1] = DISP_OUTPUT_TYPE_HDMI;
|
||||
arg[2] = set_mode;
|
||||
ioctl(Globctx->DisplayFd, DISP_DEVICE_SWITCH, (unsigned long)arg);
|
||||
PsDisplayInfo->setblank = 0;
|
||||
Globctx->psHwcProcs->invalidate(Globctx->psHwcProcs);
|
||||
arg[0] = DisplayNum;
|
||||
arg[1] = 1;
|
||||
ioctl(Globctx->DisplayFd, DISP_VSYNC_EVENT_EN,(unsigned long)arg);
|
||||
|
@ -266,7 +273,8 @@ int hwc_hotplug_switch(int DisplayNum, bool plug, disp_tv_mode set_mode)
|
|||
ALOGD( "###hdmi plug in, Type:%d, Mode:0x%08x###",
|
||||
PsDisplayInfo->DisplayType, PsDisplayInfo->DisplayMode);
|
||||
|
||||
}else{
|
||||
}
|
||||
else if(Globctx->SunxiDisplay[0].DisplayType != DISP_OUTPUT_TYPE_HDMI){
|
||||
Globctx->hot_plug = 0;
|
||||
hwc_manage_display(NULL, DisplayNum ,FREE_DISP);
|
||||
}
|
||||
|
@ -281,7 +289,7 @@ int hwc_hotplug_switch(int DisplayNum, bool plug, disp_tv_mode set_mode)
|
|||
}else{
|
||||
ALOGD("###psHwcProcs No register.###");
|
||||
}
|
||||
if(!plug)
|
||||
if(!plug && Globctx->SunxiDisplay[0].DisplayType != DISP_OUTPUT_TYPE_HDMI)
|
||||
{
|
||||
arg[0] = DisplayNum;
|
||||
arg[1] = DISP_OUTPUT_TYPE_NONE;
|
||||
|
@ -416,7 +424,7 @@ static int hwc_uevent(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(IsHdmi)
|
||||
if(IsHdmi && Globctx->SunxiDisplay[0].DisplayType != DISP_OUTPUT_TYPE_HDMI)
|
||||
{
|
||||
while(s)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue