2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-01-13 00:57:42 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-06-26 21:23:34 +08:00
|
|
|
LinearStream::LinearStream(GraphicsAllocation *gfxAllocation, void *buffer, size_t bufferSize)
|
2022-05-18 03:04:23 +08:00
|
|
|
: maxAvailableSpace(bufferSize), buffer(buffer), graphicsAllocation(gfxAllocation) {
|
2019-06-26 21:23:34 +08:00
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
LinearStream::LinearStream(void *buffer, size_t bufferSize)
|
2019-06-26 21:23:34 +08:00
|
|
|
: LinearStream(nullptr, buffer, bufferSize) {
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
LinearStream::LinearStream(GraphicsAllocation *gfxAllocation)
|
2022-05-18 03:04:23 +08:00
|
|
|
: graphicsAllocation(gfxAllocation) {
|
2017-12-21 07:45:38 +08:00
|
|
|
if (gfxAllocation) {
|
|
|
|
maxAvailableSpace = gfxAllocation->getUnderlyingBufferSize();
|
|
|
|
buffer = gfxAllocation->getUnderlyingBuffer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-13 00:57:42 +08:00
|
|
|
LinearStream::LinearStream(void *buffer, size_t bufferSize, CommandContainer *cmdContainer, size_t batchBufferEndSize)
|
|
|
|
: LinearStream(buffer, bufferSize) {
|
|
|
|
this->cmdContainer = cmdContainer;
|
|
|
|
this->batchBufferEndSize = batchBufferEndSize;
|
|
|
|
}
|
2022-03-29 22:11:50 +08:00
|
|
|
|
|
|
|
uint64_t LinearStream::getGpuBase() const {
|
|
|
|
if (graphicsAllocation) {
|
|
|
|
return graphicsAllocation->getGpuAddress();
|
|
|
|
}
|
|
|
|
return gpuBase;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|