mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-24 10:39:51 +09:00
Match gsr monitor name with wayland monitor name. Thanks info@leocodes
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
project('gsr-ui', ['c', 'cpp'], version : '1.6.4', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
|
project('gsr-ui', ['c', 'cpp'], version : '1.6.5', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
|
||||||
|
|
||||||
if get_option('buildtype') == 'debug'
|
if get_option('buildtype') == 'debug'
|
||||||
add_project_arguments('-g3', language : ['c', 'cpp'])
|
add_project_arguments('-g3', language : ['c', 'cpp'])
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gsr-ui"
|
name = "gsr-ui"
|
||||||
type = "executable"
|
type = "executable"
|
||||||
version = "1.6.4"
|
version = "1.6.5"
|
||||||
platforms = ["posix"]
|
platforms = ["posix"]
|
||||||
|
|
||||||
[lang.cpp]
|
[lang.cpp]
|
||||||
|
|||||||
@@ -9,14 +9,8 @@
|
|||||||
|
|
||||||
namespace gsr {
|
namespace gsr {
|
||||||
static const int MAX_CONNECTORS = 32;
|
static const int MAX_CONNECTORS = 32;
|
||||||
static const int CONNECTOR_TYPE_COUNTS = 32;
|
|
||||||
static const uint32_t plane_property_all = 0xF;
|
static const uint32_t plane_property_all = 0xF;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int type;
|
|
||||||
int count;
|
|
||||||
} drm_connector_type_count;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PLANE_PROPERTY_CRTC_X = 1 << 0,
|
PLANE_PROPERTY_CRTC_X = 1 << 0,
|
||||||
PLANE_PROPERTY_CRTC_Y = 1 << 1,
|
PLANE_PROPERTY_CRTC_Y = 1 << 1,
|
||||||
@@ -105,22 +99,6 @@ namespace gsr {
|
|||||||
return get_drm_property_by_name(drm_fd, &properties, name, result);
|
return get_drm_property_by_name(drm_fd, &properties, name, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static drm_connector_type_count* drm_connector_types_get_index(drm_connector_type_count *type_counts, int *num_type_counts, int connector_type) {
|
|
||||||
for(int i = 0; i < *num_type_counts; ++i) {
|
|
||||||
if(type_counts[i].type == connector_type)
|
|
||||||
return &type_counts[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(*num_type_counts == CONNECTOR_TYPE_COUNTS)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
const int index = *num_type_counts;
|
|
||||||
type_counts[index].type = connector_type;
|
|
||||||
type_counts[index].count = 0;
|
|
||||||
++*num_type_counts;
|
|
||||||
return &type_counts[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: this monitor name logic is kept in sync with gpu screen recorder
|
// Note: this monitor name logic is kept in sync with gpu screen recorder
|
||||||
static std::string get_monitor_name_from_crtc_id(int drm_fd, uint32_t crtc_id) {
|
static std::string get_monitor_name_from_crtc_id(int drm_fd, uint32_t crtc_id) {
|
||||||
std::string result;
|
std::string result;
|
||||||
@@ -128,27 +106,23 @@ namespace gsr {
|
|||||||
if(!resources)
|
if(!resources)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
drm_connector_type_count type_counts[CONNECTOR_TYPE_COUNTS];
|
|
||||||
int num_type_counts = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < resources->count_connectors; ++i) {
|
for(int i = 0; i < resources->count_connectors; ++i) {
|
||||||
uint64_t connector_crtc_id = 0;
|
uint64_t connector_crtc_id = 0;
|
||||||
drmModeConnectorPtr connector = drmModeGetConnectorCurrent(drm_fd, resources->connectors[i]);
|
drmModeConnectorPtr connector = drmModeGetConnectorCurrent(drm_fd, resources->connectors[i]);
|
||||||
if(!connector)
|
if(!connector)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
drm_connector_type_count *connector_type = drm_connector_types_get_index(type_counts, &num_type_counts, connector->connector_type);
|
|
||||||
const char *connection_name = drmModeGetConnectorTypeName(connector->connector_type);
|
const char *connection_name = drmModeGetConnectorTypeName(connector->connector_type);
|
||||||
if(connector_type)
|
if(!connection_name)
|
||||||
++connector_type->count;
|
goto next;
|
||||||
|
|
||||||
if(connector->connection != DRM_MODE_CONNECTED)
|
if(connector->connection != DRM_MODE_CONNECTED)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
if(connector_type && connector_get_property_by_name(drm_fd, connector, "CRTC_ID", &connector_crtc_id) && connector_crtc_id == crtc_id) {
|
if(connector_get_property_by_name(drm_fd, connector, "CRTC_ID", &connector_crtc_id) && connector_crtc_id == crtc_id) {
|
||||||
result = connection_name;
|
result = connection_name;
|
||||||
result += "-";
|
result += "-";
|
||||||
result += std::to_string(connector_type->count);
|
result += std::to_string(connector->connector_type_id);
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(connector);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user