egl: Add storage for EGL_KHR_debug's state to EGL objects
authorKyle Brenneman <kbrenneman@nvidia.com>
Mon, 12 Sep 2016 20:15:10 +0000 (16:15 -0400)
committerAdam Jackson <ajax@redhat.com>
Wed, 14 Sep 2016 15:45:58 +0000 (11:45 -0400)
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/main/eglcurrent.c
src/egl/main/eglcurrent.h
src/egl/main/egldisplay.h
src/egl/main/eglglobals.c
src/egl/main/eglglobals.h

index 2a225bc48357889dbddd2af0fe2a891bdae36f58..f093becc7b48e4f6b0d5eff2e9b8a07044096dea 100644 (file)
 #include "eglcurrent.h"
 #include "eglglobals.h"
 
-
 /* This should be kept in sync with _eglInitThreadInfo() */
 #define _EGL_THREAD_INFO_INITIALIZER \
-   { EGL_SUCCESS, NULL, 0 }
+   { EGL_SUCCESS, NULL, 0, NULL, NULL, NULL }
 
 /* a fallback thread info to guarantee that every thread always has one */
 static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
index b922435e31f9ac217002637bdac6c0cd5445688a..b2638fd7ab5ae0e901c98f2324ad223417098196 100644 (file)
@@ -54,6 +54,14 @@ struct _egl_thread_info
    EGLint LastError;
    _EGLContext *CurrentContext;
    EGLenum CurrentAPI;
+   EGLLabelKHR Label;
+
+   /**
+    * The name of the EGL function that's being called at the moment. This is
+    * used to report the function name to the EGL_KHR_debug callback.
+    */
+   const char *CurrentFuncName;
+   EGLLabelKHR CurrentObjectLabel;
 };
 
 
index 6f3340ef40433b0710eb998cd517d02a109b0d89..22fb5c82c6ef6b6d18f4958091abe5b1e11711d6 100644 (file)
@@ -79,6 +79,8 @@ struct _egl_resource
    EGLBoolean IsLinked;
    EGLint RefCount;
 
+   EGLLabelKHR Label;
+
    /* used to link resources of the same type */
    _EGLResource *Next;
 };
@@ -165,6 +167,8 @@ struct _egl_display
 
    /* lists of resources */
    _EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
+
+   EGLLabelKHR Label;
 };
 
 
index 04bb5ba9d929b8dd6da7cfdbf5c9ea4c3f2443e4..dca5c21f0dcba5096c802f56f388667c58665202 100644 (file)
@@ -56,7 +56,10 @@ struct _egl_global _eglGlobal =
    " EGL_EXT_platform_wayland"
    " EGL_EXT_platform_x11"
    " EGL_KHR_client_get_all_proc_addresses"
-   " EGL_MESA_platform_gbm"
+   " EGL_MESA_platform_gbm",
+
+   NULL, /* debugCallback */
+   _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR, /* debugTypesEnabled */
 };
 
 
index ae1b75b4545555e204de60f2bf908f43e2f47695..dfa357759b8aedd868b2a8bc725f784a926718f5 100644 (file)
 
 #include "egltypedefs.h"
 
+enum
+{
+    _EGL_DEBUG_BIT_CRITICAL = 0x1,
+    _EGL_DEBUG_BIT_ERROR = 0x2,
+    _EGL_DEBUG_BIT_WARN = 0x4,
+    _EGL_DEBUG_BIT_INFO = 0x8,
+};
 
 /**
  * Global library data
@@ -51,6 +58,9 @@ struct _egl_global
    void (*AtExitCalls[10])(void);
 
    const char *ClientExtensionString;
+
+   EGLDEBUGPROCKHR debugCallback;
+   unsigned int debugTypesEnabled;
 };