⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcc_display.c

📁 dcc code for smp 8634 media processor
💻 C
📖 第 1 页 / 共 5 页
字号:
	case EMhwlibHDSDConversionMode_OnTheFly:		err = RUAExchangeProperty(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_OnTheFlyModeParameters, 					  &fly_params_in, sizeof(fly_params_in), &(fly_params_out), sizeof(fly_params_out));		if(RMFAILED(err)){			RMDBGLOG((ENABLE, "Incompatible formats for on-the-fly conversion\n"));			return RM_ERROR;		}		RMDBGLOG((ENABLE, "=================ON THE FLY MODE====================\n", buffer_params_out.BufferSize));		RMDBGLOG((ENABLE, "dumped lines %ld, delay %ld\n", fly_params_out.DumpedLines, fly_params_out.DelayLines, fly_params_out.DelayPixels));		dumped_lines = fly_params_out.DumpedLines;		reset_master.ResetSourceID = sd_outport_id;		reset_master.DelayLines = fly_params_out.DelayLines;		reset_master.DelayPixels = fly_params_out.DelayPixels;		break;	case EMhwlibHDSDConversionMode_Buffered:		RUAExchangeProperty(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_BufferedModeParameters, 				    &buffer_params_in, sizeof(buffer_params_in), &(buffer_params_out), sizeof(buffer_params_out));		RMDBGLOG((ENABLE, "=================BUFFERED MODE====================\n", buffer_params_out.BufferSize));		RMDBGLOG((ENABLE, "buffer is %ld bytes long\n", buffer_params_out.BufferSize));		hdsd_open.BufferSize = buffer_params_out.BufferSize;		hdsd_open.BufferAddress = pDCC->rua_malloc(pDCC->pRUA, DisplayBlock, pDCC->dram, RUA_DRAM_UNCACHED, buffer_params_out.BufferSize);		DCCSP(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_Open, &hdsd_open, sizeof(hdsd_open));		dumped_lines = 0;		reset_master.ResetSourceID = hd_outport_id;		reset_master.DelayLines = 0;		reset_master.DelayPixels = 0;		break;	}	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_TimingResetMaster, &reset_master, sizeof(reset_master));	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_AddSlaveOutput, &hdslave_outport_id, sizeof(hdslave_outport_id));	DCCSP(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_ConversionMode, &hdsd_mode, sizeof(hdsd_mode));	DCCSP(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_DumpedLines, &dumped_lines, sizeof(dumped_lines));	DCCSP(pDCC->pRUA, DispHDSDConverter, RMGenericPropertyID_Validate, NULL, 0);	enable = TRUE;	DCCSP(pDCC->pRUA, DispHDSDConverter, RMGenericPropertyID_Enable, &enable, sizeof(enable));	DCCSP(pDCC->pRUA, sd_outport_id, RMGenericPropertyID_SyncSourceModuleID, &sd_outport_id, sizeof(sd_outport_id));	DCCSP(pDCC->pRUA, sd_outport_id, RMGenericPropertyID_TVStandard, &sd_standard, sizeof(sd_standard));	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_SyncSourceModuleID, &hd_outport_id, sizeof(hd_outport_id));	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_TVStandard, &hd_standard, sizeof(hd_standard));	{		RMbool DoubleRate = DCCGetDoubleRate(hd_standard);		RMDBGLOG((LOCALDBG, "Applying DoubleRate(%s)\n", DoubleRate ? "TRUE" : "FALSE"));		DCCSP(pDCC->pRUA, DispDigitalOut, RMDispDigitalOutPropertyID_DoubleRate, &DoubleRate, sizeof(DoubleRate));	}	DCCSP(pDCC->pRUA, hdslave_outport_id, RMGenericPropertyID_SyncSourceModuleID, &hd_outport_id, sizeof(hd_outport_id));	DCCSP(pDCC->pRUA, hdslave_outport_id, RMGenericPropertyID_TVStandard, &hd_standard, sizeof(hd_standard));	DCCSP(pDCC->pRUA, sd_outport_id, RMGenericPropertyID_Validate, NULL, 0);	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_Validate, NULL, 0);	DCCSP(pDCC->pRUA, hdslave_outport_id, RMGenericPropertyID_Validate, NULL, 0);	enable = TRUE;	DCCSP(pDCC->pRUA, sd_outport_id, RMGenericPropertyID_Enable, &enable, sizeof(enable));	DCCSP(pDCC->pRUA, hdslave_outport_id, RMGenericPropertyID_Enable, &enable, sizeof(enable));	DCCSP(pDCC->pRUA, hd_outport_id, RMGenericPropertyID_Enable, &enable, sizeof(enable));#endif#endif  // RMFEATURE_HAS_HDSD_CONVERTER		return RM_OK;}#define slaving_mode_same_timing     0x01#define	slaving_mode_same_route      0x02#define	slaving_mode_hdsd_on_the_fly 0x04#define	slaving_mode_hdsd_buffered  0x08#define slaving_mode_non_compatible  0x10/* deprecated */struct slaving_info{	struct outport_info *master;	RMuint32 mode;	RMuint32 dumped_lines;	RMuint32 delay_lines;	RMuint32 delay_pixels;	RMuint32 hd_slave;};struct compatibility_info{	RMuint32 mode;	RMuint32 dumped_lines;	RMuint32 delay_lines;	RMuint32 delay_pixels;	RMbool hd_slave;};struct outport_info{	struct DCCOutportConfig *config;	struct DCCOutportConfig old_config;	RMuint32 module_id;	RMuint32 route_id;	RMuint32 clean_divider;	struct slaving_info slaving;	RMbool disabled;};/* FIXME this is here because get_slaves from an outport returns a vsync bitmask!  */#define	dcc_OUTPUT_PORT_DIGITAL (1 << 0)#define	dcc_OUTPUT_PORT_MAIN_ANALOG (1 << 1)#define	dcc_OUTPUT_PORT_COMPONENT (1 << 2)#define GET_OUTPORT_NAME(x) ((x==DispDigitalOut)?"digital":((x==DispComponentOut)?"component":((x==DispMainAnalogOut)?"analog":"unknown")))#define GET_ROUTE_NAME(x) ((x==DCCRoute_Main)?"main":((x==DCCRoute_Secondary)?"secondary":((x==DCCRoute_ColorBars)?"colorbars":"unknown")))static RMstatus disable_outports_in_route(struct DCC *pDCC, struct outport_info *outports, enum DCCRoute route){	struct RUAEvent evt;	RMuint32 j, i;	RMstatus err;	RMbool enable;	RMuint32 disable_count = 0, disable_array[RMFEATURE_OUTPORT_COUNT];	RMDBGLOG((OUTPORTDBG, "Disabling route %s\n", GET_ROUTE_NAME(route)));	evt.ModuleID = EMHWLIB_MODULE(DisplayBlock, 0);	for (j = 0; j< RMFEATURE_OUTPORT_COUNT; j++){		for (i = 0; i< RMFEATURE_OUTPORT_COUNT; i++){			RMuint32 slaves;						if (outports[i].disabled) {				RMDBGLOG((OUTPORTDBG, "outport %s already disabled\n", GET_OUTPORT_NAME(outports[i].module_id)));				continue;			}						if (outports[i].old_config.route != route) {				RMDBGLOG((OUTPORTDBG, "outport %s had different route %s\n", GET_OUTPORT_NAME(outports[i].module_id), GET_ROUTE_NAME(outports[i].old_config.route)));				continue;			}						err = RUAGetProperty(pDCC->pRUA, outports[i].module_id, RMGenericPropertyID_SlaveOutput, &slaves, sizeof(slaves));			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot get slaves from outport %s\n", GET_OUTPORT_NAME(outports[i].module_id)));				return err;			}			if ((slaves & dcc_OUTPUT_PORT_DIGITAL) && (!outports[0].disabled)) {				RMDBGLOG((OUTPORTDBG, "disable slave %s first\n", GET_OUTPORT_NAME(outports[0].module_id)));				continue;			}						if ((slaves & dcc_OUTPUT_PORT_COMPONENT) && (!outports[1].disabled)) {				RMDBGLOG((OUTPORTDBG, "disable slave %s first\n", GET_OUTPORT_NAME(outports[1].module_id)));				continue;			}						if ((slaves & dcc_OUTPUT_PORT_MAIN_ANALOG)&& (!outports[2].disabled)) {				RMDBGLOG((OUTPORTDBG, "disable slave %s first\n", GET_OUTPORT_NAME(outports[2].module_id)));				continue;			}						RMDBGLOG((OUTPORTDBG, "Disabling %s\n", GET_OUTPORT_NAME(outports[i].module_id)));						enable = FALSE;			DCCSP(pDCC->pRUA, outports[i].module_id, RMGenericPropertyID_Enable, &enable, sizeof(enable));			outports[i].disabled = TRUE;			disable_array[disable_count] = outports[i].module_id;			disable_count++;		}	}	for (i=0 ; i<disable_count ; i++) {		while (1) {			err = RUAGetProperty(pDCC->pRUA, disable_array[i], RMGenericPropertyID_Enable, &enable, sizeof(enable));			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "Cannot get enable state from outport %s\n", GET_OUTPORT_NAME(disable_array[i])));				return err;			}			if (!enable)				break;						evt.Mask = EMHWLIB_DISPLAY_EVENT_ID(disable_array[i]);			err = RUAWaitForMultipleEvents(pDCC->pRUA, &evt, 1, 400000, &j);			if (err == RM_ERROR) {				RMDBGLOG((ENABLE, "Cannot wait for event\n"));				return err;			}		} 	}		for (i = 0; i< disable_count ; i++){		unbind_outport(pDCC, disable_array[i]);	}#ifdef WITH_NEW_VCXO	{		RMuint32 vcxo_module_id;				/* connect the outport clock to the route VCXO */		if (DCCGetRouteVCXO(route, &vcxo_module_id) == RM_OK) {			for (i = 0; i< disable_count ; i++){				DCCSP(pDCC->pRUA, vcxo_module_id, RMVCXOPropertyID_DisconnectClock, &(outports[i].module_id), sizeof(outports[i].module_id));			}		}	}#endif	return RM_OK;}static RMstatus format_compatibility(struct DCC *pDCC,				      struct outport_info *out1,				      struct outport_info *out2,				      struct compatibility_info *slaving,				      RMuint32 allowed_modes){	RMuint32 pixel_clock_1 = 0, active_width_1 = 0, total_width_1 = 0, active_height_1 = 0, total_height_1 = 0, y_offset_top_1 = 0, x_offset_1 = 0;	RMuint32 pixel_clock_2 = 0, active_width_2 = 0, total_width_2 = 0, active_height_2 = 0, total_height_2 = 0, y_offset_top_2 = 0, x_offset_2 = 0;	RMbool found_couple = FALSE;	RMuint32 mode = 0;	RMuint32 dumped_lines = 0;	RMuint32 delay_lines = 0;	RMuint32 delay_pixels = 0;	RMbool hd_slave = FALSE;		switch(out1->config->format.Type){	case EMhwlibTVFormatType_Analog:		pixel_clock_1 = out1->config->format.Format.Analog.PixelClock;		active_width_1 = out1->config->format.Format.Analog.ActiveWidth;		total_width_1 = out1->config->format.Format.Analog.Width;		active_height_1 = out1->config->format.Format.Analog.ActiveHeight;		total_height_1 = out1->config->format.Format.Analog.Height;		y_offset_top_1 = out1->config->format.Format.Analog.YOffsetTop;		x_offset_1 = out1->config->format.Format.Analog.XOffset;		if(!out1->config->format.Format.Analog.HDTVMode){			pixel_clock_1 /= 4;			total_width_1 /= 4;			x_offset_1 /= 4;		}		break;	case EMhwlibTVFormatType_Digital:		pixel_clock_1 =out1->config->format.Format.Digital.PixelClock;		active_width_1 = out1->config->format.Format.Digital.ActiveWidth;		total_width_1 =out1->config->format.Format.Digital.HTotalSize;		active_height_1 =out1->config->format.Format.Digital.ActiveHeight;		total_height_1 =out1->config->format.Format.Digital.VTotalSize;		y_offset_top_1 =out1->config->format.Format.Digital.YOffsetTop;		x_offset_1 = out1->config->format.Format.Digital.XOffset;		if(out1->config->format.Format.Digital.DoubleRateMode){#ifndef RMFEATURE_HAS_DOUBLE_RATE			active_width_1 *= 2;#endif			pixel_clock_1 *= 2;			total_width_1 *= 2;			x_offset_1 *= 2;		}		break;	}	switch(out2->config->format.Type){	case EMhwlibTVFormatType_Analog:		pixel_clock_2 = out2->config->format.Format.Analog.PixelClock;		active_width_2 = out2->config->format.Format.Analog.ActiveWidth;		total_width_2 = out2->config->format.Format.Analog.Width;		active_height_2 = out2->config->format.Format.Analog.ActiveHeight;		total_height_2 = out2->config->format.Format.Analog.Height;		y_offset_top_2 = out2->config->format.Format.Analog.YOffsetTop;		x_offset_2 = out2->config->format.Format.Analog.XOffset;		if(!out2->config->format.Format.Analog.HDTVMode){			pixel_clock_2 /= 4;			total_width_2 /= 4;			x_offset_2 /= 4;		}		break;	case EMhwlibTVFormatType_Digital:		pixel_clock_2 = out2->config->format.Format.Digital.PixelClock;		active_width_2 = out2->config->format.Format.Digital.ActiveWidth;		total_width_2 = out2->config->format.Format.Digital.HTotalSize;		active_height_2 = out2->config->format.Format.Digital.ActiveHeight;		total_height_2 = out2->config->format.Format.Digital.VTotalSize;		y_offset_top_2 = out2->config->format.Format.Digital.YOffsetTop;		x_offset_2 = out2->config->format.Format.Digital.XOffset;		if(out2->config->format.Format.Digital.DoubleRateMode){#ifndef RMFEATURE_HAS_DOUBLE_RATE			active_width_2 *= 2;#endif			pixel_clock_2 *= 2;			total_width_2 *= 2;			x_offset_2 *= 2;		}		break;	}		RMDBGLOG((DISABLE, "height %ld vs %ld\n", total_height_1, total_height_2));	RMDBGLOG((DISABLE, "width %ld vs %ld\n", total_width_1, total_width_2));	RMDBGLOG((DISABLE, "active height %ld vs %ld\n", active_height_1, active_height_2));	RMDBGLOG((DISABLE, "y offset %ld vs %ld\n", y_offset_top_1, y_offset_top_2));	RMDBGLOG((DISABLE, "pixel clock %ld vs %ld\n", pixel_clock_1, pixel_clock_2));	if ((out1->config->flags & DCC_OUTPORT_FLAG_CONSTRAINED) || (out2->config->flags & DCC_OUTPORT_FLAG_CONSTRAINED)) {		if (allowed_modes & slaving_mode_hdsd_buffered) {			mode = slaving_mode_hdsd_buffered;			found_couple = TRUE;			RMDBGLOG((OUTPORTDBG, "I need to slave %s to %s on \"buffered\" mode\n", GET_OUTPORT_NAME(out2->module_id), GET_OUTPORT_NAME(out1->module_id)));		}		else {			slaving->mode = slaving_mode_non_compatible;			return RM_ERROR;		}	}				if((!found_couple)&&	   (total_height_1 == total_height_2) &&	   (active_height_1 == active_height_2) &&	   (active_width_1 == active_width_2) &&	   (y_offset_top_1 == y_offset_top_2) &&	   /* this is to allow modes with double rate to pass the test */	   ((RMuint64)(total_width_1 * pixel_clock_2) == (RMuint64)(total_width_2 * pixel_clock_1))){		/* this is what we require for two outports consuming from the same route */		if((allowed_modes & slaving_mode_same_timing)&&		   (x_offset_1 == x_offset_2) &&		   (total_width_1 == total_width_2) &&		   (pixel_clock_1 == pixel_clock_2)){			/* this is what we requite for two outports sharing the sime timing signals */			mode = slaving_mode_same_timing;			RMDBGLOG((OUTPORTDBG, "I can slave %s to %s on \"same timing\"\n", GET_OUTPORT_NAME(out2->module_id), GET_OUTPORT_NAME(out1->module_id)));			found_couple = TRUE;		}		else if (allowed_modes & slaving_mode_same_route){			mode = slaving_mode_same_route;			found_couple = TRUE;			RMDBGLOG((OUTPORTDBG, "I can slave %s to %s on \"same route\"\n", GET_OUTPORT_NAME(out2->module_id), GET_OUTPORT_NAME(out1->module_id)));		}	}	/* see if we can do on-the-fly */	if((!found_couple) && (allowed_modes & slaving_mode_hdsd_on_the_fly)){		struct DispHDSDConverter_OnTheFlyModeParametersX_in_type fly_params_in;		struct DispHDSDConverter_OnTheFlyModeParametersX_out_type fly_params_out;		RMstatus err;		RMbool require_hd_first = FALSE;		/* if the master is reset-dependent of another outport, we cannot do on-the-fly */		if(active_height_1 >= active_height_2){			fly_params_in.HDFormat = out1->config->format;			fly_params_in.SDFormat = out2->config->format;		}		else{			fly_params_in.SDFormat = out1->config->format;			fly_params_in.HDFormat = out2->config->format;			require_hd_first = TRUE;		}					err = RUAExchangeProperty(pDCC->pRUA, DispHDSDConverter, RMDispHDSDConverterPropertyID_OnTheFlyModeParametersX, 			

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -