diff options
author | Dave Airlie <airlied@linux.ie> | 2009-09-15 20:15:21 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-09-18 02:01:53 -0400 |
commit | 41456df2d45299c2eea5aaabafbaa2430ab9a124 (patch) | |
tree | fad0d3958c9b1d2f9fdc0c919c9d137c47552438 /drivers/gpu | |
parent | 65cb15a686cedab52abc336d7a400fe3a110ac4c (diff) |
drm/radeon/kms: reprogram format in set base.
This should in theory fix the problem with a mode set being required
for adjusting the color depth.
This also adds in the necessary bits to the format tables for
8-bit, though it doesn't work yet.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 41 |
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index a7edd0f2ac37..6a015929deee 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -488,6 +488,11 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
488 | } | 488 | } |
489 | 489 | ||
490 | switch (crtc->fb->bits_per_pixel) { | 490 | switch (crtc->fb->bits_per_pixel) { |
491 | case 8: | ||
492 | fb_format = | ||
493 | AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | | ||
494 | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; | ||
495 | break; | ||
491 | case 15: | 496 | case 15: |
492 | fb_format = | 497 | fb_format = |
493 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 498 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 0d29d15aa62b..2b997a15fb1f 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -341,6 +341,9 @@ void radeon_legacy_atom_set_surface(struct drm_crtc *crtc) | |||
341 | uint32_t crtc_pitch; | 341 | uint32_t crtc_pitch; |
342 | 342 | ||
343 | switch (crtc->fb->bits_per_pixel) { | 343 | switch (crtc->fb->bits_per_pixel) { |
344 | case 8: | ||
345 | format = 2; | ||
346 | break; | ||
344 | case 15: /* 555 */ | 347 | case 15: /* 555 */ |
345 | format = 3; | 348 | format = 3; |
346 | break; | 349 | break; |
@@ -401,11 +404,33 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
401 | uint32_t crtc_offset, crtc_offset_cntl, crtc_tile_x0_y0 = 0; | 404 | uint32_t crtc_offset, crtc_offset_cntl, crtc_tile_x0_y0 = 0; |
402 | uint32_t crtc_pitch, pitch_pixels; | 405 | uint32_t crtc_pitch, pitch_pixels; |
403 | uint32_t tiling_flags; | 406 | uint32_t tiling_flags; |
407 | int format; | ||
408 | uint32_t gen_cntl_reg, gen_cntl_val; | ||
404 | 409 | ||
405 | DRM_DEBUG("\n"); | 410 | DRM_DEBUG("\n"); |
406 | 411 | ||
407 | radeon_fb = to_radeon_framebuffer(crtc->fb); | 412 | radeon_fb = to_radeon_framebuffer(crtc->fb); |
408 | 413 | ||
414 | switch (crtc->fb->bits_per_pixel) { | ||
415 | case 8: | ||
416 | format = 2; | ||
417 | break; | ||
418 | case 15: /* 555 */ | ||
419 | format = 3; | ||
420 | break; | ||
421 | case 16: /* 565 */ | ||
422 | format = 4; | ||
423 | break; | ||
424 | case 24: /* RGB */ | ||
425 | format = 5; | ||
426 | break; | ||
427 | case 32: /* xRGB */ | ||
428 | format = 6; | ||
429 | break; | ||
430 | default: | ||
431 | return false; | ||
432 | } | ||
433 | |||
409 | obj = radeon_fb->obj; | 434 | obj = radeon_fb->obj; |
410 | if (radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &base)) { | 435 | if (radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &base)) { |
411 | return -EINVAL; | 436 | return -EINVAL; |
@@ -458,6 +483,9 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
458 | } else { | 483 | } else { |
459 | int offset = y * pitch_pixels + x; | 484 | int offset = y * pitch_pixels + x; |
460 | switch (crtc->fb->bits_per_pixel) { | 485 | switch (crtc->fb->bits_per_pixel) { |
486 | case 8: | ||
487 | offset *= 1; | ||
488 | break; | ||
461 | case 15: | 489 | case 15: |
462 | case 16: | 490 | case 16: |
463 | offset *= 2; | 491 | offset *= 2; |
@@ -476,6 +504,16 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
476 | 504 | ||
477 | base &= ~7; | 505 | base &= ~7; |
478 | 506 | ||
507 | if (radeon_crtc->crtc_id == 1) | ||
508 | gen_cntl_reg = RADEON_CRTC2_GEN_CNTL; | ||
509 | else | ||
510 | gen_cntl_reg = RADEON_CRTC_GEN_CNTL; | ||
511 | |||
512 | gen_cntl_val = RREG32(gen_cntl_reg); | ||
513 | gen_cntl_val &= ~(0xf << 8); | ||
514 | gen_cntl_val |= (format << 8); | ||
515 | WREG32(gen_cntl_reg, gen_cntl_val); | ||
516 | |||
479 | crtc_offset = (u32)base; | 517 | crtc_offset = (u32)base; |
480 | 518 | ||
481 | WREG32(RADEON_DISPLAY_BASE_ADDR + radeon_crtc->crtc_offset, radeon_crtc->legacy_display_base_addr); | 519 | WREG32(RADEON_DISPLAY_BASE_ADDR + radeon_crtc->crtc_offset, radeon_crtc->legacy_display_base_addr); |
@@ -526,6 +564,9 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod | |||
526 | } | 564 | } |
527 | 565 | ||
528 | switch (crtc->fb->bits_per_pixel) { | 566 | switch (crtc->fb->bits_per_pixel) { |
567 | case 8: | ||
568 | format = 2; | ||
569 | break; | ||
529 | case 15: /* 555 */ | 570 | case 15: /* 555 */ |
530 | format = 3; | 571 | format = 3; |
531 | break; | 572 | break; |