2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-02-05 00:48:27 +08:00
|
|
|
* Copyright (C) 2019-2021 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-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/helpers/surface_formats.h"
|
|
|
|
#include "opencl/source/mem_obj/buffer.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
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>
|
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;
|
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;
|
|
|
|
appendSurfaceStateArgs(args);
|
|
|
|
EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
|
2019-02-15 00:12:15 +08:00
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|