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

junyan.he at inbox.com junyan.he at inbox.com
Tue Jul 19 11:25:49 UTC 2016


From: Junyan He <junyan.he at intel.com>

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

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);
 
-- 
1.7.9.5

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
Check it out at http://www.inbox.com/marineaquarium




More information about the Beignet mailing list