2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-06-29 01:36:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-07-06 15:07:42 +08:00
|
|
|
#pragma once
|
2021-06-29 01:36:16 +08:00
|
|
|
#include "shared/source/gmm_helper/client_context/gmm_handle_allocator.h"
|
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
|
|
|
|
|
|
|
#include <memory>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2021-06-29 01:36:16 +08:00
|
|
|
class GmmClientContext;
|
|
|
|
class OSInterface;
|
|
|
|
struct HardwareInfo;
|
|
|
|
|
|
|
|
class GmmClientContext {
|
2018-07-06 15:07:42 +08:00
|
|
|
public:
|
2020-01-14 20:47:40 +08:00
|
|
|
GmmClientContext(OSInterface *osInterface, HardwareInfo *hwInfo);
|
2021-06-29 01:36:16 +08:00
|
|
|
MOCKABLE_VIRTUAL ~GmmClientContext();
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage);
|
|
|
|
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams);
|
|
|
|
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes);
|
|
|
|
MOCKABLE_VIRTUAL void destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo);
|
|
|
|
GMM_CLIENT_CONTEXT *getHandle() const;
|
|
|
|
template <typename T>
|
|
|
|
static std::unique_ptr<GmmClientContext> create(OSInterface *osInterface, HardwareInfo *hwInfo) {
|
|
|
|
return std::make_unique<T>(osInterface, hwInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
const HardwareInfo *getHardwareInfo() {
|
|
|
|
return hardwareInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL uint8_t getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
|
|
|
|
MOCKABLE_VIRTUAL uint8_t getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
|
|
|
|
|
|
|
|
void setHandleAllocator(std::unique_ptr<GmmHandleAllocator> allocator) {
|
|
|
|
this->handleAllocator = std::move(allocator);
|
|
|
|
}
|
|
|
|
|
2021-09-08 07:30:06 +08:00
|
|
|
MOCKABLE_VIRTUAL void setGmmDeviceInfo(GMM_DEVICE_INFO *deviceInfo);
|
|
|
|
|
2021-06-29 01:36:16 +08:00
|
|
|
GmmHandleAllocator *getHandleAllocator() {
|
|
|
|
return handleAllocator.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
HardwareInfo *hardwareInfo = nullptr;
|
|
|
|
GMM_CLIENT_CONTEXT *clientContext;
|
|
|
|
std::unique_ptr<GmmHandleAllocator> handleAllocator;
|
2018-07-06 15:07:42 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|