2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-05-12 10:36:06 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 13:10:44 +01:00
|
|
|
#include "shared/source/built_ins/built_ins.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
|
#include "shared/source/helpers/basic_math.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
|
|
|
|
#include "opencl/source/helpers/hardware_commands_helper.h"
|
|
|
|
|
#include "opencl/source/helpers/mipmap.h"
|
|
|
|
|
#include "opencl/source/mem_obj/image.h"
|
|
|
|
|
#include "opencl/source/memory_manager/mem_obj_surface.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <algorithm>
|
|
|
|
|
#include <new>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
cl_int CommandQueueHw<GfxFamily>::enqueueCopyImage(
|
|
|
|
|
Image *srcImage,
|
|
|
|
|
Image *dstImage,
|
2021-06-15 12:24:35 +00:00
|
|
|
const size_t *srcOrigin,
|
|
|
|
|
const size_t *dstOrigin,
|
|
|
|
|
const size_t *region,
|
2017-12-21 00:45:38 +01:00
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
|
const cl_event *eventWaitList,
|
|
|
|
|
cl_event *event) {
|
2021-09-06 17:04:14 +00:00
|
|
|
constexpr cl_command_type cmdType = CL_COMMAND_COPY_IMAGE;
|
|
|
|
|
|
|
|
|
|
CsrSelectionArgs csrSelectionArgs{cmdType, srcImage, dstImage, device->getRootDeviceIndex(), region, srcOrigin, dstOrigin};
|
|
|
|
|
CommandStreamReceiver &csr = selectCsrForBuiltinOperation(csrSelectionArgs);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-02-08 22:52:58 +01:00
|
|
|
MemObjSurface srcImgSurf(srcImage);
|
|
|
|
|
MemObjSurface dstImgSurf(dstImage);
|
|
|
|
|
Surface *surfaces[] = {&srcImgSurf, &dstImgSurf};
|
|
|
|
|
|
2019-07-03 09:30:30 +02:00
|
|
|
BuiltinOpParams dc;
|
2017-12-21 00:45:38 +01:00
|
|
|
dc.srcMemObj = srcImage;
|
|
|
|
|
dc.dstMemObj = dstImage;
|
|
|
|
|
dc.srcOffset = srcOrigin;
|
|
|
|
|
dc.dstOffset = dstOrigin;
|
|
|
|
|
dc.size = region;
|
2021-01-19 10:10:19 +00:00
|
|
|
if (isMipMapped(srcImage->getImageDesc())) {
|
2018-03-21 14:35:26 +01:00
|
|
|
dc.srcMipLevel = findMipLevel(srcImage->getImageDesc().image_type, srcOrigin);
|
|
|
|
|
}
|
2021-01-19 10:10:19 +00:00
|
|
|
if (isMipMapped(dstImage->getImageDesc())) {
|
2018-03-21 14:35:26 +01:00
|
|
|
dc.dstMipLevel = findMipLevel(dstImage->getImageDesc().image_type, dstOrigin);
|
|
|
|
|
}
|
2022-08-30 14:10:57 +00:00
|
|
|
dc.bcsSplit = this->isSplitEnqueueBlitNeeded(csrSelectionArgs.direction, getTotalSizeFromRectRegion(region), csr);
|
2023-05-12 10:36:06 +00:00
|
|
|
dc.direction = csrSelectionArgs.direction;
|
2020-09-01 11:39:32 +02:00
|
|
|
|
2021-07-26 00:49:41 +00:00
|
|
|
MultiDispatchInfo dispatchInfo(dc);
|
2021-09-02 10:14:12 +00:00
|
|
|
|
2023-12-01 08:57:48 +00:00
|
|
|
return dispatchBcsOrGpgpuEnqueue<CL_COMMAND_COPY_IMAGE>(dispatchInfo, surfaces, EBuiltInOps::copyImageToImage3d, numEventsInWaitList, eventWaitList, event, false, csr);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2022-03-21 11:08:43 +00:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|