2018-06-21 17:36:47 +08:00
|
|
|
/*
|
2022-02-07 22:27:53 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2018-06-21 17:36:47 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-06-21 17:36:47 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-06-21 17:36:47 +08:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2020-01-09 18:15:03 +08:00
|
|
|
enum class ImagePlane;
|
2018-06-21 17:36:47 +08:00
|
|
|
struct HardwareInfo;
|
|
|
|
struct ImageInfo;
|
2022-07-26 12:58:51 +08:00
|
|
|
struct StorageInfo;
|
2018-06-21 17:36:47 +08:00
|
|
|
class GmmResourceInfo;
|
2022-04-27 18:20:10 +08:00
|
|
|
class GmmHelper;
|
2018-06-21 17:36:47 +08:00
|
|
|
|
|
|
|
class Gmm {
|
|
|
|
public:
|
2020-01-13 18:35:19 +08:00
|
|
|
virtual ~Gmm();
|
2018-06-29 17:48:19 +08:00
|
|
|
Gmm() = delete;
|
2022-07-26 12:58:51 +08:00
|
|
|
Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, const StorageInfo &storageInfo, bool preferCompressed);
|
2022-04-27 18:20:10 +08:00
|
|
|
Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment,
|
2022-07-26 12:58:51 +08:00
|
|
|
GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, bool preferCompressed, const StorageInfo &storageInfo, bool allowLargePages);
|
2022-04-27 18:20:10 +08:00
|
|
|
Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm);
|
2022-04-19 20:11:45 +08:00
|
|
|
Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm, bool openingHandle);
|
2018-06-21 17:36:47 +08:00
|
|
|
|
2018-06-29 17:48:19 +08:00
|
|
|
void queryImageParams(ImageInfo &inputOutputImgInfo);
|
2018-06-21 17:36:47 +08:00
|
|
|
|
2021-12-03 21:52:16 +08:00
|
|
|
void applyAuxFlagsForBuffer(bool preferCompression);
|
2022-07-26 12:58:51 +08:00
|
|
|
void applyMemoryFlags(const StorageInfo &storageInfo);
|
|
|
|
void applyAppResource(const StorageInfo &storageInfo);
|
2018-08-03 00:24:59 +08:00
|
|
|
|
2018-06-21 17:36:47 +08:00
|
|
|
bool unifiedAuxTranslationCapable() const;
|
2019-01-30 18:29:48 +08:00
|
|
|
bool hasMultisampleControlSurface() const;
|
2018-06-21 17:36:47 +08:00
|
|
|
|
2022-04-28 20:51:31 +08:00
|
|
|
GmmHelper *getGmmHelper() const;
|
|
|
|
|
2018-06-28 19:38:15 +08:00
|
|
|
uint32_t queryQPitch(GMM_RESOURCE_TYPE resType);
|
2020-01-09 18:15:03 +08:00
|
|
|
void updateImgInfoAndDesc(ImageInfo &imgInfo, uint32_t arrayIndex);
|
|
|
|
void updateOffsetsInImgInfo(ImageInfo &imgInfo, uint32_t arrayIndex);
|
|
|
|
uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, ImagePlane plane);
|
2018-06-21 17:36:47 +08:00
|
|
|
|
2019-02-08 17:19:22 +08:00
|
|
|
uint32_t getUnifiedAuxPitchTiles();
|
|
|
|
uint32_t getAuxQPitch();
|
|
|
|
|
2018-06-21 17:36:47 +08:00
|
|
|
GMM_RESCREATE_PARAMS resourceParams = {};
|
|
|
|
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
|
|
|
|
2021-06-09 00:37:54 +08:00
|
|
|
bool isCompressionEnabled = false;
|
2019-04-01 13:22:13 +08:00
|
|
|
|
|
|
|
protected:
|
2021-12-03 21:52:16 +08:00
|
|
|
void applyAuxFlagsForImage(ImageInfo &imgInfo, bool preferCompressed);
|
|
|
|
void setupImageResourceParams(ImageInfo &imgInfo, bool preferCompressed);
|
2021-07-16 00:05:09 +08:00
|
|
|
bool extraMemoryFlagsRequired();
|
|
|
|
void applyExtraMemoryFlags(const StorageInfo &storageInfo);
|
2021-08-06 18:46:00 +08:00
|
|
|
void applyDebugOverrides();
|
2022-04-27 18:20:10 +08:00
|
|
|
GmmHelper *gmmHelper = nullptr;
|
2018-06-21 17:36:47 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|