Changeset 60357 in vbox for trunk/src/VBox/Additions/linux/drm
- Timestamp:
- Apr 6, 2016 1:01:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r60352 r60357 429 429 } 430 430 431 /** Generate EDID data with a mode-unique serial number for the virtual 432 * monitor to try to persuade Unity that different modes correspond to 433 * different monitors and it should not try to force the same resolution on 434 * them. */ 435 static void vbox_set_edid(struct drm_connector *connector, int width, 436 int height) 437 { 438 enum { EDID_SIZE = 128 }; 439 unsigned char edid[EDID_SIZE] = { 440 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */ 441 0x58, 0x58, /* manufacturer (VBX) */ 442 0x00, 0x00, /* product code */ 443 0x00, 0x00,0x00, 0x00, /* serial number goes here */ 444 0x01, /* week of manufacture */ 445 0x00, /* year of manufacture */ 446 0x01, 0x03, /* EDID version */ 447 0x80, /* capabilities - digital */ 448 0x00, /* horiz. res in cm, zero for projectors */ 449 0x00, /* vert. res in cm */ 450 0x78, /* display gamma (120 == 2.2). */ 451 0xEE, /* features (standby, suspend, off, RGB, standard colour space, 452 * preferred timing mode) */ 453 0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54, 454 /* chromaticity for standard colour space. */ 455 0x00, 0x00, 0x00, /* no default timings */ 456 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 457 0x01, 0x01, 0x01, 0x01, /* no standard timings */ 458 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* descriptor block 1 goes here */ 460 0x00, 0x00, 0x00, 0xFD, 0x00, /* descriptor block 2, monitor ranges */ 461 0x00, 0xC8, 0x00, 0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 462 0x20, /* 0-200Hz vertical, 0-200KHz horizontal, 1000MHz pixel clock */ 463 0x00, 0x00, 0x00, 0xFC, 0x00, /* descriptor block 3, monitor name */ 464 'V', 'B', 'O', 'X', ' ', 'm', 'o', 'n', 'i', 't', 'o', 'r', '\n', 465 0x00, 0x00, 0x00, 0x10, 0x00, /* descriptor block 4: dummy data */ 466 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 467 0x20, 468 0x00, /* number of extensions */ 469 0x00 /* checksum goes here */ 470 }; 471 int clock = (width + 6) * (height + 6) * 60 / 10000; 472 unsigned i; 473 unsigned sum = 0; 474 475 edid[12] = width & 0xff; 476 edid[13] = width >> 8; 477 edid[14] = height & 0xff; 478 edid[15] = height >> 8; 479 edid[54] = clock & 0xff; 480 edid[55] = clock >> 8; 481 edid[56] = width & 0xff; 482 edid[58] = (width >> 4) & 0xf0; 483 edid[59] = height & 0xff; 484 edid[61] = (height >> 4) & 0xf0; 485 for (i = 0; i < EDID_SIZE - 1; ++i) 486 sum += edid[i]; 487 edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF; 488 drm_mode_connector_update_edid_property(connector, (struct edid *)edid); 489 } 490 431 491 static int vbox_get_modes(struct drm_connector *connector) 432 492 { … … 460 520 ++num_modes; 461 521 } 522 vbox_set_edid(connector, preferred_width, preferred_height); 462 523 return num_modes; 463 524 }
Note:
See TracChangeset
for help on using the changeset viewer.