[Beignet] [PATCH] Add cl_mem_map_gtt and cl_mem_unmap_gtt
Homer Hsing
homer.xing at intel.com
Sun Apr 21 17:48:04 PDT 2013
cl_mem_map_gtt calls cl_buffer_map_gtt.
cl_mem_unmap_gtt calls cl_buffer_unmap_gtt.
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
src/cl_mem.c | 15 +++++++++++++++
src/cl_mem.h | 6 ++++++
2 files changed, 21 insertions(+)
diff --git a/src/cl_mem.c b/src/cl_mem.c
index 4bbaee4..e551c1f 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -480,6 +480,21 @@ cl_mem_unmap(cl_mem mem)
return CL_SUCCESS;
}
+LOCAL void*
+cl_mem_map_gtt(cl_mem mem)
+{
+ cl_buffer_map_gtt(mem->bo);
+ assert(cl_buffer_get_virtual(mem->bo));
+ return cl_buffer_get_virtual(mem->bo);
+}
+
+LOCAL cl_int
+cl_mem_unmap_gtt(cl_mem mem)
+{
+ cl_buffer_unmap_gtt(mem->bo);
+ return CL_SUCCESS;
+}
+
LOCAL cl_int
cl_mem_pin(cl_mem mem)
{
diff --git a/src/cl_mem.h b/src/cl_mem.h
index 836deb4..0294ee9 100644
--- a/src/cl_mem.h
+++ b/src/cl_mem.h
@@ -75,6 +75,12 @@ extern void *cl_mem_map(cl_mem);
/* Unmap a memory object */
extern cl_int cl_mem_unmap(cl_mem);
+/* Directly map a memory object in GTT mode */
+extern void *cl_mem_map_gtt(cl_mem);
+
+/* Unmap a memory object in GTT mode */
+extern cl_int cl_mem_unmap_gtt(cl_mem);
+
/* Pin/unpin the buffer in memory (you must be root) */
extern cl_int cl_mem_pin(cl_mem);
extern cl_int cl_mem_unpin(cl_mem);
--
1.8.1.2
More information about the Beignet
mailing list