diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen_cs.c | 49 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 3 |
2 files changed, 47 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 4e7dd2b4843d..c16554122ccd 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -52,6 +52,7 @@ struct evergreen_cs_track { | |||
52 | u32 cb_color_view[12]; | 52 | u32 cb_color_view[12]; |
53 | u32 cb_color_pitch[12]; | 53 | u32 cb_color_pitch[12]; |
54 | u32 cb_color_slice[12]; | 54 | u32 cb_color_slice[12]; |
55 | u32 cb_color_slice_idx[12]; | ||
55 | u32 cb_color_attrib[12]; | 56 | u32 cb_color_attrib[12]; |
56 | u32 cb_color_cmask_slice[8];/* unused */ | 57 | u32 cb_color_cmask_slice[8];/* unused */ |
57 | u32 cb_color_fmask_slice[8];/* unused */ | 58 | u32 cb_color_fmask_slice[8];/* unused */ |
@@ -127,12 +128,14 @@ static void evergreen_cs_track_init(struct evergreen_cs_track *track) | |||
127 | track->cb_color_info[i] = 0; | 128 | track->cb_color_info[i] = 0; |
128 | track->cb_color_view[i] = 0xFFFFFFFF; | 129 | track->cb_color_view[i] = 0xFFFFFFFF; |
129 | track->cb_color_pitch[i] = 0; | 130 | track->cb_color_pitch[i] = 0; |
130 | track->cb_color_slice[i] = 0; | 131 | track->cb_color_slice[i] = 0xfffffff; |
132 | track->cb_color_slice_idx[i] = 0; | ||
131 | } | 133 | } |
132 | track->cb_target_mask = 0xFFFFFFFF; | 134 | track->cb_target_mask = 0xFFFFFFFF; |
133 | track->cb_shader_mask = 0xFFFFFFFF; | 135 | track->cb_shader_mask = 0xFFFFFFFF; |
134 | track->cb_dirty = true; | 136 | track->cb_dirty = true; |
135 | 137 | ||
138 | track->db_depth_slice = 0xffffffff; | ||
136 | track->db_depth_view = 0xFFFFC000; | 139 | track->db_depth_view = 0xFFFFC000; |
137 | track->db_depth_size = 0xFFFFFFFF; | 140 | track->db_depth_size = 0xFFFFFFFF; |
138 | track->db_depth_control = 0xFFFFFFFF; | 141 | track->db_depth_control = 0xFFFFFFFF; |
@@ -250,10 +253,9 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
250 | { | 253 | { |
251 | struct evergreen_cs_track *track = p->track; | 254 | struct evergreen_cs_track *track = p->track; |
252 | unsigned palign, halign, tileb, slice_pt; | 255 | unsigned palign, halign, tileb, slice_pt; |
256 | unsigned mtile_pr, mtile_ps, mtileb; | ||
253 | 257 | ||
254 | tileb = 64 * surf->bpe * surf->nsamples; | 258 | tileb = 64 * surf->bpe * surf->nsamples; |
255 | palign = track->group_size / (8 * surf->bpe * surf->nsamples); | ||
256 | palign = MAX(8, palign); | ||
257 | slice_pt = 1; | 259 | slice_pt = 1; |
258 | if (tileb > surf->tsplit) { | 260 | if (tileb > surf->tsplit) { |
259 | slice_pt = tileb / surf->tsplit; | 261 | slice_pt = tileb / surf->tsplit; |
@@ -262,7 +264,10 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
262 | /* macro tile width & height */ | 264 | /* macro tile width & height */ |
263 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; | 265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; |
264 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; | 266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; |
265 | surf->layer_size = surf->nbx * surf->nby * surf->bpe * slice_pt; | 267 | mtileb = (palign / 8) * (halign / 8) * tileb;; |
268 | mtile_pr = surf->nbx / palign; | ||
269 | mtile_ps = (mtile_pr * surf->nby) / halign; | ||
270 | surf->layer_size = mtile_ps * mtileb * slice_pt; | ||
266 | surf->base_align = (palign / 8) * (halign / 8) * tileb; | 271 | surf->base_align = (palign / 8) * (halign / 8) * tileb; |
267 | surf->palign = palign; | 272 | surf->palign = palign; |
268 | surf->halign = halign; | 273 | surf->halign = halign; |
@@ -434,6 +439,39 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i | |||
434 | 439 | ||
435 | offset += surf.layer_size * mslice; | 440 | offset += surf.layer_size * mslice; |
436 | if (offset > radeon_bo_size(track->cb_color_bo[id])) { | 441 | if (offset > radeon_bo_size(track->cb_color_bo[id])) { |
442 | /* old ddx are broken they allocate bo with w*h*bpp but | ||
443 | * program slice with ALIGN(h, 8), catch this and patch | ||
444 | * command stream. | ||
445 | */ | ||
446 | if (!surf.mode) { | ||
447 | volatile u32 *ib = p->ib.ptr; | ||
448 | unsigned long tmp, nby, bsize, size, min = 0; | ||
449 | |||
450 | /* find the height the ddx wants */ | ||
451 | if (surf.nby > 8) { | ||
452 | min = surf.nby - 8; | ||
453 | } | ||
454 | bsize = radeon_bo_size(track->cb_color_bo[id]); | ||
455 | tmp = track->cb_color_bo_offset[id] << 8; | ||
456 | for (nby = surf.nby; nby > min; nby--) { | ||
457 | size = nby * surf.nbx * surf.bpe * surf.nsamples; | ||
458 | if ((tmp + size * mslice) <= bsize) { | ||
459 | break; | ||
460 | } | ||
461 | } | ||
462 | if (nby > min) { | ||
463 | surf.nby = nby; | ||
464 | slice = ((nby * surf.nbx) / 64) - 1; | ||
465 | if (!evergreen_surface_check(p, &surf, "cb")) { | ||
466 | /* check if this one works */ | ||
467 | tmp += surf.layer_size * mslice; | ||
468 | if (tmp <= bsize) { | ||
469 | ib[track->cb_color_slice_idx[id]] = slice; | ||
470 | goto old_ddx_ok; | ||
471 | } | ||
472 | } | ||
473 | } | ||
474 | } | ||
437 | dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, " | 475 | dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, " |
438 | "offset %d, max layer %d, bo size %ld, slice %d)\n", | 476 | "offset %d, max layer %d, bo size %ld, slice %d)\n", |
439 | __func__, __LINE__, id, surf.layer_size, | 477 | __func__, __LINE__, id, surf.layer_size, |
@@ -446,6 +484,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i | |||
446 | surf.tsplit, surf.mtilea); | 484 | surf.tsplit, surf.mtilea); |
447 | return -EINVAL; | 485 | return -EINVAL; |
448 | } | 486 | } |
487 | old_ddx_ok: | ||
449 | 488 | ||
450 | return 0; | 489 | return 0; |
451 | } | 490 | } |
@@ -1532,6 +1571,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
1532 | case CB_COLOR7_SLICE: | 1571 | case CB_COLOR7_SLICE: |
1533 | tmp = (reg - CB_COLOR0_SLICE) / 0x3c; | 1572 | tmp = (reg - CB_COLOR0_SLICE) / 0x3c; |
1534 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); | 1573 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); |
1574 | track->cb_color_slice_idx[tmp] = idx; | ||
1535 | track->cb_dirty = true; | 1575 | track->cb_dirty = true; |
1536 | break; | 1576 | break; |
1537 | case CB_COLOR8_SLICE: | 1577 | case CB_COLOR8_SLICE: |
@@ -1540,6 +1580,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
1540 | case CB_COLOR11_SLICE: | 1580 | case CB_COLOR11_SLICE: |
1541 | tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8; | 1581 | tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8; |
1542 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); | 1582 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); |
1583 | track->cb_color_slice_idx[tmp] = idx; | ||
1543 | track->cb_dirty = true; | 1584 | track->cb_dirty = true; |
1544 | break; | 1585 | break; |
1545 | case CB_COLOR0_ATTRIB: | 1586 | case CB_COLOR0_ATTRIB: |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index f0bb2b543b13..03e5f5df40f1 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -57,9 +57,10 @@ | |||
57 | * 2.13.0 - virtual memory support, streamout | 57 | * 2.13.0 - virtual memory support, streamout |
58 | * 2.14.0 - add evergreen tiling informations | 58 | * 2.14.0 - add evergreen tiling informations |
59 | * 2.15.0 - add max_pipes query | 59 | * 2.15.0 - add max_pipes query |
60 | * 2.16.0 - fix evergreen 2D tiled surface calculation | ||
60 | */ | 61 | */ |
61 | #define KMS_DRIVER_MAJOR 2 | 62 | #define KMS_DRIVER_MAJOR 2 |
62 | #define KMS_DRIVER_MINOR 15 | 63 | #define KMS_DRIVER_MINOR 16 |
63 | #define KMS_DRIVER_PATCHLEVEL 0 | 64 | #define KMS_DRIVER_PATCHLEVEL 0 |
64 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 65 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
65 | int radeon_driver_unload_kms(struct drm_device *dev); | 66 | int radeon_driver_unload_kms(struct drm_device *dev); |