Beispiel #1
0
/**
*	@fn		PACSurf::PACSurf
*	@brief	try to allocate memory region that is physically linear
*	@param	GPESurf **ppSurf, INT width, INT height, EGPEFormat format, int surfaceFlags
*	@sa		GPESurf
*	@note	This Surface format is compatible to GPESurf
**/
PACSurf::PACSurf(int width, int height, EGPEFormat format)
{
	RETAILMSG(DBGLCD, (_T("\n[DISPDRV] PACSurf Constructor(%d, %d, %d)"), width, height, format));	

    // Even though "width" and "height" are int's, they must be positive.
    ASSERT(width > 0);
    ASSERT(height > 0);

    memset( &m_Format, 0, sizeof ( m_Format ) );

    m_pVirtAddr            = NULL;
    m_nStrideBytes         = 0;
    m_eFormat              = gpeUndefined;
    m_fInVideoMemory       = 0;
    m_fOwnsBuffer          = 0;
    m_nWidth               = 0;
    m_nHeight              = 0;
    m_nOffsetInVideoMemory = 0;
    m_iRotate              = DMDO_0;
    m_ScreenWidth          = 0;
    m_ScreenHeight         = 0;
    m_BytesPixel           = 0;
    m_nHandle              = NULL;
    m_fPLAllocated		= 0;

    if (width > 0 && height > 0)
    {
		m_nWidth               = width;
		m_nHeight              = height;
		m_eFormat              = format;
		m_nStrideBytes         = ( (EGPEFormatToBpp[ format ] * width + 7 )/ 8 + 3 ) & ~3L;
		m_pVirtAddr  = (ADDRESS) AllocPhysMem(  m_nStrideBytes * height, PAGE_READWRITE, 0, 0,&m_pPhysAddr);
		if(m_pVirtAddr != NULL)
		{
	       	 m_fPLAllocated = 1;		
//	       	 m_fInVideoMemory = 1;
	       	 RETAILMSG(DBGLCD,(TEXT("\nPAC Surf PA Base : 0x%x VA Base : 0x%x STRIDE : %d"), m_pPhysAddr, m_pVirtAddr, m_nStrideBytes));
       	 }
		else
		{
			m_fPLAllocated = 0;
	       	 RETAILMSG(DBGLCD,(TEXT("\nPAC Surf PA Base : 0x%x VA Base : 0x%x STRIDE : %d  new unsigned char"), m_pPhysAddr, m_pVirtAddr, m_nStrideBytes));		
	       	 m_pVirtAddr = (ADDRESS) new unsigned char[ m_nStrideBytes * height ];
	        }
		m_fOwnsBuffer          = 1;
		m_BytesPixel           = EGPEFormatToBpp[m_eFormat] >> 3;
    }
Beispiel #2
0
//**************************************
// Function   :VO_set_video_parameter
// Description
//	
//**************************************
void VO_set_video_parameter(unsigned long in_w, unsigned long in_h , unsigned long in_mem_w , unsigned long out_w, unsigned long out_h , unsigned long out_mem_w , unsigned long buff_num)
{
	unsigned int i;
	DWORD	nswap = 0x67;

	_veu_srcsetting.x = 0;	// not used
	_veu_srcsetting.y = 0;	// not used
	_veu_srcsetting.xoffset = 0;
	_veu_srcsetting.yoffset = 0;
	_veu_srcsetting.width_mem = in_mem_w;
	_veu_srcsetting.width = in_w;
	_veu_srcsetting.height = in_h;
	_veu_srcsetting.format = VIO_YUV420;		//VIO_YUV420

	_veu_dstsetting.x = 0;	// not used
	_veu_dstsetting.y = 0;	// not used
	//_veu_dstsetting.xoffset = 0;//VO_NORMAL_POS_X;	
	//_veu_dstsetting.yoffset = 0;//VO_NORMAL_POS_Y;	
	_veu_dstsetting.width_mem = out_mem_w;
	_veu_dstsetting.width = out_w;
	_veu_dstsetting.height = out_h;
	_veu_dstsetting.format = VIO_RGB_06_OUT;
	_veu_dstsetting.buff1 = (unsigned char*)TO_CACHE(0xAF000000);
	DeviceIoControl(_hddVEU1,IOCTL_VEU_SWAPVALUE, (LPVOID)&nswap, sizeof(nswap), NULL, 0, NULL, NULL);


	for( i = 0 ; i < _frame_rb.frame_rb_num ; i ++)
	{
		FreePhysMem(_frame_rb.frame_info[i].address);
      _frame_rb.frame_info[i].address = 0;
	}

	//attach the frame buffer
	for( i = 0 ; i < VO_BUFFER_FRAME ; i ++)
	{
		_frame_rb.frame_info[i].address = (unsigned char*)AllocPhysMem( in_w * in_h * VO_FRMAE_SIZE_PIXEL , PAGE_EXECUTE_READWRITE , 0 , 0 , (unsigned long*)&_frame_rb.frame_info[i].phy_address);
		if( _frame_rb.frame_info[i].address == NULL ){
			//init the ring buffer
			VO_sub_rb_set_buffernum(i);
			break;
		}
		VO_sub_rb_set_buffernum( VO_BUFFER_FRAME );
	}

	return;
}