2018-06-21 11:36:47 +02:00
|
|
|
/*
|
2020-01-08 11:11:54 +01:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-06-21 11:36:47 +02:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-06-21 11:36:47 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2019-02-28 16:12:23 +01:00
|
|
|
#include "storage_info.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2018-06-21 11:36:47 +02:00
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <memory>
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2020-01-09 11:15:03 +01:00
|
|
|
enum class ImagePlane;
|
2018-06-21 11:36:47 +02:00
|
|
|
struct HardwareInfo;
|
|
|
|
struct ImageInfo;
|
|
|
|
class GmmResourceInfo;
|
2019-12-30 14:14:27 +01:00
|
|
|
class GmmClientContext;
|
2018-06-21 11:36:47 +02:00
|
|
|
|
|
|
|
class Gmm {
|
|
|
|
public:
|
2020-01-13 11:35:19 +01:00
|
|
|
virtual ~Gmm();
|
2018-06-29 11:48:19 +02:00
|
|
|
Gmm() = delete;
|
2019-12-30 14:14:27 +01:00
|
|
|
Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo);
|
|
|
|
Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, bool uncacheable);
|
|
|
|
Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, bool uncacheable, bool preferRenderCompressed, bool systemMemoryPool, StorageInfo storageInfo);
|
|
|
|
Gmm(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmm);
|
2018-06-21 11:36:47 +02:00
|
|
|
|
2018-06-29 11:48:19 +02:00
|
|
|
void queryImageParams(ImageInfo &inputOutputImgInfo);
|
2018-06-21 11:36:47 +02:00
|
|
|
|
2018-06-29 11:48:19 +02:00
|
|
|
void applyAuxFlagsForBuffer(bool preferRenderCompression);
|
2019-02-28 16:12:23 +01:00
|
|
|
void applyMemoryFlags(bool systemMemoryPool, StorageInfo &storageInfo);
|
2018-08-02 18:24:59 +02:00
|
|
|
|
2018-06-21 11:36:47 +02:00
|
|
|
bool unifiedAuxTranslationCapable() const;
|
2019-01-30 11:29:48 +01:00
|
|
|
bool hasMultisampleControlSurface() const;
|
2018-06-21 11:36:47 +02:00
|
|
|
|
2018-06-28 13:38:15 +02:00
|
|
|
uint32_t queryQPitch(GMM_RESOURCE_TYPE resType);
|
2020-01-09 11:15:03 +01: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 11:36:47 +02:00
|
|
|
|
2019-02-08 10:19:22 +01:00
|
|
|
uint32_t getUnifiedAuxPitchTiles();
|
|
|
|
uint32_t getAuxQPitch();
|
|
|
|
|
2018-06-21 11:36:47 +02:00
|
|
|
GMM_RESCREATE_PARAMS resourceParams = {};
|
|
|
|
std::unique_ptr<GmmResourceInfo> gmmResourceInfo;
|
|
|
|
|
|
|
|
bool isRenderCompressed = false;
|
2018-08-02 18:24:59 +02:00
|
|
|
bool useSystemMemoryPool = true;
|
2019-04-01 07:22:13 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void applyAuxFlagsForImage(ImageInfo &imgInfo);
|
|
|
|
void setupImageResourceParams(ImageInfo &imgInfo);
|
2019-12-30 14:14:27 +01:00
|
|
|
GmmClientContext *clientContext = nullptr;
|
2018-06-21 11:36:47 +02:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|