Ignore overlay planes for the future

This commit is contained in:
dec05eba
2024-03-10 21:07:03 +01:00
parent f3c32a880a
commit 1690381bb2

View File

@@ -126,11 +126,11 @@ typedef enum {
PLANE_PROPERTY_SRC_W = 1 << 4, PLANE_PROPERTY_SRC_W = 1 << 4,
PLANE_PROPERTY_SRC_H = 1 << 5, PLANE_PROPERTY_SRC_H = 1 << 5,
PLANE_PROPERTY_IS_CURSOR = 1 << 6, PLANE_PROPERTY_IS_CURSOR = 1 << 6,
PLANE_PROPERTY_IS_PRIMARY = 1 << 7,
} plane_property_mask; } plane_property_mask;
/* Returns plane_property_mask */ /* Returns plane_property_mask */
static uint32_t plane_get_properties(int drmfd, uint32_t plane_id, bool *is_cursor, int *x, int *y, int *src_x, int *src_y, int *src_w, int *src_h) { static uint32_t plane_get_properties(int drmfd, uint32_t plane_id, int *x, int *y, int *src_x, int *src_y, int *src_w, int *src_h) {
*is_cursor = false;
*x = 0; *x = 0;
*y = 0; *y = 0;
*src_x = 0; *src_x = 0;
@@ -142,7 +142,7 @@ static uint32_t plane_get_properties(int drmfd, uint32_t plane_id, bool *is_curs
drmModeObjectPropertiesPtr props = drmModeObjectGetProperties(drmfd, plane_id, DRM_MODE_OBJECT_PLANE); drmModeObjectPropertiesPtr props = drmModeObjectGetProperties(drmfd, plane_id, DRM_MODE_OBJECT_PLANE);
if(!props) if(!props)
return false; return property_mask;
// TODO: Dont do this every frame // TODO: Dont do this every frame
for(uint32_t i = 0; i < props->count_props; ++i) { for(uint32_t i = 0; i < props->count_props; ++i) {
@@ -173,8 +173,10 @@ static uint32_t plane_get_properties(int drmfd, uint32_t plane_id, bool *is_curs
} else if((type & DRM_MODE_PROP_ENUM) && strcmp(prop->name, "type") == 0) { } else if((type & DRM_MODE_PROP_ENUM) && strcmp(prop->name, "type") == 0) {
const uint64_t current_enum_value = props->prop_values[i]; const uint64_t current_enum_value = props->prop_values[i];
for(int j = 0; j < prop->count_enums; ++j) { for(int j = 0; j < prop->count_enums; ++j) {
if(prop->enums[j].value == current_enum_value && strcmp(prop->enums[j].name, "Cursor") == 0) { if(prop->enums[j].value == current_enum_value && strcmp(prop->enums[j].name, "Primary") == 0) {
*is_cursor = true; property_mask |= PLANE_PROPERTY_IS_PRIMARY;
break;
} else if(prop->enums[j].value == current_enum_value && strcmp(prop->enums[j].name, "Cursor") == 0) {
property_mask |= PLANE_PROPERTY_IS_CURSOR; property_mask |= PLANE_PROPERTY_IS_CURSOR;
break; break;
} }
@@ -308,10 +310,9 @@ static int kms_get_fb(gsr_drm *drm, gsr_kms_response *response, connector_to_crt
const int fd_index = response->num_fds; const int fd_index = response->num_fds;
bool is_cursor = false;
int x = 0, y = 0, src_x = 0, src_y = 0, src_w = 0, src_h = 0; int x = 0, y = 0, src_x = 0, src_y = 0, src_w = 0, src_h = 0;
plane_get_properties(drm->drmfd, plane->plane_id, &is_cursor, &x, &y, &src_x, &src_y, &src_w, &src_h); plane_property_mask property_mask = plane_get_properties(drm->drmfd, plane->plane_id, &x, &y, &src_x, &src_y, &src_w, &src_h);
if((property_mask & PLANE_PROPERTY_IS_PRIMARY) || (property_mask & PLANE_PROPERTY_IS_CURSOR)) {
const connector_crtc_pair *crtc_pair = get_connector_pair_by_crtc_id(c2crtc_map, plane->crtc_id); const connector_crtc_pair *crtc_pair = get_connector_pair_by_crtc_id(c2crtc_map, plane->crtc_id);
if(crtc_pair && crtc_pair->hdr_metadata_blob_id) { if(crtc_pair && crtc_pair->hdr_metadata_blob_id) {
response->fds[fd_index].has_hdr_metadata = get_hdr_metadata(drm->drmfd, crtc_pair->hdr_metadata_blob_id, &response->fds[fd_index].hdr_metadata); response->fds[fd_index].has_hdr_metadata = get_hdr_metadata(drm->drmfd, crtc_pair->hdr_metadata_blob_id, &response->fds[fd_index].hdr_metadata);
@@ -327,9 +328,9 @@ static int kms_get_fb(gsr_drm *drm, gsr_kms_response *response, connector_to_crt
response->fds[fd_index].pixel_format = drmfb->pixel_format; response->fds[fd_index].pixel_format = drmfb->pixel_format;
response->fds[fd_index].modifier = drmfb->modifier; response->fds[fd_index].modifier = drmfb->modifier;
response->fds[fd_index].connector_id = crtc_pair ? crtc_pair->connector_id : 0; response->fds[fd_index].connector_id = crtc_pair ? crtc_pair->connector_id : 0;
response->fds[fd_index].is_cursor = is_cursor; response->fds[fd_index].is_cursor = property_mask & PLANE_PROPERTY_IS_CURSOR;
response->fds[fd_index].is_combined_plane = false; response->fds[fd_index].is_combined_plane = false;
if(is_cursor) { if(property_mask & PLANE_PROPERTY_IS_CURSOR) {
response->fds[fd_index].x = x; response->fds[fd_index].x = x;
response->fds[fd_index].y = y; response->fds[fd_index].y = y;
response->fds[fd_index].src_w = 0; response->fds[fd_index].src_w = 0;
@@ -341,6 +342,9 @@ static int kms_get_fb(gsr_drm *drm, gsr_kms_response *response, connector_to_crt
response->fds[fd_index].src_h = src_h; response->fds[fd_index].src_h = src_h;
} }
++response->num_fds; ++response->num_fds;
} else {
close(fb_fd);
}
cleanup_handles: cleanup_handles:
drm_mode_cleanup_handles(drm->drmfd, drmfb); drm_mode_cleanup_handles(drm->drmfd, drmfb);