[Mesa-dev] [PATCH 27/45] st/nine: Print GUID instead of pointer

Axel Davy axel.davy at ens.fr
Fri Jan 29 08:08:51 PST 2016


From: Patrick Rudolph <siro at das-labor.org>

To ease debugging print the GUID instead of the pointer to it.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/guid.c      | 18 ++++++++++++++++++
 src/gallium/state_trackers/nine/guid.h      |  4 ++++
 src/gallium/state_trackers/nine/resource9.c | 14 ++++++++------
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/nine/guid.c b/src/gallium/state_trackers/nine/guid.c
index 5034feb..5e63d2f 100644
--- a/src/gallium/state_trackers/nine/guid.c
+++ b/src/gallium/state_trackers/nine/guid.c
@@ -20,6 +20,7 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#include <stdio.h>
 #include "guid.h"
 
 const GUID IID_IUnknown = { 0x00000000, 0x0000, 0x0000, { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } };
@@ -64,3 +65,20 @@ GUID_equal( const GUID *a,
     }
     return TRUE;
 }
+
+char* GUID_sprintf(char *guid_str, REFGUID id) {
+    sprintf( guid_str,
+             "{%08X,%04X,%04X,%02X%02X%02X%02X%02X%02X%02X%02X}",
+             id->Data1,
+             id->Data2,
+             id->Data3,
+             id->Data4[0],
+             id->Data4[1],
+             id->Data4[2],
+             id->Data4[3],
+             id->Data4[4],
+             id->Data4[5],
+             id->Data4[6],
+             id->Data4[7]);
+    return guid_str;
+}
diff --git a/src/gallium/state_trackers/nine/guid.h b/src/gallium/state_trackers/nine/guid.h
index 1f9ff00..af8f081 100644
--- a/src/gallium/state_trackers/nine/guid.h
+++ b/src/gallium/state_trackers/nine/guid.h
@@ -33,4 +33,8 @@ boolean
 GUID_equal( const GUID *a,
             const GUID *b );
 
+char*
+GUID_sprintf( char *guid_str,
+              REFGUID id );
+
 #endif /* _NINE_GUID_H_ */
diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c
index 6d91533..f3c2689 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -34,7 +34,6 @@
 
 #define DBG_CHANNEL DBG_RESOURCE
 
-
 HRESULT
 NineResource9_ctor( struct NineResource9 *This,
                     struct NineUnknownParams *pParams,
@@ -117,9 +116,10 @@ NineResource9_SetPrivateData( struct NineResource9 *This,
     enum pipe_error err;
     struct pheader *header;
     const void *user_data = pData;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p pData=%p SizeOfData=%u Flags=%x\n",
-        This, refguid, pData, SizeOfData, Flags);
+    DBG("This=%p GUID=%s pData=%p SizeOfData=%u Flags=%x\n",
+        This, GUID_sprintf(guid_str, refguid), pData, SizeOfData, Flags);
 
     if (Flags & D3DSPD_IUNKNOWN)
         user_assert(SizeOfData == sizeof(IUnknown *), D3DERR_INVALIDCALL);
@@ -162,9 +162,10 @@ NineResource9_GetPrivateData( struct NineResource9 *This,
 {
     struct pheader *header;
     DWORD sizeofdata;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p pData=%p pSizeOfData=%p\n",
-        This, refguid, pData, pSizeOfData);
+    DBG("This=%p GUID=%s pData=%p pSizeOfData=%p\n",
+        This, GUID_sprintf(guid_str, refguid), pData, pSizeOfData);
 
     header = util_hash_table_get(This->pdata, refguid);
     if (!header) { return D3DERR_NOTFOUND; }
@@ -191,8 +192,9 @@ NineResource9_FreePrivateData( struct NineResource9 *This,
                                REFGUID refguid )
 {
     struct pheader *header;
+    char guid_str[64];
 
-    DBG("This=%p refguid=%p\n", This, refguid);
+    DBG("This=%p GUID=%s\n", This, GUID_sprintf(guid_str, refguid));
 
     header = util_hash_table_get(This->pdata, refguid);
     if (!header)
-- 
2.7.0



More information about the mesa-dev mailing list