Debian Codegraph @

shared/source/direct_submission/dispatchers/dispatcher.inl

raw
1 /*
2 * Copyright (C) 2020-2024 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/command_container/command_encoder.h"
9 #include "shared/source/command_stream/linear_stream.h"
10 #include "shared/source/direct_submission/dispatchers/dispatcher.h"
11
12 namespace NEO {
13
14 class LinearStream;
15
16 template <typename GfxFamily>
17 inline void Dispatcher<GfxFamily>::dispatchStartCommandBuffer(LinearStream &cmdBuffer, uint64_t gpuStartAddress) {
18 using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
19
20 MI_BATCH_BUFFER_START cmd = GfxFamily::cmdInitBatchBufferStart;
21 cmd.setBatchBufferStartAddress(gpuStartAddress);
22 cmd.setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
23
24 auto bbufferStart = cmdBuffer.getSpaceForCmd<MI_BATCH_BUFFER_START>();
25 *bbufferStart = cmd;
26 }
27
28 template <typename GfxFamily>
29 inline size_t Dispatcher<GfxFamily>::getSizeStartCommandBuffer() {
30 using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
31 return sizeof(MI_BATCH_BUFFER_START);
32 }
33
34 template <typename GfxFamily>
35 inline void Dispatcher<GfxFamily>::dispatchStopCommandBuffer(LinearStream &cmdBuffer) {
36 using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
37
38 MI_BATCH_BUFFER_END cmd = GfxFamily::cmdInitBatchBufferEnd;
39
40 auto bbufferEnd = cmdBuffer.getSpaceForCmd<MI_BATCH_BUFFER_END>();
41 *bbufferEnd = cmd;
42 }
43
44 template <typename GfxFamily>
45 inline size_t Dispatcher<GfxFamily>::getSizeStopCommandBuffer() {
46 using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
47 return sizeof(MI_BATCH_BUFFER_END);
48 }
49
50 template <typename GfxFamily>
51 inline void Dispatcher<GfxFamily>::dispatchStoreDwordCommand(LinearStream &cmdBuffer, uint64_t gpuVa, uint32_t value) {
52 EncodeStoreMemory<GfxFamily>::programStoreDataImm(cmdBuffer,
53 gpuVa,
54 value,
55 0,
56 false,
57 false,
58 nullptr);
59 }
60
61 template <typename GfxFamily>
62 inline size_t Dispatcher<GfxFamily>::getSizeStoreDwordCommand() {
63 return EncodeStoreMemory<GfxFamily>::getStoreDataImmSize();
64 }
65
66 } // namespace NEO