1212
1313namespace NEO {
1414
15+ template <typename GfxFamily>
16+ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitWidth() {
17+ if (DebugManager.flags .LimitBlitterMaxWidth .get () != -1 ) {
18+ return static_cast <uint64_t >(DebugManager.flags .LimitBlitterMaxWidth .get ());
19+ }
20+ return BlitterConstants::maxBlitWidth;
21+ }
22+
23+ template <typename GfxFamily>
24+ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeight() {
25+ if (DebugManager.flags .LimitBlitterMaxHeight .get () != -1 ) {
26+ return static_cast <uint64_t >(DebugManager.flags .LimitBlitterMaxHeight .get ());
27+ }
28+ return BlitterConstants::maxBlitHeight;
29+ }
30+
31+ template <typename GfxFamily>
32+ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream) {
33+ bool useFlush = false ;
34+ if (DebugManager.flags .FlushAfterEachBlit .get () != -1 ) {
35+ useFlush = static_cast <bool >(DebugManager.flags .FlushAfterEachBlit .get ());
36+ }
37+
38+ if (useFlush) {
39+ EncodeMiFlushDW<GfxFamily>::programMiFlushDw (linearStream, 0 , 0 , false , false );
40+ } else {
41+ auto miArbCheckStream = linearStream.getSpaceForCmd <typename GfxFamily::MI_ARB_CHECK>();
42+ *miArbCheckStream = GfxFamily::cmdInitArbCheck;
43+ }
44+ }
45+
46+ template <typename GfxFamily>
47+ size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
48+ bool useFlush = false ;
49+ if (DebugManager.flags .FlushAfterEachBlit .get () != -1 ) {
50+ useFlush = static_cast <bool >(DebugManager.flags .FlushAfterEachBlit .get ());
51+ }
52+
53+ if (useFlush) {
54+ return sizeof (typename GfxFamily::MI_FLUSH_DW);
55+ }
56+ return sizeof (typename GfxFamily::MI_ARB_CHECK);
57+ }
58+
1559template <typename GfxFamily>
1660size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t > copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket) {
1761 size_t numberOfBlits = 0 ;
@@ -22,10 +66,10 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t> copy
2266 for (uint64_t row = 0 ; row < copySize.y ; row++) {
2367 uint64_t sizeToBlit = copySize.x ;
2468 while (sizeToBlit != 0 ) {
25- if (sizeToBlit > BlitterConstants::maxBlitWidth ) {
69+ if (sizeToBlit > getMaxBlitWidth () ) {
2670 // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
27- width = BlitterConstants::maxBlitWidth ;
28- height = std::min ((sizeToBlit / width), BlitterConstants::maxBlitHeight );
71+ width = getMaxBlitWidth () ;
72+ height = std::min ((sizeToBlit / width), getMaxBlitHeight () );
2973
3074 } else {
3175 // dispatch 1D blt: (1 .. maxBlitWidth) x 1
@@ -38,7 +82,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t> copy
3882 }
3983 }
4084
41- constexpr size_t cmdsSizePerBlit = (sizeof (typename GfxFamily::XY_COPY_BLT) + sizeof ( typename GfxFamily::MI_ARB_CHECK ));
85+ const size_t cmdsSizePerBlit = (sizeof (typename GfxFamily::XY_COPY_BLT) + estimatePostBlitCommandSize ( ));
4286
4387 return TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDependencies) +
4488 (cmdsSizePerBlit * numberOfBlits) +
@@ -86,10 +130,10 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(const BlitProp
86130 uint64_t offset = 0 ;
87131 uint64_t sizeToBlit = blitProperties.copySize .x ;
88132 while (sizeToBlit != 0 ) {
89- if (sizeToBlit > BlitterConstants::maxBlitWidth ) {
133+ if (sizeToBlit > getMaxBlitWidth () ) {
90134 // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
91- width = BlitterConstants::maxBlitWidth ;
92- height = std::min ((sizeToBlit / width), BlitterConstants::maxBlitHeight );
135+ width = getMaxBlitWidth () ;
136+ height = std::min ((sizeToBlit / width), getMaxBlitHeight () );
93137 } else {
94138 // dispatch 1D blt: (1 .. maxBlitWidth) x 1
95139 width = sizeToBlit;
@@ -116,10 +160,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(const BlitProp
116160 *bltStream = bltCmd;
117161 }
118162
119- {
120- auto miArbCheckStream = linearStream.getSpaceForCmd <typename GfxFamily::MI_ARB_CHECK>();
121- *miArbCheckStream = GfxFamily::cmdInitArbCheck;
122- }
163+ dispatchPostBlitCommand (linearStream);
123164
124165 auto blitSize = width * height;
125166 sizeToBlit -= blitSize;
@@ -146,12 +187,12 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocati
146187 tmpCmd.setDestinationBaseAddress (ptrOffset (dstAlloc->getGpuAddress (), static_cast <size_t >(offset)));
147188 uint64_t height = 0 ;
148189 uint64_t width = 0 ;
149- if (sizeToFill <= BlitterConstants::maxBlitWidth ) {
190+ if (sizeToFill <= getMaxBlitWidth () ) {
150191 width = sizeToFill;
151192 height = 1 ;
152193 } else {
153- width = BlitterConstants::maxBlitWidth ;
154- height = std::min ((sizeToFill / width), BlitterConstants::maxBlitHeight );
194+ width = getMaxBlitWidth () ;
195+ height = std::min ((sizeToFill / width), getMaxBlitHeight () );
155196 if (height > 1 ) {
156197 appendTilingEnable (tmpCmd);
157198 }
0 commit comments