[03/11] Runtime: Apply base object to cl_platform_id

Submitted by junyan.he@inbox.com on July 19, 2016, 11:25 a.m.

Details

Message ID 1468927557-5051-3-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com July 19, 2016, 11:25 a.m.
From: Junyan He <junyan.he@intel.com>

Signed-off-by: Junyan He <junyan.he@intel.com>
---
 src/cl_platform_id.c |    2 +-
 src/cl_platform_id.h |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/cl_platform_id.c b/src/cl_platform_id.c
index d7a1f68..400f6f7 100644
--- a/src/cl_platform_id.c
+++ b/src/cl_platform_id.c
@@ -31,7 +31,6 @@ 
     .JOIN(FIELD,_sz) = sizeof(STRING),
 
 static struct _cl_platform_id intel_platform_data = {
-  INIT_ICD(dispatch)
   DECL_INFO_STRING(profile, "FULL_PROFILE")
   DECL_INFO_STRING(version, LIBCL_VERSION_STRING)
   DECL_INFO_STRING(name, "Intel Gen OCL Driver")
@@ -51,6 +50,7 @@  cl_get_platform_default(void)
     return intel_platform;
 
   intel_platform = &intel_platform_data;
+  CL_OBJECT_INIT_BASE(intel_platform, CL_OBJECT_PLATFORM_MAGIC);
   cl_intel_platform_extension_init(intel_platform);
   return intel_platform;
 }
diff --git a/src/cl_platform_id.h b/src/cl_platform_id.h
index 865317a..11e90d0 100644
--- a/src/cl_platform_id.h
+++ b/src/cl_platform_id.h
@@ -23,12 +23,12 @@ 
 #include "CL/cl.h"
 #include "cl_internals.h"
 #include "cl_extensions.h"
-#include "cl_khr_icd.h"
+#include "cl_base_object.h"
 #include "src/OCLConfig.h"
 #include "src/git_sha1.h"
 
 struct _cl_platform_id {
-  DEFINE_ICD(dispatch)
+  _cl_base_object base;
   const char *profile;
   const char *version;
   const char *name;
@@ -44,6 +44,9 @@  struct _cl_platform_id {
   struct cl_extensions *internal_extensions;
 };
 
+#define CL_OBJECT_PLATFORM_MAGIC 0xaacdbb00123ccd85LL
+#define CL_OBJECT_IS_PLATFORM(obj) (((cl_base_object)obj)->magic == CL_OBJECT_PLATFORM_MAGIC)
+
 /* Return the default platform */
 extern cl_platform_id cl_get_platform_default(void);