2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-12-30 21:40:24 +08:00
|
|
|
* Copyright (C) 2019-2020 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-06-23 18:03:43 +08:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
2020-06-30 23:42:12 +08:00
|
|
|
#include "shared/source/device/device.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-04-16 22:53:09 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/gmm.h"
|
2020-04-16 22:53:09 +08:00
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/resource_info.h"
|
|
|
|
#include "shared/source/helpers/aligned_memory.h"
|
|
|
|
#include "shared/source/helpers/bit_helpers.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/surface_formats.h"
|
|
|
|
#include "opencl/source/mem_obj/buffer.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-10-11 12:54:10 +08:00
|
|
|
#include "buffer_ext.inl"
|
2020-07-30 21:02:11 +08:00
|
|
|
#include "hw_cmds.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
|
|
|
|
|
|
|
union SURFACE_STATE_BUFFER_LENGTH {
|
|
|
|
uint32_t Length;
|
|
|
|
struct SurfaceState {
|
|
|
|
uint32_t Width : BITFIELD_RANGE(0, 6);
|
|
|
|
uint32_t Height : BITFIELD_RANGE(7, 20);
|
|
|
|
uint32_t Depth : BITFIELD_RANGE(21, 31);
|
|
|
|
} SurfaceState;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-06-30 23:42:12 +08:00
|
|
|
void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, const Device &device) {
|
|
|
|
auto rootDeviceIndex = device.getRootDeviceIndex();
|
2020-06-26 00:17:44 +08:00
|
|
|
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
|
2020-10-01 18:22:54 +08:00
|
|
|
const auto isReadOnly = isValueSet(getFlags(), CL_MEM_READ_ONLY) || isReadOnlyArgument;
|
2020-06-30 23:42:12 +08:00
|
|
|
EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(rootDeviceIndex),
|
|
|
|
getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex),
|
2020-10-01 18:22:54 +08:00
|
|
|
getMocsValue(disableL3, isReadOnly, rootDeviceIndex),
|
|
|
|
true, forceNonAuxMode, isReadOnly, device.getNumAvailableDevices(),
|
2020-09-16 02:27:18 +08:00
|
|
|
graphicsAllocation, device.getGmmHelper());
|
2019-10-11 12:54:10 +08:00
|
|
|
appendSurfaceStateExt(memory);
|
2019-02-15 00:12:15 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|