[PATCH 3/5] drm/amd/dal: refactor and fix lb memory size setting
Harry Wentland
harry.wentland at amd.com
Fri Nov 25 21:59:39 UTC 2016
From: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>
- Underlay was missing default lb memory size
- Unify num_of_entries and memory size
Change-Id: I521ec6532dba4de55491c4fb164a44bf93250698
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>
Reviewed-by: Reviewed-by: Jordan Lazare <Jordan.Lazare at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c | 24 ++++++++++------------
drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h | 4 +++-
.../gpu/drm/amd/dal/dc/dce100/dce100_resource.c | 1 -
.../gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c | 6 +++---
.../gpu/drm/amd/dal/dc/dce112/dce112_resource.c | 2 +-
drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c | 1 -
drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h | 4 ----
7 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c
index 4659deadcc15..f47b6617f662 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c
@@ -285,7 +285,7 @@ static void dce_transform_set_scaler(
/*Use all three pieces of memory always*/
REG_SET_2(LB_MEMORY_CTRL, 0,
LB_MEMORY_CONFIG, 0,
- LB_MEMORY_SIZE, xfm_dce->base.lb_memory_size);
+ LB_MEMORY_SIZE, xfm_dce->lb_memory_size);
/* 1. Program overscan */
program_overscan(xfm_dce, data);
@@ -649,7 +649,7 @@ static void program_bit_depth_reduction(
}
static int dce_transform_get_max_num_of_supported_lines(
- struct transform *xfm,
+ struct dce_transform *xfm_dce,
enum lb_pixel_depth depth,
int pixel_width)
{
@@ -663,23 +663,23 @@ static int dce_transform_get_max_num_of_supported_lines(
* across multiple entries. */
switch (depth) {
case LB_PIXEL_DEPTH_18BPP:
- pixels_per_entries = xfm->lb_bits_per_entry / 18;
+ pixels_per_entries = xfm_dce->lb_bits_per_entry / 18;
break;
case LB_PIXEL_DEPTH_24BPP:
- pixels_per_entries = xfm->lb_bits_per_entry / 24;
+ pixels_per_entries = xfm_dce->lb_bits_per_entry / 24;
break;
case LB_PIXEL_DEPTH_30BPP:
- pixels_per_entries = xfm->lb_bits_per_entry / 30;
+ pixels_per_entries = xfm_dce->lb_bits_per_entry / 30;
break;
case LB_PIXEL_DEPTH_36BPP:
- pixels_per_entries = xfm->lb_bits_per_entry / 36;
+ pixels_per_entries = xfm_dce->lb_bits_per_entry / 36;
break;
default:
- dm_logger_write(xfm->ctx->logger, LOG_WARNING,
+ dm_logger_write(xfm_dce->base.ctx->logger, LOG_WARNING,
"%s: Invalid LB pixel depth",
__func__);
BREAK_TO_DEBUGGER();
@@ -690,7 +690,7 @@ static int dce_transform_get_max_num_of_supported_lines(
max_pixels_supports =
pixels_per_entries *
- xfm->lb_total_entries_num;
+ xfm_dce->lb_memory_size;
return (max_pixels_supports / pixel_width);
}
@@ -899,7 +899,7 @@ bool dce_transform_get_optimal_number_of_taps(
pixel_width = scl_data->recout.width;
max_num_of_lines = dce_transform_get_max_num_of_supported_lines(
- xfm,
+ xfm_dce,
scl_data->lb_params.depth,
pixel_width);
@@ -995,10 +995,8 @@ bool dce_transform_construct(
LB_PIXEL_DEPTH_24BPP |
LB_PIXEL_DEPTH_30BPP;
- xfm_dce->base.lb_bits_per_entry = LB_BITS_PER_ENTRY;
- xfm_dce->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES;
-
- xfm_dce->base.lb_memory_size = 0x6B0; /*1712*/
+ xfm_dce->lb_bits_per_entry = LB_BITS_PER_ENTRY;
+ xfm_dce->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x6B0*/
return true;
}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h
index b793ddda4783..897645e2889f 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h
+++ b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h
@@ -291,7 +291,9 @@ struct dce_transform {
const uint16_t *filter_h;
const uint16_t *filter_v_c;
const uint16_t *filter_h_c;
- uint32_t lb_pixel_depth_supported;
+ int lb_pixel_depth_supported;
+ int lb_memory_size;
+ int lb_bits_per_entry;
bool prescaler_on;
};
diff --git a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
index 08e0ca11a48d..fafc976e5209 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c
@@ -541,7 +541,6 @@ static struct transform *dce100_transform_create(
if (dce_transform_construct(transform, ctx, inst,
&xfm_regs[inst], &xfm_shift, &xfm_mask)) {
- transform->base.lb_memory_size = 0x6B0; /*1712*/
return &transform->base;
}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c
index 4f2aa7722961..7d8cf7a58f46 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c
@@ -503,7 +503,7 @@ static bool dce110_xfmv_power_up_line_buffer(struct transform *xfm)
/*Use all three pieces of memory always*/
set_reg_field_value(value, 0, LBV_MEMORY_CTRL, LB_MEMORY_CONFIG);
/*hard coded number DCE11 1712(0x6B0) Partitions: 720/960/1712*/
- set_reg_field_value(value, xfm_dce->base.lb_memory_size, LBV_MEMORY_CTRL,
+ set_reg_field_value(value, xfm_dce->lb_memory_size, LBV_MEMORY_CTRL,
LB_MEMORY_SIZE);
dm_write_reg(xfm_dce->base.ctx, mmLBV_MEMORY_CTRL, value);
@@ -697,8 +697,8 @@ bool dce110_transform_v_construct(
LB_PIXEL_DEPTH_30BPP;
xfm_dce->prescaler_on = true;
- xfm_dce->base.lb_bits_per_entry = LB_BITS_PER_ENTRY;
- xfm_dce->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES;
+ xfm_dce->lb_bits_per_entry = LB_BITS_PER_ENTRY;
+ xfm_dce->lb_memory_size = LB_TOTAL_NUMBER_OF_ENTRIES; /*0x6B0*/
return true;
}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
index a9991aa28666..c0d7ecc89374 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c
@@ -555,7 +555,7 @@ static struct transform *dce112_transform_create(
if (dce_transform_construct(transform, ctx, inst,
&xfm_regs[inst], &xfm_shift, &xfm_mask)) {
- transform->base.lb_memory_size = 0x1404; /*5124*/
+ transform->lb_memory_size = 0x1404; /*5124*/
return &transform->base;
}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
index 738201b15722..7dc0e9f6165e 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c
@@ -524,7 +524,6 @@ static struct transform *dce80_transform_create(
if (dce_transform_construct(transform, ctx, inst,
&xfm_regs[inst], &xfm_shift, &xfm_mask)) {
transform->prescaler_on = false;
- transform->base.lb_memory_size = 0x6B0; /*1712*/
return &transform->base;
}
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h b/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h
index 7f88272f8290..ef743b70b3e9 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h
@@ -37,10 +37,6 @@ struct transform {
const struct transform_funcs *funcs;
struct dc_context *ctx;
int inst;
-
- int lb_total_entries_num;
- int lb_bits_per_entry;
- unsigned int lb_memory_size;
};
/* Colorimetry */
--
2.10.1
More information about the amd-gfx
mailing list