[PATCH] amdgpu/dc: move filter taps to being static const data (v2)

Harry Wentland harry.wentland at amd.com
Thu Sep 28 14:41:44 UTC 2017


On 2017-09-27 08:22 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This just adds two accessor methods, and moves all the data
> to static const.
> 
> v2: fix dcn build.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Harry Wentland <harry.wentland at amd.com>

Harry

> ---
>  .../gpu/drm/amd/display/dc/dce/dce_scl_filters.c   | 78 ++++++++++++----------
>  drivers/gpu/drm/amd/display/dc/dce/dce_transform.c |  2 +-
>  .../drm/amd/display/dc/dce110/dce110_transform_v.c |  2 +-
>  .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c  |  2 +-
>  drivers/gpu/drm/amd/display/dc/inc/hw/transform.h  |  4 +-
>  5 files changed, 49 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_scl_filters.c b/drivers/gpu/drm/amd/display/dc/dce/dce_scl_filters.c
> index 2cfdb83..6243450 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_scl_filters.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_scl_filters.c
> @@ -25,7 +25,7 @@
>  
>  #include "transform.h"
>  
> -const uint16_t filter_2tap_16p[18] = {
> +static const uint16_t filter_2tap_16p[18] = {
>  	4096, 0,
>  	3840, 256,
>  	3584, 512,
> @@ -37,7 +37,7 @@ const uint16_t filter_2tap_16p[18] = {
>  	2048, 2048
>  };
>  
> -const uint16_t filter_3tap_16p_upscale[27] = {
> +static const uint16_t filter_3tap_16p_upscale[27] = {
>  	2048, 2048, 0,
>  	1708, 2424, 16348,
>  	1372, 2796, 16308,
> @@ -49,7 +49,7 @@ const uint16_t filter_3tap_16p_upscale[27] = {
>  	0, 4096, 0
>  };
>  
> -const uint16_t filter_3tap_16p_117[27] = {
> +static const uint16_t filter_3tap_16p_117[27] = {
>  	2048, 2048, 0,
>  	1824, 2276, 16376,
>  	1600, 2496, 16380,
> @@ -61,7 +61,7 @@ const uint16_t filter_3tap_16p_117[27] = {
>  	428, 3236, 428
>  };
>  
> -const uint16_t filter_3tap_16p_150[27] = {
> +static const uint16_t filter_3tap_16p_150[27] = {
>  	2048, 2048, 0,
>  	1872, 2184, 36,
>  	1692, 2308, 88,
> @@ -73,7 +73,7 @@ const uint16_t filter_3tap_16p_150[27] = {
>  	696, 2696, 696
>  };
>  
> -const uint16_t filter_3tap_16p_183[27] = {
> +static const uint16_t filter_3tap_16p_183[27] = {
>  	2048, 2048, 0,
>  	1892, 2104, 92,
>  	1744, 2152, 196,
> @@ -85,7 +85,7 @@ const uint16_t filter_3tap_16p_183[27] = {
>  	900, 2292, 900
>  };
>  
> -const uint16_t filter_4tap_16p_upscale[36] = {
> +static const uint16_t filter_4tap_16p_upscale[36] = {
>  	0, 4096, 0, 0,
>  	16240, 4056, 180, 16380,
>  	16136, 3952, 404, 16364,
> @@ -97,7 +97,7 @@ const uint16_t filter_4tap_16p_upscale[36] = {
>  	16128, 2304, 2304, 16128
>  };
>  
> -const uint16_t filter_4tap_16p_117[36] = {
> +static const uint16_t filter_4tap_16p_117[36] = {
>  	428, 3236, 428, 0,
>  	276, 3232, 604, 16364,
>  	148, 3184, 800, 16340,
> @@ -109,7 +109,7 @@ const uint16_t filter_4tap_16p_117[36] = {
>  	16212, 2216, 2216, 16212
>  };
>  
> -const uint16_t filter_4tap_16p_150[36] = {
> +static const uint16_t filter_4tap_16p_150[36] = {
>  	696, 2700, 696, 0,
>  	560, 2700, 848, 16364,
>  	436, 2676, 1008, 16348,
> @@ -121,7 +121,7 @@ const uint16_t filter_4tap_16p_150[36] = {
>  	16376, 2052, 2052, 16376
>  };
>  
> -const uint16_t filter_4tap_16p_183[36] = {
> +static const uint16_t filter_4tap_16p_183[36] = {
>  	940, 2208, 940, 0,
>  	832, 2200, 1052, 4,
>  	728, 2180, 1164, 16,
> @@ -133,7 +133,7 @@ const uint16_t filter_4tap_16p_183[36] = {
>  	232, 1812, 1812, 232
>  };
>  
> -const uint16_t filter_2tap_64p[66] = {
> +static const uint16_t filter_2tap_64p[66] = {
>  	4096, 0,
>  	4032, 64,
>  	3968, 128,
> @@ -168,7 +168,7 @@ const uint16_t filter_2tap_64p[66] = {
>  	2112, 1984,
>  	2048, 2048 };
>  
> -const uint16_t filter_3tap_64p_upscale[99] = {
> +static const uint16_t filter_3tap_64p_upscale[99] = {
>  	2048, 2048, 0,
>  	1960, 2140, 16376,
>  	1876, 2236, 16364,
> @@ -204,7 +204,7 @@ const uint16_t filter_3tap_64p_upscale[99] = {
>  	0, 4096, 0
>  };
>  
> -const uint16_t filter_3tap_64p_117[99] = {
> +static const uint16_t filter_3tap_64p_117[99] = {
>  	2048, 2048, 0,
>  	1992, 2104, 16380,
>  	1936, 2160, 16380,
> @@ -240,7 +240,7 @@ const uint16_t filter_3tap_64p_117[99] = {
>  	428, 3236, 428
>  };
>  
> -const uint16_t filter_3tap_64p_150[99] = {
> +static const uint16_t filter_3tap_64p_150[99] = {
>  	2048, 2048, 0,
>  	2004, 2080, 8,
>  	1960, 2116, 16,
> @@ -276,7 +276,7 @@ const uint16_t filter_3tap_64p_150[99] = {
>  	696, 2696, 696
>  };
>  
> -const uint16_t filter_3tap_64p_183[99] = {
> +static const uint16_t filter_3tap_64p_183[99] = {
>  	2048, 2048, 0,
>  	2008, 2060, 20,
>  	1968, 2076, 44,
> @@ -312,7 +312,7 @@ const uint16_t filter_3tap_64p_183[99] = {
>  	900, 2292, 900
>  };
>  
> -const uint16_t filter_4tap_64p_upscale[132] = {
> +static const uint16_t filter_4tap_64p_upscale[132] = {
>  	0, 4096, 0, 0,
>  	16344, 4092, 40, 0,
>  	16308, 4084, 84, 16380,
> @@ -347,7 +347,7 @@ const uint16_t filter_4tap_64p_upscale[132] = {
>  	16116, 2388, 2216, 16140,
>  	16128, 2304, 2304, 16128 };
>  
> -const uint16_t filter_4tap_64p_117[132] = {
> +static const uint16_t filter_4tap_64p_117[132] = {
>  	420, 3248, 420, 0,
>  	380, 3248, 464, 16380,
>  	344, 3248, 508, 16372,
> @@ -382,7 +382,7 @@ const uint16_t filter_4tap_64p_117[132] = {
>  	16212, 2276, 2160, 16212,
>  	16212, 2220, 2220, 16212 };
>  
> -const uint16_t filter_4tap_64p_150[132] = {
> +static const uint16_t filter_4tap_64p_150[132] = {
>  	696, 2700, 696, 0,
>  	660, 2704, 732, 16380,
>  	628, 2704, 768, 16376,
> @@ -417,7 +417,7 @@ const uint16_t filter_4tap_64p_150[132] = {
>  	4, 2112, 1996, 16364,
>  	16380, 2072, 2036, 16372 };
>  
> -const uint16_t filter_4tap_64p_183[132] = {
> +static const uint16_t filter_4tap_64p_183[132] = {
>  	944, 2204, 944, 0,
>  	916, 2204, 972, 0,
>  	888, 2200, 996, 0,
> @@ -452,7 +452,7 @@ const uint16_t filter_4tap_64p_183[132] = {
>  	252, 1832, 1784, 220,
>  	236, 1808, 1808, 236 };
>  
> -const uint16_t filter_5tap_64p_upscale[165] = {
> +static const uint16_t filter_5tap_64p_upscale[165] = {
>  	15936, 2496, 2496, 15936, 0,
>  	15948, 2404, 2580, 15924, 0,
>  	15960, 2312, 2664, 15912, 4,
> @@ -487,7 +487,7 @@ const uint16_t filter_5tap_64p_upscale[165] = {
>  	16376, 48, 4092, 16336, 4,
>  	0, 0, 4096, 0, 0 };
>  
> -const uint16_t filter_5tap_64p_117[165] = {
> +static const uint16_t filter_5tap_64p_117[165] = {
>  	16056, 2372, 2372, 16056, 0,
>  	16052, 2312, 2432, 16060, 0,
>  	16052, 2252, 2488, 16064, 0,
> @@ -522,7 +522,7 @@ const uint16_t filter_5tap_64p_117[165] = {
>  	16248, 504, 3428, 408, 16268,
>  	16256, 456, 3428, 456, 16256 };
>  
> -const uint16_t filter_5tap_64p_150[165] = {
> +static const uint16_t filter_5tap_64p_150[165] = {
>  	16368, 2064, 2064, 16368, 0,
>  	16352, 2028, 2100, 16380, 16380,
>  	16340, 1996, 2132, 12, 16376,
> @@ -557,7 +557,7 @@ const uint16_t filter_5tap_64p_150[165] = {
>  	16248, 860, 2708, 788, 16252,
>  	16248, 824, 2708, 824, 16248 };
>  
> -const uint16_t filter_5tap_64p_183[165] = {
> +static const uint16_t filter_5tap_64p_183[165] = {
>  	228, 1816, 1816, 228, 0,
>  	216, 1792, 1836, 248, 16380,
>  	200, 1772, 1860, 264, 16376,
> @@ -592,7 +592,7 @@ const uint16_t filter_5tap_64p_183[165] = {
>  	16340, 1000, 2232, 944, 16336,
>  	16340, 972, 2232, 972, 16340 };
>  
> -const uint16_t filter_6tap_64p_upscale[198] = {
> +static const uint16_t filter_6tap_64p_upscale[198] = {
>  	0, 0, 4092, 0, 0, 0,
>  	12, 16332, 4092, 52, 16368, 0,
>  	24, 16280, 4088, 108, 16356, 0,
> @@ -627,7 +627,7 @@ const uint16_t filter_6tap_64p_upscale[198] = {
>  	104, 15816, 2588, 2416, 15840, 92,
>  	100, 15828, 2504, 2504, 15828, 100 };
>  
> -const uint16_t filter_6tap_64p_117[198] = {
> +static const uint16_t filter_6tap_64p_117[198] = {
>  	16168, 476, 3568, 476, 16168, 0,
>  	16180, 428, 3564, 528, 16156, 0,
>  	16192, 376, 3556, 584, 16144, 4,
> @@ -662,7 +662,7 @@ const uint16_t filter_6tap_64p_117[198] = {
>  	40, 15956, 2496, 2376, 15944, 44,
>  	40, 15952, 2436, 2436, 15952, 40 };
>  
> -const uint16_t filter_6tap_64p_150[198] = {
> +static const uint16_t filter_6tap_64p_150[198] = {
>  	16148, 920, 2724, 920, 16148, 0,
>  	16152, 880, 2724, 956, 16148, 0,
>  	16152, 844, 2720, 996, 16144, 0,
> @@ -697,7 +697,7 @@ const uint16_t filter_6tap_64p_150[198] = {
>  	16292, 8, 2172, 2108, 16356, 16304,
>  	16300, 16372, 2140, 2140, 16372, 16300 };
>  
> -const uint16_t filter_6tap_64p_183[198] = {
> +static const uint16_t filter_6tap_64p_183[198] = {
>  	16296, 1032, 2196, 1032, 16296, 0,
>  	16292, 1004, 2200, 1060, 16304, 16380,
>  	16288, 976, 2200, 1088, 16308, 16380,
> @@ -732,7 +732,7 @@ const uint16_t filter_6tap_64p_183[198] = {
>  	16288, 296, 1880, 1840, 256, 16296,
>  	16292, 276, 1860, 1860, 276, 16292 };
>  
> -const uint16_t filter_7tap_64p_upscale[231] = {
> +static const uint16_t filter_7tap_64p_upscale[231] = {
>  	176, 15760, 2488, 2488, 15760, 176, 0,
>  	172, 15772, 2404, 2572, 15752, 180, 16380,
>  	168, 15784, 2324, 2656, 15740, 184, 16380,
> @@ -767,7 +767,7 @@ const uint16_t filter_7tap_64p_upscale[231] = {
>  	0, 16364, 56, 4092, 16328, 16, 16380,
>  	0, 0, 0, 4096, 0, 0, 0 };
>  
> -const uint16_t filter_7tap_64p_117[231] = {
> +static const uint16_t filter_7tap_64p_117[231] = {
>  	92, 15868, 2464, 2464, 15868, 92, 0,
>  	96, 15864, 2404, 2528, 15876, 88, 0,
>  	100, 15860, 2344, 2584, 15884, 84, 0,
> @@ -802,7 +802,7 @@ const uint16_t filter_7tap_64p_117[231] = {
>  	68, 16108, 504, 3572, 396, 16140, 60,
>  	64, 16124, 452, 3576, 452, 16124, 64 };
>  
> -const uint16_t filter_7tap_64p_150[231] = {
> +static const uint16_t filter_7tap_64p_150[231] = {
>  	16224, 16380, 2208, 2208, 16380, 16224, 0,
>  	16232, 16360, 2172, 2236, 16, 16216, 0,
>  	16236, 16340, 2140, 2268, 40, 16212, 0,
> @@ -837,7 +837,7 @@ const uint16_t filter_7tap_64p_150[231] = {
>  	16380, 16076, 1020, 2740, 944, 16076, 0,
>  	0, 16076, 984, 2740, 984, 16076, 0 };
>  
> -const uint16_t filter_7tap_64p_183[231] = {
> +static const uint16_t filter_7tap_64p_183[231] = {
>  	16216, 324, 1884, 1884, 324, 16216, 0,
>  	16220, 304, 1864, 1904, 344, 16216, 0,
>  	16224, 284, 1844, 1924, 364, 16216, 0,
> @@ -872,7 +872,7 @@ const uint16_t filter_7tap_64p_183[231] = {
>  	16316, 16284, 1132, 2216, 1076, 16268, 16324,
>  	16320, 16276, 1104, 2216, 1104, 16276, 16320 };
>  
> -const uint16_t filter_8tap_64p_upscale[264] = {
> +static const uint16_t filter_8tap_64p_upscale[264] = {
>  	0, 0, 0, 4096, 0, 0, 0, 0,
>  	16376, 20, 16328, 4092, 56, 16364, 4, 0,
>  	16372, 36, 16272, 4088, 116, 16340, 12, 0,
> @@ -907,7 +907,7 @@ const uint16_t filter_8tap_64p_upscale[264] = {
>  	16328, 248, 15692, 2616, 2448, 15716, 240, 16332,
>  	16332, 244, 15704, 2532, 2532, 15704, 244, 16332 };
>  
> -const uint16_t filter_8tap_64p_117[264] = {
> +static const uint16_t filter_8tap_64p_117[264] = {
>  	116, 16100, 428, 3564, 428, 16100, 116, 0,
>  	112, 16116, 376, 3564, 484, 16084, 120, 16380,
>  	104, 16136, 324, 3560, 540, 16064, 124, 16380,
> @@ -942,7 +942,7 @@ const uint16_t filter_8tap_64p_117[264] = {
>  	16372, 136, 15816, 2548, 2428, 15804, 148, 16368,
>  	16372, 140, 15812, 2488, 2488, 15812, 140, 16372 };
>  
> -const uint16_t filter_8tap_64p_150[264] = {
> +static const uint16_t filter_8tap_64p_150[264] = {
>  	16380, 16020, 1032, 2756, 1032, 16020, 16380, 0,
>  	0, 16020, 992, 2756, 1068, 16024, 16376, 0,
>  	4, 16020, 952, 2752, 1108, 16024, 16372, 0,
> @@ -977,7 +977,7 @@ const uint16_t filter_8tap_64p_150[264] = {
>  	44, 16160, 24, 2244, 2180, 16364, 16176, 40,
>  	44, 16168, 4, 2212, 2212, 4, 16168, 44 };
>  
> -const uint16_t filter_8tap_64p_183[264] = {
> +static const uint16_t filter_8tap_64p_183[264] = {
>  	16264, 16264, 1164, 2244, 1164, 16264, 16264, 0,
>  	16268, 16256, 1136, 2240, 1188, 16272, 16260, 0,
>  	16272, 16248, 1108, 2240, 1216, 16280, 16256, 0,
> @@ -1107,3 +1107,13 @@ const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio)
>  	else
>  		return filter_8tap_64p_183;
>  }
> +
> +const uint16_t *get_filter_2tap_16p(void)
> +{
> +	return filter_2tap_16p;
> +}
> +
> +const uint16_t *get_filter_2tap_64p(void)
> +{
> +	return filter_2tap_64p;
> +}
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
> index 0e36602..a8f60d7 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_transform.c
> @@ -306,7 +306,7 @@ static const uint16_t *get_filter_coeffs_16p(int taps, struct fixed31_32 ratio)
>  	else if (taps == 3)
>  		return get_filter_3tap_16p(ratio);
>  	else if (taps == 2)
> -		return filter_2tap_16p;
> +		return get_filter_2tap_16p();
>  	else if (taps == 1)
>  		return NULL;
>  	else {
> diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c
> index c84823a..47390dc 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c
> @@ -489,7 +489,7 @@ static const uint16_t *get_filter_coeffs_64p(int taps, struct fixed31_32 ratio)
>  	if (taps == 4)
>  		return get_filter_4tap_64p(ratio);
>  	else if (taps == 2)
> -		return filter_2tap_64p;
> +		return get_filter_2tap_64p();
>  	else if (taps == 1)
>  		return NULL;
>  	else {
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c
> index b62cb38..82b8887 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c
> @@ -240,7 +240,7 @@ static const uint16_t *get_filter_coeffs_64p(int taps, struct fixed31_32 ratio)
>  	else if (taps == 3)
>  		return get_filter_3tap_64p(ratio);
>  	else if (taps == 2)
> -		return filter_2tap_64p;
> +		return get_filter_2tap_64p();
>  	else if (taps == 1)
>  		return NULL;
>  	else {
> diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
> index 3294745..9d4a3a0 100644
> --- a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
> +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
> @@ -240,8 +240,8 @@ struct transform_funcs {
>  
>  };
>  
> -extern const uint16_t filter_2tap_16p[18];
> -extern const uint16_t filter_2tap_64p[66];
> +const uint16_t *get_filter_2tap_16p(void);
> +const uint16_t *get_filter_2tap_64p(void);
>  const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio);
>  const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio);
>  const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio);
> 


More information about the amd-gfx mailing list