aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/radeon/atom.c15
-rw-r--r--drivers/gpu/drm/radeon/atom.h1
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c25
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c2
5 files changed, 36 insertions, 9 deletions
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index e88c64417a8a..14cc88aaf3a7 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -277,7 +277,12 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,
277 case ATOM_ARG_FB: 277 case ATOM_ARG_FB:
278 idx = U8(*ptr); 278 idx = U8(*ptr);
279 (*ptr)++; 279 (*ptr)++;
280 val = gctx->scratch[((gctx->fb_base + idx) / 4)]; 280 if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
281 DRM_ERROR("ATOM: fb read beyond scratch region: %d vs. %d\n",
282 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
283 val = 0;
284 } else
285 val = gctx->scratch[(gctx->fb_base / 4) + idx];
281 if (print) 286 if (print)
282 DEBUG("FB[0x%02X]", idx); 287 DEBUG("FB[0x%02X]", idx);
283 break; 288 break;
@@ -531,7 +536,11 @@ static void atom_put_dst(atom_exec_context *ctx, int arg, uint8_t attr,
531 case ATOM_ARG_FB: 536 case ATOM_ARG_FB:
532 idx = U8(*ptr); 537 idx = U8(*ptr);
533 (*ptr)++; 538 (*ptr)++;
534 gctx->scratch[((gctx->fb_base + idx) / 4)] = val; 539 if ((gctx->fb_base + (idx * 4)) > gctx->scratch_size_bytes) {
540 DRM_ERROR("ATOM: fb write beyond scratch region: %d vs. %d\n",
541 gctx->fb_base + (idx * 4), gctx->scratch_size_bytes);
542 } else
543 gctx->scratch[(gctx->fb_base / 4) + idx] = val;
535 DEBUG("FB[0x%02X]", idx); 544 DEBUG("FB[0x%02X]", idx);
536 break; 545 break;
537 case ATOM_ARG_PLL: 546 case ATOM_ARG_PLL:
@@ -1370,11 +1379,13 @@ int atom_allocate_fb_scratch(struct atom_context *ctx)
1370 1379
1371 usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024; 1380 usage_bytes = firmware_usage->asFirmwareVramReserveInfo[0].usFirmwareUseInKb * 1024;
1372 } 1381 }
1382 ctx->scratch_size_bytes = 0;
1373 if (usage_bytes == 0) 1383 if (usage_bytes == 0)
1374 usage_bytes = 20 * 1024; 1384 usage_bytes = 20 * 1024;
1375 /* allocate some scratch memory */ 1385 /* allocate some scratch memory */
1376 ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL); 1386 ctx->scratch = kzalloc(usage_bytes, GFP_KERNEL);
1377 if (!ctx->scratch) 1387 if (!ctx->scratch)
1378 return -ENOMEM; 1388 return -ENOMEM;
1389 ctx->scratch_size_bytes = usage_bytes;
1379 return 0; 1390 return 0;
1380} 1391}
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h
index a589a55b223e..93cfe2086ba0 100644
--- a/drivers/gpu/drm/radeon/atom.h
+++ b/drivers/gpu/drm/radeon/atom.h
@@ -137,6 +137,7 @@ struct atom_context {
137 int cs_equal, cs_above; 137 int cs_equal, cs_above;
138 int io_mode; 138 int io_mode;
139 uint32_t *scratch; 139 uint32_t *scratch;
140 int scratch_size_bytes;
140}; 141};
141 142
142extern int atom_debug; 143extern int atom_debug;
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index c742944d3805..a515b2a09d85 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -466,7 +466,7 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc,
466 return; 466 return;
467 } 467 }
468 args.v2.ucEnable = enable; 468 args.v2.ucEnable = enable;
469 if ((ss->percentage == 0) || (ss->type & ATOM_EXTERNAL_SS_MASK)) 469 if ((ss->percentage == 0) || (ss->type & ATOM_EXTERNAL_SS_MASK) || ASIC_IS_DCE41(rdev))
470 args.v2.ucEnable = ATOM_DISABLE; 470 args.v2.ucEnable = ATOM_DISABLE;
471 } else if (ASIC_IS_DCE3(rdev)) { 471 } else if (ASIC_IS_DCE3(rdev)) {
472 args.v1.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage); 472 args.v1.usSpreadSpectrumPercentage = cpu_to_le16(ss->percentage);
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 8a171b21b453..eb3f6dc6df83 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -1638,7 +1638,17 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
1638 break; 1638 break;
1639 case 2: 1639 case 2:
1640 args.v2.ucCRTC = radeon_crtc->crtc_id; 1640 args.v2.ucCRTC = radeon_crtc->crtc_id;
1641 args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder); 1641 if (radeon_encoder_is_dp_bridge(encoder)) {
1642 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
1643
1644 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
1645 args.v2.ucEncodeMode = ATOM_ENCODER_MODE_LVDS;
1646 else if (connector->connector_type == DRM_MODE_CONNECTOR_VGA)
1647 args.v2.ucEncodeMode = ATOM_ENCODER_MODE_CRT;
1648 else
1649 args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
1650 } else
1651 args.v2.ucEncodeMode = atombios_get_encoder_mode(encoder);
1642 switch (radeon_encoder->encoder_id) { 1652 switch (radeon_encoder->encoder_id) {
1643 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 1653 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
1644 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: 1654 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
@@ -1756,10 +1766,15 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
1756 if (ASIC_IS_DCE4(rdev)) { 1766 if (ASIC_IS_DCE4(rdev)) {
1757 dig = radeon_encoder->enc_priv; 1767 dig = radeon_encoder->enc_priv;
1758 if (ASIC_IS_DCE41(rdev)) { 1768 if (ASIC_IS_DCE41(rdev)) {
1759 if (dig->linkb) 1769 /* ontario follows DCE4 */
1760 return 1; 1770 if (rdev->family == CHIP_PALM) {
1761 else 1771 if (dig->linkb)
1762 return 0; 1772 return 1;
1773 else
1774 return 0;
1775 } else
1776 /* llano follows DCE3.2 */
1777 return radeon_crtc->crtc_id;
1763 } else { 1778 } else {
1764 switch (radeon_encoder->encoder_id) { 1779 switch (radeon_encoder->encoder_id) {
1765 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: 1780 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index ae3c6f5dd2b7..082fcaea583f 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -321,7 +321,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
321 struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type]; 321 struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type];
322 struct ttm_tt *ttm = bo->ttm; 322 struct ttm_tt *ttm = bo->ttm;
323 struct ttm_mem_reg *old_mem = &bo->mem; 323 struct ttm_mem_reg *old_mem = &bo->mem;
324 struct ttm_mem_reg old_copy; 324 struct ttm_mem_reg old_copy = *old_mem;
325 void *old_iomap; 325 void *old_iomap;
326 void *new_iomap; 326 void *new_iomap;
327 int ret; 327 int ret;