This patch fixes an issue where Weston using the DRM backend, cannot start
the display. This happens in the following context:
- no video mode is set before weston starts (eg no "/dev/fb" set up)
- weston is not configured with any default video mode (nothing from
weston.ini nor command line)
- the DRM driver provides with a list of supported modes, but none of them
is marked as PREFERRED (which is not a usual case, but it happens)
In that case, according to the current implementation, the DRM compositor
fails to set a video mode.
This fix lets the DRM compositor selects a video mode (the best one of the
list, which is the first) from the ones provided by the driver.
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
int x, int y, struct udev_device *drm_device)
{
struct drm_output *output;
int x, int y, struct udev_device *drm_device)
{
struct drm_output *output;
- struct drm_mode *drm_mode, *next, *preferred, *current, *configured;
+ struct drm_mode *drm_mode, *next, *preferred, *current, *configured, *best;
struct weston_mode *m;
struct weston_config_section *section;
drmModeEncoder *encoder;
struct weston_mode *m;
struct weston_config_section *section;
drmModeEncoder *encoder;
preferred = NULL;
current = NULL;
configured = NULL;
preferred = NULL;
current = NULL;
configured = NULL;
wl_list_for_each_reverse(drm_mode, &output->base.mode_list, base.link) {
if (config == OUTPUT_CONFIG_MODE &&
wl_list_for_each_reverse(drm_mode, &output->base.mode_list, base.link) {
if (config == OUTPUT_CONFIG_MODE &&
current = drm_mode;
if (drm_mode->base.flags & WL_OUTPUT_MODE_PREFERRED)
preferred = drm_mode;
current = drm_mode;
if (drm_mode->base.flags & WL_OUTPUT_MODE_PREFERRED)
preferred = drm_mode;
}
if (config == OUTPUT_CONFIG_MODELINE) {
}
if (config == OUTPUT_CONFIG_MODELINE) {
output->base.current_mode = &preferred->base;
else if (current)
output->base.current_mode = ¤t->base;
output->base.current_mode = &preferred->base;
else if (current)
output->base.current_mode = ¤t->base;
+ else if (best)
+ output->base.current_mode = &best->base;
if (output->base.current_mode == NULL) {
weston_log("no available modes for %s\n", output->base.name);
if (output->base.current_mode == NULL) {
weston_log("no available modes for %s\n", output->base.name);