mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user