xserver: Branch 'master'
Zhenyu Wang
zhenyu.z.wang at intel.com
Thu Mar 6 22:54:58 PST 2008
On 2008.03.04 09:04:43 -0800, Adam Jackson wrote:
> hw/xfree86/modes/xf86Crtc.c | 376 ++++++++++++++++++++++++++++++++++----------
> 1 file changed, 299 insertions(+), 77 deletions(-)
>
> New commits:
> commit 27e7dacbf7ef17712be31ff90f98ee3a5c5cf909
> Author: Adam Jackson <ajax at redhat.com>
> Date: Tue Mar 4 11:38:34 2008 -0500
>
> Make xf86InitialConfiguration slightly smarter.
>
> +static DisplayModePtr
> +nextAspectMode(DisplayModePtr start, float aspect)
> +{
> + DisplayModePtr m = start;
> +
> + for (m = m->next; m; m = m->next)
> + if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
> + return m;
> +
> + return NULL;
> +}
> +
> +static DisplayModePtr
> +bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
> +{
> + int o, p;
> + DisplayModePtr mode, test = NULL, match = NULL;
> +
> + for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
> + mode = config->output[o]->probed_modes;
> + while ((mode = nextAspectMode(mode, aspect))) {
> + for (p = o; nextEnabledOutput(config, enabled, &p); ) {
> + test = xf86OutputFindClosestMode(config->output[p], mode);
> + if (!test)
> + break;
> + if (test->HDisplay != mode->HDisplay ||
> + test->VDisplay != mode->VDisplay) {
> + test = NULL;
> + break;
> + }
> + }
> +
> + /* if we didn't match it on all outputs, try the next one */
> + if (!test)
> + continue;
> +
> + /* if it's bigger than the last one, save it */
> + if (!match || (test->HDisplay > match->HDisplay))
> + match = test;
> + }
> + }
> +
> + /* return the biggest one found */
> + return match;
> +}
> +
Ajax, I hit X segfault when plugging one monitor which returns no
probed_modes.
---
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 4d5d7b8..d32fa15 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1693,7 +1693,7 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
mode = config->output[o]->probed_modes;
- while ((mode = nextAspectMode(mode, aspect))) {
+ while (mode && (mode = nextAspectMode(mode, aspect))) {
for (p = o; nextEnabledOutput(config, enabled, &p); ) {
test = xf86OutputFindClosestMode(config->output[p], mode);
if (!test)
---
More information about the xorg
mailing list