2019-06-26 11:37:46 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2019 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/helpers/blit_commands_helper.h"
|
|
|
|
|
|
|
|
|
|
#include "runtime/helpers/timestamp_packet.h"
|
2019-06-27 16:08:20 +02:00
|
|
|
#include "runtime/memory_manager/surface.h"
|
2019-06-26 11:37:46 +02:00
|
|
|
|
|
|
|
|
#include "CL/cl.h"
|
|
|
|
|
|
|
|
|
|
namespace NEO {
|
2019-06-27 16:08:20 +02:00
|
|
|
BlitProperties BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitWithHostPtrDirection copyDirection,
|
|
|
|
|
CommandStreamReceiver &commandStreamReceiver,
|
|
|
|
|
GraphicsAllocation *memObjAllocation, void *hostPtr, bool blocking,
|
|
|
|
|
size_t offset, uint64_t copySize) {
|
|
|
|
|
GraphicsAllocation *hostPtrAllocation = nullptr;
|
|
|
|
|
if (hostPtr) {
|
|
|
|
|
HostPtrSurface hostPtrSurface(hostPtr, static_cast<size_t>(copySize), true);
|
|
|
|
|
bool success = commandStreamReceiver.createAllocationForHostSurface(hostPtrSurface, false);
|
|
|
|
|
UNRECOVERABLE_IF(!success);
|
|
|
|
|
hostPtrAllocation = hostPtrSurface.getAllocation();
|
2019-06-26 11:37:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (BlitterConstants::BlitWithHostPtrDirection::FromHostPtr == copyDirection) {
|
2019-06-27 16:08:20 +02:00
|
|
|
return {nullptr, copyDirection, {}, memObjAllocation, hostPtrAllocation, hostPtr, blocking, offset, 0, copySize};
|
2019-06-26 11:37:46 +02:00
|
|
|
} else {
|
2019-06-27 16:08:20 +02:00
|
|
|
return {nullptr, copyDirection, {}, hostPtrAllocation, memObjAllocation, hostPtr, blocking, 0, offset, copySize};
|
2019-06-26 11:37:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
2019-06-27 16:08:20 +02:00
|
|
|
|
2019-06-26 11:37:46 +02:00
|
|
|
} // namespace NEO
|