1111#include " shared/source/helpers/gfx_core_helper.h"
1212#include " shared/source/helpers/register_offsets.h"
1313#include " shared/source/helpers/timestamp_packet.h"
14- #include " shared/source/utilities/lookup_array.h"
1514
1615#include < cmath>
1716
@@ -254,31 +253,22 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
254253}
255254
256255template <typename GfxFamily>
257- void BlitCommandsHelper<GfxFamily>::appendBlitMemSetCommand(const BlitProperties &blitProperties, void *blitCmd) {}
256+ void BlitCommandsHelper<GfxFamily>::appendBlitMemSetCommand(void *blitCmd) {}
258257
259258template <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 ) {
261260 using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT;
262261 auto blitCmd = GfxFamily::cmdInitXyColorBlt;
263262 const auto maxWidth = getMaxBlitWidth (rootDeviceEnvironment);
264263 const auto maxHeight = getMaxBlitHeight (rootDeviceEnvironment, true );
265264
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);
273267
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;
279269 while (sizeToFill != 0 ) {
280270 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)));
282272 uint64_t height = 0 ;
283273 uint64_t width = 0 ;
284274 if (sizeToFill <= maxWidth) {
@@ -293,15 +283,15 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(const BlitProperties
293283 }
294284 tmpCmd.setDestinationX2CoordinateRight (static_cast <uint32_t >(width));
295285 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 ));
297287
298- appendBlitMemoryOptionsForFillBuffer (blitProperties. dstAllocation , tmpCmd, rootDeviceEnvironment);
299- appendBlitFillCommand (blitProperties, tmpCmd);
288+ appendBlitMemoryOptionsForFillBuffer (dstAlloc , tmpCmd, rootDeviceEnvironment);
289+ appendBlitFillCommand (tmpCmd);
300290
301291 auto cmd = linearStream.getSpaceForCmd <XY_COLOR_BLT>();
302292 *cmd = tmpCmd;
303293 auto blitSize = width * height;
304- offset += (blitSize * blitProperties. fillPatternSize );
294+ offset += (blitSize * patternSize );
305295 sizeToFill -= blitSize;
306296 }
307297}
@@ -564,14 +554,25 @@ template <typename GfxFamily>
564554void BlitCommandsHelper<GfxFamily>::adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {}
565555
566556template <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 );
575576 }
576577}
577578
0 commit comments