EXTRA_CFLAGS += -DNO_USER_DIRECT_ACCESS_FROM_KERNEL=0
endif
+ifeq ($(gcdkREPORT_VIDMEM_USAGE), 1)
+EXTRA_CFLAGS += -DgcdkREPORT_VIDMEM_USAGE=1
+else
+EXTRA_CFLAGS += -DgcdkREPORT_VIDMEM_USAGE=0
+endif
+
EXTRA_CFLAGS += -I$(AQROOT)/hal/inc
EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel
EXTRA_CFLAGS += -I$(AQARCH)/hal/kernel
ABI ?= aapcs-linux
endif
-################################################################
# Force to use dma_coherent_* stuff.
+NO_DMA_COHERENT ?= 1
-NO_DMA_COHERENT ?= 0
+# Enable to start GPU clock in drver.
+ENABLE_GPU_CLOCK_BY_DRIVER = 1
-################################################################
# Set this value to 1 if you are using ARM L2 cache.
-
ENABLE_ARM_L2_CACHE = 1
-################################################################
# Set this value to 1 if you are using DOVE board.
CONFIG_DOVE_GPU = 0
-ENABLE_GPU_CLOCK_BY_DRIVER = 1
-
-
AQROOT ?= drivers/staging/rk29/vivante
AQARCH ?= $(AQROOT)/arch/XAQ2
EXTRA_CFLAGS += -DNO_USER_DIRECT_ACCESS_FROM_KERNEL=0
endif
+ifeq ($(gcdkREPORT_VIDMEM_USAGE), 1)
+EXTRA_CFLAGS += -DgcdkREPORT_VIDMEM_USAGE=1
+else
+EXTRA_CFLAGS += -DgcdkREPORT_VIDMEM_USAGE=0
+endif
+
EXTRA_CFLAGS += -I$(AQROOT)/hal/inc
EXTRA_CFLAGS += -I$(AQROOT)/hal/kernel
EXTRA_CFLAGS += -I$(AQARCH)/hal/kernel
/* Disable fast clear flush on some specific cores. */
if (((*ChipModel == gcv600) && (*ChipRevision == 0x4302))
+/* || ((*ChipModel == gcv530) && (*ChipRevision == 0x4303))
+ || ((*ChipModel == gcv800) && (*ChipRevision == 0x4301)) */
)
{
*ChipMinorFeatures0 = ((((gctUINT32) (*ChipMinorFeatures0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 6:6) - (0 ? 6:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 6:6) - (0 ? 6:6) + 1))))))) << (0 ? 6:6)));
gcmkVERIFY_OBJECT(Os, gcvOBJ_OS);
gcmkVERIFY_ARGUMENT(Hardware != gcvNULL);
+ /* Enable the GPU. */
+ gcmkONERROR(gckOS_SetGPUPower(Os, gcvTRUE, gcvTRUE));
+ gcmkONERROR(gckOS_WriteRegister(Os, 0x00000, 0));
+
/* Identify the hardware. */
gcmkONERROR(_IdentifyHardware(Os,
&chipModel,
IN gctPOINTER Memory
);
+/* Allocate paged memory. */
+gceSTATUS
+gckOS_AllocateVirtualMemory(
+ IN gckOS Os,
+ IN gctSIZE_T Bytes,
+ OUT gctPOINTER * Memory
+ );
+
+/* Wrapper for freeing virtual memory. */
+gceSTATUS
+gckOS_FreeVirtualMemory(
+ IN gckOS Os,
+ IN gctPOINTER Memory
+ );
+
/* Allocate paged memory. */
gceSTATUS
gckOS_AllocatePagedMemory(
IN gctCONST_POINTER Data
);
+/* Flush data to a file. */
+gceSTATUS
+gcoOS_Flush(
+ IN gcoOS Os,
+ IN gctFILE File
+ );
+
+/* Create an endpoint for communication. */
+gceSTATUS
+gcoOS_Socket(
+ IN gcoOS Os,
+ IN gctINT Domain,
+ IN gctINT Type,
+ IN gctINT Protocol,
+ OUT gctINT *SockFd
+ );
+
+/* Close a socket. */
+gceSTATUS
+gcoOS_CloseSocket(
+ IN gcoOS Os,
+ IN gctINT SockFd
+ );
+
+/* Initiate a connection on a socket. */
+gceSTATUS
+gcoOS_Connect(
+ IN gcoOS Os,
+ IN gctINT SockFd,
+ IN gctCONST_POINTER HostName,
+ IN gctUINT Port);
+
+/* Shut down part of connection on a socket. */
+gceSTATUS
+gcoOS_Shutdown(
+ IN gcoOS Os,
+ IN gctINT SockFd,
+ IN gctINT How
+ );
+
+/* Send a message on a socket. */
+gceSTATUS
+gcoOS_Send(
+ IN gcoOS Os,
+ IN gctINT SockFd,
+ IN gctSIZE_T ByteCount,
+ IN gctCONST_POINTER Data,
+ IN gctINT Flags
+ );
+
+/* Initiate a connection on a socket. */
+gceSTATUS
+gcoOS_WaitForSend(
+ IN gcoOS Os,
+ IN gctINT SockFd,
+ IN gctINT Seconds,
+ IN gctINT MicroSeconds);
+
+/* Get environment variable value. */
+gceSTATUS
+gcoOS_GetEnv(
+ IN gcoOS Os,
+ IN gctCONST_STRING VarName,
+ OUT gctSTRING * Value
+ );
+
typedef enum _gceFILE_WHENCE
{
gcvFILE_SEEK_SET,
#define gcmOPT_VALUE(ptr) (((ptr) == gcvNULL) ? 0 : *(ptr))
#define gcmOPT_POINTER(ptr) (((ptr) == gcvNULL) ? gcvNULL : *(ptr))
+#define gcmOPT_STRING(ptr) (((ptr) == gcvNULL) ? "(nil)" : (ptr))
void
gcoOS_Print(
IN OUT gctSIZE_T * BufferSize
);
+/*******************************************************************************
+** gcSHADER_ReallocateAttributes
+**
+** Reallocate an array of pointers to gcATTRIBUTE objects.
+**
+** INPUT:
+**
+** gcSHADER Shader
+** Pointer to a gcSHADER object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcSHADER_ReallocateAttributes(
+ IN gcSHADER Shader,
+ IN gctSIZE_T Count
+ );
+
/*******************************************************************************
** gcSHADER_AddAttribute
********************************************************************************
OUT gcATTRIBUTE * Attribute
);
+/*******************************************************************************
+** gcSHADER_ReallocateUniforms
+**
+** Reallocate an array of pointers to gcUNIFORM objects.
+**
+** INPUT:
+**
+** gcSHADER Shader
+** Pointer to a gcSHADER object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcSHADER_ReallocateUniforms(
+ IN gcSHADER Shader,
+ IN gctSIZE_T Count
+ );
+
/*******************************************************************************
** gcSHADER_AddUniform
********************************************************************************
OUT gcUNIFORM * Uniform
);
+/*******************************************************************************
+** gcSHADER_ReallocateOutputs
+**
+** Reallocate an array of pointers to gcOUTPUT objects.
+**
+** INPUT:
+**
+** gcSHADER Shader
+** Pointer to a gcSHADER object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcSHADER_ReallocateOutputs(
+ IN gcSHADER Shader,
+ IN gctSIZE_T Count
+ );
+
/*******************************************************************************
** gcSHADER_AddOutput
********************************************************************************
OUT gcOUTPUT * Output
);
+/*******************************************************************************
+** gcSHADER_ReallocateVariables
+**
+** Reallocate an array of pointers to gcVARIABLE objects.
+**
+** INPUT:
+**
+** gcSHADER Shader
+** Pointer to a gcSHADER object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcSHADER_ReallocateVariables(
+ IN gcSHADER Shader,
+ IN gctSIZE_T Count
+ );
+
/*******************************************************************************
** gcSHADER_AddVariable
********************************************************************************
IN gctUINT OptimizationOption
);
+/*******************************************************************************
+** gcSHADER_ReallocateFunctions
+**
+** Reallocate an array of pointers to gcFUNCTION objects.
+**
+** INPUT:
+**
+** gcSHADER Shader
+** Pointer to a gcSHADER object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcSHADER_ReallocateFunctions(
+ IN gcSHADER Shader,
+ IN gctSIZE_T Count
+ );
+
gceSTATUS
gcSHADER_AddFunction(
IN gcSHADER Shader,
*********************************************************** F U N C T I O N S **
*******************************************************************************/
+/*******************************************************************************
+** gcFUNCTION_ReallocateArguments
+**
+** Reallocate an array of gcsFUNCTION_ARGUMENT objects.
+**
+** INPUT:
+**
+** gcFUNCTION Function
+** Pointer to a gcFUNCTION object.
+**
+** gctSIZE_T Count
+** Array count to reallocate. 'Count' must be at least 1.
+*/
+gceSTATUS
+gcFUNCTION_ReallocateArguments(
+ IN gcFUNCTION Function,
+ IN gctSIZE_T Count
+ );
+
gceSTATUS
gcFUNCTION_AddArgument(
IN gcFUNCTION Function,
IN gctPOINTER IndexBuffer
);
+/* Bind an index object to the hardware, for neocore hacking*/
+gceSTATUS
+gcoINDEX_LoadHack(
+ IN gcoINDEX Index,
+ IN gceINDEX_TYPE IndexType,
+ IN gctUINT32 IndexCount,
+ IN gctPOINTER IndexBuffer
+ );
+
/* Bind an index object to the hardware. */
gceSTATUS
gcoINDEX_Bind(
}
gceTEXTURE_FACE;
+typedef struct _gcsTEXTURE
+{
+ /* Addressing modes. */
+ gceTEXTURE_ADDRESSING s;
+ gceTEXTURE_ADDRESSING t;
+ gceTEXTURE_ADDRESSING r;
+
+ /* Border color. */
+ gctUINT8 border[4];
+
+ /* Filters. */
+ gceTEXTURE_FILTER minFilter;
+ gceTEXTURE_FILTER magFilter;
+ gceTEXTURE_FILTER mipFilter;
+
+ /* Level of detail. */
+ gctFIXED_POINT lodBias;
+ gctFIXED_POINT lodMin;
+ gctFIXED_POINT lodMax;
+}
+gcsTEXTURE, * gcsTEXTURE_PTR;
+
+
/* Construct a new gcoTEXTURE object. */
gceSTATUS
gcoTEXTURE_Construct(
gceSTATUS
gcoTEXTURE_QueryCaps(
+ IN gcoHAL Hal,
OUT gctUINT * MaxWidth,
OUT gctUINT * MaxHeight,
OUT gctUINT * MaxDepth,
IN gctINT MaxLevel
);
+gceSTATUS
+gcoTEXTURE_BindTexture(
+ IN gcoTEXTURE Texture,
+ IN gctINT Sampler,
+ IN gcsTEXTURE_PTR Info
+ );
+
/******************************************************************************\
******************************* gcoSTREAM Object ******************************
\******************************************************************************/
IN gcoVERTEX Vertex
);
+gceSTATUS
+gcoVERTEX_BindHack(
+ IN gctUINT32 ActiveAttributeCount,
+ IN gctUINT32 TotalStride,
+ IN gcoVERTEX Vertex,
+ IN gctUINT32 Address
+ );
+
#ifdef __cplusplus
}
#endif
/* HAL profile information. */
typedef struct _gcsPROFILER
{
- gctFILE file;
+ gctUINT32 enable;
+
+ gctBOOL useSocket;
+ gctINT sockFd;
+
+ gctFILE file;
/* Aggregate Information */
/* Clock Info */
- gctUINT64 frameStart;
- gctUINT64 frameEnd;
+ gctUINT64 frameStart;
+ gctUINT64 frameEnd;
/* Current frame information */
- gctUINT32 frameNumber;
- gctUINT64 frameStartTimeusec;
- gctUINT64 frameEndTimeusec;
- gctUINT64 frameStartCPUTimeusec;
- gctUINT64 frameEndCPUTimeusec;
+ gctUINT32 frameNumber;
+ gctUINT64 frameStartTimeusec;
+ gctUINT64 frameEndTimeusec;
+ gctUINT64 frameStartCPUTimeusec;
+ gctUINT64 frameEndCPUTimeusec;
#if PROFILE_HAL_COUNTERS
- gctUINT32 vertexBufferTotalBytesAlloc;
- gctUINT32 vertexBufferNewBytesAlloc;
- int vertexBufferTotalObjectsAlloc;
- int vertexBufferNewObjectsAlloc;
-
- gctUINT32 indexBufferTotalBytesAlloc;
- gctUINT32 indexBufferNewBytesAlloc;
- int indexBufferTotalObjectsAlloc;
- int indexBufferNewObjectsAlloc;
-
- gctUINT32 textureBufferTotalBytesAlloc;
- gctUINT32 textureBufferNewBytesAlloc;
- int textureBufferTotalObjectsAlloc;
- int textureBufferNewObjectsAlloc;
-
- gctUINT32 numCommits;
- gctUINT32 drawPointCount;
- gctUINT32 drawLineCount;
- gctUINT32 drawTriangleCount;
- gctUINT32 drawVertexCount;
- gctUINT32 redundantStateChangeCalls;
+ gctUINT32 vertexBufferTotalBytesAlloc;
+ gctUINT32 vertexBufferNewBytesAlloc;
+ int vertexBufferTotalObjectsAlloc;
+ int vertexBufferNewObjectsAlloc;
+
+ gctUINT32 indexBufferTotalBytesAlloc;
+ gctUINT32 indexBufferNewBytesAlloc;
+ int indexBufferTotalObjectsAlloc;
+ int indexBufferNewObjectsAlloc;
+
+ gctUINT32 textureBufferTotalBytesAlloc;
+ gctUINT32 textureBufferNewBytesAlloc;
+ int textureBufferTotalObjectsAlloc;
+ int textureBufferNewObjectsAlloc;
+
+ gctUINT32 numCommits;
+ gctUINT32 drawPointCount;
+ gctUINT32 drawLineCount;
+ gctUINT32 drawTriangleCount;
+ gctUINT32 drawVertexCount;
+ gctUINT32 redundantStateChangeCalls;
#endif
}
gcsPROFILER;
/* Initialize the gcsProfiler. */
gceSTATUS
gcoPROFILER_Initialize(
- IN gcoHAL Hal,
- IN gctFILE File
+ IN gcoHAL Hal
);
/* Destroy the gcProfiler. */
IN gcoHAL Hal
);
+/* Write data to profiler. */
+gceSTATUS
+gcoPROFILER_Write(
+ IN gcoHAL Hal,
+ IN gctSIZE_T ByteCount,
+ IN gctCONST_POINTER Data
+ );
+
+/* Flush data out. */
+gceSTATUS
+gcoPROFILER_Flush(
+ IN gcoHAL Hal
+ );
+
/* Call to signal end of frame. */
gceSTATUS
gcoPROFILER_EndFrame(
IN gcoHAL Hal
);
+/* Increase profile counter Enum by Value. */
gceSTATUS
gcoPROFILER_Count(
IN gcoHAL Hal,
#define _GC_OBJ_ZONE gcvZONE_EVENT
-#define gcdEVENT_ALLOCATION_COUNT (4096 / gcmSIZEOF(gcsHAL_INTERFACE))
+#define gcdEVENT_ALLOCATION_COUNT (4096 / gcmSIZEOF(gcsEVENT))
#define gcdEVENT_MIN_THRESHOLD 4
/******************************************************************************\
/* Acquire the mutex. */
gcmkONERROR(gckOS_AcquireMutex(Event->os, Event->freeMutex, gcvINFINITE));
acquired = gcvTRUE;
-
- *Record = Event->freeList;
- Event->freeList = Event->freeList->next;
- Event->freeCount -= 1;
+ if (Event->freeCount == 0)
+ {
+ gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
+ }
+ else
+ {
+ *Record = Event->freeList;
+ Event->freeList = Event->freeList->next;
+ Event->freeCount -= 1;
+ }
/* Release the mutex. */
gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->freeMutex));
&& (Event->list.source != FromWhere)
)
{
- /* No match - auto-submit the list. */
- status = gckEVENT_Submit(Event, gcvFALSE);
-
- if (status == gcvSTATUS_OUT_OF_RESOURCES)
- {
- /* When we are out of resources, just convert to submit from
- ** PIXEL. */
- Event->list.source = FromWhere = gcvKERNEL_PIXEL;
- }
-
- else
- {
- /* Check for error. */
- gcmkONERROR(status);
- }
+ /* Just convert to submit from PIXEL. */
+ Event->list.source = FromWhere = gcvKERNEL_PIXEL;
}
break;
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HEAP,
"Freeing heap 0x%x (%lu bytes)",
heap, heap->size + gcmSIZEOF(gcskHEAP));
- gcmkVERIFY_OK(gckOS_FreeMemory(Heap->os, heap));
+ gcmkVERIFY_OK(gckOS_FreeVirtualMemory(Heap->os, heap));
}
/* Acquire the mutex again. */
#endif
/* Free the heap. */
- gcmkVERIFY_OK(gckOS_FreeMemory(Heap->os, heap));
+ gcmkVERIFY_OK(gckOS_FreeVirtualMemory(Heap->os, heap));
}
/* Free the mutex. */
/* Allocate a new heap. */
gcmkONERROR(
- gckOS_AllocateMemory(Heap->os,
- Heap->allocationSize,
- &memory));
+ gckOS_AllocateVirtualMemory(Heap->os,
+ Heap->allocationSize,
+ &memory));
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HEAP,
"Allocated heap 0x%x (%lu bytes)",
if (memory != gcvNULL)
{
/* Free the heap memory. */
- gckOS_FreeMemory(Heap->os, memory);
+ gckOS_FreeVirtualMemory(Heap->os, memory);
}
/* Return the status. */
#
##############################################################################
#
-# Auto-generated file on 10/12/2010. Do not edit!!!
+# Auto-generated file on 12/8/2010. Do not edit!!!
#
##############################################################################
#
##############################################################################
#
-# Auto-generated file on 10/12/2010. Do not edit!!!
+# Auto-generated file on 12/8/2010. Do not edit!!!
#
##############################################################################
gcoINDEX_Lock
gcoINDEX_Unlock
gcoINDEX_Load
+ gcoINDEX_LoadHack
gcoINDEX_Bind
gcoINDEX_BindOffset
gcoINDEX_Free
gcoTEXTURE_RenderIntoMipMap
gcoTEXTURE_IsRenderable
gcoTEXTURE_IsComplete
+ gcoTEXTURE_BindTexture
!ENDIF
; gcsRECT
gcoVERTEX_EnableAttribute
gcoVERTEX_DisableAttribute
gcoVERTEX_Bind
+ gcoVERTEX_BindHack
!ENDIF
!IFNDEF VIVANTE_NO_3D
#include <linux/seq_file.h>
#include <linux/mm.h>
#include <linux/mman.h>
+#include <linux/slab.h>
#define _GC_OBJ_ZONE gcvZONE_DEVICE
gcmkVERIFY_ARGUMENT(Device != NULL);
- if (Device->irqLine == 0)
+ if (Device->irqLine < 0)
{
return gcvSTATUS_GENERIC_IO;
}
#define gcdkUSE_MEMORY_RECORD 1
+#ifndef gcdkREPORT_VIDMEM_USAGE
+#define gcdkREPORT_VIDMEM_USAGE 0
+#endif
+
#ifdef ANDROID
#define gcdkREPORT_VIDMEM_LEAK 0
#else
typedef struct MEMORY_RECORD
{
gcuVIDMEM_NODE_PTR node;
+ gceSURF_TYPE type;
+ gctSIZE_T bytes;
struct MEMORY_RECORD * prev;
struct MEMORY_RECORD * next;
#include <linux/device.h>
#include <linux/miscdevice.h>
+#include <linux/slab.h>
#include "gc_hal_kernel_linux.h"
static int major = 199;
module_param(major, int, 0644);
-int irqLine = 0;
+int irqLine = -1;
module_param(irqLine, int, 0644);
long registerMemBase = 0x80000000;
int showArgs = 0;
module_param(showArgs, int, 0644);
+#if ENABLE_GPU_CLOCK_BY_DRIVER
+unsigned long coreClock = 156000000;
+module_param(coreClock, ulong, 0644);
+#endif
+
static int drv_open(struct inode *inode, struct file *filp);
static int drv_release(struct inode *inode, struct file *filp);
static int drv_ioctl(struct inode *inode, struct file *filp,
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_DRIVER,
"Entering drv_close\n");
+ gcmkVERIFY_OK(
+ gckOS_DestroyAllUserSignals(galDevice->os));
+
private = filp->private_data;
gcmkASSERT(private != gcvNULL);
#if gcdkUSE_MEMORY_RECORD
else if (iface.command == gcvHAL_ALLOCATE_VIDEO_MEMORY)
{
+ gctSIZE_T bytes = (iface.u.AllocateVideoMemory.node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
+ ? iface.u.AllocateVideoMemory.node->VidMem.bytes
+ : iface.u.AllocateVideoMemory.node->Virtual.bytes;
CreateMemoryRecord(device->os,
&private->memoryRecordList,
- iface.u.AllocateVideoMemory.node);
+ iface.u.AllocateVideoMemory.node,
+ iface.u.AllocateVideoMemory.type & 0xFF,
+ bytes);
}
else if (iface.command == gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY)
{
+ gctSIZE_T bytes = (iface.u.AllocateLinearVideoMemory.node->VidMem.memory->object.type == gcvOBJ_VIDMEM)
+ ? iface.u.AllocateLinearVideoMemory.node->VidMem.bytes
+ : iface.u.AllocateLinearVideoMemory.node->Virtual.bytes;
CreateMemoryRecord(device->os,
&private->memoryRecordList,
- iface.u.AllocateLinearVideoMemory.node);
+ iface.u.AllocateLinearVideoMemory.node,
+ iface.u.AllocateLinearVideoMemory.type & 0xFF,
+ bytes);
}
else if (iface.command == gcvHAL_FREE_VIDEO_MEMORY)
{
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <asm/atomic.h>
#ifdef NO_DMA_COHERENT
#include <linux/dma-mapping.h>
#define MEMORY_MAP_UNLOCK(os) \
gcmkVERIFY_OK(gckOS_ReleaseMutex((os), (os)->memoryMapLock))
+#if gcdkREPORT_VIDMEM_USAGE
+static gctUINT64 AllocatedSurfaceTotal[12] = {0};
+/*
+ * AllocatedSurfaceMax[12]: Current total memory
+ * AllocatedSurfaceMax[13]: Current total memory in history
+ */
+static gctUINT64 AllocatedSurfaceMax[12 + 2] = {0};
+static char *pszSurfaceType[12] = {"UNKNOWN", "INDEX", "VERTEX", "TEXTURE", "RENDER_TARGET", \
+ "DEPTH", "BITMAP", "TILE_STATUS", "MASK", "SCISSOR", "HIERARCHICAL_DEPTH", \
+ "NUM_TYPES"};
+#endif
+
/******************************************************************************\
********************************** Structures **********************************
\******************************************************************************/
}
gcsPageInfo;
+
static PLINUX_MDL
_CreateMdl(
IN gctINT PID
return gcvSTATUS_OK;
}
+/*******************************************************************************
+**
+** gckOS_AllocateVirtualMemory
+**
+** Allocate virtual memory wrapper.
+**
+** INPUT:
+**
+** gctSIZE_T Bytes
+** Number of bytes to allocate.
+**
+** OUTPUT:
+**
+** gctPOINTER * Memory
+** Pointer to a variable that will hold the allocated memory location.
+*/
+gceSTATUS
+gckOS_AllocateVirtualMemory(
+ IN gckOS Os,
+ IN gctSIZE_T Bytes,
+ OUT gctPOINTER * Memory
+ )
+{
+ gctPOINTER memory;
+ gceSTATUS status;
+
+ gcmkHEADER_ARG("Os=0x%x Bytes=%lu", Os, Bytes);
+
+ /* Verify the arguments. */
+ gcmkVERIFY_ARGUMENT(Bytes > 0);
+ gcmkVERIFY_ARGUMENT(Memory != NULL);
+
+ memory = (gctPOINTER) vmalloc(Bytes);
+
+ if (memory == NULL)
+ {
+ /* Out of memory. */
+ gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
+ }
+
+ /* Return pointer to the memory allocation. */
+ *Memory = memory;
+
+ /* Success. */
+ gcmkFOOTER_ARG("*Memory=%p", *Memory);
+ return gcvSTATUS_OK;
+
+OnError:
+ /* Return the status. */
+ gcmkFOOTER();
+ return status;
+}
+
+/*******************************************************************************
+**
+** gckOS_FreeVirtualMemory
+**
+** Free allocated virtual memory wrapper.
+**
+** INPUT:
+**
+** gctPOINTER Memory
+** Pointer to memory allocation to free.
+**
+** OUTPUT:
+**
+** Nothing.
+*/
+gceSTATUS
+gckOS_FreeVirtualMemory(
+ IN gckOS Os,
+ IN gctPOINTER Memory
+ )
+{
+ gcmkHEADER_ARG("Memory=%p", Memory);
+
+ /* Verify the arguments. */
+ gcmkVERIFY_ARGUMENT(Memory != NULL);
+
+ /* Free the memory from the OS pool. */
+ vfree(Memory);
+
+ /* Success. */
+ gcmkFOOTER_NO();
+ return gcvSTATUS_OK;
+}
+
/*******************************************************************************
**
** gckOS_MapMemory
}
gceSTATUS
-gckOS_CleanProcessSignal(
- gckOS Os,
- gctHANDLE Process
+gckOS_DestroyAllUserSignals(
+ IN gckOS Os
)
{
gctINT signal;
for (signal = 0; signal < Os->signal.tableLen; signal++)
{
if (Os->signal.table[signal] != gcvNULL &&
- ((gcsSIGNAL_PTR)Os->signal.table[signal])->process == Process)
+ ((gcsSIGNAL_PTR)Os->signal.table[signal])->process == (gctHANDLE) current->tgid)
{
gckOS_DestroySignal(Os, Os->signal.table[signal]);
CreateMemoryRecord(
gckOS Os,
MEMORY_RECORD_PTR List,
- gcuVIDMEM_NODE_PTR Node
+ gcuVIDMEM_NODE_PTR Node,
+ gceSURF_TYPE Type,
+ gctSIZE_T Bytes
)
{
MEMORY_RECORD_PTR mr;
MEMORY_LOCK(Os);
mr->node = Node;
+ mr->type = Type;
+ mr->bytes = Bytes;
+
+#if gcdkREPORT_VIDMEM_USAGE
+ AllocatedSurfaceTotal[Type] += Bytes;
+ AllocatedSurfaceMax[Type] = (AllocatedSurfaceMax[Type] > AllocatedSurfaceTotal[Type])
+ ? AllocatedSurfaceMax[Type] : AllocatedSurfaceTotal[Type];
+ AllocatedSurfaceMax[12] += Bytes;
+ if(AllocatedSurfaceMax[12] > AllocatedSurfaceMax[13])
+ {
+ AllocatedSurfaceMax[13] = AllocatedSurfaceMax[12];
+ }
+#endif
mr->prev = List->prev;
mr->next = List;
{
MEMORY_LOCK(Os);
+#if gcdkREPORT_VIDMEM_USAGE
+ AllocatedSurfaceTotal[Mr->type] -= Mr->bytes;
+ AllocatedSurfaceMax[12] -= Mr->bytes;
+#endif
+
Mr->prev->next = Mr->next;
Mr->next->prev = Mr->prev;
MEMORY_LOCK(Os);
+#if gcdkREPORT_VIDMEM_USAGE
+ for (; i < 12; i++) {
+ printk("AllocatedSurfaceTotal[%s]:\t %12lluK, AllocatedSurfaceMax[%s]:\t %12lluK\n",
+ pszSurfaceType[i], AllocatedSurfaceTotal[i]/1024,
+ pszSurfaceType[i], AllocatedSurfaceMax[i]/1024);
+
+ AllocatedSurfaceTotal[i] = 0;
+ AllocatedSurfaceMax[i] = 0;
+ }
+ printk("AllocatedSurfaceMax[unfreed]:\t %12lluK\n", AllocatedSurfaceMax[12]/1024);
+ printk("AllocatedSurfaceMax[total]:\t %12lluK\n", AllocatedSurfaceMax[13]/1024);
+ AllocatedSurfaceMax[12] = AllocatedSurfaceMax[13] = 0;
+ i = 0;
+#endif
+
while (List->next != List)
{
mr = List->next;
{
gceSTATUS status;
gctUINT32 idle = 0, dma = 0, axi = 0, read0 = 0, read1 = 0, write = 0;
+ gctUINT32 debugState = 0, memoryDebug = 0;
+ gctUINT32 debugCmdLow = 0, debugCmdHi = 0;
+ gctUINT32 i, debugSignalsPe, debugSignalsMc;
gcmkHEADER_ARG("Os=0x%x Hardware=0x%x Reason=%d", Os, Hardware, Reason);
read0, read1, write);
}
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x660, &debugState));
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x414, &memoryDebug));
+ gcmkPRINT(" debugState(0x660)=0x%08X memoryDebug(0x414)=0x%08X",
+ debugState, memoryDebug);
+
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x668, &debugCmdLow));
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x66C, &debugCmdHi));
+ gcmkPRINT(" debugCmdLow(0x668)=0x%08X debugCmdHi(0x66C)=0x%08X",
+ debugCmdLow, debugCmdHi);
+
+ for (i = 0; i < 16; i++)
+ {
+ gcmkONERROR(gckOS_WriteRegister(Os, 0x470, i << 16));
+ gcmkPRINT("%d: Write 0x%08X to DebugControl0(0x470)", i, i << 16);
+
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x454, &debugSignalsPe));
+ gcmkPRINT("%d: debugSignalsPe(0x454)=0x%08X", i, debugSignalsPe);
+
+ gcmkPRINT("");
+ }
+
+ for (i = 0; i < 16; i++)
+ {
+ gcmkONERROR(gckOS_WriteRegister(Os, 0x478, i));
+ gcmkPRINT("%d: Write 0x%08X to DebugControl2(0x478)", i, i);
+
+ gcmkONERROR(gckOS_ReadRegister(Os, 0x468, &debugSignalsMc));
+ gcmkPRINT("%d: debugSignalsMc(0x468)=0x%08X", i, debugSignalsMc);
+
+ gcmkPRINT("");
+ }
+
+
gcmkONERROR(gckKERNEL_Recovery(Hardware->kernel));
break;
}
DRIVER_ARGS;
-/* Cleanup the signal table. */
+/* Destroy all user signals of the current process */
gceSTATUS
-gckOS_CleanProcessSignal(
- gckOS Os,
- gctHANDLE Process
- );
+gckOS_DestroyAllUserSignals(
+ IN gckOS Os
+ );
#ifdef gcdkUSE_MEMORY_RECORD
MEMORY_RECORD_PTR
CreateMemoryRecord(
gckOS Os,
MEMORY_RECORD_PTR List,
- gcuVIDMEM_NODE_PTR Node
+ gcuVIDMEM_NODE_PTR Node,
+ gceSURF_TYPE Type,
+ gctSIZE_T Bytes
);
void
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
*
*****************************************************************************
*
-* Auto-generated file on 10/12/2010. Do not edit!!!
+* Auto-generated file on 12/8/2010. Do not edit!!!
*
*****************************************************************************/
#
##############################################################################
#
-# Auto-generated file on 10/12/2010. Do not edit!!!
+# Auto-generated file on 12/8/2010. Do not edit!!!
#
##############################################################################
#
##############################################################################
#
-# Auto-generated file on 10/12/2010. Do not edit!!!
+# Auto-generated file on 12/8/2010. Do not edit!!!
#
##############################################################################