Rev 1230 | Rev 1313 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1230 | Rev 1233 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | #include "drm_fb_helper.h" |
40 | #include "drm_fb_helper.h" |
Line 41... | Line 41... | ||
41 | 41 | ||
42 | #include |
42 | #include |
Line -... | Line 43... | ||
- | 43 | #include "radeon_object.h" |
|
43 | #include "radeon_object.h" |
44 | |
Line 44... | Line 45... | ||
44 | 45 | ||
45 | struct fb_info *framebuffer_alloc(size_t size, void *dev); |
46 | struct fb_info *framebuffer_alloc(size_t size, void *dev); |
46 | 47 | ||
Line 101... | Line 102... | ||
101 | 102 | ||
102 | return 0; |
103 | return 0; |
103 | } |
104 | } |
Line 104... | Line 105... | ||
104 | EXPORT_SYMBOL(radeonfb_resize); |
105 | EXPORT_SYMBOL(radeonfb_resize); |
105 | 106 | ||
106 | static int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) |
107 | int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) |
107 | { |
108 | { |
108 | int aligned = width; |
109 | int aligned = width; |
Line 434... | Line 435... | ||
434 | return info; |
435 | return info; |
435 | #undef PADDING |
436 | #undef PADDING |
436 | #undef BYTES_PER_LONG |
437 | #undef BYTES_PER_LONG |
437 | } |
438 | }> |
Line 438... | Line -... | ||
438 | - | ||
439 | static char *manufacturer_name(unsigned char *x) |
- | |
440 | { |
- | |
441 | static char name[4]; |
- | |
442 | - | ||
443 | name[0] = ((x[0] & 0x7C) >> 2) + '@'; |
- | |
444 | name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'; |
- | |
445 | name[2] = (x[1] & 0x1F) + '@'; |
- | |
446 | name[3] = 0; |
- | |
447 | - | ||
448 | return name; |
- | |
449 | } |
- | |
450 | - | ||
451 | void set_crtc(struct drm_crtc *crtc); |
- | |
452 | - | ||
453 | bool set_mode(struct drm_device *dev, int width, int height) |
- | |
454 | { |
- | |
455 | struct drm_connector *connector; |
- | |
456 | - | ||
457 | bool ret = false; |
- | |
458 | - | ||
459 | ENTER(); |
- | |
460 | - | ||
461 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
- | |
462 | { |
- | |
463 | struct drm_display_mode *mode; |
- | |
464 | - | ||
465 | struct drm_encoder *encoder; |
- | |
466 | struct drm_crtc *crtc; |
- | |
467 | - | ||
468 | if( connector->status != connector_status_connected) |
- | |
469 | continue; |
- | |
470 | - | ||
471 | encoder = connector->encoder; |
- | |
472 | if( encoder == NULL) |
- | |
473 | continue; |
- | |
474 | - | ||
475 | crtc = encoder->crtc; |
- | |
476 | - | ||
477 | if(crtc == NULL) |
- | |
478 | continue; |
- | |
479 | - | ||
480 | list_for_each_entry(mode, &connector->modes, head) |
- | |
481 | { |
- | |
482 | char *con_name, *enc_name; |
- | |
483 | - | ||
484 | struct drm_framebuffer *fb; |
- | |
485 | - | ||
486 | if (drm_mode_width(mode) == width && |
- | |
487 | drm_mode_height(mode) == height) |
- | |
488 | { |
- | |
489 | char con_edid[128]; |
- | |
490 | - | ||
491 | fb = list_first_entry(&dev->mode_config.fb_kernel_list, |
- | |
492 | struct drm_framebuffer, filp_head); |
- | |
493 | - | ||
494 | memcpy(con_edid, connector->edid_blob_ptr->data, 128); |
- | |
495 | - | ||
496 | dbgprintf("Manufacturer: %s Model %x Serial Number %u\n", |
- | |
497 | manufacturer_name(con_edid + 0x08), |
- | |
498 | (unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)), |
- | |
499 | (unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8) |
- | |
500 | + (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24))); |
- | |
501 | - | ||
502 | - | ||
503 | con_name = drm_get_connector_name(connector); |
- | |
504 | enc_name = drm_get_encoder_name(encoder); |
- | |
505 | - | ||
506 | dbgprintf("set mode %d %d connector %s encoder %s\n", |
- | |
507 | width, height, con_name, enc_name); |
- | |
508 | - | ||
509 | fb->width = width; |
- | |
510 | fb->height = height; |
- | |
511 | fb->pitch = radeon_align_pitch(dev->dev_private, width, 32, false) * ((32 + 1) / 8); |
- | |
512 | - | ||
513 | crtc->fb = fb; |
- | |
514 | crtc->enabled = true; |
- | |
515 | set_crtc(crtc); |
- | |
516 | - | ||
517 | ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb); |
- | |
518 | - | ||
519 | sysSetScreen(fb->width, fb->height, fb->pitch); |
- | |
520 | - | ||
521 | if (ret == true) |
- | |
522 | { |
- | |
523 | dbgprintf("new mode %d %d pitch %d\n",fb->width, fb->height, fb->pitch); |
- | |
524 | } |
- | |
525 | else |
- | |
526 | { |
- | |
527 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
- | |
528 | fb->width, fb->height, crtc); |
- | |
529 | }; |
- | |
530 | - | ||
Line 531... | Line -... | ||
531 | LEAVE(); |
- | |
532 | - | ||
533 | return ret; |
- | |
534 | }; |
- | |
535 | } |
- | |
536 | }; |
- | |
537 | LEAVE(); |
- |