Commit 4162338a authored by Dave Airlie's avatar Dave Airlie

drm/radeon/kms: set crtc and cursor offsets correctly on legacy chips.

The crtc and cursor offsets on the legacy chips are offset from
DISPLAY_BASE_ADDR. The code worked if display base addr was at 0,
but otherwise falls to pieces.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6cdf6585
...@@ -113,7 +113,7 @@ static void radeon_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj, ...@@ -113,7 +113,7 @@ static void radeon_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj,
WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr); WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr);
else else
/* offset is from DISP(2)_BASE_ADDRESS */ /* offset is from DISP(2)_BASE_ADDRESS */
WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, gpu_addr); WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, (gpu_addr-radeon_crtc->legacy_display_base_addr));
} }
int radeon_crtc_cursor_set(struct drm_crtc *crtc, int radeon_crtc_cursor_set(struct drm_crtc *crtc,
......
...@@ -244,7 +244,12 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -244,7 +244,12 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
if (radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &base)) { if (radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &base)) {
return -EINVAL; return -EINVAL;
} }
crtc_offset = (u32)base; /* if scanout was in GTT this really wouldn't work */
/* crtc offset is from display base addr not FB location */
radeon_crtc->legacy_display_base_addr = rdev->mc.vram_location;
base -= radeon_crtc->legacy_display_base_addr;
crtc_offset_cntl = 0; crtc_offset_cntl = 0;
pitch_pixels = crtc->fb->pitch / (crtc->fb->bits_per_pixel / 8); pitch_pixels = crtc->fb->pitch / (crtc->fb->bits_per_pixel / 8);
...@@ -303,11 +308,9 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -303,11 +308,9 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
base &= ~7; base &= ~7;
/* update sarea TODO */
crtc_offset = (u32)base; crtc_offset = (u32)base;
WREG32(RADEON_DISPLAY_BASE_ADDR + radeon_crtc->crtc_offset, rdev->mc.vram_location); WREG32(RADEON_DISPLAY_BASE_ADDR + radeon_crtc->crtc_offset, radeon_crtc->legacy_display_base_addr);
if (ASIC_IS_R300(rdev)) { if (ASIC_IS_R300(rdev)) {
if (radeon_crtc->crtc_id) if (radeon_crtc->crtc_id)
......
...@@ -185,6 +185,7 @@ struct radeon_crtc { ...@@ -185,6 +185,7 @@ struct radeon_crtc {
uint64_t cursor_addr; uint64_t cursor_addr;
int cursor_width; int cursor_width;
int cursor_height; int cursor_height;
uint32_t legacy_display_base_addr;
}; };
#define RADEON_USE_RMX 1 #define RADEON_USE_RMX 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment