2
0

P4 to Git Change 1133818 by gandryey@gera-w8 on 2015/03/24 11:30:12

ECR #304775 - Mipmaps support in OCL
	- Add support for clEnqueueMapImage/Unmap functionality

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_memobj.cpp#76 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#175 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#241 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#503 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#140 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#120 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#212 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#356 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#89 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#46 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#27 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#14 edit
Este cometimento está contido em:
foreman
2015-03-24 11:45:49 -04:00
ascendente 58b20f1bc4
cometimento 20974393b1
10 ficheiros modificados com 81 adições e 99 eliminações
+34
Ver ficheiro
@@ -1150,6 +1150,17 @@ VirtualGPU::submitMapMemory(amd::MapMemoryCommand& vcmd)
}
}
else {
// Validate if it's a view for a map of mip level
if (memory->isUnmapWrite() && (vcmd.memory().parent() != NULL)) {
amd::Image* amdImage = vcmd.memory().parent()->asImage();
if ((amdImage != NULL) && (amdImage->getMipLevels() > 1)) {
// Save map write info in the parent object
dev().getGpuMemory(amdImage)->saveMapInfo(
vcmd.origin(), vcmd.size(),
vcmd.mapFlags(), vcmd.isEntireMemory(),
vcmd.memory().asImage());
}
}
if (!blitMgr().copyImageToBuffer(*memory,
*memory->mapMemory(), vcmd.origin(), dstOrigin,
vcmd.size(), vcmd.isEntireMemory())) {
@@ -1175,6 +1186,20 @@ VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand& vcmd)
profilingBegin(vcmd, true);
gpu::Memory* memory = dev().getGpuMemory(&vcmd.memory());
amd::Memory* owner = memory->owner();
bool unmapMip = false;
// Check if image is a mipmap and assign a saved view
amd::Image* amdImage = owner->asImage();
if ((amdImage != NULL) && (amdImage->getMipLevels() > 1) &&
memory->isUnmapWrite() &&
(memory->writeMapInfo()->baseMip_ != NULL)) {
// Clear unmap flags from the parent image
memory->clearUnmapFlags();
// Assign mip level view
amdImage = memory->writeMapInfo()->baseMip_;
memory = dev().getGpuMemory(amdImage);
unmapMip = true;
}
// We used host memory
if ((owner->getHostMem() != NULL) && memory->isDirectMap()) {
@@ -1249,6 +1274,11 @@ VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand& vcmd)
}
}
}
else if ((amdImage != NULL) && (amdImage->getMipLevels() > 1) &&
(!memory->isUnmapWrite())) {
// Release a view for a mipmap map
amdImage->release();
}
else {
LogError("Unhandled unmap!");
vcmd.setStatus(CL_INVALID_VALUE);
@@ -1257,6 +1287,10 @@ VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand& vcmd)
// Clear unmap flags
memory->clearUnmapFlags();
// Release a view for a mipmap map
if (unmapMip) {
amdImage->release();
}
profilingEnd(vcmd);
}