2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-05-18 16:27:44 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-09-18 09:11:08 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-07-06 09:07:42 +02:00
|
|
|
#pragma once
|
2021-06-28 17:36:16 +00:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2021-06-28 17:36:16 +00:00
|
|
|
class GmmClientContext;
|
2022-11-25 07:53:05 +00:00
|
|
|
struct RootDeviceEnvironment;
|
|
|
|
|
class GmmHandleAllocator;
|
2023-05-18 16:27:44 +00:00
|
|
|
class MapGpuVirtualAddressGmm;
|
|
|
|
|
class FreeGpuVirtualAddressGmm;
|
2021-06-28 17:36:16 +00:00
|
|
|
|
|
|
|
|
class GmmClientContext {
|
2018-07-06 09:07:42 +02:00
|
|
|
public:
|
2022-11-25 07:53:05 +00:00
|
|
|
GmmClientContext(const RootDeviceEnvironment &rootDeviceEnvironment);
|
2021-06-28 17:36:16 +00:00
|
|
|
MOCKABLE_VIRTUAL ~GmmClientContext();
|
|
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage);
|
2022-09-21 12:49:45 +00:00
|
|
|
MOCKABLE_VIRTUAL uint32_t cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage, bool compressed, bool cachable);
|
2022-02-15 15:07:01 +00:00
|
|
|
|
2021-06-28 17:36:16 +00:00
|
|
|
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);
|
2023-05-18 16:27:44 +00:00
|
|
|
MOCKABLE_VIRTUAL uint64_t mapGpuVirtualAddress(MapGpuVirtualAddressGmm *pMapGpuVa);
|
|
|
|
|
MOCKABLE_VIRTUAL uint64_t freeGpuVirtualAddress(FreeGpuVirtualAddressGmm *pFreeGpuVa);
|
2021-06-28 17:36:16 +00:00
|
|
|
GMM_CLIENT_CONTEXT *getHandle() const;
|
|
|
|
|
template <typename T>
|
2022-11-25 07:53:05 +00:00
|
|
|
static std::unique_ptr<GmmClientContext> create(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
|
|
|
|
return std::make_unique<T>(rootDeviceEnvironment);
|
2021-06-28 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL uint8_t getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
|
|
|
|
|
MOCKABLE_VIRTUAL uint8_t getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
|
|
|
|
|
|
2022-11-25 07:53:05 +00:00
|
|
|
void setHandleAllocator(std::unique_ptr<GmmHandleAllocator> allocator);
|
2021-06-28 17:36:16 +00:00
|
|
|
|
2021-09-07 23:30:06 +00:00
|
|
|
MOCKABLE_VIRTUAL void setGmmDeviceInfo(GMM_DEVICE_INFO *deviceInfo);
|
|
|
|
|
|
2021-06-28 17:36:16 +00:00
|
|
|
GmmHandleAllocator *getHandleAllocator() {
|
|
|
|
|
return handleAllocator.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
GMM_CLIENT_CONTEXT *clientContext;
|
|
|
|
|
std::unique_ptr<GmmHandleAllocator> handleAllocator;
|
2018-07-06 09:07:42 +02:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|