Remove redundant/recursive checks in unmap operations

- Some of the paths were made only for ULTs
- Params like mappedPtr were ignored
- Improve confusing method names
- Fix for memory leak in map shared buffer path (not tested code)

Change-Id: I8a69035f1d1c340f2d131a6f8d7e13116e3ddabc
This commit is contained in:
Dunajski, Bartosz
2018-02-01 13:40:30 +01:00
parent ac3c032af0
commit 844f956244
18 changed files with 163 additions and 111 deletions

View File

@@ -415,44 +415,6 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
return sharedImage;
}
cl_int Image::unmapObj(CommandQueue *cmdQ, void *ptr,
cl_uint numEventsInWaitList,
const cl_event *eventWaitList,
cl_event *event) {
if (!allowTiling() && !peekSharingHandler()) {
return cmdQ->enqueueUnmapMemObject(this, ptr, numEventsInWaitList, eventWaitList, event);
}
if (ptr != getMappedPtr()) {
return CL_INVALID_VALUE;
}
cl_int retVal;
size_t Region[] = {mappedRegion[0] ? mappedRegion[0] : 1,
+mappedRegion[1] ? mappedRegion[1] : 1,
+mappedRegion[2] ? mappedRegion[2] : 1};
size_t rowPitch = getHostPtrRowPitch();
size_t slicePitch = getHostPtrSlicePitch();
retVal = cmdQ->enqueueWriteImage(this,
CL_FALSE, mappedOrigin, Region, rowPitch, slicePitch, getMappedPtr(),
numEventsInWaitList,
eventWaitList,
event);
bool mustCallFinish = true;
if (!(flags & CL_MEM_USE_HOST_PTR)) {
mustCallFinish = true;
} else {
mustCallFinish = (CommandQueue::getTaskLevelFromWaitList(cmdQ->taskLevel, numEventsInWaitList, eventWaitList) != Event::eventNotReady);
}
if (mustCallFinish) {
cmdQ->finish(true);
}
return retVal;
}
cl_int Image::validate(Context *context,
cl_mem_flags flags,
const SurfaceFormatInfo *surfaceFormat,