11
11
#include " shared/source/helpers/gfx_core_helper.h"
12
12
#include " shared/source/helpers/register_offsets.h"
13
13
#include " shared/source/helpers/timestamp_packet.h"
14
- #include " shared/source/utilities/lookup_array.h"
15
14
16
15
#include < cmath>
17
16
@@ -254,31 +253,22 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
254
253
}
255
254
256
255
template <typename GfxFamily>
257
- void BlitCommandsHelper<GfxFamily>::appendBlitMemSetCommand(const BlitProperties &blitProperties, void *blitCmd) {}
256
+ void BlitCommandsHelper<GfxFamily>::appendBlitMemSetCommand(void *blitCmd) {}
258
257
259
258
template <typename GfxFamily>
260
- void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
259
+ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocation *dstAlloc, uint64_t offset, uint32_t *pattern, LinearStream &linearStream, size_t size, RootDeviceEnvironment &rootDeviceEnvironment, COLOR_DEPTH depth, size_t patternSize ) {
261
260
using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT;
262
261
auto blitCmd = GfxFamily::cmdInitXyColorBlt;
263
262
const auto maxWidth = getMaxBlitWidth (rootDeviceEnvironment);
264
263
const auto maxHeight = getMaxBlitHeight (rootDeviceEnvironment, true );
265
264
266
- const LookupArray<size_t , COLOR_DEPTH, 5 > colorDepthSize ({{
267
- {1 , COLOR_DEPTH::COLOR_DEPTH_8_BIT_COLOR},
268
- {2 , COLOR_DEPTH::COLOR_DEPTH_16_BIT_COLOR},
269
- {4 , COLOR_DEPTH::COLOR_DEPTH_32_BIT_COLOR},
270
- {8 , COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR},
271
- {16 , COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR},
272
- }});
265
+ blitCmd.setFillColor (pattern);
266
+ blitCmd.setColorDepth (depth);
273
267
274
- blitCmd.setFillColor (blitProperties.fillPattern );
275
- blitCmd.setColorDepth (colorDepthSize.lookUp (blitProperties.fillPatternSize ));
276
-
277
- uint64_t sizeToFill = blitProperties.copySize .x / blitProperties.fillPatternSize ;
278
- uint64_t offset = blitProperties.dstOffset .x ;
268
+ uint64_t sizeToFill = size / patternSize;
279
269
while (sizeToFill != 0 ) {
280
270
auto tmpCmd = blitCmd;
281
- tmpCmd.setDestinationBaseAddress (ptrOffset (blitProperties. dstAllocation ->getGpuAddress (), static_cast <size_t >(offset)));
271
+ tmpCmd.setDestinationBaseAddress (ptrOffset (dstAlloc ->getGpuAddress (), static_cast <size_t >(offset)));
282
272
uint64_t height = 0 ;
283
273
uint64_t width = 0 ;
284
274
if (sizeToFill <= maxWidth) {
@@ -293,15 +283,15 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
293
283
}
294
284
tmpCmd.setDestinationX2CoordinateRight (static_cast <uint32_t >(width));
295
285
tmpCmd.setDestinationY2CoordinateBottom (static_cast <uint32_t >(height));
296
- tmpCmd.setDestinationPitch (static_cast <uint32_t >(width * blitProperties. fillPatternSize ));
286
+ tmpCmd.setDestinationPitch (static_cast <uint32_t >(width * patternSize ));
297
287
298
- appendBlitMemoryOptionsForFillBuffer (blitProperties. dstAllocation , tmpCmd, rootDeviceEnvironment);
299
- appendBlitFillCommand (blitProperties, tmpCmd);
288
+ appendBlitMemoryOptionsForFillBuffer (dstAlloc , tmpCmd, rootDeviceEnvironment);
289
+ appendBlitFillCommand (tmpCmd);
300
290
301
291
auto cmd = linearStream.getSpaceForCmd <XY_COLOR_BLT>();
302
292
*cmd = tmpCmd;
303
293
auto blitSize = width * height;
304
- offset += (blitSize * blitProperties. fillPatternSize );
294
+ offset += (blitSize * patternSize );
305
295
sizeToFill -= blitSize;
306
296
}
307
297
}
@@ -564,14 +554,25 @@ template <typename GfxFamily>
564
554
void BlitCommandsHelper<GfxFamily>::adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {}
565
555
566
556
template <typename GfxFamily>
567
- void BlitCommandsHelper<GfxFamily>::appendBlitFillCommand(const BlitProperties &blitProperties, typename GfxFamily::XY_COLOR_BLT &blitCmd) {}
568
-
569
- template <typename GfxFamily>
570
- void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryColorFill(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
571
- if (blitProperties.fillPatternSize == 1 ) {
572
- NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryByteFill (blitProperties, linearStream, rootDeviceEnvironment);
573
- } else {
574
- NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill (blitProperties, linearStream, rootDeviceEnvironment);
557
+ void BlitCommandsHelper<GfxFamily>::appendBlitFillCommand(typename GfxFamily::XY_COLOR_BLT &blitCmd) {}
558
+
559
+ template <typename GfxFamily>
560
+ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryColorFill(NEO::GraphicsAllocation *dstAlloc, uint64_t offset, uint32_t *pattern, size_t patternSize, LinearStream &linearStream, size_t size, RootDeviceEnvironment &rootDeviceEnvironment) {
561
+ switch (patternSize) {
562
+ case 1 :
563
+ NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryByteFill (dstAlloc, offset, pattern, linearStream, size, rootDeviceEnvironment);
564
+ break ;
565
+ case 2 :
566
+ NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill (dstAlloc, offset, pattern, linearStream, size, rootDeviceEnvironment, COLOR_DEPTH::COLOR_DEPTH_16_BIT_COLOR, 2 );
567
+ break ;
568
+ case 4 :
569
+ NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill (dstAlloc, offset, pattern, linearStream, size, rootDeviceEnvironment, COLOR_DEPTH::COLOR_DEPTH_32_BIT_COLOR, 4 );
570
+ break ;
571
+ case 8 :
572
+ NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill (dstAlloc, offset, pattern, linearStream, size, rootDeviceEnvironment, COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR, 8 );
573
+ break ;
574
+ default :
575
+ NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill (dstAlloc, offset, pattern, linearStream, size, rootDeviceEnvironment, COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR, 16 );
575
576
}
576
577
}
577
578
0 commit comments