|
|
|
@ -1178,32 +1178,41 @@ static struct wlr_drm_format *output_pick_format(struct wlr_output *output,
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t fmt = DRM_FORMAT_ARGB8888;
|
|
|
|
|
struct wlr_drm_format *format = NULL;
|
|
|
|
|
const uint32_t candidates[] = { DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888 };
|
|
|
|
|
for (size_t i = 0; i < sizeof(candidates) / sizeof(candidates[0]); i++) {
|
|
|
|
|
uint32_t fmt = candidates[i];
|
|
|
|
|
|
|
|
|
|
const struct wlr_drm_format *render_format =
|
|
|
|
|
wlr_drm_format_set_get(render_formats, fmt);
|
|
|
|
|
if (render_format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Renderer doesn't support format 0x%"PRIX32, fmt);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const struct wlr_drm_format *render_format =
|
|
|
|
|
wlr_drm_format_set_get(render_formats, fmt);
|
|
|
|
|
if (render_format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Renderer doesn't support format 0x%"PRIX32, fmt);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (display_formats != NULL) {
|
|
|
|
|
const struct wlr_drm_format *display_format =
|
|
|
|
|
wlr_drm_format_set_get(display_formats, fmt);
|
|
|
|
|
if (display_format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Output doesn't support format 0x%"PRIX32, fmt);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
format = wlr_drm_format_intersect(display_format, render_format);
|
|
|
|
|
} else {
|
|
|
|
|
// The output can display any format
|
|
|
|
|
format = wlr_drm_format_dup(render_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const struct wlr_drm_format *display_format;
|
|
|
|
|
if (display_formats != NULL) {
|
|
|
|
|
display_format = wlr_drm_format_set_get(display_formats, fmt);
|
|
|
|
|
if (display_format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Output doesn't support format 0x%"PRIX32, fmt);
|
|
|
|
|
return NULL;
|
|
|
|
|
if (format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Failed to intersect display and render "
|
|
|
|
|
"modifiers for format 0x%"PRIX32, fmt);
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// The output can display any format
|
|
|
|
|
display_format = render_format;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct wlr_drm_format *format =
|
|
|
|
|
wlr_drm_format_intersect(display_format, render_format);
|
|
|
|
|
if (format == NULL) {
|
|
|
|
|
wlr_log(WLR_DEBUG, "Failed to intersect display and render "
|
|
|
|
|
"modifiers for format 0x%"PRIX32, fmt);
|
|
|
|
|
wlr_log(WLR_ERROR, "Failed to choose a format for output '%s'",
|
|
|
|
|
output->name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|