aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-12-09 14:40:06 -0500
committerDave Airlie <airlied@redhat.com>2009-12-10 00:09:05 -0500
commit69b3b5e59bc763c30d0098ae4bbe1225c0e82a04 (patch)
tree0e76e8bc46d589419eb16769a2c3560810395ac7
parent2e7b6f7fa62d92d941c626f8ae45f5cd75a52d55 (diff)
drm/radeon/kms/avivo: fix some bugs in the display bandwidth setup
Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
-rw-r--r--drivers/gpu/drm/radeon/radeon_fixed.h17
-rw-r--r--drivers/gpu/drm/radeon/rs690.c7
-rw-r--r--drivers/gpu/drm/radeon/rv515.c9
3 files changed, 28 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_fixed.h b/drivers/gpu/drm/radeon/radeon_fixed.h
index 90187d173847..3d4d84e078ac 100644
--- a/drivers/gpu/drm/radeon/radeon_fixed.h
+++ b/drivers/gpu/drm/radeon/radeon_fixed.h
@@ -38,6 +38,23 @@ typedef union rfixed {
38#define fixed_init_half(A) { .full = rfixed_const_half((A)) } 38#define fixed_init_half(A) { .full = rfixed_const_half((A)) }
39#define rfixed_trunc(A) ((A).full >> 12) 39#define rfixed_trunc(A) ((A).full >> 12)
40 40
41static inline u32 rfixed_floor(fixed20_12 A)
42{
43 u32 non_frac = rfixed_trunc(A);
44
45 return rfixed_const(non_frac);
46}
47
48static inline u32 rfixed_ceil(fixed20_12 A)
49{
50 u32 non_frac = rfixed_trunc(A);
51
52 if (A.full > rfixed_const(non_frac))
53 return rfixed_const(non_frac + 1);
54 else
55 return rfixed_const(non_frac);
56}
57
41static inline u32 rfixed_div(fixed20_12 A, fixed20_12 B) 58static inline u32 rfixed_div(fixed20_12 A, fixed20_12 B)
42{ 59{
43 u64 tmp = ((u64)A.full << 13); 60 u64 tmp = ((u64)A.full << 13);
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index eb486ee7ea00..98079367fbba 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -260,8 +260,9 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
260 260
261 b.full = rfixed_const(mode->crtc_hdisplay); 261 b.full = rfixed_const(mode->crtc_hdisplay);
262 c.full = rfixed_const(256); 262 c.full = rfixed_const(256);
263 a.full = rfixed_mul(wm->num_line_pair, b); 263 a.full = rfixed_div(b, c);
264 request_fifo_depth.full = rfixed_div(a, c); 264 request_fifo_depth.full = rfixed_mul(a, wm->num_line_pair);
265 request_fifo_depth.full = rfixed_ceil(request_fifo_depth);
265 if (a.full < rfixed_const(4)) { 266 if (a.full < rfixed_const(4)) {
266 wm->lb_request_fifo_depth = 4; 267 wm->lb_request_fifo_depth = 4;
267 } else { 268 } else {
@@ -390,6 +391,7 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
390 a.full = rfixed_const(16); 391 a.full = rfixed_const(16);
391 wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay); 392 wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay);
392 wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a); 393 wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a);
394 wm->priority_mark_max.full = rfixed_ceil(wm->priority_mark_max);
393 395
394 /* Determine estimated width */ 396 /* Determine estimated width */
395 estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full; 397 estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full;
@@ -399,6 +401,7 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
399 } else { 401 } else {
400 a.full = rfixed_const(16); 402 a.full = rfixed_const(16);
401 wm->priority_mark.full = rfixed_div(estimated_width, a); 403 wm->priority_mark.full = rfixed_div(estimated_width, a);
404 wm->priority_mark.full = rfixed_ceil(wm->priority_mark);
402 wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; 405 wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full;
403 } 406 }
404} 407}
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 7793239e24b2..6aa4ad87222a 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -889,8 +889,9 @@ void rv515_crtc_bandwidth_compute(struct radeon_device *rdev,
889 889
890 b.full = rfixed_const(mode->crtc_hdisplay); 890 b.full = rfixed_const(mode->crtc_hdisplay);
891 c.full = rfixed_const(256); 891 c.full = rfixed_const(256);
892 a.full = rfixed_mul(wm->num_line_pair, b); 892 a.full = rfixed_div(b, c);
893 request_fifo_depth.full = rfixed_div(a, c); 893 request_fifo_depth.full = rfixed_mul(a, wm->num_line_pair);
894 request_fifo_depth.full = rfixed_ceil(request_fifo_depth);
894 if (a.full < rfixed_const(4)) { 895 if (a.full < rfixed_const(4)) {
895 wm->lb_request_fifo_depth = 4; 896 wm->lb_request_fifo_depth = 4;
896 } else { 897 } else {
@@ -992,15 +993,17 @@ void rv515_crtc_bandwidth_compute(struct radeon_device *rdev,
992 a.full = rfixed_const(16); 993 a.full = rfixed_const(16);
993 wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay); 994 wm->priority_mark_max.full = rfixed_const(crtc->base.mode.crtc_hdisplay);
994 wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a); 995 wm->priority_mark_max.full = rfixed_div(wm->priority_mark_max, a);
996 wm->priority_mark_max.full = rfixed_ceil(wm->priority_mark_max);
995 997
996 /* Determine estimated width */ 998 /* Determine estimated width */
997 estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full; 999 estimated_width.full = tolerable_latency.full - wm->worst_case_latency.full;
998 estimated_width.full = rfixed_div(estimated_width, consumption_time); 1000 estimated_width.full = rfixed_div(estimated_width, consumption_time);
999 if (rfixed_trunc(estimated_width) > crtc->base.mode.crtc_hdisplay) { 1001 if (rfixed_trunc(estimated_width) > crtc->base.mode.crtc_hdisplay) {
1000 wm->priority_mark.full = rfixed_const(10); 1002 wm->priority_mark.full = wm->priority_mark_max.full;
1001 } else { 1003 } else {
1002 a.full = rfixed_const(16); 1004 a.full = rfixed_const(16);
1003 wm->priority_mark.full = rfixed_div(estimated_width, a); 1005 wm->priority_mark.full = rfixed_div(estimated_width, a);
1006 wm->priority_mark.full = rfixed_ceil(wm->priority_mark);
1004 wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full; 1007 wm->priority_mark.full = wm->priority_mark_max.full - wm->priority_mark.full;
1005 } 1008 }
1006} 1009}