diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-05-12 05:03:12 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-05-12 05:03:12 +0200 |
commit | 26571094aa67d2f4829ea0fc1649aed37d8fbaf5 (patch) | |
tree | 58aceb28d1830cbaf4d59a32c1d417c83a513106 /kms/server | |
parent | 99dbbd07ab9e8c9a899fd8ccb042b74f336dd026 (diff) |
kms_vaapi: fix regression, screen rotation not working when capturing screen
Diffstat (limited to 'kms/server')
-rw-r--r-- | kms/server/kms_server.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/kms/server/kms_server.c b/kms/server/kms_server.c index 76bf718..3c6e2d5 100644 --- a/kms/server/kms_server.c +++ b/kms/server/kms_server.c @@ -14,6 +14,7 @@ #include <xf86drm.h> #include <xf86drmMode.h> +#include <libdrm/drm_mode.h> #define MAX_CONNECTORS 32 @@ -85,6 +86,37 @@ static bool connector_get_property_by_name(int drmfd, drmModeConnectorPtr props, return false; } +static bool plane_is_cursor_plane(int drmfd, uint32_t plane_id) { + drmModeObjectPropertiesPtr props = drmModeObjectGetProperties(drmfd, plane_id, DRM_MODE_OBJECT_PLANE); + if(!props) + return false; + + for(uint32_t i = 0; i < props->count_props; ++i) { + drmModePropertyPtr prop = drmModeGetProperty(drmfd, props->props[i]); + if(prop) { + if(strcmp(prop->name, "type") == 0) { + const uint64_t current_enum_value = props->prop_values[i]; + bool is_cursor = false; + + for(int j = 0; j < prop->count_enums; ++j) { + if(prop->enums[j].value == current_enum_value && strcmp(prop->enums[j].name, "Cursor") == 0) { + is_cursor = true; + break; + } + + } + + drmModeFreeProperty(prop); + return is_cursor; + } + drmModeFreeProperty(prop); + } + } + + drmModeFreeObjectProperties(props); + return false; +} + /* Returns 0 if not found */ static uint32_t get_connector_by_crtc_id(const connector_to_crtc_map *c2crtc_map, uint32_t crtc_id) { for(int i = 0; i < c2crtc_map->num_maps; ++i) { @@ -147,6 +179,9 @@ static int kms_get_plane_ids(gsr_drm *drm) { continue; } + if(plane_is_cursor_plane(drm->drmfd, plane->plane_id)) + continue; + // TODO: Fallback to getfb(1)? drmModeFB2Ptr drmfb = drmModeGetFB2(drm->drmfd, plane->fb_id); if(drmfb) { |