Debian Codegraph @

opencl/source/sharings/va/va_surface.h

raw
1 /*
2 * Copyright (C) 2018-2022 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #pragma once
9 #include "opencl/source/mem_obj/image.h"
10 #include "opencl/source/sharings/va/va_sharing.h"
11
12 namespace NEO {
13 class Context;
14 class Image;
15
16 struct SharedSurfaceInfo {
17 uint32_t imageFourcc = 0;
18 size_t imageOffset = 0;
19 size_t imagePitch = 0;
20 ImageInfo imgInfo = {};
21 VAImageID imageId = 0;
22 unsigned int sharedHandle = 0;
23 cl_uint plane;
24
25 cl_image_format gmmImgFormat = {CL_NV12_INTEL, CL_UNORM_INT8};
26 cl_channel_order channelOrder = CL_RG;
27 cl_channel_type channelType = CL_UNORM_INT8;
28 };
29
30 class VASurface : VASharing {
31 public:
32 static Image *createSharedVaSurface(Context *context, VASharingFunctions *sharingFunctions,
33 cl_mem_flags flags, cl_mem_flags_intel flagsIntel, VASurfaceID *surface, cl_uint plane,
34 cl_int *errcodeRet);
35
36 void synchronizeObject(UpdateData &updateData) override;
37
38 void getMemObjectInfo(size_t &paramValueSize, void *&paramValue) override;
39
40 static bool validate(cl_mem_flags flags, cl_uint plane);
41 static const ClSurfaceFormatInfo *getExtendedSurfaceFormatInfo(uint32_t formatFourCC);
42 static bool isSupportedFourCCTwoPlaneFormat(int fourcc);
43 static bool isSupportedFourCCThreePlaneFormat(int fourcc);
44 static bool isSupportedFourCCPackedFormat(int fourcc);
45 static bool isSupportedPlanarFormat(uint32_t imageFourcc);
46 static bool isSupportedPackedFormat(uint32_t imageFourcc);
47 static VAStatus getSurfaceDescription(SharedSurfaceInfo &surfaceInfo, VASharingFunctions *sharingFunctions, VASurfaceID *surface);
48 static void applyPlanarOptions(SharedSurfaceInfo &sharedSurfaceInfo, cl_uint plane, cl_mem_flags flags, bool supportOcl21);
49 static void applyPackedOptions(SharedSurfaceInfo &sharedSurfaceInfo);
50 static void applyPlaneSettings(SharedSurfaceInfo &sharedSurfaceInfo, cl_uint plane);
51
52 protected:
53 VASurface(VASharingFunctions *sharingFunctions, VAImageID imageId,
54 cl_uint plane, VASurfaceID *surfaceId, bool interopUserSync)
55 : VASharing(sharingFunctions, imageId), plane(plane), surfaceId(*surfaceId), interopUserSync(interopUserSync) {
56 surfaceIdPtr = &this->surfaceId;
57 };
58
59 cl_uint plane;
60 VASurfaceID surfaceId;
61 VASurfaceID *surfaceIdPtr;
62 bool interopUserSync;
63 };
64 } // namespace NEO