2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-01-15 01:50:42 +08:00
|
|
|
* Copyright (C) 2019-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-06-23 18:03:43 +08:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
2022-01-15 01:50:42 +08:00
|
|
|
#include "shared/source/command_container/implicit_scaling.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/helpers/bit_helpers.h"
|
2020-10-14 20:04:29 +08:00
|
|
|
#include "shared/source/helpers/populate_factory.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/mem_obj/buffer.h"
|
2019-02-27 18:39:32 +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 {
|
2022-06-29 06:23:39 +08:00
|
|
|
uint32_t Width : 7;
|
|
|
|
uint32_t Height : 14;
|
|
|
|
uint32_t Depth : 11;
|
2017-12-21 07:45:38 +08:00
|
|
|
} SurfaceState;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2021-02-05 00:48:27 +08:00
|
|
|
void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation,
|
2021-03-30 01:06:29 +08:00
|
|
|
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
2020-06-30 23:42:12 +08:00
|
|
|
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;
|
2022-08-23 19:48:18 +08:00
|
|
|
auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr;
|
2021-10-21 09:30:53 +08:00
|
|
|
|
|
|
|
NEO::EncodeSurfaceStateArgs args;
|
|
|
|
args.outMemory = memory;
|
|
|
|
args.graphicsAddress = getBufferAddress(rootDeviceIndex);
|
|
|
|
args.size = getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex);
|
|
|
|
args.mocs = getMocsValue(disableL3, isReadOnly, rootDeviceIndex);
|
|
|
|
args.cpuCoherent = true;
|
|
|
|
args.forceNonAuxMode = forceNonAuxMode;
|
|
|
|
args.isReadOnly = isReadOnly;
|
|
|
|
args.numAvailableDevices = device.getNumGenericSubDevices();
|
|
|
|
args.allocation = graphicsAllocation;
|
|
|
|
args.gmmHelper = device.getGmmHelper();
|
|
|
|
args.useGlobalAtomics = useGlobalAtomics;
|
|
|
|
args.areMultipleSubDevicesInContext = areMultipleSubDevicesInContext;
|
2022-01-15 01:50:42 +08:00
|
|
|
args.implicitScaling = ImplicitScalingHelper::isImplicitScalingEnabled(device.getDeviceBitfield(), true);
|
2022-08-23 19:48:18 +08:00
|
|
|
args.isDebuggerActive = isDebuggerActive;
|
2021-10-21 09:30:53 +08:00
|
|
|
appendSurfaceStateArgs(args);
|
|
|
|
EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
|
2019-02-15 00:12:15 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|