start graphics-phase-3 graphics-phase-3
authorjahyvone@4FIL49437
Wed, 02 Jun 2010 11:02:14 +0300
branchgraphics-phase-3
changeset 77 b3dcdc7f8f12
parent 75 bb16bb5b2818
child 97 c7e943dbf70f
start graphics-phase-3
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/ReadMe.txt
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/BuildLog.htm
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/RCa04556
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/app.ico
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.cpp
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.h
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.sln
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.suo
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj
symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.vcproj.NOE.jahyvone.user
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/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.
+
+/////////////////////////////////////////////////////////////////////////////
Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/BuildLog.htm has changed
Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/Release/RCa04556 has changed
Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/app.ico has changed
--- /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 <KhronosAPIWrapper.h>
+#include <VirtualVideoInterfaceConstants.h>  //Registers and enums 
+#include <platformthreading.h>  //mutex
+#include <protocol_MGraphicsVHWCallback.h>
+#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
--- /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
--- /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
Binary file symbian-qemu-0.9.1-12/model-libraries/syborg-graphicswrapper/syborg-graphicswrapper.suo has changed
--- /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 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="syborg-graphicswrapper"
+	ProjectGUID="{93690C8A-9167-4A2D-9682-3E437A31347D}"
+	RootNamespace="syborggraphicswrapper"
+	Keyword="ManagedCProj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			ManagedExtensions="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="$(NoInherit)"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				AssemblyDebug="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			ManagedExtensions="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="$(SolutionDir)..\platsim_graphics\platsimvideodriver\commoninc;$(SolutionDir)..\PlatsimUtil\PlatsimUtil\inc\public;$(SolutionDir)..\KhronosAPIWrapper\inc;$(SolutionDir)..\platsim_graphics\serialiser\inc"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;SYBORG_GRAPHICSWRAPPER_EXPORTS;WIN32_LEAN_AND_MEAN"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="PlatsimUtil.lib KhronosApiWrapper.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(SolutionDir)..\PlatsimUtil\PlatsimUtil\$(ConfigurationName);$(SolutionDir)..\KhronosAPIWrapper\$(ConfigurationName)"
+				GenerateDebugInformation="true"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+		<AssemblyReference
+			RelativePath="System.dll"
+			AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
+		/>
+		<AssemblyReference
+			RelativePath="System.Data.dll"
+			AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
+		/>
+		<AssemblyReference
+			RelativePath="System.XML.dll"
+			AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
+		/>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\syborg-graphicswrapper.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\syborg-graphicswrapper.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\app.ico"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /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 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="8.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			>
+			<DebugSettings
+				Command=""
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="4FIL49437"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			>
+			<DebugSettings
+				Command=""
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="4FIL49437"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>
--- /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)