2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-09 00:29:15 +08:00
|
|
|
* Copyright (C) 2017-2020 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 20:10:44 +08:00
|
|
|
#include "shared/source/built_ins/built_ins.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
#include "shared/source/helpers/basic_math.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
|
|
|
#include "opencl/source/helpers/hardware_commands_helper.h"
|
|
|
|
#include "opencl/source/mem_obj/image.h"
|
|
|
|
#include "opencl/source/memory_manager/mem_obj_surface.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <algorithm>
|
|
|
|
#include <new>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
cl_int CommandQueueHw<GfxFamily>::enqueueFillImage(
|
|
|
|
Image *image,
|
|
|
|
const void *fillColor,
|
|
|
|
const size_t *origin,
|
|
|
|
const size_t *region,
|
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList,
|
|
|
|
cl_event *event) {
|
|
|
|
|
2020-12-30 19:41:08 +08:00
|
|
|
auto rootDeviceIndex = getDevice().getRootDeviceIndex();
|
|
|
|
|
|
|
|
image->getMigrateableMultiGraphicsAllocation().ensureMemoryOnDevice(*getDevice().getMemoryManager(), rootDeviceIndex);
|
|
|
|
|
2020-02-21 18:37:14 +08:00
|
|
|
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::FillImage3d,
|
2020-10-22 18:14:54 +08:00
|
|
|
this->getClDevice());
|
2020-11-19 00:06:55 +08:00
|
|
|
BuiltInOwnershipWrapper builtInLock(builder);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-09 05:52:58 +08:00
|
|
|
MemObjSurface dstImgSurf(image);
|
|
|
|
Surface *surfaces[] = {&dstImgSurf};
|
|
|
|
|
2019-07-03 15:30:30 +08:00
|
|
|
BuiltinOpParams dc;
|
2017-12-21 07:45:38 +08:00
|
|
|
dc.srcPtr = const_cast<void *>(fillColor);
|
|
|
|
dc.dstMemObj = image;
|
|
|
|
dc.srcOffset = {0, 0, 0};
|
|
|
|
dc.dstOffset = origin;
|
|
|
|
dc.size = region;
|
2020-09-01 17:39:32 +08:00
|
|
|
|
|
|
|
MultiDispatchInfo di(dc);
|
|
|
|
|
|
|
|
builder.buildDispatchInfos(di);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
enqueueHandler<CL_COMMAND_FILL_IMAGE>(
|
2018-02-09 05:52:58 +08:00
|
|
|
surfaces,
|
2017-12-21 07:45:38 +08:00
|
|
|
false,
|
|
|
|
di,
|
|
|
|
numEventsInWaitList,
|
|
|
|
eventWaitList,
|
|
|
|
event);
|
|
|
|
|
|
|
|
return CL_SUCCESS;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|