guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp
branchbug235_bringup_0
changeset 30 f204b762818d
parent 13 220791dae4c4
child 32 b23067389fdf
equal deleted inserted replaced
29:2fcf0803a8bd 30:f204b762818d
    48     VVI_R_INPUT_BUFFER_READ_COUNT,
    48     VVI_R_INPUT_BUFFER_READ_COUNT,
    49     VVI_R_INPUT_BUFFER_WRITE_COUNT,
    49     VVI_R_INPUT_BUFFER_WRITE_COUNT,
    50     VVI_R_INPUT_BUFFER_MAX_TAIL,
    50     VVI_R_INPUT_BUFFER_MAX_TAIL,
    51     VVI_R_REQUEST_ID,
    51     VVI_R_REQUEST_ID,
    52 	VVI_R_SHARED_CMD_MEMORY_BASE,
    52 	VVI_R_SHARED_CMD_MEMORY_BASE,
    53 	VVI_R_SHARED_FRAMEBUFFER_MEMORY_BASE
    53 	VVI_R_SHARED_SURFACEBUFFER_MEMORY_BASE
    54     };
    54     };
    55 #define ASSERT_PANIC(c,p) __ASSERT_DEBUG(c,Kern::PanicCurrentThread(KVirtualVideoHwInterfacePanic,p));
    55 #define ASSERT_PANIC(c,p) __ASSERT_DEBUG(c,Kern::PanicCurrentThread(KVirtualVideoHwInterfacePanic,p));
    56 
    56 
    57 // ============================ LOCAL FUNCTIONS ================================
    57 // ============================ LOCAL FUNCTIONS ================================
    58 
    58 
    79 	iVideoRamBasePhys = VVI_BASE;
    79 	iVideoRamBasePhys = VVI_BASE;
    80 #else
    80 #else
    81 	// Reserve a contiguous memory chunk for graphics usage
    81 	// Reserve a contiguous memory chunk for graphics usage
    82 	TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE +
    82 	TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE +
    83 						VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + 
    83 						VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + 
    84 						VVI_FRAMEBUFFER_MEMORY_SIZE;
    84 						VVI_SURFACEBUFFER_MEMORY_SIZE;
    85 	TInt r = Epoc::AllocPhysicalRam( ramSize, iVideoRamBasePhys );
    85 	TInt r = Epoc::AllocPhysicalRam( ramSize, iVideoRamBasePhys );
    86     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface() AllocPhysicalRam %d", r);
    86     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface() AllocPhysicalRam %d", r);
    87 	if (r != KErrNone)
    87 	if (r != KErrNone)
    88 		{
    88 		{
    89 	    NKern::ThreadLeaveCS();
    89 	    NKern::ThreadLeaveCS();
    90 		Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r);
    90 		Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r);
    91 		}
    91 		}
    92  	SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS );
    92  	SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS );
    93 	SetSharedFramebufferMemBase( iVideoRamBasePhys + VVI_FRAMEBUFFER_BASE_ADDRESS );
    93 	SetSharedSurfacebufferMemBase( iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS );
    94 
    94 
    95 #endif // PLATSIM_CONFIG
    95 #endif // PLATSIM_CONFIG
    96     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<");
    96     VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<");
    97     }
    97     }
    98 
    98 
   256     {
   256     {
   257     VVHW_TRACE("DVirtualVideoHwInterface::SetSharedCmdMemBase 0x%08x", aPhysicalAddress);
   257     VVHW_TRACE("DVirtualVideoHwInterface::SetSharedCmdMemBase 0x%08x", aPhysicalAddress);
   258     SetRegisterValue( ERegSharedCmdMemBase, aPhysicalAddress );
   258     SetRegisterValue( ERegSharedCmdMemBase, aPhysicalAddress );
   259     }
   259     }
   260 
   260 
   261 void DVirtualVideoHwInterface::SetSharedFramebufferMemBase( TUint32 aPhysicalAddress )
   261 void DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase( TUint32 aPhysicalAddress )
   262     {
   262     {
   263     VVHW_TRACE("DVirtualVideoHwInterface::SetSharedFramebufferMemBase 0x%08x", aPhysicalAddress);
   263     VVHW_TRACE("DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase 0x%08x", aPhysicalAddress);
   264     SetRegisterValue( ERegSharedFramebufferMemBase, aPhysicalAddress );
   264     SetRegisterValue( ERegSharedSurfacebufferMemBase, aPhysicalAddress );
   265     }
   265     }
   266 
   266 
   267 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   268 // DVirtualVideoHwInterface::GetRegisterValue
   268 // DVirtualVideoHwInterface::GetRegisterValue
   269 // -----------------------------------------------------------------------------
   269 // -----------------------------------------------------------------------------
   313 		WriteReg( KHwGraphicsRegBase, offset, aValue );
   313 		WriteReg( KHwGraphicsRegBase, offset, aValue );
   314 #endif // PLATSIM_CONFIG
   314 #endif // PLATSIM_CONFIG
   315         }
   315         }
   316     }
   316     }
   317 
   317 
   318 EXPORT_C TPhysAddr  DVirtualVideoHwInterface::GetFrameBase()
   318 EXPORT_C TPhysAddr  DVirtualVideoHwInterface::GetSurfaceBase()
   319 	{
   319 	{
   320 	TPhysAddr ret = 0;
   320 	TPhysAddr ret = 0;
   321 	if( iVideoRamBasePhys != 0 )
   321 	if( iVideoRamBasePhys != 0 )
   322 		{
   322 		{
   323 		ret = iVideoRamBasePhys + VVI_FRAMEBUFFER_BASE_ADDRESS;
   323 		ret = iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS;
   324 		}
   324 		}
   325 	return ret;
   325 	return ret;
   326     }
   326     }
   327 
   327