| @@ -533,27 +533,27 @@ mode_geometry (XRRModeInfo *mode_info, R | | | @@ -533,27 +533,27 @@ mode_geometry (XRRModeInfo *mode_info, R |
533 | rect[1].y = 0; | | 533 | rect[1].y = 0; |
534 | rect[2].x = width; | | 534 | rect[2].x = width; |
535 | rect[2].y = height; | | 535 | rect[2].y = height; |
536 | rect[3].x = 0; | | 536 | rect[3].x = 0; |
537 | rect[3].y = height; | | 537 | rect[3].y = height; |
538 | path_bounds (transform, rect, 4, bounds); | | 538 | path_bounds (transform, rect, 4, bounds); |
539 | } | | 539 | } |
540 | | | 540 | |
541 | /* v refresh frequency in Hz */ | | 541 | /* v refresh frequency in Hz */ |
542 | static double | | 542 | static double |
543 | mode_refresh (XRRModeInfo *mode_info) | | 543 | mode_refresh (XRRModeInfo *mode_info) |
544 | { | | 544 | { |
545 | double rate; | | 545 | double rate; |
546 | unsigned int vTotal = mode_info->vTotal; | | 546 | double vTotal = mode_info->vTotal; |
547 | | | 547 | |
548 | if (mode_info->modeFlags & RR_DoubleScan) { | | 548 | if (mode_info->modeFlags & RR_DoubleScan) { |
549 | /* doublescan doubles the number of lines */ | | 549 | /* doublescan doubles the number of lines */ |
550 | vTotal *= 2; | | 550 | vTotal *= 2; |
551 | } | | 551 | } |
552 | | | 552 | |
553 | if (mode_info->modeFlags & RR_Interlace) { | | 553 | if (mode_info->modeFlags & RR_Interlace) { |
554 | /* interlace splits the frame into two fields */ | | 554 | /* interlace splits the frame into two fields */ |
555 | /* the field rate is what is typically reported by monitors */ | | 555 | /* the field rate is what is typically reported by monitors */ |
556 | vTotal /= 2; | | 556 | vTotal /= 2; |
557 | } | | 557 | } |
558 | | | 558 | |
559 | if (mode_info->hTotal && vTotal) | | 559 | if (mode_info->hTotal && vTotal) |
| @@ -1556,27 +1556,27 @@ crtc_apply (crtc_t *crtc) | | | @@ -1556,27 +1556,27 @@ crtc_apply (crtc_t *crtc) |
1556 | Status s; | | 1556 | Status s; |
1557 | RRMode mode = None; | | 1557 | RRMode mode = None; |
1558 | | | 1558 | |
1559 | if (!crtc->changing || !crtc->mode_info) | | 1559 | if (!crtc->changing || !crtc->mode_info) |
1560 | return RRSetConfigSuccess; | | 1560 | return RRSetConfigSuccess; |
1561 | | | 1561 | |
1562 | rr_outputs = calloc (crtc->noutput, sizeof (RROutput)); | | 1562 | rr_outputs = calloc (crtc->noutput, sizeof (RROutput)); |
1563 | if (!rr_outputs) | | 1563 | if (!rr_outputs) |
1564 | return BadAlloc; | | 1564 | return BadAlloc; |
1565 | for (o = 0; o < crtc->noutput; o++) | | 1565 | for (o = 0; o < crtc->noutput; o++) |
1566 | rr_outputs[o] = crtc->outputs[o]->output.xid; | | 1566 | rr_outputs[o] = crtc->outputs[o]->output.xid; |
1567 | mode = crtc->mode_info->id; | | 1567 | mode = crtc->mode_info->id; |
1568 | if (verbose) { | | 1568 | if (verbose) { |
1569 | printf ("crtc %d: %12s %6.1f +%d+%d", crtc->crtc.index, | | 1569 | printf ("crtc %d: %12s %6.2f +%d+%d", crtc->crtc.index, |
1570 | crtc->mode_info->name, mode_refresh (crtc->mode_info), | | 1570 | crtc->mode_info->name, mode_refresh (crtc->mode_info), |
1571 | crtc->x, crtc->y); | | 1571 | crtc->x, crtc->y); |
1572 | for (o = 0; o < crtc->noutput; o++) | | 1572 | for (o = 0; o < crtc->noutput; o++) |
1573 | printf (" \"%s\"", crtc->outputs[o]->output.string); | | 1573 | printf (" \"%s\"", crtc->outputs[o]->output.string); |
1574 | printf ("\n"); | | 1574 | printf ("\n"); |
1575 | } | | 1575 | } |
1576 | | | 1576 | |
1577 | if (dryrun) | | 1577 | if (dryrun) |
1578 | s = RRSetConfigSuccess; | | 1578 | s = RRSetConfigSuccess; |
1579 | else | | 1579 | else |
1580 | { | | 1580 | { |
1581 | if (!equal_transform (&crtc->current_transform, &crtc->pending_transform)) | | 1581 | if (!equal_transform (&crtc->current_transform, &crtc->pending_transform)) |
1582 | crtc_set_transform (crtc, &crtc->pending_transform); | | 1582 | crtc_set_transform (crtc, &crtc->pending_transform); |
| @@ -2332,39 +2332,30 @@ property_values_from_string(const char * | | | @@ -2332,39 +2332,30 @@ property_values_from_string(const char * |
2332 | } | | 2332 | } |
2333 | | | 2333 | |
2334 | nitems++; | | 2334 | nitems++; |
2335 | } | | 2335 | } |
2336 | | | 2336 | |
2337 | free (tmp); | | 2337 | free (tmp); |
2338 | | | 2338 | |
2339 | *returned_nitems = nitems; | | 2339 | *returned_nitems = nitems; |
2340 | return returned_bytes; | | 2340 | return returned_bytes; |
2341 | } | | 2341 | } |
2342 | | | 2342 | |
2343 | | | 2343 | |
2344 | static void | | 2344 | static void |
2345 | print_output_property_value(Bool is_edid, | | 2345 | print_output_property_value(int value_format, /* 8, 16, 32 */ |
2346 | int value_format, /* 8, 16, 32 */ | | | |
2347 | Atom value_type, /* XA_{ATOM,INTEGER,CARDINAL} */ | | 2346 | Atom value_type, /* XA_{ATOM,INTEGER,CARDINAL} */ |
2348 | const void *value_bytes) | | 2347 | const void *value_bytes) |
2349 | { | | 2348 | { |
2350 | /* special-case the EDID */ | | | |
2351 | if (is_edid && value_format == 8) | | | |
2352 | { | | | |
2353 | const uint8_t *val = value_bytes; | | | |
2354 | printf ("%02" PRIx8, *val); | | | |
2355 | return; | | | |
2356 | } | | | |
2357 | | | | |
2358 | if (value_type == XA_ATOM && value_format == 32) | | 2349 | if (value_type == XA_ATOM && value_format == 32) |
2359 | { | | 2350 | { |
2360 | const Atom *val = value_bytes; | | 2351 | const Atom *val = value_bytes; |
2361 | char *str = XGetAtomName (dpy, *val); | | 2352 | char *str = XGetAtomName (dpy, *val); |
2362 | if (str != NULL) | | 2353 | if (str != NULL) |
2363 | { | | 2354 | { |
2364 | printf ("%s", str); | | 2355 | printf ("%s", str); |
2365 | XFree (str); | | 2356 | XFree (str); |
2366 | return; | | 2357 | return; |
2367 | } | | 2358 | } |
2368 | } | | 2359 | } |
2369 | | | 2360 | |
2370 | if (value_type == XA_INTEGER) | | 2361 | if (value_type == XA_INTEGER) |
| @@ -2405,26 +2396,108 @@ print_output_property_value(Bool is_edid | | | @@ -2405,26 +2396,108 @@ print_output_property_value(Bool is_edid |
2405 | } | | 2396 | } |
2406 | if (value_format == 32) | | 2397 | if (value_format == 32) |
2407 | { | | 2398 | { |
2408 | const uint32_t *val = value_bytes; | | 2399 | const uint32_t *val = value_bytes; |
2409 | printf ("%" PRIu32, *val); | | 2400 | printf ("%" PRIu32, *val); |
2410 | return; | | 2401 | return; |
2411 | } | | 2402 | } |
2412 | } | | 2403 | } |
2413 | | | 2404 | |
2414 | printf ("?"); | | 2405 | printf ("?"); |
2415 | } | | 2406 | } |
2416 | | | 2407 | |
2417 | static void | | 2408 | static void |
| | | 2409 | print_edid(int nitems, const unsigned char *prop) |
| | | 2410 | { |
| | | 2411 | int k; |
| | | 2412 | |
| | | 2413 | printf ("\n\t\t"); |
| | | 2414 | |
| | | 2415 | for (k = 0; k < nitems; k++) |
| | | 2416 | { |
| | | 2417 | if (k != 0 && (k % 16) == 0) |
| | | 2418 | { |
| | | 2419 | printf ("\n\t\t"); |
| | | 2420 | } |
| | | 2421 | |
| | | 2422 | printf("%02" PRIx8, prop[k]); |
| | | 2423 | } |
| | | 2424 | |
| | | 2425 | printf("\n"); |
| | | 2426 | } |
| | | 2427 | |
| | | 2428 | static void |
| | | 2429 | print_guid(const unsigned char *prop) |
| | | 2430 | { |
| | | 2431 | int k; |
| | | 2432 | |
| | | 2433 | printf("{"); |
| | | 2434 | |
| | | 2435 | for (k = 0; k < 16; k++) |
| | | 2436 | { |
| | | 2437 | printf("%02" PRIX8, prop[k]); |
| | | 2438 | if (k == 3 || k == 5 || k == 7 || k == 9) |
| | | 2439 | { |
| | | 2440 | printf("-"); |
| | | 2441 | } |
| | | 2442 | } |
| | | 2443 | |
| | | 2444 | printf("}\n"); |
| | | 2445 | } |
| | | 2446 | |
| | | 2447 | static void |
| | | 2448 | print_output_property(const char *atom_name, |
| | | 2449 | int value_format, |
| | | 2450 | Atom value_type, |
| | | 2451 | int nitems, |
| | | 2452 | const unsigned char *prop) |
| | | 2453 | { |
| | | 2454 | int bytes_per_item = value_format / 8; |
| | | 2455 | int k; |
| | | 2456 | |
| | | 2457 | /* |
| | | 2458 | * Check for properties that need special formatting. |
| | | 2459 | */ |
| | | 2460 | if (strcmp (atom_name, "EDID") == 0 && value_format == 8 && |
| | | 2461 | value_type == XA_INTEGER) |
| | | 2462 | { |
| | | 2463 | print_edid (nitems, prop); |
| | | 2464 | return; |
| | | 2465 | } |
| | | 2466 | else if (strcmp (atom_name, "GUID") == 0 && value_format == 8 && |
| | | 2467 | value_type == XA_INTEGER && nitems == 16) |
| | | 2468 | { |
| | | 2469 | print_guid (prop); |
| | | 2470 | return; |
| | | 2471 | } |
| | | 2472 | |
| | | 2473 | for (k = 0; k < nitems; k++) |
| | | 2474 | { |
| | | 2475 | if (k != 0) |
| | | 2476 | { |
| | | 2477 | if ((k % 16) == 0) |
| | | 2478 | { |
| | | 2479 | printf ("\n\t\t"); |
| | | 2480 | } |
| | | 2481 | } |
| | | 2482 | print_output_property_value (value_format, value_type, |
| | | 2483 | prop + (k * bytes_per_item)); |
| | | 2484 | printf (" "); |
| | | 2485 | } |
| | | 2486 | |
| | | 2487 | printf ("\n"); |
| | | 2488 | } |
| | | 2489 | |
| | | 2490 | static void |
2418 | get_providers (void) | | 2491 | get_providers (void) |
2419 | { | | 2492 | { |
2420 | XRRProviderResources *pr; | | 2493 | XRRProviderResources *pr; |
2421 | int i; | | 2494 | int i; |
2422 | | | 2495 | |
2423 | if (!has_1_4 || providers) | | 2496 | if (!has_1_4 || providers) |
2424 | return; | | 2497 | return; |
2425 | | | 2498 | |
2426 | pr = XRRGetProviderResources(dpy, root); | | 2499 | pr = XRRGetProviderResources(dpy, root); |
2427 | num_providers = pr->nproviders; | | 2500 | num_providers = pr->nproviders; |
2428 | providers = calloc (num_providers, sizeof (provider_t)); | | 2501 | providers = calloc (num_providers, sizeof (provider_t)); |
2429 | if (!providers) | | 2502 | if (!providers) |
2430 | fatal ("out of memory\n"); | | 2503 | fatal ("out of memory\n"); |
| @@ -2438,26 +2511,28 @@ get_providers (void) | | | @@ -2438,26 +2511,28 @@ get_providers (void) |
2438 | set_name_xid (name, pr->providers[i]); | | 2511 | set_name_xid (name, pr->providers[i]); |
2439 | set_name_index (name, i); | | 2512 | set_name_index (name, i); |
2440 | set_name_string (name, info->name); | | 2513 | set_name_string (name, info->name); |
2441 | } | | 2514 | } |
2442 | | | 2515 | |
2443 | XRRFreeProviderResources(pr); | | 2516 | XRRFreeProviderResources(pr); |
2444 | } | | 2517 | } |
2445 | | | 2518 | |
2446 | static provider_t * | | 2519 | static provider_t * |
2447 | find_provider (name_t *name) | | 2520 | find_provider (name_t *name) |
2448 | { | | 2521 | { |
2449 | int i; | | 2522 | int i; |
2450 | | | 2523 | |
| | | 2524 | if ((name->kind & name_xid) && name->xid == 0) |
| | | 2525 | return NULL; |
2451 | for (i = 0; i < num_providers; i++) { | | 2526 | for (i = 0; i < num_providers; i++) { |
2452 | provider_t *p = &providers[i]; | | 2527 | provider_t *p = &providers[i]; |
2453 | name_kind_t common = name->kind & p->provider.kind; | | 2528 | name_kind_t common = name->kind & p->provider.kind; |
2454 | | | 2529 | |
2455 | if ((common & name_xid) && name->xid == p->provider.xid) | | 2530 | if ((common & name_xid) && name->xid == p->provider.xid) |
2456 | return p; | | 2531 | return p; |
2457 | if ((common & name_string) && !strcmp (name->string, p->provider.string)) | | 2532 | if ((common & name_string) && !strcmp (name->string, p->provider.string)) |
2458 | return p; | | 2533 | return p; |
2459 | if ((common & name_index) && name->index == p->provider.index) | | 2534 | if ((common & name_index) && name->index == p->provider.index) |
2460 | return p; | | 2535 | return p; |
2461 | } | | 2536 | } |
2462 | | | 2537 | |
2463 | printf ("Could not find provider with "); | | 2538 | printf ("Could not find provider with "); |
| @@ -3221,42 +3296,42 @@ main (int argc, char **argv) | | | @@ -3221,42 +3296,42 @@ main (int argc, char **argv) |
3221 | if (provsetoutsource) | | 3296 | if (provsetoutsource) |
3222 | { | | 3297 | { |
3223 | provider_t *provider, *source; | | 3298 | provider_t *provider, *source; |
3224 | | | 3299 | |
3225 | if (!has_1_4) | | 3300 | if (!has_1_4) |
3226 | fatal ("--setprovideroutputsource requires RandR 1.4\n"); | | 3301 | fatal ("--setprovideroutputsource requires RandR 1.4\n"); |
3227 | | | 3302 | |
3228 | get_screen (current); | | 3303 | get_screen (current); |
3229 | get_providers (); | | 3304 | get_providers (); |
3230 | | | 3305 | |
3231 | provider = find_provider (&provider_name); | | 3306 | provider = find_provider (&provider_name); |
3232 | source = find_provider(&output_source_provider_name); | | 3307 | source = find_provider(&output_source_provider_name); |
3233 | | | 3308 | |
3234 | XRRSetProviderOutputSource(dpy, provider->provider.xid, source->provider.xid); | | 3309 | XRRSetProviderOutputSource(dpy, provider->provider.xid, source ? source->provider.xid : 0); |
3235 | } | | 3310 | } |
3236 | if (provsetoffsink) | | 3311 | if (provsetoffsink) |
3237 | { | | 3312 | { |
3238 | provider_t *provider, *sink; | | 3313 | provider_t *provider, *sink; |
3239 | | | 3314 | |
3240 | if (!has_1_4) | | 3315 | if (!has_1_4) |
3241 | fatal ("--setprovideroffloadsink requires RandR 1.4\n"); | | 3316 | fatal ("--setprovideroffloadsink requires RandR 1.4\n"); |
3242 | | | 3317 | |
3243 | get_screen (current); | | 3318 | get_screen (current); |
3244 | get_providers (); | | 3319 | get_providers (); |
3245 | | | 3320 | |
3246 | provider = find_provider (&provider_name); | | 3321 | provider = find_provider (&provider_name); |
3247 | sink = find_provider(&offload_sink_provider_name); | | 3322 | sink = find_provider(&offload_sink_provider_name); |
3248 | | | 3323 | |
3249 | XRRSetProviderOffloadSink(dpy, provider->provider.xid, sink->provider.xid); | | 3324 | XRRSetProviderOffloadSink(dpy, provider->provider.xid, sink ? sink->provider.xid : 0); |
3250 | } | | 3325 | } |
3251 | if (setit_1_2) | | 3326 | if (setit_1_2) |
3252 | { | | 3327 | { |
3253 | get_screen (current); | | 3328 | get_screen (current); |
3254 | get_crtcs (); | | 3329 | get_crtcs (); |
3255 | get_outputs (); | | 3330 | get_outputs (); |
3256 | set_positions (); | | 3331 | set_positions (); |
3257 | set_screen_size (); | | 3332 | set_screen_size (); |
3258 | | | 3333 | |
3259 | pick_crtcs (); | | 3334 | pick_crtcs (); |
3260 | | | 3335 | |
3261 | /* | | 3336 | /* |
3262 | * Assign outputs to crtcs | | 3337 | * Assign outputs to crtcs |
| @@ -3500,177 +3575,153 @@ main (int argc, char **argv) | | | @@ -3500,177 +3575,153 @@ main (int argc, char **argv) |
3500 | printf ("\n"); | | 3575 | printf ("\n"); |
3501 | } | | 3576 | } |
3502 | if (verbose || properties) | | 3577 | if (verbose || properties) |
3503 | { | | 3578 | { |
3504 | props = XRRListOutputProperties (dpy, output->output.xid, | | 3579 | props = XRRListOutputProperties (dpy, output->output.xid, |
3505 | &nprop); | | 3580 | &nprop); |
3506 | for (j = 0; j < nprop; j++) { | | 3581 | for (j = 0; j < nprop; j++) { |
3507 | unsigned char *prop; | | 3582 | unsigned char *prop; |
3508 | int actual_format; | | 3583 | int actual_format; |
3509 | unsigned long nitems, bytes_after; | | 3584 | unsigned long nitems, bytes_after; |
3510 | Atom actual_type; | | 3585 | Atom actual_type; |
3511 | XRRPropertyInfo *propinfo; | | 3586 | XRRPropertyInfo *propinfo; |
3512 | char *atom_name = XGetAtomName (dpy, props[j]); | | 3587 | char *atom_name = XGetAtomName (dpy, props[j]); |
3513 | Bool is_edid = strcmp (atom_name, "EDID") == 0; | | 3588 | int k; |
3514 | int bytes_per_item, k; | | | |
3515 | | | 3589 | |
3516 | XRRGetOutputProperty (dpy, output->output.xid, props[j], | | 3590 | XRRGetOutputProperty (dpy, output->output.xid, props[j], |
3517 | 0, 100, False, False, | | 3591 | 0, 100, False, False, |
3518 | AnyPropertyType, | | 3592 | AnyPropertyType, |
3519 | &actual_type, &actual_format, | | 3593 | &actual_type, &actual_format, |
3520 | &nitems, &bytes_after, &prop); | | 3594 | &nitems, &bytes_after, &prop); |
3521 | | | 3595 | |
3522 | propinfo = XRRQueryOutputProperty(dpy, output->output.xid, | | 3596 | propinfo = XRRQueryOutputProperty(dpy, output->output.xid, |
3523 | props[j]); | | 3597 | props[j]); |
3524 | | | 3598 | |
3525 | bytes_per_item = actual_format / 8; | | | |
3526 | | | | |
3527 | printf ("\t%s: ", atom_name); | | 3599 | printf ("\t%s: ", atom_name); |
3528 | | | 3600 | |
3529 | if (is_edid) | | 3601 | print_output_property(atom_name, actual_format, |
3530 | { | | 3602 | actual_type, nitems, prop); |
3531 | printf ("\n\t\t"); | | | |
3532 | } | | | |
3533 | | | | |
3534 | for (k = 0; k < nitems; k++) | | | |
3535 | { | | | |
3536 | if (k != 0) | | | |
3537 | { | | | |
3538 | if ((k % 16) == 0) | | | |
3539 | { | | | |
3540 | printf ("\n\t\t"); | | | |
3541 | } | | | |
3542 | } | | | |
3543 | print_output_property_value (is_edid, actual_format, | | | |
3544 | actual_type, | | | |
3545 | prop + (k * bytes_per_item)); | | | |
3546 | if (!is_edid) | | | |
3547 | { | | | |
3548 | printf (" "); | | | |
3549 | } | | | |
3550 | } | | | |
3551 | printf ("\n"); | | | |
3552 | | | 3603 | |
3553 | if (propinfo->range && propinfo->num_values > 0) | | 3604 | if (propinfo->range && propinfo->num_values > 0) |
3554 | { | | 3605 | { |
3555 | printf ("\t\trange%s: ", | | 3606 | printf ("\t\trange%s: ", |
3556 | (propinfo->num_values == 2) ? "" : "s"); | | 3607 | (propinfo->num_values == 2) ? "" : "s"); |
3557 | for (k = 0; k < propinfo->num_values / 2; k++) | | 3608 | for (k = 0; k < propinfo->num_values / 2; k++) |
3558 | { | | 3609 | { |
3559 | printf ("("); | | 3610 | printf ("("); |
3560 | print_output_property_value (False, 32, actual_type, | | 3611 | print_output_property_value (32, actual_type, |
3561 | (unsigned char *) &(propinfo->values[k * 2])); | | 3612 | (unsigned char *) &(propinfo->values[k * 2])); |
3562 | printf (", "); | | 3613 | printf (", "); |
3563 | print_output_property_value (False, 32, actual_type, | | 3614 | print_output_property_value (32, actual_type, |
3564 | (unsigned char *) &(propinfo->values[k * 2 + 1])); | | 3615 | (unsigned char *) &(propinfo->values[k * 2 + 1])); |
3565 | printf (")"); | | 3616 | printf (")"); |
3566 | if (k < propinfo->num_values / 2 - 1) | | 3617 | if (k < propinfo->num_values / 2 - 1) |
3567 | printf (", "); | | 3618 | printf (", "); |
3568 | } | | 3619 | } |
3569 | printf ("\n"); | | 3620 | printf ("\n"); |
3570 | } | | 3621 | } |
3571 | if (!propinfo->range && propinfo->num_values > 0) | | 3622 | if (!propinfo->range && propinfo->num_values > 0) |
3572 | { | | 3623 | { |
3573 | printf ("\t\tsupported: "); | | 3624 | printf ("\t\tsupported: "); |
3574 | for (k = 0; k < propinfo->num_values; k++) | | 3625 | for (k = 0; k < propinfo->num_values; k++) |
3575 | { | | 3626 | { |
3576 | print_output_property_value (False, 32, actual_type, | | 3627 | print_output_property_value (32, actual_type, |
3577 | (unsigned char *) &(propinfo->values[k])); | | 3628 | (unsigned char *) &(propinfo->values[k])); |
3578 | if (k < propinfo->num_values - 1) | | 3629 | if (k < propinfo->num_values - 1) |
3579 | printf (", "); | | 3630 | printf (", "); |
3580 | } | | 3631 | } |
3581 | printf ("\n"); | | 3632 | printf ("\n"); |
3582 | } | | 3633 | } |
3583 | | | 3634 | |
3584 | free(propinfo); | | 3635 | free(propinfo); |
3585 | } | | 3636 | } |
3586 | } | | 3637 | } |
3587 | | | 3638 | |
3588 | if (verbose) | | 3639 | if (verbose) |
3589 | { | | 3640 | { |
3590 | for (j = 0; j < output_info->nmode; j++) | | 3641 | for (j = 0; j < output_info->nmode; j++) |
3591 | { | | 3642 | { |
3592 | XRRModeInfo *mode = find_mode_by_xid (output_info->modes[j]); | | 3643 | XRRModeInfo *mode = find_mode_by_xid (output_info->modes[j]); |
3593 | int f; | | 3644 | int f; |
3594 | | | 3645 | |
3595 | printf (" %s (0x%x) %6.1fMHz", | | 3646 | printf (" %s (0x%x) %6.3fMHz", |
3596 | mode->name, (int)mode->id, | | 3647 | mode->name, (int)mode->id, |
3597 | (double)mode->dotClock / 1000000.0); | | 3648 | (double)mode->dotClock / 1000000.0); |
3598 | for (f = 0; mode_flags[f].flag; f++) | | 3649 | for (f = 0; mode_flags[f].flag; f++) |
3599 | if (mode->modeFlags & mode_flags[f].flag) | | 3650 | if (mode->modeFlags & mode_flags[f].flag) |
3600 | printf (" %s", mode_flags[f].string); | | 3651 | printf (" %s", mode_flags[f].string); |
3601 | if (mode == output->mode_info) | | 3652 | if (mode == output->mode_info) |
3602 | printf (" *current"); | | 3653 | printf (" *current"); |
3603 | if (j < output_info->npreferred) | | 3654 | if (j < output_info->npreferred) |
3604 | printf (" +preferred"); | | 3655 | printf (" +preferred"); |
3605 | printf ("\n"); | | 3656 | printf ("\n"); |
3606 | printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n", | | 3657 | printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.2fKHz\n", |
3607 | mode->width, mode->hSyncStart, mode->hSyncEnd, | | 3658 | mode->width, mode->hSyncStart, mode->hSyncEnd, |
3608 | mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); | | 3659 | mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); |
3609 | printf (" v: height %4d start %4d end %4d total %4d clock %6.1fHz\n", | | 3660 | printf (" v: height %4d start %4d end %4d total %4d clock %6.2fHz\n", |
3610 | mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, | | 3661 | mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, |
3611 | mode_refresh (mode)); | | 3662 | mode_refresh (mode)); |
3612 | mode->modeFlags |= ModeShown; | | 3663 | mode->modeFlags |= ModeShown; |
3613 | } | | 3664 | } |
3614 | } | | 3665 | } |
3615 | else | | 3666 | else |
3616 | { | | 3667 | { |
3617 | mode_shown = calloc (output_info->nmode, sizeof (Bool)); | | 3668 | mode_shown = calloc (output_info->nmode, sizeof (Bool)); |
3618 | if (!mode_shown) fatal ("out of memory\n"); | | 3669 | if (!mode_shown) fatal ("out of memory\n"); |
3619 | for (j = 0; j < output_info->nmode; j++) | | 3670 | for (j = 0; j < output_info->nmode; j++) |
3620 | { | | 3671 | { |
3621 | XRRModeInfo *jmode, *kmode; | | 3672 | XRRModeInfo *jmode, *kmode; |
3622 | int k; | | 3673 | int k; |
3623 | | | 3674 | |
3624 | if (mode_shown[j]) continue; | | 3675 | if (mode_shown[j]) continue; |
3625 | | | 3676 | |
3626 | jmode = find_mode_by_xid (output_info->modes[j]); | | 3677 | jmode = find_mode_by_xid (output_info->modes[j]); |
3627 | printf (" "); | | 3678 | printf (" "); |
3628 | printf (" %-12s", jmode->name); | | 3679 | printf (" %-12s", jmode->name); |
3629 | for (k = j; k < output_info->nmode; k++) | | 3680 | for (k = j; k < output_info->nmode; k++) |
3630 | { | | 3681 | { |
3631 | if (mode_shown[k]) continue; | | 3682 | if (mode_shown[k]) continue; |
3632 | kmode = find_mode_by_xid (output_info->modes[k]); | | 3683 | kmode = find_mode_by_xid (output_info->modes[k]); |
3633 | if (strcmp (jmode->name, kmode->name) != 0) continue; | | 3684 | if (strcmp (jmode->name, kmode->name) != 0) continue; |
3634 | mode_shown[k] = True; | | 3685 | mode_shown[k] = True; |
3635 | kmode->modeFlags |= ModeShown; | | 3686 | kmode->modeFlags |= ModeShown; |
3636 | printf (" %6.1f", mode_refresh (kmode)); | | 3687 | printf (" %6.2f", mode_refresh (kmode)); |
3637 | if (kmode == output->mode_info) | | 3688 | if (kmode == output->mode_info) |
3638 | printf ("*"); | | 3689 | printf ("*"); |
3639 | else | | 3690 | else |
3640 | printf (" "); | | 3691 | printf (" "); |
3641 | if (k < output_info->npreferred) | | 3692 | if (k < output_info->npreferred) |
3642 | printf ("+"); | | 3693 | printf ("+"); |
3643 | else | | 3694 | else |
3644 | printf (" "); | | 3695 | printf (" "); |
3645 | } | | 3696 | } |
3646 | printf ("\n"); | | 3697 | printf ("\n"); |
3647 | } | | 3698 | } |
3648 | free (mode_shown); | | 3699 | free (mode_shown); |
3649 | } | | 3700 | } |
3650 | } | | 3701 | } |
3651 | for (m = 0; m < res->nmode; m++) | | 3702 | for (m = 0; m < res->nmode; m++) |
3652 | { | | 3703 | { |
3653 | XRRModeInfo *mode = &res->modes[m]; | | 3704 | XRRModeInfo *mode = &res->modes[m]; |
3654 | | | 3705 | |
3655 | if (!(mode->modeFlags & ModeShown)) | | 3706 | if (!(mode->modeFlags & ModeShown)) |
3656 | { | | 3707 | { |
3657 | printf (" %s (0x%x) %6.1fMHz\n", | | 3708 | printf (" %s (0x%x) %6.3fMHz\n", |
3658 | mode->name, (int)mode->id, | | 3709 | mode->name, (int)mode->id, |
3659 | (double)mode->dotClock / 1000000.0); | | 3710 | (double)mode->dotClock / 1000000.0); |
3660 | printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.1fKHz\n", | | 3711 | printf (" h: width %4d start %4d end %4d total %4d skew %4d clock %6.2fKHz\n", |
3661 | mode->width, mode->hSyncStart, mode->hSyncEnd, | | 3712 | mode->width, mode->hSyncStart, mode->hSyncEnd, |
3662 | mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); | | 3713 | mode->hTotal, mode->hSkew, mode_hsync (mode) / 1000); |
3663 | printf (" v: height %4d start %4d end %4d total %4d clock %6.1fHz\n", | | 3714 | printf (" v: height %4d start %4d end %4d total %4d clock %6.2fHz\n", |
3664 | mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, | | 3715 | mode->height, mode->vSyncStart, mode->vSyncEnd, mode->vTotal, |
3665 | mode_refresh (mode)); | | 3716 | mode_refresh (mode)); |
3666 | } | | 3717 | } |
3667 | } | | 3718 | } |
3668 | exit (0); | | 3719 | exit (0); |
3669 | } | | 3720 | } |
3670 | if (list_providers) { | | 3721 | if (list_providers) { |
3671 | int k; | | 3722 | int k; |
3672 | | | 3723 | |
3673 | if (!has_1_4) { | | 3724 | if (!has_1_4) { |
3674 | printf ("RandR 1.4 not supported\n"); | | 3725 | printf ("RandR 1.4 not supported\n"); |
3675 | exit (0); | | 3726 | exit (0); |
3676 | } | | 3727 | } |
| @@ -3740,27 +3791,27 @@ main (int argc, char **argv) | | | @@ -3740,27 +3791,27 @@ main (int argc, char **argv) |
3740 | { | | 3791 | { |
3741 | if (size == current_size) | | 3792 | if (size == current_size) |
3742 | rate = current_rate; | | 3793 | rate = current_rate; |
3743 | else | | 3794 | else |
3744 | rate = 0; | | 3795 | rate = 0; |
3745 | } | | 3796 | } |
3746 | else | | 3797 | else |
3747 | { | | 3798 | { |
3748 | rates = XRRConfigRates (sc, size, &nrate); | | 3799 | rates = XRRConfigRates (sc, size, &nrate); |
3749 | for (i = 0; i < nrate; i++) | | 3800 | for (i = 0; i < nrate; i++) |
3750 | if (rate == rates[i]) | | 3801 | if (rate == rates[i]) |
3751 | break; | | 3802 | break; |
3752 | if (i == nrate) { | | 3803 | if (i == nrate) { |
3753 | fprintf (stderr, "Rate %.1f Hz not available for this size\n", rate); | | 3804 | fprintf (stderr, "Rate %.2f Hz not available for this size\n", rate); |
3754 | exit (1); | | 3805 | exit (1); |
3755 | } | | 3806 | } |
3756 | } | | 3807 | } |
3757 | | | 3808 | |
3758 | if (version) { | | 3809 | if (version) { |
3759 | int major_version, minor_version; | | 3810 | int major_version, minor_version; |
3760 | XRRQueryVersion (dpy, &major_version, &minor_version); | | 3811 | XRRQueryVersion (dpy, &major_version, &minor_version); |
3761 | printf("Server reports RandR version %d.%d\n", | | 3812 | printf("Server reports RandR version %d.%d\n", |
3762 | major_version, minor_version); | | 3813 | major_version, minor_version); |
3763 | } | | 3814 | } |
3764 | | | 3815 | |
3765 | if (query || query_1) { | | 3816 | if (query || query_1) { |
3766 | printf(" SZ: Pixels Physical Refresh\n"); | | 3817 | printf(" SZ: Pixels Physical Refresh\n"); |