gpu: pvr: add option for extra debugging information
authorImre Deak <imre.deak@nokia.com>
Thu, 1 Apr 2010 14:44:37 +0000 (17:44 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
This is basically a sed -i 's/\<DEBUG\>/CONFIG_PVR_DEBUG_EXTRA' *.[ch] .

Currently a driver built in debug mode will only work together with the
relevant PVR/OGLES user space libraries being built in debug mode too.
This is becuase the ABI is different in debug and release build.

This is not very flexible when one wants to only debug the kernel driver
and not care about the user space part, let alone figuring out where to
get the sources for that and rebuild it in debug mode too.

Mark the current user space dependent debug code parts with a new
CONFIG_PVR_DEBUG_EXTRA option instead of DEBUG, so that later we can
selectively add back basic debugging facilities like debug traces and
mark them with CONFIG_PVR_DEBUG.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
21 files changed:
pvr/Kconfig
pvr/bridged_pvr_bridge.c
pvr/bridged_pvr_bridge.h
pvr/bufferclass_example_linux.c
pvr/event.c
pvr/handle.c
pvr/mm.h
pvr/mmap.c
pvr/module.c
pvr/omaplfb.h
pvr/osfunc.c
pvr/pb.c
pvr/proc.c
pvr/pvr_debug.h
pvr/pvrconfig.h
pvr/ra.c
pvr/resman.c
pvr/sgx_options.h
pvr/sgxutils.c
pvr/syslocal.h
pvr/sysutils.c

index 2021d31..949911c 100644 (file)
@@ -15,6 +15,15 @@ config PVR_TIMING
        bool "Timing"
 endchoice
 
+config PVR_DEBUG_EXTRA
+       bool "Extra debugging info"
+       depends on PVR_DEBUG
+       help
+           This enables extra debugging facilities on top of what you
+           get with setting debug build type above. This effectively
+           changes the driver's ABI, so the user space clients using
+           the driver need to be built in debug mode as well.
+
 config PVR_DEBUG_PDUMP
        tristate "PDUMP debug support"
        depends on PVR
index fa1a371..2f20554 100644 (file)
@@ -2464,7 +2464,7 @@ static int MMU_GetPDDevPAddrBW(u32 ui32BridgeID,
 int DummyBW(u32 ui32BridgeID, void *psBridgeIn, void *psBridgeOut,
            struct PVRSRV_PER_PROCESS_DATA *psPerProc)
 {
-#if !defined(DEBUG)
+#if !defined(CONFIG_PVR_DEBUG_EXTRA)
        PVR_UNREFERENCED_PARAMETER(ui32BridgeID);
 #endif
        PVR_UNREFERENCED_PARAMETER(psBridgeIn);
@@ -2493,7 +2493,7 @@ void _SetDispatchTableEntry(u32 ui32Index, const char *pszIOCName,
                            const char *pszFunctionName)
 {
        static u32 ui32PrevIndex = ~0UL;
-#if !defined(DEBUG)
+#if !defined(CONFIG_PVR_DEBUG_EXTRA)
        PVR_UNREFERENCED_PARAMETER(pszIOCName);
 #endif
 #if !defined(DEBUG_BRIDGE_KM_DISPATCH_TABLE) && !defined(DEBUG_BRIDGE_KM)
index 7249802..1e35ff4 100644 (file)
@@ -133,7 +133,7 @@ void _SetDispatchTableEntry(u32 ui32Index,
 
 #define DISPATCH_TABLE_GAP_THRESHOLD 5
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
 #define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) PVR_ASSERT(X == PVRSRV_GET_BRIDGE_ID(Y))
 #else
 #define PVRSRV_BRIDGE_ASSERT_CMD(X, Y) PVR_UNREFERENCED_PARAMETER(X)
index bfb6ab6..924a27e 100644 (file)
@@ -168,7 +168,7 @@ static int __init BC_Example_ModInit(void)
 
                goto ExitDisable;
        }
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        printk(KERN_ERR DRVNAME ": BC_Example_ModInit: major device %d\n",
               AssignedMajorNumber);
 #endif
index 3dc4ab5..e1c2aee 100644 (file)
@@ -62,7 +62,7 @@ struct PVRSRV_LINUX_EVENT_OBJECT_LIST {
 struct PVRSRV_LINUX_EVENT_OBJECT {
        atomic_t sTimeStamp;
        u32 ui32TimeStampPrevious;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        unsigned ui32Stats;
 #endif
        wait_queue_head_t sWait;
@@ -118,7 +118,7 @@ enum PVRSRV_ERROR LinuxEventObjectDelete(void *hOSEventObjectList,
                if (hOSEventObject) {
                        struct PVRSRV_LINUX_EVENT_OBJECT *psLinuxEventObject =
                            (struct PVRSRV_LINUX_EVENT_OBJECT *)hOSEventObject;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
                        PVR_DPF(PVR_DBG_MESSAGE,
                        "LinuxEventObjectListDelete: Event object waits: %lu",
                                 psLinuxEventObject->ui32Stats);
@@ -144,7 +144,7 @@ static enum PVRSRV_ERROR LinuxEventObjectDeleteCallback(void *pvParam,
        list_del(&psLinuxEventObject->sList);
        write_unlock_bh(&psLinuxEventObjectList->sLock);
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        PVR_DPF(PVR_DBG_MESSAGE,
                 "LinuxEventObjectDeleteCallback: Event object waits: %lu",
                 psLinuxEventObject->ui32Stats);
@@ -186,7 +186,7 @@ enum PVRSRV_ERROR LinuxEventObjectAdd(void *hOSEventObjectList,
        atomic_set(&psLinuxEventObject->sTimeStamp, 0);
        psLinuxEventObject->ui32TimeStampPrevious = 0;
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        psLinuxEventObject->ui32Stats = 0;
 #endif
        init_waitqueue_head(&psLinuxEventObject->sWait);
@@ -254,7 +254,7 @@ enum PVRSRV_ERROR LinuxEventObjectWait(void *hOSEventObject, u32 ui32MSTimeout)
                    (u32) schedule_timeout((s32) ui32TimeOutJiffies);
 
                pvr_lock();
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
                psLinuxEventObject->ui32Stats++;
 #endif
 
index 77e28fc..3372c6a 100644 (file)
@@ -29,7 +29,7 @@
 #include "services_headers.h"
 #include "handle.h"
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 #define        HANDLE_BLOCK_SIZE               1
 #else
 #define        HANDLE_BLOCK_SIZE               256
@@ -187,7 +187,7 @@ static inline IMG_BOOL HandleListIsEmpty(u32 ui32Index,
 
        bIsEmpty = (IMG_BOOL) (psList->ui32Next == ui32Index);
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        {
                IMG_BOOL bIsEmpty2;
 
@@ -199,7 +199,7 @@ static inline IMG_BOOL HandleListIsEmpty(u32 ui32Index,
        return bIsEmpty;
 }
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 static inline IMG_BOOL NoChildren(struct PVRSRV_HANDLE_BASE *psBase,
                                  struct sHandle *psHandle)
 {
@@ -1200,7 +1200,7 @@ static enum PVRSRV_ERROR PVRSRVHandleBatchCommitOrRelease(
                ui32IndexPlusOne = ui32NextIndexPlusOne;
        }
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        if (psBase->ui32TotalHandCountPreBatch != psBase->ui32TotalHandCount) {
                u32 ui32Delta =
                    psBase->ui32TotalHandCount -
index 9484363..777c49c 100644 (file)
--- a/pvr/mm.h
+++ b/pvr/mm.h
@@ -260,7 +260,7 @@ static inline enum LINUX_MEM_AREA_TYPE LinuxMemAreaRootType(struct LinuxMemArea
 
 const char *LinuxMemAreaTypeToString(enum LINUX_MEM_AREA_TYPE eMemAreaType);
 
-#if defined(DEBUG) || defined(DEBUG_LINUX_MEM_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MEM_AREAS)
 const char *HAPFlagsToString(u32 ui32Flags);
 #endif
 
index 240d121..6bc58e1 100644 (file)
@@ -118,7 +118,7 @@ static struct KV_OFFSET_STRUCT *CreateOffsetStruct(struct LinuxMemArea
                                                   u32 ui32RealByteSize)
 {
        struct KV_OFFSET_STRUCT *psOffsetStruct;
-#if defined(DEBUG) || defined(DEBUG_LINUX_MMAP_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MMAP_AREAS)
        const char *pszName =
            LinuxMemAreaTypeToString(LinuxMemAreaRootType(psLinuxMemArea));
 #endif
@@ -714,7 +714,7 @@ unlock_and_return:
 enum PVRSRV_ERROR PVRMMapRegisterArea(struct LinuxMemArea *psLinuxMemArea)
 {
        enum PVRSRV_ERROR eError = PVRSRV_ERROR_GENERIC;
-#if defined(DEBUG) || defined(DEBUG_LINUX_MMAP_AREAS)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(DEBUG_LINUX_MMAP_AREAS)
        const char *pszName =
            LinuxMemAreaTypeToString(LinuxMemAreaRootType(psLinuxMemArea));
 #endif
index 29062b2..3ba1aea 100644 (file)
@@ -55,7 +55,7 @@
 
 #define DRVNAME                "pvrsrvkm"
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 static int debug = DBGPRIV_WARNING;
 #include <linux/moduleparam.h>
 module_param(debug, int, 0);
@@ -218,7 +218,7 @@ static int __init pvr_init(void)
 
        pvr_init_lock();
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        PVRDebugSetLevel(debug);
 #endif
 
index fe4b2bb..34e7a6d 100644 (file)
@@ -115,7 +115,7 @@ struct OMAPLFB_DEVINFO {
 
 #define        OMAPLFB_PAGE_ROUNDUP(x) (((x) + OMAPLFB_PAGE_MASK) & OMAPLFB_PAGE_TRUNC)
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 #define        DEBUG_PRINTK(x) printk x
 #else
 #define        DEBUG_PRINTK(x)
index c0d0ba7..907ccc6 100644 (file)
@@ -1237,7 +1237,7 @@ struct sWrapMemInfo {
        struct IMG_SYS_PHYADDR *psPhysAddr;
        int iPageOffset;
        int iContiguous;
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        u32 ulStartAddr;
        u32 ulBeyondEndAddr;
        struct vm_area_struct *psVMArea;
@@ -1384,7 +1384,7 @@ enum PVRSRV_ERROR OSAcquirePhysPageAddr(void *pvCPUVAddr, u32 ui32Bytes,
        }
        memset(psInfo, 0, sizeof(*psInfo));
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        psInfo->ulStartAddr = ulStartAddrOrig;
        psInfo->ulBeyondEndAddr = ulBeyondEndAddrOrig;
 #endif
@@ -1462,7 +1462,7 @@ enum PVRSRV_ERROR OSAcquirePhysPageAddr(void *pvCPUVAddr, u32 ui32Bytes,
 
                goto error_release_mmap_sem;
        }
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        psInfo->psVMArea = psVMArea;
 #endif
 
index a614069..ffd8f69 100644 (file)
--- a/pvr/pb.c
+++ b/pvr/pb.c
@@ -232,7 +232,7 @@ static enum PVRSRV_ERROR SGXCleanupSharedPBDescCallback(void *pvParam,
 static enum PVRSRV_ERROR SGXCleanupSharedPBDescCreateLockCallback(void *pvParam,
                                                             u32 ui32Param)
 {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        struct PVRSRV_PER_PROCESS_DATA *psPerProc =
            (struct PVRSRV_PER_PROCESS_DATA *)pvParam;
        PVR_ASSERT(psPerProc == psPerProcCreateSharedPB);
index 0ade0b9..613d3de 100644 (file)
@@ -241,7 +241,7 @@ int CreateProcEntries(void)
 
                return -ENOMEM;
        }
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        if (CreateProcEntry
            ("debug_level", PVRDebugProcGetLevel, PVRDebugProcSetLevel, NULL)) {
                PVR_DPF(PVR_DBG_ERROR,
@@ -301,7 +301,7 @@ void RemovePerProcessProcDir(struct PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
 
 void RemoveProcEntries(void)
 {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        RemoveProcEntry("debug_level");
 #endif
        RemoveProcEntry("queue");
index a47d718..23ebe65 100644 (file)
@@ -52,7 +52,7 @@
 #define PVR_DBG_CALLTRACE              DBGPRIV_CALLTRACE
 #define PVR_DBG_ALLOC                  DBGPRIV_ALLOC
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
 
 #define PVR_ASSERT(EXPR)                                                    \
        do {                                                                 \
index 54f8549..eeaa95e 100644 (file)
@@ -17,7 +17,7 @@
 # define NO_HARDWARE                   1
 #endif
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 # define DEBUG_LINUX_MEMORY_ALLOCATIONS        1
 # define DEBUG_LINUX_MEM_AREAS         1
 # define DEBUG_LINUX_MMAP_AREAS                1
index 4d002a6..4c71af1 100644 (file)
--- a/pvr/ra.c
+++ b/pvr/ra.c
@@ -73,7 +73,7 @@ struct RA_ARENA {
 #ifdef RA_STATS
        struct RA_STATISTICS sStatistics;
 #endif
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
 #define PROC_NAME_SIZE         32
        char szProcInfoName[PROC_NAME_SIZE];
        char szProcSegsName[PROC_NAME_SIZE];
@@ -81,14 +81,14 @@ struct RA_ARENA {
 #endif
 };
 
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
 static int RA_DumpSegs(char *page, char **start, off_t off, int count, int *eof,
                       void *data);
 static int RA_DumpInfo(char *page, char **start, off_t off, int count, int *eof,
                       void *data);
 #endif
 
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
 static char *ReplaceSpaces(char *const pS)
 {
        char *pT;
@@ -641,7 +641,7 @@ struct RA_ARENA *RA_Create(char *name, u32 base, size_t uSize,
        pArena->sStatistics.uExportCount = 0;
 #endif
 
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
        if (strcmp(pArena->name, "") != 0) {
                int ret;
                int (*pfnCreateProcEntry) (const char *, read_proc_t,
@@ -732,7 +732,7 @@ void RA_Delete(struct RA_ARENA *pArena)
                pArena->sStatistics.uSpanCount--;
 #endif
        }
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
        {
                void (*pfnRemoveProcEntry) (const char *);
 
@@ -924,7 +924,8 @@ IMG_BOOL RA_GetNextLiveSegment(void *hArena,
        return IMG_FALSE;
 }
 
-#if (defined(CONFIG_PROC_FS) && defined(DEBUG)) || defined(RA_STATS)
+#if (defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)) || \
+     defined(RA_STATS)
 static char *_BTType(int eType)
 {
        switch (eType) {
@@ -968,7 +969,7 @@ void RA_Dump(struct RA_ARENA *pArena)
 }
 #endif
 
-#if defined(CONFIG_PROC_FS) && defined(DEBUG)
+#if defined(CONFIG_PROC_FS) && defined(CONFIG_PVR_DEBUG_EXTRA)
 static int RA_DumpSegs(char *page, char **start, off_t off, int count, int *eof,
                       void *data)
 {
index ccb1664..59e8a17 100644 (file)
@@ -48,7 +48,7 @@ static DEFINE_SEMAPHORE(lock);
 #define RESMAN_SIGNATURE 0x12345678
 
 struct RESMAN_ITEM {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        u32 ui32Signature;
 #endif
        struct RESMAN_ITEM **ppsThis;
@@ -64,7 +64,7 @@ struct RESMAN_ITEM {
 };
 
 struct RESMAN_CONTEXT {
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        u32 ui32Signature;
 #endif
        struct RESMAN_CONTEXT **ppsThis;
@@ -91,7 +91,7 @@ static int FreeResourceByCriteria(struct RESMAN_CONTEXT *psContext,
                                           u32 ui32Param,
                                           IMG_BOOL bExecuteCallback);
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 static void ValidateResList(struct RESMAN_LIST *psResList);
 #define VALIDATERESLIST() ValidateResList(gpsResList)
 #else
@@ -144,7 +144,7 @@ enum PVRSRV_ERROR PVRSRVResManConnect(void *hPerProc,
 
                return eError;
        }
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        psResManContext->ui32Signature = RESMAN_SIGNATURE;
 #endif
        psResManContext->psResItemList = NULL;
@@ -274,7 +274,7 @@ struct RESMAN_ITEM *ResManRegisterRes(struct RESMAN_CONTEXT *psResManContext,
                return (struct RESMAN_ITEM *)NULL;
        }
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        psNewResItem->ui32Signature = RESMAN_SIGNATURE;
 #endif
        psNewResItem->ui32ResType = ui32ResType;
@@ -349,7 +349,7 @@ enum PVRSRV_ERROR ResManDissociateRes(struct RESMAN_ITEM *psResItem,
                PVR_DBG_BREAK;
                return PVRSRV_ERROR_INVALID_PARAMS;
        }
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        PVR_ASSERT(psResItem->ui32Signature == RESMAN_SIGNATURE);
 #endif
 
@@ -385,7 +385,7 @@ enum PVRSRV_ERROR ResManFindResourceByPtr(
                PVR_DBG_BREAK;
                return PVRSRV_ERROR_INVALID_PARAMS;
        }
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
        PVR_ASSERT(psItem->ui32Signature == RESMAN_SIGNATURE);
 #endif
 
@@ -517,7 +517,7 @@ static int FreeResourceByCriteria(struct RESMAN_CONTEXT *psResManContext,
        return freed;
 }
 
-#ifdef DEBUG
+#ifdef CONFIG_PVR_DEBUG_EXTRA
 static void ValidateResList(struct RESMAN_LIST *psResList)
 {
        struct RESMAN_ITEM *psCurItem, **ppsThisItem;
index ce59e49..67402fe 100644 (file)
@@ -24,7 +24,7 @@
  *
  ******************************************************************************/
 
-#if defined(DEBUG) || defined(INTERNAL_TEST)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(INTERNAL_TEST)
 #define DEBUG_SET_OFFSET                               OPTIONS_BIT0
 #define OPTIONS_BIT0                                   0x1
 #else
index feb3504..5b04f04 100644 (file)
@@ -703,7 +703,7 @@ enum PVRSRV_ERROR SGX2DQueryBlitsCompleteKM(
        PVR_DPF(PVR_DBG_ERROR,
                 "SGX2DQueryBlitsCompleteKM: Timed out. Ops pending.");
 
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
        {
                struct PVRSRV_SYNC_DATA *psSyncData = psSyncInfo->psSyncData;
 
index de31046..0cda586 100644 (file)
@@ -85,7 +85,7 @@ struct SYS_SPECIFIC_DATA {
        struct clk *psSGX_FCK;
        struct clk *psSGX_ICK;
        struct clk *psMPU_CK;
-#if defined(DEBUG) || defined(TIMING)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(TIMING)
        struct clk *psGPT11_FCK;
        struct clk *psGPT11_ICK;
        void __iomem *gpt_base;
index 5729b5a..52c2584 100644 (file)
@@ -90,7 +90,7 @@ static int vdd2_post_func(struct notifier_block *n, unsigned long event,
 
        if (atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0 &&
            gpsSysSpecificData->bSGXInitComplete) {
-#if defined(DEBUG)
+#if defined(CONFIG_PVR_DEBUG_EXTRA)
                unsigned long rate;
 
                rate = clk_get_rate(gpsSysSpecificData->psSGX_FCK);
@@ -520,7 +520,7 @@ static void CleanupSgxClocks(struct SYS_DATA *psSysData)
        }
 }
 
-#if defined(DEBUG) || defined(TIMING)
+#if defined(CONFIG_PVR_DEBUG_EXTRA) || defined(TIMING)
 static inline u32 gpt_read_reg(struct SYS_DATA *psSysData, u32 reg)
 {
        struct SYS_SPECIFIC_DATA *psSysSpecData = psSysData->pvSysSpecificData;