mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Add queryItem flags to drm query ioctl
Signed-off-by: Bartosz Dunajski bartosz.dunajski@intel.com
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
60ba1b7147
commit
e08bd20289
@@ -37,6 +37,7 @@ set(NEO_CORE_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux_inc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/engine_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/engine_info_impl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/flags${BRANCH_DIR_SUFFIX}/drm_query_flags.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux.h
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
#include "drm_query_flags.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <linux/limits.h>
|
||||
@@ -383,11 +385,12 @@ bool Drm::isi915Version(int fileDescriptor) {
|
||||
return strcmp(name, "i915") == 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> Drm::query(uint32_t queryId, int32_t &length) {
|
||||
std::unique_ptr<uint8_t[]> Drm::query(uint32_t queryId, uint32_t queryItemFlags, int32_t &length) {
|
||||
drm_i915_query query{};
|
||||
drm_i915_query_item queryItem{};
|
||||
queryItem.query_id = queryId;
|
||||
queryItem.length = 0; // query length first
|
||||
queryItem.flags = queryItemFlags;
|
||||
query.items_ptr = reinterpret_cast<__u64>(&queryItem);
|
||||
query.num_items = 1;
|
||||
length = 0;
|
||||
@@ -412,7 +415,7 @@ std::unique_ptr<uint8_t[]> Drm::query(uint32_t queryId, int32_t &length) {
|
||||
|
||||
bool Drm::queryTopology(int &sliceCount, int &subSliceCount, int &euCount) {
|
||||
int32_t length;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_TOPOLOGY_INFO, length);
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_TOPOLOGY_INFO, DrmQueryItemFlags::topology, length);
|
||||
auto data = reinterpret_cast<drm_i915_query_topology_info *>(dataQuery.get());
|
||||
|
||||
if (!data) {
|
||||
|
||||
@@ -172,7 +172,7 @@ class Drm {
|
||||
std::vector<uint32_t> virtualMemoryIds;
|
||||
|
||||
std::string getSysFsPciPath();
|
||||
std::unique_ptr<uint8_t[]> query(uint32_t queryId, int32_t &length);
|
||||
std::unique_ptr<uint8_t[]> query(uint32_t queryId, uint32_t queryItemFlags, int32_t &length);
|
||||
|
||||
StackVec<uint32_t, size_t(ResourceClass::MaxSize)> classHandles;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/os_interface/linux/engine_info_impl.h"
|
||||
|
||||
#include "drm_neo.h"
|
||||
#include "drm_query_flags.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -32,7 +33,7 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
||||
|
||||
bool Drm::queryEngineInfo() {
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, length);
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||
auto data = reinterpret_cast<drm_i915_query_engine_info *>(dataQuery.get());
|
||||
if (data) {
|
||||
this->engineInfo.reset(new EngineInfoImpl(data->engines, data->num_engines));
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/os_interface/linux/memory_info_impl.h"
|
||||
|
||||
#include "drm_neo.h"
|
||||
#include "drm_query_flags.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -34,7 +35,7 @@ int Drm::getMaxGpuFrequency(HardwareInfo &hwInfo, int &maxGpuFrequency) {
|
||||
|
||||
bool Drm::queryEngineInfo() {
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, length);
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_ENGINE_INFO, DrmQueryItemFlags::empty, length);
|
||||
auto data = reinterpret_cast<drm_i915_query_engine_info *>(dataQuery.get());
|
||||
if (data) {
|
||||
this->engineInfo.reset(new EngineInfoImpl(data->engines, data->num_engines));
|
||||
@@ -45,7 +46,7 @@ bool Drm::queryEngineInfo() {
|
||||
|
||||
bool Drm::queryMemoryInfo() {
|
||||
auto length = 0;
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, length);
|
||||
auto dataQuery = this->query(DRM_I915_QUERY_MEMORY_REGIONS, DrmQueryItemFlags::empty, length);
|
||||
auto data = reinterpret_cast<drm_i915_query_memory_regions *>(dataQuery.get());
|
||||
if (data) {
|
||||
this->memoryInfo.reset(new MemoryInfoImpl(data->regions, data->num_regions));
|
||||
|
||||
17
shared/source/os_interface/linux/flags/drm_query_flags.h
Normal file
17
shared/source/os_interface/linux/flags/drm_query_flags.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
namespace DrmQueryItemFlags {
|
||||
constexpr uint32_t empty = 0;
|
||||
constexpr uint32_t topology = 0;
|
||||
} // namespace DrmQueryItemFlags
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user