# HG changeset patch # User jahyvone@4FIL49437 # Date 1275465734 -10800 # Node ID b3dcdc7f8f1253625777b6329f0bbc31cacdcfd2 # Parent bb16bb5b281805dd5d25a008d10ac3a30dbe3369 start graphics-phase-3 diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/ReadMe.txt Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,31 @@ +======================================================================== + DYNAMIC LINK LIBRARY : syborg-graphicswrapper Project Overview +======================================================================== + +AppWizard has created this syborg-graphicswrapper DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your syborg-graphicswrapper application. + +syborg-graphicswrapper.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +syborg-graphicswrapper.cpp + This is the main DLL source file. + +syborg-graphicswrapper.h + This file contains a class declaration. + +AssemblyInfo.cpp + Contains custom attributes for modifying assembly metadata. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/BuildLog.htm Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/BuildLog.htm has changed diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/RCa04556 Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/RCa04556 has changed diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/app.ico Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/app.ico has changed diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.cpp Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,150 @@ +// This is the main DLL file. + +#include "platformtypes.h" +#include +#include //Registers and enums +#include //mutex +#include +#include "syborg-graphicswrapper.h" + +SyborgGraphicsWrapper::SyborgGraphicsWrapper() + { + } + +SyborgGraphicsWrapper::~SyborgGraphicsWrapper() + { + delete m_wrapper; + m_wrapper = 0; + + Psu::platform_release_semaphore(m_outputBufferSemaphore); + } + +int SyborgGraphicsWrapper::Reset( uint32_t *aGraphicsMemBase, uint32_t *aCommandMemBase ) + { + int ret = -1; + if ( m_wrapper ) + { + delete m_wrapper; + } + m_wrapper = NULL; + + uint8_t *cmd_buffer = (uint8_t *)aCommandMemBase; + uint8_t *frame_buffer = (uint8_t *)aGraphicsMemBase; + if( (cmd_buffer != NULL) && (frame_buffer != NULL) ) + { + m_wrapper = new KhronosAPIWrapper( (protocol_MGraphicsVHWCallback*)this, + frame_buffer, &cmd_buffer[VVHW_INPUT_BASE], &cmd_buffer[VVHW_OUTPUT_BASE] ); + //Reset synchronisation mechanisms + Psu::platform_release_semaphore(m_outputBufferSemaphore); + Psu::platform_create_semaphore(m_outputBufferSemaphore, 1, 1); + ret = 0; + } + else + { + ret = -1; + } + return ret; + } + +void SyborgGraphicsWrapper::LockOutputBuffer() + { + #ifdef KHRONOS_API_W_MULTITHREAD + Psu::platform_wait_for_signal(m_outputBufferSemaphore); + #endif + } + +void SyborgGraphicsWrapper::ReleaseOutputBuffer(){} + +void SyborgGraphicsWrapper::ProsessingDone(int i) + { + m_pythonCallBack( i ); + } + +extern "C" + { + SYBORG_GRAPHICSWRAPPER_API SyborgGraphicsWrapper* create_SyborgGraphicsWrapper() + { + return new SyborgGraphicsWrapper(); + } + SYBORG_GRAPHICSWRAPPER_API int initialize_SyborgGraphicsWrapper( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + Psu::platform_create_semaphore(m_outputBufferSemaphore, 1, 1); + // Change to proper error handling + return 0; + } + + SYBORG_GRAPHICSWRAPPER_API int set_GraphicsCallBack( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, int (*aGraphicsCallBack) (int) ) + { + m_pythonCallBack = aGraphicsCallBack; + // Change to proper error handling + return 0; + } + + SYBORG_GRAPHICSWRAPPER_API int reset_SyborgGraphicsWrapper( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t *aGraphicsMemBase, uint32_t *aCommandMemBase ) + { + return aSyborgGraphicsWrapper->Reset( aGraphicsMemBase, aCommandMemBase ); + } + + SYBORG_GRAPHICSWRAPPER_API uint32_t get_InputBufferTail( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->InputBufferTail(); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_InputBufferHead( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->InputBufferHead( ); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_InputBufferReadCount( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->InputBufferReadCount( ); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_InputBufferWriteCount( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->InputBufferWriteCount( ); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_InputMaxTailIndex( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->InputMaxTailIndex( ); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_cmd_memsize( void ) + { + return (VVI_PARAMETERS_INPUT_MEMORY_SIZE + + VVI_PARAMETERS_OUTPUT_MEMORY_SIZE); + } + SYBORG_GRAPHICSWRAPPER_API uint32_t get_framebuffer_memsize( void ) + { + return VVI_FRAMEBUFFER_MEMORY_SIZE; + } + + + SYBORG_GRAPHICSWRAPPER_API unsigned int execute_command( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + return m_wrapper->Execute( ); + } + SYBORG_GRAPHICSWRAPPER_API void set_InputBufferTail( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t aVal ) + { + m_wrapper->SetInputBufferTail( aVal ); + } + SYBORG_GRAPHICSWRAPPER_API void set_InputBufferHead( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t aVal ) + { + m_wrapper->SetInputBufferHead( aVal ); + } + SYBORG_GRAPHICSWRAPPER_API void set_InputBufferReadCount( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t aVal ) + { + m_wrapper->SetInputBufferReadCount( aVal ); + } + SYBORG_GRAPHICSWRAPPER_API void set_InputBufferWriteCount( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t aVal ) + { + m_wrapper->SetInputBufferWriteCount( aVal ); + } + SYBORG_GRAPHICSWRAPPER_API void set_InputMaxTailIndex( SyborgGraphicsWrapper* aSyborgGraphicsWrapper, uint32_t aVal ) + { + m_wrapper->SetInputMaxTailIndex( aVal ); + } + SYBORG_GRAPHICSWRAPPER_API void signal_outputbuffer_semafore( SyborgGraphicsWrapper* aSyborgGraphicsWrapper ) + { + #ifdef KHRONOS_API_W_MULTITHREAD + Psu::platform_signal_semaphore(m_outputBufferSemaphore); + #endif + } + + } \ No newline at end of file diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.h Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,47 @@ +#ifndef _SYBORG_GRAPHICSWRAPPER_H +#define _SYBORG_GRAPHICSWRAPPER_H + +#pragma once + +#ifdef WIN32 +#ifdef SYBORG_GRAPHICSWRAPPER_EXPORTS +#define SYBORG_GRAPHICSWRAPPER_API __declspec(dllexport) +#else +#define SYBORG_GRAPHICSWRAPPER_API __declspec(dllimport) +#endif +#else +#define SYBORG_GRAPHICSWRAPPER_API +#endif + +Psu::PLATFORM_SEMAPHORE_T m_outputBufferSemaphore; +int (*m_pythonCallBack)(int); +KhronosAPIWrapper* m_wrapper; + + +// Derived from GraphicsVirtualHW.lisa +static const int VVHW_BUFFER (0x3000000); +static const int VVHW_INPUT_BUFFER (0x1000000); +static const int VVHW_INPUT_BASE(0x0); +static const int VVHW_OUTPUT_BUFFER (0x1000000); +static const int VVHW_OUTPUT_BASE(0x1000000); +static const int VVHW_FRAME_BUFFER (0x1000000); +static const int VVHW_FRAME_BASE(0x2000000); + +class SyborgGraphicsWrapper : public protocol_MGraphicsVHWCallback + { + public: + + SyborgGraphicsWrapper(); + ~SyborgGraphicsWrapper(); + + int Reset( uint32_t *aGraphicsMemBase, uint32_t *aCommandMemBase ); + + virtual void LockOutputBuffer(); + virtual void ReleaseOutputBuffer(); + virtual void ProsessingDone(int i); + + private: + }; + + +#endif // _SYBORG_GRAPHICSWRAPPER_H \ No newline at end of file diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.sln Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C++ Express 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "syborg-graphicswrapper", "syborg-graphicswrapper.vcproj", "{93690C8A-9167-4A2D-9682-3E437A31347D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {93690C8A-9167-4A2D-9682-3E437A31347D}.Debug|Win32.ActiveCfg = Debug|Win32 + {93690C8A-9167-4A2D-9682-3E437A31347D}.Debug|Win32.Build.0 = Debug|Win32 + {93690C8A-9167-4A2D-9682-3E437A31347D}.Release|Win32.ActiveCfg = Release|Win32 + {93690C8A-9167-4A2D-9682-3E437A31347D}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.suo Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.suo has changed diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj.NOE.jahyvone.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj.NOE.jahyvone.user Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,65 @@ + + + + + + + + + + + diff -r bb16bb5b2818 -r b3dcdc7f8f12 symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/syborg_graphicsdevice.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/qemu-symbian-svp/plugins/syborg_graphicsdevice.py Wed Jun 02 11:02:14 2010 +0300 @@ -0,0 +1,162 @@ +import ctypes +import qemu +import sys +#import SyborgModule + +class syborg_graphicsdevice(qemu.devclass): + # Graphics device registers derived from VirtualVideoInterfaceConstants.h + VVI_R_ID = 0x0000 + VVI_R_IRQ_ENABLE = 0x0004 + VVI_R_IRQ_STATUS = 0x0008 + VVI_R_COMMAND = 0x000c + VVI_R_PARAMETER_LOAD = 0x0010 + VVI_R_ERROR = 0x0014 + VVI_R_INPUT_BUFFER_TAIL = 0x0018 + VVI_R_INPUT_BUFFER_HEAD = 0x001c + VVI_R_INPUT_BUFFER_READ_COUNT = 0x0020 + VVI_R_INPUT_BUFFER_WRITE_COUNT = 0x0024 + VVI_R_INPUT_BUFFER_MAX_TAIL = 0x0028 + VVI_R_REQUEST_ID = 0x002c + VVI_R_SHARED_CMD_MEMORY_BASE = 0x0030 + VVI_R_SHARED_FRAMEBUFFER_MEMORY_BASE = 0x0034 + VVI_R_LASTREG = 0x0038 # not a register, address of last register + + VVI_EXECUTE = 0 + shared_cmd_memory_base = 0 + shared_framebuffer_memory_base = 0 + m_request_id_reg = 0 + + # Memory base id's from SyborgModule.h + # SYBORG_CMDMEMBASE = 0 + # SYBORG_FRAMEBUFFERMEMBASE = 1 + + class DllLoadExeption( Exception ): + def __init__(self,value): + self.value = value + + def __str__(self): + return repr(self.value) + + class SyborgGraphicsWrapper(): + def __init__(self): + try: + self.library = ctypes.CDLL("syborg-graphicswrapper.dll") + except: + raise syborg_graphicsdevice.DllLoadExeption(1) + self.obj = self.library.create_SyborgGraphicsWrapper() + + def initialize_graphics_utils(self): + self.library.initialize_SyborgGraphicsWrapper( self.obj ) + + def create(self): + try: + self.graphicsutils = self.SyborgGraphicsWrapper() + except syborg_graphicsdevice.DllLoadExeption: + #print "syborg_graphicsdevice: Graphics dll load failed" + sys.exit("syborg_graphicsdevice: Graphics dll load failed") + + + self.graphicsutils.initialize_graphics_utils() + self.initialize_graphics_callback() + # deliver the graphics ram region + # self.gmembase = self.graphicsutils.library.get_membase() + + self.irqenable = 0 + self.irqstatus = 0 + self.command = 0 + self.parameterload = 0 + + def updateIrq(self,new_value): + self.set_irq_level(0, new_value) + + def graphics_request_callback(self, request_id): + #print "graphics_request_callback: " , request_id + self.m_request_id_reg = request_id + self.updateIrq(1) + return 0 + + def initialize_graphics_callback(self): + self.CALLBACKFUNC = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int) + self.graphics_callback = self.CALLBACKFUNC(self.graphics_request_callback) + self.graphicsutils.library.set_GraphicsCallBack( self.graphicsutils.obj, self.graphics_callback ) + + def read_reg(self, offset): + offset >>= 2 + if offset == self.VVI_R_ID: + return 0xDEADBEEF + elif offset == self.VVI_R_IRQ_ENABLE: + return self.irqenable + elif offset == self.VVI_R_IRQ_STATUS: + return self.irqstatus + elif offset == self.VVI_R_COMMAND: + return self.command + elif offset == self.VVI_R_PARAMETER_LOAD: + return self.parameterload + elif offset == self.VVI_R_ERROR: + self.lasterror = 0 + return self.lasterror + elif offset == self.VVI_R_INPUT_BUFFER_TAIL: + return self.graphicsutils.library.get_InputBufferTail( self.graphicsutils.obj ) + elif offset == self.VVI_R_INPUT_BUFFER_HEAD: + return self.graphicsutils.library.get_InputBufferHead( self.graphicsutils.obj ) + elif offset == self.VVI_R_INPUT_BUFFER_READ_COUNT: + return self.graphicsutils.library.get_InputBufferReadCount( self.graphicsutils.obj ) + elif offset == self.VVI_R_INPUT_BUFFER_WRITE_COUNT: + return self.graphicsutils.library.get_InputBufferWriteCount( self.graphicsutils.obj ) + elif offset == self.VVI_R_INPUT_BUFFER_MAX_TAIL: + return self.graphicsutils.library.get_InputMaxTailIndex( self.graphicsutils.obj ) + elif offset == self.VVI_R_REQUEST_ID: + return self.m_request_id_reg + elif offset == self.VVI_R_SHARED_CMD_MEMORY_BASE: + return self.shared_cmd_memory_base + elif offset == self.VVI_R_SHARED_FRAMEBUFFER_MEMORY_BASE: + return self.shared_framebuffer_memory_base + else: + reg_read_error = "syborg_graphicsdevice: Illegal register read at: ", offset + sys.exit( reg_read_error ) + + def write_reg(self, offset, value): + offset >>= 2 + if offset == self.VVI_R_IRQ_STATUS: + self.updateIrq(0); + self.graphicsutils.library.signal_outputbuffer_semafore( self.graphicsutils.obj ) + self.graphicsutils.library.execute_command( self.graphicsutils.obj ); + elif offset == self.VVI_R_COMMAND: + if value == self.VVI_EXECUTE: + self.graphicsutils.library.execute_command( self.graphicsutils.obj ); + else: + sys.exit("syborg_graphicsdevice: Unknown command issued!") + elif offset == self.VVI_R_INPUT_BUFFER_TAIL: + self.graphicsutils.library.set_InputBufferTail( self.graphicsutils.obj, value ); + elif offset == self.VVI_R_INPUT_BUFFER_HEAD: + self.graphicsutils.library.set_InputBufferHead( self.graphicsutils.obj, value ); + elif offset == self.VVI_R_INPUT_BUFFER_READ_COUNT: + self.graphicsutils.library.set_InputBufferReadCount( self.graphicsutils.obj, value ); + elif offset == self.VVI_R_INPUT_BUFFER_WRITE_COUNT: + self.graphicsutils.library.set_InputBufferWriteCount( self.graphicsutils.obj, value ); + elif offset == self.VVI_R_INPUT_BUFFER_MAX_TAIL: + self.graphicsutils.library.set_InputMaxTailIndex( self.graphicsutils.obj, value ); + elif offset == self.VVI_R_SHARED_CMD_MEMORY_BASE: + gmemsize = self.graphicsutils.library.get_cmd_memsize() + self.cmd_memregion = qemu.memregion( value, gmemsize ) + self.memregion_cmd_base = self.cmd_memregion.region_host_addr() + #SyborgModule.post_address( self.memregion_cmd_base, self.SYBORG_CMDMEMBASE ) + elif offset == self.VVI_R_SHARED_FRAMEBUFFER_MEMORY_BASE: + gmemsize = self.graphicsutils.library.get_framebuffer_memsize() + self.framebuffer_memregion = qemu.memregion( value, gmemsize ) + self.memregion_framebuffer_base = self.framebuffer_memregion.region_host_addr() + #SyborgModule.post_address( self.memregion_framebuffer_base, self.SYBORG_FRAMEBUFFERMEMBASE ) + # Ready to finalise graphics initialization + if( self.graphicsutils.library.reset_SyborgGraphicsWrapper( self.graphicsutils.obj, self.memregion_framebuffer_base, self.memregion_cmd_base ) != 0 ): + sys.exit("syborg_graphicsdevice: Syborg graphicsutils library not initialized correctly!") + else: + reg_write_error = "syborg_graphicsdevice: Illegal register write to: ", offset + sys.exit( reg_write_error ) + + # Device class properties + regions = [qemu.ioregion(0x1000, readl=read_reg, writel=write_reg)] + irqs = 1 + name = "syborg,graphicsdevice" + properties = {} + +qemu.register_device(syborg_graphicsdevice)