[Mesa-dev] [PATCH 2/2] clover: clGetMemObjectInfo report sub buffer inherited flags
EdB
edb+mesa at sigluy.net
Tue Nov 11 08:42:43 PST 2014
when call cbCreateSubBuffer when followings memory flags are not set
they should be inherited from parent buffer.
Report them when calling clGetMemObjectInfo
flags:
CL_MEM_READ_WRITE, CL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY,
CL_MEM_USE_HOST_PTR, CL_MEM_ALLOC_HOST_PTR, CL_MEM_COPY_HOST_PTR,
CL_MEM_HOST_WRITE_ONLY, CL_MEM_HOST_READ_ONLY, CL_MEM_HOST_NO_ACCESS
---
src/gallium/state_trackers/clover/api/memory.cpp | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
index fe01d3f..4843cff 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -226,9 +226,22 @@ clGetMemObjectInfo(cl_mem d_mem, cl_mem_info param,
buf.as_scalar<cl_mem_object_type>() = mem.type();
break;
- case CL_MEM_FLAGS:
- buf.as_scalar<cl_mem_flags>() = mem.flags();
+ case CL_MEM_FLAGS: {
+ cl_mem_flags flags = mem.flags();
+
+ //inherited flags
+ sub_buffer *sub = dynamic_cast<sub_buffer *>(&mem);
+ if (sub) {
+ flags = flags | (sub->parent().flags() &
+ (CL_MEM_READ_WRITE | CL_MEM_READ_ONLY | CL_MEM_WRITE_ONLY |
+ CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR |
+ CL_MEM_COPY_HOST_PTR |
+ CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_READ_ONLY |
+ CL_MEM_HOST_NO_ACCESS));
+ }
+ buf.as_scalar<cl_mem_flags>() = flags;
break;
+ }
case CL_MEM_SIZE:
buf.as_scalar<size_t>() = mem.size();
--
1.9.3
More information about the mesa-dev
mailing list