From 366196a2ccdecfb8fd04137ec5bad7f4a2f1c43c Mon Sep 17 00:00:00 2001
From: Ilyes Gouta <ilyes.gouta@st.com>
Date: Thu, 19 Dec 2013 15:03:17 -0500
Subject: [PATCH - RFC 1/2] core: debugging messages for the shared surface
 pool

Signed-off-by: Ilyes Gouta <ilyes.gouta@st.com>
---
 src/core/shared_surface_pool.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/core/shared_surface_pool.c b/src/core/shared_surface_pool.c
index 1321a97..6337813 100644
--- a/src/core/shared_surface_pool.c
+++ b/src/core/shared_surface_pool.c
@@ -40,6 +40,8 @@
 
 #include <misc/conf.h>
 
+D_DEBUG_DOMAIN( Core_SharedSurfacePool, "Core/SharedSurfacePool", "Core Shared Surface Pool" );
+
 /**********************************************************************************************************************/
 
 typedef struct {
@@ -90,6 +92,8 @@ sharedInitPool( CoreDFB                    *core,
      SharedPoolData      *data  = pool_data;
      SharedPoolLocalData *local = pool_local;
 
+     D_DEBUG_AT( Core_SharedSurfacePool, "%s()\n", __FUNCTION__ );
+
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
      D_ASSERT( ret_desc != NULL );
 
@@ -141,6 +145,8 @@ sharedAllocateBuffer( CoreSurfacePool       *pool,
      SharedPoolData       *data  = pool_data;
      SharedAllocationData *alloc = alloc_data;
 
+     D_DEBUG_AT( Core_SharedSurfacePool, "%s()\n", __FUNCTION__ );
+
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
      D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
 
@@ -159,6 +165,8 @@ sharedAllocateBuffer( CoreSurfacePool       *pool,
           dfb_surface_calc_buffer_size( surface, dfb_config->system_surface_align_pitch, 0,
                                         &alloc->pitch, &alloc->size );
 
+          D_DEBUG_AT( Core_SharedSurfacePool, "Allocating %d bytes for allocation 0x%p\n", alloc->size + dfb_config->system_surface_align_base, alloc );
+
           alloc->addr = SHMALLOC( data->shmpool, alloc->size + dfb_config->system_surface_align_base );
           if ( !alloc->addr )
                return D_OOSHM();
@@ -176,6 +184,8 @@ sharedAllocateBuffer( CoreSurfacePool       *pool,
 
           dfb_surface_calc_buffer_size( surface, 8, 0, &alloc->pitch, &alloc->size );
 
+          D_DEBUG_AT( Core_SharedSurfacePool, "Allocating %d bytes for allocation 0x%p\n", alloc->size, alloc );
+
           alloc->addr = SHMALLOC( data->shmpool, alloc->size );
           if (!alloc->addr)
                return D_OOSHM();
@@ -200,8 +210,12 @@ sharedDeallocateBuffer( CoreSurfacePool       *pool,
      SharedPoolData       *data  = pool_data;
      SharedAllocationData *alloc = alloc_data;
 
+     D_DEBUG_AT( Core_SharedSurfacePool, "%s()\n", __FUNCTION__ );
+
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
 
+     D_DEBUG_AT( Core_SharedSurfacePool, "Freeing %d bytes of allocation 0x%p\n", alloc->size, alloc );
+
      SHFREE( data->shmpool, alloc->addr );
 
      return DFB_OK;
@@ -217,6 +231,8 @@ sharedLock( CoreSurfacePool       *pool,
 {
      SharedAllocationData *alloc = alloc_data;
 
+     D_DEBUG_AT( Core_SharedSurfacePool, "%s()\n", __FUNCTION__ );
+
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
      D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
      D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
@@ -240,6 +256,8 @@ sharedUnlock( CoreSurfacePool       *pool,
               void                  *alloc_data,
               CoreSurfaceBufferLock *lock )
 {
+     D_DEBUG_AT( Core_SharedSurfacePool, "%s()\n", __FUNCTION__ );
+
      D_MAGIC_ASSERT( pool, CoreSurfacePool );
      D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
      D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
-- 
1.7.7.6

