compositor-drm: Look through all crtc/encoder combinations
We used to only check the first possible encoder, now we go through all possible encoders and look through all possible crtcs for each encoder.
This commit is contained in:
+31
-18
@@ -1260,6 +1260,33 @@ static const char *connector_type_names[] = {
|
|||||||
"eDP",
|
"eDP",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
find_crtc_for_connector(struct drm_compositor *ec,
|
||||||
|
drmModeRes *resources, drmModeConnector *connector)
|
||||||
|
{
|
||||||
|
drmModeEncoder *encoder;
|
||||||
|
uint32_t possible_crtcs;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (j = 0; j < connector->count_encoders; j++) {
|
||||||
|
encoder = drmModeGetEncoder(ec->drm.fd, connector->encoders[j]);
|
||||||
|
if (encoder == NULL) {
|
||||||
|
weston_log("Failed to get encoder.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
possible_crtcs = encoder->possible_crtcs;
|
||||||
|
drmModeFreeEncoder(encoder);
|
||||||
|
|
||||||
|
for (i = 0; i < resources->count_crtcs; i++) {
|
||||||
|
if (possible_crtcs & (1 << i) &&
|
||||||
|
!(ec->crtc_allocator & (1 << resources->crtcs[i])))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
create_output_for_connector(struct drm_compositor *ec,
|
create_output_for_connector(struct drm_compositor *ec,
|
||||||
drmModeRes *resources,
|
drmModeRes *resources,
|
||||||
@@ -1276,28 +1303,15 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||||||
char name[32];
|
char name[32];
|
||||||
const char *type_name;
|
const char *type_name;
|
||||||
|
|
||||||
encoder = drmModeGetEncoder(ec->drm.fd, connector->encoders[0]);
|
i = find_crtc_for_connector(ec, resources, connector);
|
||||||
if (encoder == NULL) {
|
if (i < 0) {
|
||||||
weston_log("No encoder for connector.\n");
|
weston_log("No usable crtc/encoder pair for connector.\n");
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < resources->count_crtcs; i++) {
|
|
||||||
if (encoder->possible_crtcs & (1 << i) &&
|
|
||||||
!(ec->crtc_allocator & (1 << resources->crtcs[i])))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == resources->count_crtcs) {
|
|
||||||
weston_log("No usable crtc for encoder.\n");
|
|
||||||
drmModeFreeEncoder(encoder);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = malloc(sizeof *output);
|
output = malloc(sizeof *output);
|
||||||
if (output == NULL) {
|
if (output == NULL)
|
||||||
drmModeFreeEncoder(encoder);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
memset(output, 0, sizeof *output);
|
memset(output, 0, sizeof *output);
|
||||||
output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);
|
output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);
|
||||||
@@ -1318,7 +1332,6 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||||||
ec->connector_allocator |= (1 << output->connector_id);
|
ec->connector_allocator |= (1 << output->connector_id);
|
||||||
|
|
||||||
output->original_crtc = drmModeGetCrtc(ec->drm.fd, output->crtc_id);
|
output->original_crtc = drmModeGetCrtc(ec->drm.fd, output->crtc_id);
|
||||||
drmModeFreeEncoder(encoder);
|
|
||||||
|
|
||||||
/* Get the current mode on the crtc that's currently driving
|
/* Get the current mode on the crtc that's currently driving
|
||||||
* this connector. */
|
* this connector. */
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ animation=zoom
|
|||||||
#lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
|
#lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
|
||||||
#homescreen=/usr/share/backgrounds/gnome/Blinds.jpg
|
#homescreen=/usr/share/backgrounds/gnome/Blinds.jpg
|
||||||
#animation=fade
|
#animation=fade
|
||||||
|
|
||||||
[launcher]
|
[launcher]
|
||||||
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
|
||||||
path=/usr/bin/gnome-terminal
|
path=/usr/bin/gnome-terminal
|
||||||
@@ -32,3 +33,10 @@ path=./clients/flower
|
|||||||
# Uncomment path to disable screensaver
|
# Uncomment path to disable screensaver
|
||||||
path=/usr/libexec/weston-screensaver
|
path=/usr/libexec/weston-screensaver
|
||||||
duration=600
|
duration=600
|
||||||
|
|
||||||
|
[output]
|
||||||
|
name=LVDS1
|
||||||
|
mode=off
|
||||||
|
|
||||||
|
mode=1366x768
|
||||||
|
modeline=36.25 912 936 1024 1136 512 515 525 533 -hsync +vsync
|
||||||
|
|||||||
Reference in New Issue
Block a user