Changing default for WDDM_LINUX support

Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
This commit is contained in:
Jaroslaw Chodor 2021-06-07 21:47:12 +02:00 committed by Compute-Runtime-Automation
parent 71cf6be59e
commit d1af8706c0
25 changed files with 175 additions and 88 deletions

View File

@ -57,7 +57,57 @@ if(NOT "${BRANCH_TYPE}" STREQUAL "")
endif()
message(STATUS "branch dir list: ${BRANCH_DIR_LIST}")
set(DISABLE_WDDM_LINUX TRUE)
if(WIN32)
set(DISABLE_WDDM_LINUX TRUE)
endif()
if(WIN32 OR NOT DISABLE_WDDM_LINUX)
# get WDK location and version to use
if(NOT WDK_DIR)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../wdk")
get_filename_component(WDK_DIR "../wdk" ABSOLUTE)
endif()
endif()
if(WDK_DIR)
if(IS_DIRECTORY "${WDK_DIR}/Win15")
get_filename_component(WDK_DIR "${WDK_DIR}/Win15" ABSOLUTE)
endif()
endif()
message(STATUS "WDK Directory: ${WDK_DIR}")
if(NOT WDK_VERSION)
if(WDK_DIR)
# Get WDK version from ${WDK_DIR}/WDKVersion.txt
file(READ "${WDK_DIR}/WDKVersion.txt" WindowsTargetPlatformVersion)
string(REPLACE " " ";" WindowsTargetPlatformVersion ${WindowsTargetPlatformVersion})
list(LENGTH WindowsTargetPlatformVersion versionListLength)
if(NOT versionListLength EQUAL 3)
if(WIN32)
message(ERROR "Error reading content of WDKVersion.txt file")
endif()
else()
list(GET WindowsTargetPlatformVersion 2 WindowsTargetPlatformVersion)
endif()
else()
if(WIN32)
message(ERROR "WDK not available")
endif()
endif()
else()
set(WindowsTargetPlatformVersion ${WDK_VERSION})
endif()
message(STATUS "WDK Version is ${WindowsTargetPlatformVersion}")
endif()
if(NOT DISABLE_WDDM_LINUX)
if(NOT EXISTS "${WDK_DIR}/Include/${WindowsTargetPlatformVersion}/shared/d3dkmthk.h")
set(DISABLE_WDDM_LINUX TRUE)
else()
set(D3DKMTHK_INCLUDE_PATHS "${WDK_DIR}/Include/${WindowsTargetPlatformVersion}/shared/")
set(D3DKMTHK_INCLUDE_PATHS_FROM_WDK TRUE)
endif()
endif()
if(WIN32)
set(DRIVER_MODEL wddm)
else()
@ -123,7 +173,10 @@ if(WIN32 OR NOT DISABLE_WDDM_LINUX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWDDM_VERSION_NUMBER=23 -DNOMINMAX)
add_definitions(-DLEGACY_D3DAPI_VERSION=20)
if(NOT WIN32)
add_definitions(-DWDDM_LINUX=1 -DDXGKDDI_INTERFACE_VERSION_WDDM2_0=1)
add_definitions(-DWDDM_LINUX=1)
if(NOT D3DKMTHK_INCLUDE_PATHS_FROM_WDK)
add_definitions(-DDXGKDDI_INTERFACE_VERSION_WDDM2_0=1)
endif()
endif()
endif()
@ -337,33 +390,6 @@ endif()
message(STATUS "Third party dir: ${THIRD_PARTY_DIR}")
if(WIN32)
# get WDK location and version to use
if(NOT WDK_DIR)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../wdk")
get_filename_component(WDK_DIR "../wdk" ABSOLUTE)
endif()
endif()
if(WDK_DIR)
if(IS_DIRECTORY "${WDK_DIR}/Win15")
get_filename_component(WDK_DIR "${WDK_DIR}/Win15" ABSOLUTE)
endif()
endif()
message(STATUS "WDK Directory: ${WDK_DIR}")
if(NOT WDK_VERSION)
# Get WDK version from ${WDK_DIR}/WDKVersion.txt
file(READ "${WDK_DIR}/WDKVersion.txt" WindowsTargetPlatformVersion)
string(REPLACE " " ";" WindowsTargetPlatformVersion ${WindowsTargetPlatformVersion})
list(LENGTH WindowsTargetPlatformVersion versionListLength)
if(NOT versionListLength EQUAL 3)
message(ERROR "Error reading content of WDKVersion.txt file")
endif()
list(GET WindowsTargetPlatformVersion 2 WindowsTargetPlatformVersion)
else()
set(WindowsTargetPlatformVersion ${WDK_VERSION})
endif()
message(STATUS "WDK Version is ${WindowsTargetPlatformVersion}")
if(${WindowsTargetPlatformVersion} VERSION_LESS "10.0.18328.0")
set(CONST_FROM_WDK_10_0_18328_0)
else()
@ -380,13 +406,13 @@ if(WIN32)
elseif(NOT DISABLE_WDDM_LINUX)
add_compile_options(-DCONST_FROM_WDK_10_0_18328_0=CONST)
add_compile_options(-DWDDM_LINUX=1)
add_compile_options(-LHDM=1)
set(WDK_INCLUDE_PATHS "")
get_filename_component(DX_HEADERS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/DirectX-Headers" ABSOLUTE)
list(APPEND WDK_INCLUDE_PATHS ${DX_HEADERS_PATH}/include/wsl)
list(APPEND WDK_INCLUDE_PATHS ${DX_HEADERS_PATH}/include/wsl/stubs)
list(APPEND WDK_INCLUDE_PATHS ${DX_HEADERS_PATH}/include/directx)
list(APPEND WDK_INCLUDE_PATHS ${DX_HEADERS_PATH}/include/dxguids)
list(APPEND WDK_INCLUDE_PATHS ${D3DKMTHK_INCLUDE_PATHS})
message(STATUS "WDK include paths: ${WDK_INCLUDE_PATHS}")
endif()

View File

@ -9,7 +9,7 @@
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/source/helpers/windows/gmm_callbacks.inl"
using namespace NEO;
namespace NEO {
template struct DeviceCallbacks<ICLFamily>;
template struct TTCallbacks<ICLFamily>;
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,7 +9,7 @@
#include "opencl/source/helpers/windows/gmm_callbacks_tgllp_plus.inl"
using namespace NEO;
namespace NEO {
template struct DeviceCallbacks<TGLLPFamily>;
template struct TTCallbacks<TGLLPFamily>;
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,7 +9,7 @@
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/source/helpers/windows/gmm_callbacks.inl"
using namespace NEO;
namespace NEO {
template struct DeviceCallbacks<BDWFamily>;
template struct TTCallbacks<BDWFamily>;
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,7 +9,7 @@
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/source/helpers/windows/gmm_callbacks.inl"
using namespace NEO;
namespace NEO {
template struct DeviceCallbacks<SKLFamily>;
template struct TTCallbacks<SKLFamily>;
} // namespace NEO

View File

@ -32,8 +32,16 @@
namespace NEO {
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wbraced-scalar-init"
#endif
// Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
#if __clang__
#pragma clang diagnostic pop
#endif
template <typename GfxFamily>
WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment,

View File

@ -55,6 +55,7 @@ else()
)
if(NOT DISABLE_WDDM_LINUX)
target_sources(igdrcl_mt_tests PRIVATE
${NEO_SHARED_DIRECTORY}/gmm_helper/windows/gmm_memory.cpp
${NEO_SHARED_DIRECTORY}/os_interface/windows/wddm/wddm_create.cpp
)
endif()

View File

@ -6,6 +6,7 @@
*/
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/device/device.h"
#include "shared/source/direct_submission/linux/drm_direct_submission.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"

View File

@ -5,6 +5,7 @@
*
*/
#include "shared/source/device/device.h"
#include "shared/source/direct_submission/windows/wddm_direct_submission.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
@ -18,8 +19,16 @@
namespace NEO {
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wbraced-scalar-init"
#endif
// Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag
DECLARE_COMMAND_BUFFER(CommandBufferHeader, UMD_OCL, FALSE, FALSE, PERFTAG_OCL);
#if __clang__
#pragma clang diagnostic pop
#endif
template <typename GfxFamily, typename Dispatcher>
WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(Device &device,

View File

@ -14,6 +14,7 @@ set(CORE_SRCS_GENX_H_BASE
set(CORE_RUNTIME_SRCS_GENX_CPP_BASE
command_encoder
command_stream_receiver_hw
direct_submission
hw_helper
preamble
preemption

View File

@ -17,6 +17,7 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_windows.h
${CMAKE_CURRENT_SOURCE_DIR}/environment_variables.h
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_drm_stub.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_inc.h
${CMAKE_CURRENT_SOURCE_DIR}/os_interface_win.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_library_win.cpp
@ -55,7 +56,6 @@ set(NEO_CORE_OS_INTERFACE_WDDM
${CMAKE_CURRENT_SOURCE_DIR}/hw_device_id_win.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_device_id.h
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_wddm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_drm_stub.cpp
${CMAKE_CURRENT_SOURCE_DIR}/init_wddm_os_interface.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener${KMDAF_FILE_SUFFIX}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kmdaf_listener.h

View File

@ -9,6 +9,16 @@
#include "shared/source/os_interface/windows/windows_wrapper.h"
#ifndef _WIN32
#define ScanLineOrdering \
ScanLineOrdering: \
8; \
int padding
typedef enum _DEVICE_POWER_STATE {
PowerDeviceUnspecified = 0,
} DEVICE_POWER_STATE,
*PDEVICE_POWER_STATE;
#endif
#include <d3dkmthk.h>
struct _D3DDDICB_LOCKFLAGS;

View File

@ -8,10 +8,9 @@
#pragma once
#include "shared/source/memory_manager/deferrable_deletion.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/windows/d3dkmthk_wrapper.h"
#include "shared/source/os_interface/windows/windows_wrapper.h"
#include <d3dkmthk.h>
namespace NEO {
class OsContextWin;

View File

@ -54,7 +54,7 @@ bool DeviceTimeWddm::getCpuGpuTime(TimeStampData *pGpuCpuTime, OSTime *osTime) {
pGpuCpuTime->CPUTimeinNS = 0;
pGpuCpuTime->GPUTimeStamp = 0;
TimeStampDataHeader escapeInfo = {0};
TimeStampDataHeader escapeInfo = {};
if (runEscape(wddm, escapeInfo)) {
auto productFamily = wddm->getRootDeviceEnvironment().getHardwareInfo()->platform.eProductFamily;

View File

@ -19,7 +19,7 @@ namespace NEO {
class Gdi {
public:
Gdi();
~Gdi(){};
MOCKABLE_VIRTUAL ~Gdi() = default;
ThkWrapper<IN OUT D3DKMT_OPENADAPTERFROMLUID *> openAdapterFromLuid{};
ThkWrapper<IN OUT D3DKMT_CREATEALLOCATION *> createAllocation_{};

View File

@ -12,6 +12,7 @@
namespace NEO {
struct KmDafListener {
MOCKABLE_VIRTUAL ~KmDafListener() = default;
MOCKABLE_VIRTUAL void notifyLock(bool ftrKmdDaf, D3DKMT_HANDLE hAdapter, D3DKMT_HANDLE hDevice, const D3DKMT_HANDLE hAllocation, D3DDDICB_LOCKFLAGS *pLockFlags, PFND3DKMT_ESCAPE pfnEscape);

View File

@ -9,13 +9,21 @@
#include "shared/source/os_interface/windows/windows_wrapper.h"
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wbraced-scalar-init"
#endif
#include "umKmInc/sharedata.h"
#if __clang__
#pragma clang diagnostic pop
#endif
using SKU_FEATURE_TABLE_GMM = SKU_FEATURE_TABLE;
using WA_TABLE_GMM = WA_TABLE;
using ADAPTER_INFO_GMM = ADAPTER_INFO;
#if !defined(WDDM_LINUX)
#if defined(UMD_KMD_COMMAND_BUFFER_REV_ID)
using SKU_FEATURE_TABLE_KMD = SKU_FEATURE_TABLE_GMM;
using WA_TABLE_KMD = WA_TABLE_GMM;
using ADAPTER_INFO_KMD = ADAPTER_INFO_GMM;

View File

@ -23,7 +23,7 @@ class DxCoreAdapterFactory : public AdapterFactory {
bool createSnapshotOfAvailableAdapters() override;
bool isSupported() {
bool isSupported() override {
return nullptr != adapterFactory;
}

View File

@ -28,7 +28,7 @@ class DxgiAdapterFactory : public AdapterFactory {
bool createSnapshotOfAvailableAdapters() override;
bool isSupported() {
bool isSupported() override {
return nullptr != adapterFactory;
}

View File

@ -133,8 +133,8 @@ bool Wddm::init() {
bool Wddm::queryAdapterInfo() {
NTSTATUS status = STATUS_UNSUCCESSFUL;
ADAPTER_INFO_KMD adapterInfo = {0};
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {0};
ADAPTER_INFO_KMD adapterInfo = {};
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {};
QueryAdapterInfo.hAdapter = getAdapter();
QueryAdapterInfo.Type = KMTQAITYPE_UMDRIVERPRIVATE;
@ -182,7 +182,7 @@ bool Wddm::queryAdapterInfo() {
}
bool Wddm::createPagingQueue() {
D3DKMT_CREATEPAGINGQUEUE CreatePagingQueue = {0};
D3DKMT_CREATEPAGINGQUEUE CreatePagingQueue = {};
CreatePagingQueue.hDevice = device;
CreatePagingQueue.Priority = D3DDDI_PAGINGQUEUE_PRIORITY_NORMAL;
@ -199,7 +199,7 @@ bool Wddm::createPagingQueue() {
}
bool Wddm::destroyPagingQueue() {
D3DDDI_DESTROYPAGINGQUEUE DestroyPagingQueue = {0};
D3DDDI_DESTROYPAGINGQUEUE DestroyPagingQueue = {};
if (pagingQueue) {
DestroyPagingQueue.hPagingQueue = pagingQueue;
@ -212,7 +212,7 @@ bool Wddm::destroyPagingQueue() {
bool Wddm::createDevice(PreemptionMode preemptionMode) {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DKMT_CREATEDEVICE CreateDevice = {{0}};
D3DKMT_CREATEDEVICE CreateDevice = {};
if (hwDeviceId) {
CreateDevice.hAdapter = getAdapter();
CreateDevice.Flags.LegacyMode = FALSE;
@ -230,7 +230,7 @@ bool Wddm::createDevice(PreemptionMode preemptionMode) {
bool Wddm::destroyDevice() {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DKMT_DESTROYDEVICE DestroyDevice = {0};
D3DKMT_DESTROYDEVICE DestroyDevice = {};
if (device) {
DestroyDevice.hDevice = device;
@ -242,8 +242,8 @@ bool Wddm::destroyDevice() {
}
bool validDriverStorePath(OsEnvironmentWin &osEnvironment, D3DKMT_HANDLE adapter) {
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {0};
ADAPTER_INFO_KMD adapterInfo = {0};
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {};
ADAPTER_INFO_KMD adapterInfo = {};
QueryAdapterInfo.hAdapter = adapter;
QueryAdapterInfo.Type = KMTQAITYPE_UMDRIVERPRIVATE;
QueryAdapterInfo.pPrivateDriverData = &adapterInfo;
@ -261,7 +261,7 @@ bool validDriverStorePath(OsEnvironmentWin &osEnvironment, D3DKMT_HANDLE adapter
}
std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid) {
D3DKMT_OPENADAPTERFROMLUID OpenAdapterData = {{0}};
D3DKMT_OPENADAPTERFROMLUID OpenAdapterData = {};
OpenAdapterData.AdapterLuid = adapterLuid;
auto status = osEnvironment.gdi->openAdapterFromLuid(&OpenAdapterData);
if (status != STATUS_SUCCESS) {
@ -276,7 +276,7 @@ std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin
}
}
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {0};
D3DKMT_QUERYADAPTERINFO QueryAdapterInfo = {};
D3DKMT_ADAPTERTYPE queryAdapterType = {};
QueryAdapterInfo.hAdapter = OpenAdapterData.hAdapter;
QueryAdapterInfo.Type = KMTQAITYPE_ADAPTERTYPE;
@ -360,7 +360,7 @@ std::vector<std::unique_ptr<HwDeviceId>> Wddm::discoverDevices(ExecutionEnvironm
bool Wddm::evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim) {
NTSTATUS status = STATUS_SUCCESS;
D3DKMT_EVICT Evict = {0};
D3DKMT_EVICT Evict = {};
Evict.AllocationList = handleList;
Evict.hDevice = device;
Evict.NumAllocations = numOfHandles;
@ -377,7 +377,7 @@ bool Wddm::evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_
bool Wddm::makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim, size_t totalSize) {
NTSTATUS status = STATUS_SUCCESS;
D3DDDI_MAKERESIDENT makeResident = {0};
D3DDDI_MAKERESIDENT makeResident = {};
UINT priority = 0;
bool success = false;
@ -420,8 +420,8 @@ bool Wddm::mapGpuVirtualAddress(AllocationStorageData *allocationStorageData) {
}
bool Wddm::mapGpuVirtualAddress(Gmm *gmm, D3DKMT_HANDLE handle, D3DGPU_VIRTUAL_ADDRESS minimumAddress, D3DGPU_VIRTUAL_ADDRESS maximumAddress, D3DGPU_VIRTUAL_ADDRESS preferredAddress, D3DGPU_VIRTUAL_ADDRESS &gpuPtr) {
D3DDDI_MAPGPUVIRTUALADDRESS MapGPUVA = {0};
D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE protectionType = {{{0}}};
D3DDDI_MAPGPUVIRTUALADDRESS MapGPUVA = {};
D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE protectionType = {};
protectionType.Write = TRUE;
uint64_t size = gmm->gmmResourceInfo->getSizeAllocation();
@ -475,7 +475,7 @@ D3DGPU_VIRTUAL_ADDRESS Wddm::reserveGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS min
bool Wddm::freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) {
NTSTATUS status = STATUS_SUCCESS;
D3DKMT_FREEGPUVIRTUALADDRESS FreeGPUVA = {0};
D3DKMT_FREEGPUVIRTUALADDRESS FreeGPUVA = {};
FreeGPUVA.hAdapter = getAdapter();
FreeGPUVA.BaseAddress = GmmHelper::decanonize(gpuPtr);
FreeGPUVA.Size = size;
@ -490,8 +490,8 @@ bool Wddm::freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size)
NTSTATUS Wddm::createAllocation(const void *alignedCpuPtr, const Gmm *gmm, D3DKMT_HANDLE &outHandle, D3DKMT_HANDLE &outResourceHandle, D3DKMT_HANDLE *outSharedHandle) {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DDDI_ALLOCATIONINFO2 AllocationInfo = {0};
D3DKMT_CREATEALLOCATION CreateAllocation = {0};
D3DDDI_ALLOCATIONINFO2 AllocationInfo = {};
D3DKMT_CREATEALLOCATION CreateAllocation = {};
if (gmm == nullptr)
return false;
@ -556,8 +556,8 @@ bool Wddm::setAllocationPriority(const D3DKMT_HANDLE *handles, uint32_t allocati
bool Wddm::createAllocation64k(const Gmm *gmm, D3DKMT_HANDLE &outHandle) {
NTSTATUS status = STATUS_SUCCESS;
D3DDDI_ALLOCATIONINFO2 AllocationInfo = {0};
D3DKMT_CREATEALLOCATION CreateAllocation = {0};
D3DDDI_ALLOCATIONINFO2 AllocationInfo = {};
D3DKMT_CREATEALLOCATION CreateAllocation = {};
AllocationInfo.pSystemMem = 0;
AllocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@ -586,8 +586,8 @@ bool Wddm::createAllocation64k(const Gmm *gmm, D3DKMT_HANDLE &outHandle) {
NTSTATUS Wddm::createAllocationsAndMapGpuVa(OsHandleStorage &osHandles) {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DDDI_ALLOCATIONINFO2 AllocationInfo[maxFragmentsCount] = {{0}};
D3DKMT_CREATEALLOCATION CreateAllocation = {0};
D3DDDI_ALLOCATIONINFO2 AllocationInfo[maxFragmentsCount] = {};
D3DKMT_CREATEALLOCATION CreateAllocation = {};
auto allocationCount = 0;
for (unsigned int i = 0; i < maxFragmentsCount; i++) {
@ -662,7 +662,7 @@ bool Wddm::destroyAllocations(const D3DKMT_HANDLE *handles, uint32_t allocationC
return true;
}
NTSTATUS status = STATUS_SUCCESS;
D3DKMT_DESTROYALLOCATION2 DestroyAllocation = {0};
D3DKMT_DESTROYALLOCATION2 DestroyAllocation = {};
DEBUG_BREAK_IF(!(allocationCount <= 1 || resourceHandle == 0));
DestroyAllocation.hDevice = device;
@ -677,7 +677,7 @@ bool Wddm::destroyAllocations(const D3DKMT_HANDLE *handles, uint32_t allocationC
return status == STATUS_SUCCESS;
}
bool Wddm::verifySharedHandle(D3DKMT_HANDLE osHandle) {
D3DKMT_QUERYRESOURCEINFO QueryResourceInfo = {0};
D3DKMT_QUERYRESOURCEINFO QueryResourceInfo = {};
QueryResourceInfo.hDevice = device;
QueryResourceInfo.hGlobalShare = osHandle;
auto status = getGdi()->queryResourceInfo(&QueryResourceInfo);
@ -685,7 +685,7 @@ bool Wddm::verifySharedHandle(D3DKMT_HANDLE osHandle) {
}
bool Wddm::openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) {
D3DKMT_QUERYRESOURCEINFO QueryResourceInfo = {0};
D3DKMT_QUERYRESOURCEINFO QueryResourceInfo = {};
QueryResourceInfo.hDevice = device;
QueryResourceInfo.hGlobalShare = handle;
auto status = getGdi()->queryResourceInfo(&QueryResourceInfo);
@ -700,7 +700,7 @@ bool Wddm::openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) {
std::unique_ptr<char[]> resPrivateRuntimeData(new char[QueryResourceInfo.PrivateRuntimeDataSize]);
std::unique_ptr<D3DDDI_OPENALLOCATIONINFO2[]> allocationInfo(new D3DDDI_OPENALLOCATIONINFO2[QueryResourceInfo.NumAllocations]);
D3DKMT_OPENRESOURCE OpenResource = {0};
D3DKMT_OPENRESOURCE OpenResource = {};
OpenResource.hDevice = device;
OpenResource.hGlobalShare = handle;
@ -808,8 +808,8 @@ void Wddm::kmDafLock(D3DKMT_HANDLE handle) {
bool Wddm::createContext(OsContextWin &osContext) {
NTSTATUS status = STATUS_UNSUCCESSFUL;
D3DKMT_CREATECONTEXTVIRTUAL CreateContext = {0};
CREATECONTEXT_PVTDATA PrivateData = {{0}};
D3DKMT_CREATECONTEXTVIRTUAL CreateContext = {};
CREATECONTEXT_PVTDATA PrivateData = {};
PrivateData.IsProtectedProcess = FALSE;
PrivateData.IsDwm = FALSE;
@ -858,7 +858,7 @@ bool Wddm::createContext(OsContextWin &osContext) {
}
bool Wddm::destroyContext(D3DKMT_HANDLE context) {
D3DKMT_DESTROYCONTEXT DestroyContext = {0};
D3DKMT_DESTROYCONTEXT DestroyContext = {};
NTSTATUS status = STATUS_UNSUCCESSFUL;
if (context != static_cast<D3DKMT_HANDLE>(0)) {
@ -906,7 +906,7 @@ unsigned int Wddm::getEnablePreemptionRegValue() {
}
bool Wddm::waitOnGPU(D3DKMT_HANDLE context) {
D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMGPU WaitOnGPU = {0};
D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMGPU WaitOnGPU = {};
WaitOnGPU.hContext = context;
WaitOnGPU.ObjectCount = 1;
@ -923,7 +923,7 @@ bool Wddm::waitFromCpu(uint64_t lastFenceValue, const MonitoredFence &monitoredF
NTSTATUS status = STATUS_SUCCESS;
if (lastFenceValue > *monitoredFence.cpuAddress) {
D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU waitFromCpu = {0};
D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU waitFromCpu = {};
waitFromCpu.ObjectCount = 1;
waitFromCpu.ObjectHandleArray = &monitoredFence.fenceHandle;
waitFromCpu.FenceValueArray = &lastFenceValue;
@ -1038,11 +1038,11 @@ bool Wddm::reserveValidAddressRange(size_t size, void *&reservedMem) {
}
void *Wddm::virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type) {
return virtualAllocFnc(inPtr, size, flags, type);
return virtualAllocFnc(inPtr, size, static_cast<DWORD>(flags), static_cast<DWORD>(type));
}
int Wddm::virtualFree(void *ptr, size_t size, unsigned long flags) {
return virtualFreeFnc(ptr, size, flags);
return virtualFreeFnc(ptr, size, static_cast<DWORD>(flags));
}
void Wddm::waitOnPagingFenceFromCpu() {

View File

@ -8,10 +8,9 @@
#pragma once
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/windows/d3dkmthk_wrapper.h"
#include "shared/source/os_interface/windows/windows_wrapper.h"
#include <d3dkmthk.h>
#include <cstdint>
namespace NEO {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -35,7 +35,7 @@ class WddmResidencyLogger {
IoFunctions::fprintf(pagingLog, "%s\n", id.str().c_str());
}
~WddmResidencyLogger() {
MOCKABLE_VIRTUAL ~WddmResidencyLogger() {
IoFunctions::fclosePtr(pagingLog);
}

View File

@ -10,10 +10,9 @@
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/residency.h"
#include "shared/source/os_interface/windows/d3dkmthk_wrapper.h"
#include "shared/source/os_interface/windows/windows_wrapper.h"
#include <d3dkmthk.h>
namespace NEO {
struct OsHandleWin : OsHandle {

View File

@ -33,8 +33,33 @@ LSTATUS APIENTRY RegQueryValueExA(
LPDWORD lpcbData);
#else
#include <cstdint>
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-value"
#endif
#include <winadapter.h>
#if __clang__
#pragma clang diagnostic pop
#endif
#include <x86intrin.h>
typedef int NTSTATUS;
#define STATUS_SUCCESS ((NTSTATUS)0)
#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)
#define STATUS_PENDING ((NTSTATUS)0x00000103L)
#define STATUS_GRAPHICS_NO_VIDEO_MEMORY ((NTSTATUS)0xC01E0100L)
#define PAGE_NOACCESS 0x01
#define PAGE_READWRITE 0x04
#define MEM_COMMIT 0x00001000
#define MEM_RESERVE 0x00002000
#define MEM_TOP_DOWN 0x00100000
#define MEM_RELEASE 0x00008000
#define MEM_FREE 0x00010000
#define DXGI_RESOURCE_PRIORITY_NORMAL 0x78000000
#define DXGI_RESOURCE_PRIORITY_HIGH 0xa0000000
#define DXGI_RESOURCE_PRIORITY_MAXIMUM 0xc8000000
#endif
#define NULL_HANDLE 0U

View File

@ -94,7 +94,7 @@ struct TokenArray {
TokenHeader header;
TokenArray(uint16_t tokenId, uint16_t elementSizeBits, uint16_t elementsCount) : header(tokenId, DwordsCount) {
WCH_ASSERT(elementSizeBits * elementsCount <= DwordsCount * sizeof(uint32_t) * 8);
WCH_ASSERT(static_cast<size_t>(elementSizeBits * elementsCount) <= static_cast<size_t>(DwordsCount * sizeof(uint32_t) * 8U));
}
static_assert(DwordsCount <= 255, "");