diff options
author | Peter Rosin <peda@axentia.se> | 2017-07-13 12:25:28 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-08-04 05:35:15 -0400 |
commit | 76dd3cd8405cd08e27f99343ceddd5d32bfa0026 (patch) | |
tree | 033ca0f202c2c1482d9a681098b856bad1ec1cf5 /drivers/gpu/drm/amd/amdgpu | |
parent | 8415ab565da966b2bf85ed9322784cd15770a66e (diff) |
drm: amd: remove dead code and pointless local lut storage
The redundant fb helpers .load_lut, .gamma_set and .gamma_get are
no longer used. Remove the dead code and hook up the crtc .gamma_set
to use the crtc gamma_store directly instead of duplicating that
info locally.
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170713162538.22788-5-peda@axentia.se
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 23 |
7 files changed, 28 insertions, 128 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index 1c57fefc364c..0a8ee2411180 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | |||
@@ -311,31 +311,7 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfb | |||
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | /** Sets the color ramps on behalf of fbcon */ | ||
315 | static void amdgpu_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, | ||
316 | u16 blue, int regno) | ||
317 | { | ||
318 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
319 | |||
320 | amdgpu_crtc->lut_r[regno] = red >> 6; | ||
321 | amdgpu_crtc->lut_g[regno] = green >> 6; | ||
322 | amdgpu_crtc->lut_b[regno] = blue >> 6; | ||
323 | } | ||
324 | |||
325 | /** Gets the color ramps on behalf of fbcon */ | ||
326 | static void amdgpu_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | ||
327 | u16 *blue, int regno) | ||
328 | { | ||
329 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
330 | |||
331 | *red = amdgpu_crtc->lut_r[regno] << 6; | ||
332 | *green = amdgpu_crtc->lut_g[regno] << 6; | ||
333 | *blue = amdgpu_crtc->lut_b[regno] << 6; | ||
334 | } | ||
335 | |||
336 | static const struct drm_fb_helper_funcs amdgpu_fb_helper_funcs = { | 314 | static const struct drm_fb_helper_funcs amdgpu_fb_helper_funcs = { |
337 | .gamma_set = amdgpu_crtc_fb_gamma_set, | ||
338 | .gamma_get = amdgpu_crtc_fb_gamma_get, | ||
339 | .fb_probe = amdgpufb_create, | 315 | .fb_probe = amdgpufb_create, |
340 | }; | 316 | }; |
341 | 317 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 43a9d3aec6c4..39f7eda6091e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | |||
@@ -369,7 +369,6 @@ struct amdgpu_atom_ss { | |||
369 | struct amdgpu_crtc { | 369 | struct amdgpu_crtc { |
370 | struct drm_crtc base; | 370 | struct drm_crtc base; |
371 | int crtc_id; | 371 | int crtc_id; |
372 | u16 lut_r[256], lut_g[256], lut_b[256]; | ||
373 | bool enabled; | 372 | bool enabled; |
374 | bool can_tile; | 373 | bool can_tile; |
375 | uint32_t crtc_offset; | 374 | uint32_t crtc_offset; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index aff1f48c947e..162d761e2f4e 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | |||
@@ -2267,6 +2267,7 @@ static void dce_v10_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2267 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2267 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2268 | struct drm_device *dev = crtc->dev; | 2268 | struct drm_device *dev = crtc->dev; |
2269 | struct amdgpu_device *adev = dev->dev_private; | 2269 | struct amdgpu_device *adev = dev->dev_private; |
2270 | u16 *r, *g, *b; | ||
2270 | int i; | 2271 | int i; |
2271 | u32 tmp; | 2272 | u32 tmp; |
2272 | 2273 | ||
@@ -2304,11 +2305,14 @@ static void dce_v10_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2304 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); | 2305 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); |
2305 | 2306 | ||
2306 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); | 2307 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); |
2308 | r = crtc->gamma_store; | ||
2309 | g = r + crtc->gamma_size; | ||
2310 | b = g + crtc->gamma_size; | ||
2307 | for (i = 0; i < 256; i++) { | 2311 | for (i = 0; i < 256; i++) { |
2308 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, | 2312 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, |
2309 | (amdgpu_crtc->lut_r[i] << 20) | | 2313 | ((*r++ & 0xffc0) << 14) | |
2310 | (amdgpu_crtc->lut_g[i] << 10) | | 2314 | ((*g++ & 0xffc0) << 4) | |
2311 | (amdgpu_crtc->lut_b[i] << 0)); | 2315 | (*b++ >> 6)); |
2312 | } | 2316 | } |
2313 | 2317 | ||
2314 | tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); | 2318 | tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); |
@@ -2624,15 +2628,6 @@ static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
2624 | u16 *blue, uint32_t size, | 2628 | u16 *blue, uint32_t size, |
2625 | struct drm_modeset_acquire_ctx *ctx) | 2629 | struct drm_modeset_acquire_ctx *ctx) |
2626 | { | 2630 | { |
2627 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
2628 | int i; | ||
2629 | |||
2630 | /* userspace palettes are always correct as is */ | ||
2631 | for (i = 0; i < size; i++) { | ||
2632 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | ||
2633 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | ||
2634 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | ||
2635 | } | ||
2636 | dce_v10_0_crtc_load_lut(crtc); | 2631 | dce_v10_0_crtc_load_lut(crtc); |
2637 | 2632 | ||
2638 | return 0; | 2633 | return 0; |
@@ -2844,14 +2839,12 @@ static const struct drm_crtc_helper_funcs dce_v10_0_crtc_helper_funcs = { | |||
2844 | .mode_set_base_atomic = dce_v10_0_crtc_set_base_atomic, | 2839 | .mode_set_base_atomic = dce_v10_0_crtc_set_base_atomic, |
2845 | .prepare = dce_v10_0_crtc_prepare, | 2840 | .prepare = dce_v10_0_crtc_prepare, |
2846 | .commit = dce_v10_0_crtc_commit, | 2841 | .commit = dce_v10_0_crtc_commit, |
2847 | .load_lut = dce_v10_0_crtc_load_lut, | ||
2848 | .disable = dce_v10_0_crtc_disable, | 2842 | .disable = dce_v10_0_crtc_disable, |
2849 | }; | 2843 | }; |
2850 | 2844 | ||
2851 | static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index) | 2845 | static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index) |
2852 | { | 2846 | { |
2853 | struct amdgpu_crtc *amdgpu_crtc; | 2847 | struct amdgpu_crtc *amdgpu_crtc; |
2854 | int i; | ||
2855 | 2848 | ||
2856 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + | 2849 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + |
2857 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); | 2850 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); |
@@ -2869,12 +2862,6 @@ static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index) | |||
2869 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; | 2862 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
2870 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; | 2863 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
2871 | 2864 | ||
2872 | for (i = 0; i < 256; i++) { | ||
2873 | amdgpu_crtc->lut_r[i] = i << 2; | ||
2874 | amdgpu_crtc->lut_g[i] = i << 2; | ||
2875 | amdgpu_crtc->lut_b[i] = i << 2; | ||
2876 | } | ||
2877 | |||
2878 | switch (amdgpu_crtc->crtc_id) { | 2865 | switch (amdgpu_crtc->crtc_id) { |
2879 | case 0: | 2866 | case 0: |
2880 | default: | 2867 | default: |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index 2df650dfa727..f420e5815edb 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | |||
@@ -2251,6 +2251,7 @@ static void dce_v11_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2251 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2251 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2252 | struct drm_device *dev = crtc->dev; | 2252 | struct drm_device *dev = crtc->dev; |
2253 | struct amdgpu_device *adev = dev->dev_private; | 2253 | struct amdgpu_device *adev = dev->dev_private; |
2254 | u16 *r, *g, *b; | ||
2254 | int i; | 2255 | int i; |
2255 | u32 tmp; | 2256 | u32 tmp; |
2256 | 2257 | ||
@@ -2282,11 +2283,14 @@ static void dce_v11_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2282 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); | 2283 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); |
2283 | 2284 | ||
2284 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); | 2285 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); |
2286 | r = crtc->gamma_store; | ||
2287 | g = r + crtc->gamma_size; | ||
2288 | b = g + crtc->gamma_size; | ||
2285 | for (i = 0; i < 256; i++) { | 2289 | for (i = 0; i < 256; i++) { |
2286 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, | 2290 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, |
2287 | (amdgpu_crtc->lut_r[i] << 20) | | 2291 | ((*r++ & 0xffc0) << 14) | |
2288 | (amdgpu_crtc->lut_g[i] << 10) | | 2292 | ((*g++ & 0xffc0) << 4) | |
2289 | (amdgpu_crtc->lut_b[i] << 0)); | 2293 | (*b++ >> 6)); |
2290 | } | 2294 | } |
2291 | 2295 | ||
2292 | tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); | 2296 | tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); |
@@ -2644,15 +2648,6 @@ static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
2644 | u16 *blue, uint32_t size, | 2648 | u16 *blue, uint32_t size, |
2645 | struct drm_modeset_acquire_ctx *ctx) | 2649 | struct drm_modeset_acquire_ctx *ctx) |
2646 | { | 2650 | { |
2647 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
2648 | int i; | ||
2649 | |||
2650 | /* userspace palettes are always correct as is */ | ||
2651 | for (i = 0; i < size; i++) { | ||
2652 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | ||
2653 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | ||
2654 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | ||
2655 | } | ||
2656 | dce_v11_0_crtc_load_lut(crtc); | 2651 | dce_v11_0_crtc_load_lut(crtc); |
2657 | 2652 | ||
2658 | return 0; | 2653 | return 0; |
@@ -2892,14 +2887,12 @@ static const struct drm_crtc_helper_funcs dce_v11_0_crtc_helper_funcs = { | |||
2892 | .mode_set_base_atomic = dce_v11_0_crtc_set_base_atomic, | 2887 | .mode_set_base_atomic = dce_v11_0_crtc_set_base_atomic, |
2893 | .prepare = dce_v11_0_crtc_prepare, | 2888 | .prepare = dce_v11_0_crtc_prepare, |
2894 | .commit = dce_v11_0_crtc_commit, | 2889 | .commit = dce_v11_0_crtc_commit, |
2895 | .load_lut = dce_v11_0_crtc_load_lut, | ||
2896 | .disable = dce_v11_0_crtc_disable, | 2890 | .disable = dce_v11_0_crtc_disable, |
2897 | }; | 2891 | }; |
2898 | 2892 | ||
2899 | static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index) | 2893 | static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index) |
2900 | { | 2894 | { |
2901 | struct amdgpu_crtc *amdgpu_crtc; | 2895 | struct amdgpu_crtc *amdgpu_crtc; |
2902 | int i; | ||
2903 | 2896 | ||
2904 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + | 2897 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + |
2905 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); | 2898 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); |
@@ -2917,12 +2910,6 @@ static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index) | |||
2917 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; | 2910 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
2918 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; | 2911 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
2919 | 2912 | ||
2920 | for (i = 0; i < 256; i++) { | ||
2921 | amdgpu_crtc->lut_r[i] = i << 2; | ||
2922 | amdgpu_crtc->lut_g[i] = i << 2; | ||
2923 | amdgpu_crtc->lut_b[i] = i << 2; | ||
2924 | } | ||
2925 | |||
2926 | switch (amdgpu_crtc->crtc_id) { | 2913 | switch (amdgpu_crtc->crtc_id) { |
2927 | case 0: | 2914 | case 0: |
2928 | default: | 2915 | default: |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 0c3891fa62f1..f3c422e93ed1 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | |||
@@ -2182,6 +2182,7 @@ static void dce_v6_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2182 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2182 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2183 | struct drm_device *dev = crtc->dev; | 2183 | struct drm_device *dev = crtc->dev; |
2184 | struct amdgpu_device *adev = dev->dev_private; | 2184 | struct amdgpu_device *adev = dev->dev_private; |
2185 | u16 *r, *g, *b; | ||
2185 | int i; | 2186 | int i; |
2186 | 2187 | ||
2187 | DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); | 2188 | DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); |
@@ -2211,11 +2212,14 @@ static void dce_v6_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2211 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); | 2212 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); |
2212 | 2213 | ||
2213 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); | 2214 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); |
2215 | r = crtc->gamma_store; | ||
2216 | g = r + crtc->gamma_size; | ||
2217 | b = g + crtc->gamma_size; | ||
2214 | for (i = 0; i < 256; i++) { | 2218 | for (i = 0; i < 256; i++) { |
2215 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, | 2219 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, |
2216 | (amdgpu_crtc->lut_r[i] << 20) | | 2220 | ((*r++ & 0xffc0) << 14) | |
2217 | (amdgpu_crtc->lut_g[i] << 10) | | 2221 | ((*g++ & 0xffc0) << 4) | |
2218 | (amdgpu_crtc->lut_b[i] << 0)); | 2222 | (*b++ >> 6)); |
2219 | } | 2223 | } |
2220 | 2224 | ||
2221 | WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, | 2225 | WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, |
@@ -2496,15 +2500,6 @@ static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
2496 | u16 *blue, uint32_t size, | 2500 | u16 *blue, uint32_t size, |
2497 | struct drm_modeset_acquire_ctx *ctx) | 2501 | struct drm_modeset_acquire_ctx *ctx) |
2498 | { | 2502 | { |
2499 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
2500 | int i; | ||
2501 | |||
2502 | /* userspace palettes are always correct as is */ | ||
2503 | for (i = 0; i < size; i++) { | ||
2504 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | ||
2505 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | ||
2506 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | ||
2507 | } | ||
2508 | dce_v6_0_crtc_load_lut(crtc); | 2503 | dce_v6_0_crtc_load_lut(crtc); |
2509 | 2504 | ||
2510 | return 0; | 2505 | return 0; |
@@ -2712,14 +2707,12 @@ static const struct drm_crtc_helper_funcs dce_v6_0_crtc_helper_funcs = { | |||
2712 | .mode_set_base_atomic = dce_v6_0_crtc_set_base_atomic, | 2707 | .mode_set_base_atomic = dce_v6_0_crtc_set_base_atomic, |
2713 | .prepare = dce_v6_0_crtc_prepare, | 2708 | .prepare = dce_v6_0_crtc_prepare, |
2714 | .commit = dce_v6_0_crtc_commit, | 2709 | .commit = dce_v6_0_crtc_commit, |
2715 | .load_lut = dce_v6_0_crtc_load_lut, | ||
2716 | .disable = dce_v6_0_crtc_disable, | 2710 | .disable = dce_v6_0_crtc_disable, |
2717 | }; | 2711 | }; |
2718 | 2712 | ||
2719 | static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) | 2713 | static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) |
2720 | { | 2714 | { |
2721 | struct amdgpu_crtc *amdgpu_crtc; | 2715 | struct amdgpu_crtc *amdgpu_crtc; |
2722 | int i; | ||
2723 | 2716 | ||
2724 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + | 2717 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + |
2725 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); | 2718 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); |
@@ -2737,12 +2730,6 @@ static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) | |||
2737 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; | 2730 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
2738 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; | 2731 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
2739 | 2732 | ||
2740 | for (i = 0; i < 256; i++) { | ||
2741 | amdgpu_crtc->lut_r[i] = i << 2; | ||
2742 | amdgpu_crtc->lut_g[i] = i << 2; | ||
2743 | amdgpu_crtc->lut_b[i] = i << 2; | ||
2744 | } | ||
2745 | |||
2746 | amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; | 2733 | amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; |
2747 | 2734 | ||
2748 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; | 2735 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index c164bef82846..b19aa39f647d 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | |||
@@ -2124,6 +2124,7 @@ static void dce_v8_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2124 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2124 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2125 | struct drm_device *dev = crtc->dev; | 2125 | struct drm_device *dev = crtc->dev; |
2126 | struct amdgpu_device *adev = dev->dev_private; | 2126 | struct amdgpu_device *adev = dev->dev_private; |
2127 | u16 *r, *g, *b; | ||
2127 | int i; | 2128 | int i; |
2128 | 2129 | ||
2129 | DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); | 2130 | DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); |
@@ -2153,11 +2154,14 @@ static void dce_v8_0_crtc_load_lut(struct drm_crtc *crtc) | |||
2153 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); | 2154 | WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); |
2154 | 2155 | ||
2155 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); | 2156 | WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); |
2157 | r = crtc->gamma_store; | ||
2158 | g = r + crtc->gamma_size; | ||
2159 | b = g + crtc->gamma_size; | ||
2156 | for (i = 0; i < 256; i++) { | 2160 | for (i = 0; i < 256; i++) { |
2157 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, | 2161 | WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, |
2158 | (amdgpu_crtc->lut_r[i] << 20) | | 2162 | ((*r++ & 0xffc0) << 14) | |
2159 | (amdgpu_crtc->lut_g[i] << 10) | | 2163 | ((*g++ & 0xffc0) << 4) | |
2160 | (amdgpu_crtc->lut_b[i] << 0)); | 2164 | (*b++ >> 6)); |
2161 | } | 2165 | } |
2162 | 2166 | ||
2163 | WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, | 2167 | WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, |
@@ -2475,15 +2479,6 @@ static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
2475 | u16 *blue, uint32_t size, | 2479 | u16 *blue, uint32_t size, |
2476 | struct drm_modeset_acquire_ctx *ctx) | 2480 | struct drm_modeset_acquire_ctx *ctx) |
2477 | { | 2481 | { |
2478 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
2479 | int i; | ||
2480 | |||
2481 | /* userspace palettes are always correct as is */ | ||
2482 | for (i = 0; i < size; i++) { | ||
2483 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | ||
2484 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | ||
2485 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | ||
2486 | } | ||
2487 | dce_v8_0_crtc_load_lut(crtc); | 2482 | dce_v8_0_crtc_load_lut(crtc); |
2488 | 2483 | ||
2489 | return 0; | 2484 | return 0; |
@@ -2702,14 +2697,12 @@ static const struct drm_crtc_helper_funcs dce_v8_0_crtc_helper_funcs = { | |||
2702 | .mode_set_base_atomic = dce_v8_0_crtc_set_base_atomic, | 2697 | .mode_set_base_atomic = dce_v8_0_crtc_set_base_atomic, |
2703 | .prepare = dce_v8_0_crtc_prepare, | 2698 | .prepare = dce_v8_0_crtc_prepare, |
2704 | .commit = dce_v8_0_crtc_commit, | 2699 | .commit = dce_v8_0_crtc_commit, |
2705 | .load_lut = dce_v8_0_crtc_load_lut, | ||
2706 | .disable = dce_v8_0_crtc_disable, | 2700 | .disable = dce_v8_0_crtc_disable, |
2707 | }; | 2701 | }; |
2708 | 2702 | ||
2709 | static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index) | 2703 | static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index) |
2710 | { | 2704 | { |
2711 | struct amdgpu_crtc *amdgpu_crtc; | 2705 | struct amdgpu_crtc *amdgpu_crtc; |
2712 | int i; | ||
2713 | 2706 | ||
2714 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + | 2707 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + |
2715 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); | 2708 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); |
@@ -2727,12 +2720,6 @@ static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index) | |||
2727 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; | 2720 | adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; |
2728 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; | 2721 | adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; |
2729 | 2722 | ||
2730 | for (i = 0; i < 256; i++) { | ||
2731 | amdgpu_crtc->lut_r[i] = i << 2; | ||
2732 | amdgpu_crtc->lut_g[i] = i << 2; | ||
2733 | amdgpu_crtc->lut_b[i] = i << 2; | ||
2734 | } | ||
2735 | |||
2736 | amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; | 2723 | amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; |
2737 | 2724 | ||
2738 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; | 2725 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c index 90bb08309a53..ecf34bc77a63 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c | |||
@@ -168,16 +168,6 @@ static int dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, | |||
168 | u16 *green, u16 *blue, uint32_t size, | 168 | u16 *green, u16 *blue, uint32_t size, |
169 | struct drm_modeset_acquire_ctx *ctx) | 169 | struct drm_modeset_acquire_ctx *ctx) |
170 | { | 170 | { |
171 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | ||
172 | int i; | ||
173 | |||
174 | /* userspace palettes are always correct as is */ | ||
175 | for (i = 0; i < size; i++) { | ||
176 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | ||
177 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | ||
178 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | ||
179 | } | ||
180 | |||
181 | return 0; | 171 | return 0; |
182 | } | 172 | } |
183 | 173 | ||
@@ -289,11 +279,6 @@ static int dce_virtual_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
289 | return 0; | 279 | return 0; |
290 | } | 280 | } |
291 | 281 | ||
292 | static void dce_virtual_crtc_load_lut(struct drm_crtc *crtc) | ||
293 | { | ||
294 | return; | ||
295 | } | ||
296 | |||
297 | static int dce_virtual_crtc_set_base_atomic(struct drm_crtc *crtc, | 282 | static int dce_virtual_crtc_set_base_atomic(struct drm_crtc *crtc, |
298 | struct drm_framebuffer *fb, | 283 | struct drm_framebuffer *fb, |
299 | int x, int y, enum mode_set_atomic state) | 284 | int x, int y, enum mode_set_atomic state) |
@@ -309,14 +294,12 @@ static const struct drm_crtc_helper_funcs dce_virtual_crtc_helper_funcs = { | |||
309 | .mode_set_base_atomic = dce_virtual_crtc_set_base_atomic, | 294 | .mode_set_base_atomic = dce_virtual_crtc_set_base_atomic, |
310 | .prepare = dce_virtual_crtc_prepare, | 295 | .prepare = dce_virtual_crtc_prepare, |
311 | .commit = dce_virtual_crtc_commit, | 296 | .commit = dce_virtual_crtc_commit, |
312 | .load_lut = dce_virtual_crtc_load_lut, | ||
313 | .disable = dce_virtual_crtc_disable, | 297 | .disable = dce_virtual_crtc_disable, |
314 | }; | 298 | }; |
315 | 299 | ||
316 | static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) | 300 | static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) |
317 | { | 301 | { |
318 | struct amdgpu_crtc *amdgpu_crtc; | 302 | struct amdgpu_crtc *amdgpu_crtc; |
319 | int i; | ||
320 | 303 | ||
321 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + | 304 | amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + |
322 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); | 305 | (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); |
@@ -329,12 +312,6 @@ static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) | |||
329 | amdgpu_crtc->crtc_id = index; | 312 | amdgpu_crtc->crtc_id = index; |
330 | adev->mode_info.crtcs[index] = amdgpu_crtc; | 313 | adev->mode_info.crtcs[index] = amdgpu_crtc; |
331 | 314 | ||
332 | for (i = 0; i < 256; i++) { | ||
333 | amdgpu_crtc->lut_r[i] = i << 2; | ||
334 | amdgpu_crtc->lut_g[i] = i << 2; | ||
335 | amdgpu_crtc->lut_b[i] = i << 2; | ||
336 | } | ||
337 | |||
338 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; | 315 | amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; |
339 | amdgpu_crtc->encoder = NULL; | 316 | amdgpu_crtc->encoder = NULL; |
340 | amdgpu_crtc->connector = NULL; | 317 | amdgpu_crtc->connector = NULL; |