mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
DRM GPU logging
This commit is contained in:
parent
1b4776e236
commit
337980881a
@ -51,6 +51,7 @@ find_path(_INCLUDE_DIR
|
|||||||
find_library(_LIBRARY NAMES
|
find_library(_LIBRARY NAMES
|
||||||
HINTS ${PC__LIBDIR} ${PC__LIBRARY_DIRS} )
|
HINTS ${PC__LIBDIR} ${PC__LIBRARY_DIRS} )
|
||||||
pkg_check_modules(GTK4 REQUIRED gtk4)
|
pkg_check_modules(GTK4 REQUIRED gtk4)
|
||||||
|
pkg_check_modules(LIBDRM REQUIRED libdrm)
|
||||||
|
|
||||||
set(_LIBRARIES ${_LIBRARY} )
|
set(_LIBRARIES ${_LIBRARY} )
|
||||||
set(_INCLUDE_DIRS ${_INCLUDE_DIR} )
|
set(_INCLUDE_DIRS ${_INCLUDE_DIR} )
|
||||||
@ -67,6 +68,8 @@ find_package(PkgConfig REQUIRED)
|
|||||||
#dependency
|
#dependency
|
||||||
include_directories(${GTK4_INCLUDE_DIRS})
|
include_directories(${GTK4_INCLUDE_DIRS})
|
||||||
link_directories(${GTK4_LIBRARY_DIRS})
|
link_directories(${GTK4_LIBRARY_DIRS})
|
||||||
|
include_directories(${LIBDRM_INCLUDE_DIRS})
|
||||||
|
link_directories(${LIBDRM_LIBRARY_DIRS})
|
||||||
|
|
||||||
#libopendx.so:
|
#libopendx.so:
|
||||||
set(OPENDX_CPP libs/opendx/opendx.cpp)
|
set(OPENDX_CPP libs/opendx/opendx.cpp)
|
||||||
@ -82,6 +85,7 @@ add_library(dsetup SHARED ${DSETUP_CPP})
|
|||||||
|
|
||||||
#libd3d9.so:
|
#libd3d9.so:
|
||||||
add_library(d3d9 SHARED libs/d3d9/d3d9.cpp)
|
add_library(d3d9 SHARED libs/d3d9/d3d9.cpp)
|
||||||
|
target_link_libraries(d3d9 ${LIBDRM_LIBRARIES})
|
||||||
|
|
||||||
#dxdiag:
|
#dxdiag:
|
||||||
add_executable(dxdiag tools/dxdiag/main.cpp)
|
add_executable(dxdiag tools/dxdiag/main.cpp)
|
||||||
|
1
build.sh
1
build.sh
@ -13,6 +13,7 @@ function check_package {
|
|||||||
check_package "gcc"
|
check_package "gcc"
|
||||||
check_package "cmake"
|
check_package "cmake"
|
||||||
check_package "make"
|
check_package "make"
|
||||||
|
check_package "libdrm-dev"
|
||||||
check_package "libgtk-4-dev"
|
check_package "libgtk-4-dev"
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <linux/kd.h>
|
#include <linux/kd.h>
|
||||||
|
#include <xf86drm.h>
|
||||||
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
IDirect3D9::IDirect3D9 (UINT SDKVersion) {
|
IDirect3D9::IDirect3D9 (UINT SDKVersion) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -33,6 +34,9 @@ IDirect3D9::IDirect3D9 (UINT SDKVersion) {
|
|||||||
drm_get_cap gpuType;
|
drm_get_cap gpuType;
|
||||||
int ioctlResult = ioctl(fd, DRM_IOCTL_GET_CAP, &gpuType);
|
int ioctlResult = ioctl(fd, DRM_IOCTL_GET_CAP, &gpuType);
|
||||||
|
|
||||||
|
//get device vendor id:
|
||||||
|
drmVersion* version = drmGetVersion(fd);
|
||||||
|
|
||||||
if (ioctlResult != 0) {
|
if (ioctlResult != 0) {
|
||||||
std::cerr << "\033[1;31m"
|
std::cerr << "\033[1;31m"
|
||||||
<< "ODX ERROR: Failed to get device info" << std::endl
|
<< "ODX ERROR: Failed to get device info" << std::endl
|
||||||
@ -47,7 +51,7 @@ IDirect3D9::IDirect3D9 (UINT SDKVersion) {
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << "\033[1;32m" //GREEN BOLD
|
std::cout << "\033[1;32m" //GREEN BOLD
|
||||||
<< "ODX INFO: Device is " << (gpuType.value == DRM_CAP_DUMB_BUFFER ? "Software" : "Hardware") << std::endl
|
<< "ODX INFO: Device \"" << version->name << '(' << version->desc << ' ' << version->version_minor << '.' << version->version_patchlevel << ')' << "\" is " << (gpuType.value == DRM_CAP_DUMB_BUFFER ? "Software" : "Hardware") << std::endl
|
||||||
<< "\033[0;0m" << std::endl;
|
<< "\033[0;0m" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user