diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/ast/ast_mode.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_mode.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/gma_display.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/gma_display.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv04/crtc.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_crtc.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 4 | ||||
-rw-r--r-- | include/drm/drm_atomic_helper.h | 6 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 4 |
19 files changed, 85 insertions, 64 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 7e57447bf5f4..112e358f0f9b 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | |||
@@ -2667,19 +2667,21 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) | |||
2667 | } | 2667 | } |
2668 | } | 2668 | } |
2669 | 2669 | ||
2670 | static void dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 2670 | static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
2671 | u16 *blue, uint32_t start, uint32_t size) | 2671 | u16 *blue, uint32_t size) |
2672 | { | 2672 | { |
2673 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2673 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2674 | int end = (start + size > 256) ? 256 : start + size, i; | 2674 | int i; |
2675 | 2675 | ||
2676 | /* userspace palettes are always correct as is */ | 2676 | /* userspace palettes are always correct as is */ |
2677 | for (i = start; i < end; i++) { | 2677 | for (i = 0; i < size; i++) { |
2678 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | 2678 | amdgpu_crtc->lut_r[i] = red[i] >> 6; |
2679 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | 2679 | amdgpu_crtc->lut_g[i] = green[i] >> 6; |
2680 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | 2680 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; |
2681 | } | 2681 | } |
2682 | dce_v10_0_crtc_load_lut(crtc); | 2682 | dce_v10_0_crtc_load_lut(crtc); |
2683 | |||
2684 | return 0; | ||
2683 | } | 2685 | } |
2684 | 2686 | ||
2685 | static void dce_v10_0_crtc_destroy(struct drm_crtc *crtc) | 2687 | static void dce_v10_0_crtc_destroy(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index da101551960b..b522fa2435a8 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | |||
@@ -2678,19 +2678,21 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) | |||
2678 | } | 2678 | } |
2679 | } | 2679 | } |
2680 | 2680 | ||
2681 | static void dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 2681 | static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
2682 | u16 *blue, uint32_t start, uint32_t size) | 2682 | u16 *blue, uint32_t size) |
2683 | { | 2683 | { |
2684 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2684 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2685 | int end = (start + size > 256) ? 256 : start + size, i; | 2685 | int i; |
2686 | 2686 | ||
2687 | /* userspace palettes are always correct as is */ | 2687 | /* userspace palettes are always correct as is */ |
2688 | for (i = start; i < end; i++) { | 2688 | for (i = 0; i < size; i++) { |
2689 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | 2689 | amdgpu_crtc->lut_r[i] = red[i] >> 6; |
2690 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | 2690 | amdgpu_crtc->lut_g[i] = green[i] >> 6; |
2691 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | 2691 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; |
2692 | } | 2692 | } |
2693 | dce_v11_0_crtc_load_lut(crtc); | 2693 | dce_v11_0_crtc_load_lut(crtc); |
2694 | |||
2695 | return 0; | ||
2694 | } | 2696 | } |
2695 | 2697 | ||
2696 | static void dce_v11_0_crtc_destroy(struct drm_crtc *crtc) | 2698 | static void dce_v11_0_crtc_destroy(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index 41d9bc5f9c0e..b50ed72feedb 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | |||
@@ -2574,19 +2574,21 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) | |||
2574 | } | 2574 | } |
2575 | } | 2575 | } |
2576 | 2576 | ||
2577 | static void dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 2577 | static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
2578 | u16 *blue, uint32_t start, uint32_t size) | 2578 | u16 *blue, uint32_t size) |
2579 | { | 2579 | { |
2580 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2580 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2581 | int end = (start + size > 256) ? 256 : start + size, i; | 2581 | int i; |
2582 | 2582 | ||
2583 | /* userspace palettes are always correct as is */ | 2583 | /* userspace palettes are always correct as is */ |
2584 | for (i = start; i < end; i++) { | 2584 | for (i = 0; i < size; i++) { |
2585 | amdgpu_crtc->lut_r[i] = red[i] >> 6; | 2585 | amdgpu_crtc->lut_r[i] = red[i] >> 6; |
2586 | amdgpu_crtc->lut_g[i] = green[i] >> 6; | 2586 | amdgpu_crtc->lut_g[i] = green[i] >> 6; |
2587 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; | 2587 | amdgpu_crtc->lut_b[i] = blue[i] >> 6; |
2588 | } | 2588 | } |
2589 | dce_v8_0_crtc_load_lut(crtc); | 2589 | dce_v8_0_crtc_load_lut(crtc); |
2590 | |||
2591 | return 0; | ||
2590 | } | 2592 | } |
2591 | 2593 | ||
2592 | static void dce_v8_0_crtc_destroy(struct drm_crtc *crtc) | 2594 | static void dce_v8_0_crtc_destroy(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index c337922606e3..5957c3e659fe 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c | |||
@@ -624,19 +624,21 @@ static void ast_crtc_reset(struct drm_crtc *crtc) | |||
624 | 624 | ||
625 | } | 625 | } |
626 | 626 | ||
627 | static void ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 627 | static int ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
628 | u16 *blue, uint32_t start, uint32_t size) | 628 | u16 *blue, uint32_t size) |
629 | { | 629 | { |
630 | struct ast_crtc *ast_crtc = to_ast_crtc(crtc); | 630 | struct ast_crtc *ast_crtc = to_ast_crtc(crtc); |
631 | int end = (start + size > 256) ? 256 : start + size, i; | 631 | int i; |
632 | 632 | ||
633 | /* userspace palettes are always correct as is */ | 633 | /* userspace palettes are always correct as is */ |
634 | for (i = start; i < end; i++) { | 634 | for (i = 0; i < size; i++) { |
635 | ast_crtc->lut_r[i] = red[i] >> 8; | 635 | ast_crtc->lut_r[i] = red[i] >> 8; |
636 | ast_crtc->lut_g[i] = green[i] >> 8; | 636 | ast_crtc->lut_g[i] = green[i] >> 8; |
637 | ast_crtc->lut_b[i] = blue[i] >> 8; | 637 | ast_crtc->lut_b[i] = blue[i] >> 8; |
638 | } | 638 | } |
639 | ast_crtc_load_lut(crtc); | 639 | ast_crtc_load_lut(crtc); |
640 | |||
641 | return 0; | ||
640 | } | 642 | } |
641 | 643 | ||
642 | 644 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index 0b1a411cb89e..17c915d9a03e 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -325,18 +325,20 @@ static void cirrus_crtc_commit(struct drm_crtc *crtc) | |||
325 | * use this for 8-bit mode so can't perform smooth fades on deeper modes, | 325 | * use this for 8-bit mode so can't perform smooth fades on deeper modes, |
326 | * but it's a requirement that we provide the function | 326 | * but it's a requirement that we provide the function |
327 | */ | 327 | */ |
328 | static void cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 328 | static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
329 | u16 *blue, uint32_t start, uint32_t size) | 329 | u16 *blue, uint32_t size) |
330 | { | 330 | { |
331 | struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); | 331 | struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); |
332 | int i; | 332 | int i; |
333 | 333 | ||
334 | for (i = 0; i < CIRRUS_LUT_SIZE; i++) { | 334 | for (i = 0; i < size; i++) { |
335 | cirrus_crtc->lut_r[i] = red[i]; | 335 | cirrus_crtc->lut_r[i] = red[i]; |
336 | cirrus_crtc->lut_g[i] = green[i]; | 336 | cirrus_crtc->lut_g[i] = green[i]; |
337 | cirrus_crtc->lut_b[i] = blue[i]; | 337 | cirrus_crtc->lut_b[i] = blue[i]; |
338 | } | 338 | } |
339 | cirrus_crtc_load_lut(crtc); | 339 | cirrus_crtc_load_lut(crtc); |
340 | |||
341 | return 0; | ||
340 | } | 342 | } |
341 | 343 | ||
342 | /* Simple cleanup function */ | 344 | /* Simple cleanup function */ |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 4342f3dfc0e1..191d84f12e67 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -2920,16 +2920,15 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state); | |||
2920 | * @red: red correction table | 2920 | * @red: red correction table |
2921 | * @green: green correction table | 2921 | * @green: green correction table |
2922 | * @blue: green correction table | 2922 | * @blue: green correction table |
2923 | * @start: first entry, must always be 0 | ||
2924 | * @size: size of the tables | 2923 | * @size: size of the tables |
2925 | * | 2924 | * |
2926 | * Implements support for legacy gamma correction table for drivers | 2925 | * Implements support for legacy gamma correction table for drivers |
2927 | * that support color management through the DEGAMMA_LUT/GAMMA_LUT | 2926 | * that support color management through the DEGAMMA_LUT/GAMMA_LUT |
2928 | * properties. | 2927 | * properties. |
2929 | */ | 2928 | */ |
2930 | void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, | 2929 | int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, |
2931 | u16 *red, u16 *green, u16 *blue, | 2930 | u16 *red, u16 *green, u16 *blue, |
2932 | uint32_t start, uint32_t size) | 2931 | uint32_t size) |
2933 | { | 2932 | { |
2934 | struct drm_device *dev = crtc->dev; | 2933 | struct drm_device *dev = crtc->dev; |
2935 | struct drm_mode_config *config = &dev->mode_config; | 2934 | struct drm_mode_config *config = &dev->mode_config; |
@@ -2941,7 +2940,7 @@ void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, | |||
2941 | 2940 | ||
2942 | state = drm_atomic_state_alloc(crtc->dev); | 2941 | state = drm_atomic_state_alloc(crtc->dev); |
2943 | if (!state) | 2942 | if (!state) |
2944 | return; | 2943 | return -ENOMEM; |
2945 | 2944 | ||
2946 | blob = drm_property_create_blob(dev, | 2945 | blob = drm_property_create_blob(dev, |
2947 | sizeof(struct drm_color_lut) * size, | 2946 | sizeof(struct drm_color_lut) * size, |
@@ -2992,7 +2991,7 @@ retry: | |||
2992 | 2991 | ||
2993 | drm_property_unreference_blob(blob); | 2992 | drm_property_unreference_blob(blob); |
2994 | 2993 | ||
2995 | return; | 2994 | return 0; |
2996 | fail: | 2995 | fail: |
2997 | if (ret == -EDEADLK) | 2996 | if (ret == -EDEADLK) |
2998 | goto backoff; | 2997 | goto backoff; |
@@ -3000,7 +2999,7 @@ fail: | |||
3000 | drm_atomic_state_free(state); | 2999 | drm_atomic_state_free(state); |
3001 | drm_property_unreference_blob(blob); | 3000 | drm_property_unreference_blob(blob); |
3002 | 3001 | ||
3003 | return; | 3002 | return ret; |
3004 | backoff: | 3003 | backoff: |
3005 | drm_atomic_state_clear(state); | 3004 | drm_atomic_state_clear(state); |
3006 | drm_atomic_legacy_backoff(state); | 3005 | drm_atomic_legacy_backoff(state); |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index ba6174fc117c..889e01f1b3f2 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -5172,7 +5172,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |||
5172 | goto out; | 5172 | goto out; |
5173 | } | 5173 | } |
5174 | 5174 | ||
5175 | crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size); | 5175 | ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); |
5176 | 5176 | ||
5177 | out: | 5177 | out: |
5178 | drm_modeset_unlock_all(dev); | 5178 | drm_modeset_unlock_all(dev); |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 7590df5e2e72..58ed6e6d4f12 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -227,7 +227,7 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc) | |||
227 | g_base = r_base + crtc->gamma_size; | 227 | g_base = r_base + crtc->gamma_size; |
228 | b_base = g_base + crtc->gamma_size; | 228 | b_base = g_base + crtc->gamma_size; |
229 | 229 | ||
230 | crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size); | 230 | crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); |
231 | } | 231 | } |
232 | 232 | ||
233 | /** | 233 | /** |
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index c95406e6f44d..5b636bf0b467 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c | |||
@@ -175,20 +175,21 @@ void gma_crtc_load_lut(struct drm_crtc *crtc) | |||
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, | 178 | int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, |
179 | u32 start, u32 size) | 179 | u32 size) |
180 | { | 180 | { |
181 | struct gma_crtc *gma_crtc = to_gma_crtc(crtc); | 181 | struct gma_crtc *gma_crtc = to_gma_crtc(crtc); |
182 | int i; | 182 | int i; |
183 | int end = (start + size > 256) ? 256 : start + size; | ||
184 | 183 | ||
185 | for (i = start; i < end; i++) { | 184 | for (i = 0; i < size; i++) { |
186 | gma_crtc->lut_r[i] = red[i] >> 8; | 185 | gma_crtc->lut_r[i] = red[i] >> 8; |
187 | gma_crtc->lut_g[i] = green[i] >> 8; | 186 | gma_crtc->lut_g[i] = green[i] >> 8; |
188 | gma_crtc->lut_b[i] = blue[i] >> 8; | 187 | gma_crtc->lut_b[i] = blue[i] >> 8; |
189 | } | 188 | } |
190 | 189 | ||
191 | gma_crtc_load_lut(crtc); | 190 | gma_crtc_load_lut(crtc); |
191 | |||
192 | return 0; | ||
192 | } | 193 | } |
193 | 194 | ||
194 | /** | 195 | /** |
diff --git a/drivers/gpu/drm/gma500/gma_display.h b/drivers/gpu/drm/gma500/gma_display.h index b2491c65f053..e72dd08b701b 100644 --- a/drivers/gpu/drm/gma500/gma_display.h +++ b/drivers/gpu/drm/gma500/gma_display.h | |||
@@ -72,8 +72,8 @@ extern int gma_crtc_cursor_set(struct drm_crtc *crtc, | |||
72 | uint32_t width, uint32_t height); | 72 | uint32_t width, uint32_t height); |
73 | extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); | 73 | extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); |
74 | extern void gma_crtc_load_lut(struct drm_crtc *crtc); | 74 | extern void gma_crtc_load_lut(struct drm_crtc *crtc); |
75 | extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 75 | extern int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
76 | u16 *blue, u32 start, u32 size); | 76 | u16 *blue, u32 size); |
77 | extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode); | 77 | extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode); |
78 | extern void gma_crtc_prepare(struct drm_crtc *crtc); | 78 | extern void gma_crtc_prepare(struct drm_crtc *crtc); |
79 | extern void gma_crtc_commit(struct drm_crtc *crtc); | 79 | extern void gma_crtc_commit(struct drm_crtc *crtc); |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 14e64e08909e..f6d5892d03f1 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -1344,19 +1344,20 @@ static void mga_crtc_commit(struct drm_crtc *crtc) | |||
1344 | * use this for 8-bit mode so can't perform smooth fades on deeper modes, | 1344 | * use this for 8-bit mode so can't perform smooth fades on deeper modes, |
1345 | * but it's a requirement that we provide the function | 1345 | * but it's a requirement that we provide the function |
1346 | */ | 1346 | */ |
1347 | static void mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 1347 | static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
1348 | u16 *blue, uint32_t start, uint32_t size) | 1348 | u16 *blue, uint32_t size) |
1349 | { | 1349 | { |
1350 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); | 1350 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); |
1351 | int end = (start + size > MGAG200_LUT_SIZE) ? MGAG200_LUT_SIZE : start + size; | ||
1352 | int i; | 1351 | int i; |
1353 | 1352 | ||
1354 | for (i = start; i < end; i++) { | 1353 | for (i = 0; i < size; i++) { |
1355 | mga_crtc->lut_r[i] = red[i] >> 8; | 1354 | mga_crtc->lut_r[i] = red[i] >> 8; |
1356 | mga_crtc->lut_g[i] = green[i] >> 8; | 1355 | mga_crtc->lut_g[i] = green[i] >> 8; |
1357 | mga_crtc->lut_b[i] = blue[i] >> 8; | 1356 | mga_crtc->lut_b[i] = blue[i] >> 8; |
1358 | } | 1357 | } |
1359 | mga_crtc_load_lut(crtc); | 1358 | mga_crtc_load_lut(crtc); |
1359 | |||
1360 | return 0; | ||
1360 | } | 1361 | } |
1361 | 1362 | ||
1362 | /* Simple cleanup function */ | 1363 | /* Simple cleanup function */ |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 6f318c54da33..0cb7a18cde26 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c | |||
@@ -785,14 +785,14 @@ nv_crtc_disable(struct drm_crtc *crtc) | |||
785 | nouveau_bo_ref(NULL, &disp->image[nv_crtc->index]); | 785 | nouveau_bo_ref(NULL, &disp->image[nv_crtc->index]); |
786 | } | 786 | } |
787 | 787 | ||
788 | static void | 788 | static int |
789 | nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start, | 789 | nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
790 | uint32_t size) | 790 | uint32_t size) |
791 | { | 791 | { |
792 | int end = (start + size > 256) ? 256 : start + size, i; | ||
793 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 792 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
793 | int i; | ||
794 | 794 | ||
795 | for (i = start; i < end; i++) { | 795 | for (i = 0; i < size; i++) { |
796 | nv_crtc->lut.r[i] = r[i]; | 796 | nv_crtc->lut.r[i] = r[i]; |
797 | nv_crtc->lut.g[i] = g[i]; | 797 | nv_crtc->lut.g[i] = g[i]; |
798 | nv_crtc->lut.b[i] = b[i]; | 798 | nv_crtc->lut.b[i] = b[i]; |
@@ -805,10 +805,12 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start, | |||
805 | */ | 805 | */ |
806 | if (!nv_crtc->base.primary->fb) { | 806 | if (!nv_crtc->base.primary->fb) { |
807 | nv_crtc->lut.depth = 0; | 807 | nv_crtc->lut.depth = 0; |
808 | return; | 808 | return 0; |
809 | } | 809 | } |
810 | 810 | ||
811 | nv_crtc_gamma_load(crtc); | 811 | nv_crtc_gamma_load(crtc); |
812 | |||
813 | return 0; | ||
812 | } | 814 | } |
813 | 815 | ||
814 | static int | 816 | static int |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 3ffc2b0057bf..7a7788212df7 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1346,21 +1346,22 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
1346 | return 0; | 1346 | return 0; |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | static void | 1349 | static int |
1350 | nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 1350 | nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
1351 | uint32_t start, uint32_t size) | 1351 | uint32_t size) |
1352 | { | 1352 | { |
1353 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 1353 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
1354 | u32 end = min_t(u32, start + size, 256); | ||
1355 | u32 i; | 1354 | u32 i; |
1356 | 1355 | ||
1357 | for (i = start; i < end; i++) { | 1356 | for (i = 0; i < size; i++) { |
1358 | nv_crtc->lut.r[i] = r[i]; | 1357 | nv_crtc->lut.r[i] = r[i]; |
1359 | nv_crtc->lut.g[i] = g[i]; | 1358 | nv_crtc->lut.g[i] = g[i]; |
1360 | nv_crtc->lut.b[i] = b[i]; | 1359 | nv_crtc->lut.b[i] = b[i]; |
1361 | } | 1360 | } |
1362 | 1361 | ||
1363 | nv50_crtc_lut_load(crtc); | 1362 | nv50_crtc_lut_load(crtc); |
1363 | |||
1364 | return 0; | ||
1364 | } | 1365 | } |
1365 | 1366 | ||
1366 | static void | 1367 | static void |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 2fb18f13395c..e85c7a2f565b 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -231,19 +231,21 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
231 | *blue = radeon_crtc->lut_b[regno] << 6; | 231 | *blue = radeon_crtc->lut_b[regno] << 6; |
232 | } | 232 | } |
233 | 233 | ||
234 | static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 234 | static int radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
235 | u16 *blue, uint32_t start, uint32_t size) | 235 | u16 *blue, uint32_t size) |
236 | { | 236 | { |
237 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 237 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
238 | int end = (start + size > 256) ? 256 : start + size, i; | 238 | int i; |
239 | 239 | ||
240 | /* userspace palettes are always correct as is */ | 240 | /* userspace palettes are always correct as is */ |
241 | for (i = start; i < end; i++) { | 241 | for (i = 0; i < size; i++) { |
242 | radeon_crtc->lut_r[i] = red[i] >> 6; | 242 | radeon_crtc->lut_r[i] = red[i] >> 6; |
243 | radeon_crtc->lut_g[i] = green[i] >> 6; | 243 | radeon_crtc->lut_g[i] = green[i] >> 6; |
244 | radeon_crtc->lut_b[i] = blue[i] >> 6; | 244 | radeon_crtc->lut_b[i] = blue[i] >> 6; |
245 | } | 245 | } |
246 | radeon_crtc_load_lut(crtc); | 246 | radeon_crtc_load_lut(crtc); |
247 | |||
248 | return 0; | ||
247 | } | 249 | } |
248 | 250 | ||
249 | static void radeon_crtc_destroy(struct drm_crtc *crtc) | 251 | static void radeon_crtc_destroy(struct drm_crtc *crtc) |
@@ -688,6 +690,7 @@ radeon_crtc_set_config(struct drm_mode_set *set) | |||
688 | pm_runtime_put_autosuspend(dev->dev); | 690 | pm_runtime_put_autosuspend(dev->dev); |
689 | return ret; | 691 | return ret; |
690 | } | 692 | } |
693 | |||
691 | static const struct drm_crtc_funcs radeon_crtc_funcs = { | 694 | static const struct drm_crtc_funcs radeon_crtc_funcs = { |
692 | .cursor_set2 = radeon_crtc_cursor_set2, | 695 | .cursor_set2 = radeon_crtc_cursor_set2, |
693 | .cursor_move = radeon_crtc_cursor_move, | 696 | .cursor_move = radeon_crtc_cursor_move, |
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index ba2e373ec901..4c0f26a644a3 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c | |||
@@ -175,20 +175,22 @@ vc4_crtc_lut_load(struct drm_crtc *crtc) | |||
175 | HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_b[i]); | 175 | HVS_WRITE(SCALER_GAMDATA, vc4_crtc->lut_b[i]); |
176 | } | 176 | } |
177 | 177 | ||
178 | static void | 178 | static int |
179 | vc4_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 179 | vc4_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
180 | uint32_t start, uint32_t size) | 180 | uint32_t size) |
181 | { | 181 | { |
182 | struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); | 182 | struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); |
183 | u32 i; | 183 | u32 i; |
184 | 184 | ||
185 | for (i = start; i < start + size; i++) { | 185 | for (i = 0; i < size; i++) { |
186 | vc4_crtc->lut_r[i] = r[i] >> 8; | 186 | vc4_crtc->lut_r[i] = r[i] >> 8; |
187 | vc4_crtc->lut_g[i] = g[i] >> 8; | 187 | vc4_crtc->lut_g[i] = g[i] >> 8; |
188 | vc4_crtc->lut_b[i] = b[i] >> 8; | 188 | vc4_crtc->lut_b[i] = b[i] >> 8; |
189 | } | 189 | } |
190 | 190 | ||
191 | vc4_crtc_lut_load(crtc); | 191 | vc4_crtc_lut_load(crtc); |
192 | |||
193 | return 0; | ||
192 | } | 194 | } |
193 | 195 | ||
194 | static u32 vc4_get_fifo_full_level(u32 format) | 196 | static u32 vc4_get_fifo_full_level(u32 format) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 55231cce73a0..8a69d4da40b5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1404,9 +1404,9 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num, | |||
1404 | return 0; | 1404 | return 0; |
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, | 1407 | int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
1408 | u16 *r, u16 *g, u16 *b, | 1408 | u16 *r, u16 *g, u16 *b, |
1409 | uint32_t start, uint32_t size) | 1409 | uint32_t size) |
1410 | { | 1410 | { |
1411 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); | 1411 | struct vmw_private *dev_priv = vmw_priv(crtc->dev); |
1412 | int i; | 1412 | int i; |
@@ -1418,6 +1418,8 @@ void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, | |||
1418 | vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 1, g[i] >> 8); | 1418 | vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 1, g[i] >> 8); |
1419 | vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 2, b[i] >> 8); | 1419 | vmw_write(dev_priv, SVGA_PALETTE_BASE + i * 3 + 2, b[i] >> 8); |
1420 | } | 1420 | } |
1421 | |||
1422 | return 0; | ||
1421 | } | 1423 | } |
1422 | 1424 | ||
1423 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode) | 1425 | int vmw_du_connector_dpms(struct drm_connector *connector, int mode) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index 57203212c501..ff4803c107bc 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | |||
@@ -195,9 +195,9 @@ struct vmw_display_unit { | |||
195 | void vmw_du_cleanup(struct vmw_display_unit *du); | 195 | void vmw_du_cleanup(struct vmw_display_unit *du); |
196 | void vmw_du_crtc_save(struct drm_crtc *crtc); | 196 | void vmw_du_crtc_save(struct drm_crtc *crtc); |
197 | void vmw_du_crtc_restore(struct drm_crtc *crtc); | 197 | void vmw_du_crtc_restore(struct drm_crtc *crtc); |
198 | void vmw_du_crtc_gamma_set(struct drm_crtc *crtc, | 198 | int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, |
199 | u16 *r, u16 *g, u16 *b, | 199 | u16 *r, u16 *g, u16 *b, |
200 | uint32_t start, uint32_t size); | 200 | uint32_t size); |
201 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, | 201 | int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, |
202 | uint32_t handle, uint32_t width, uint32_t height, | 202 | uint32_t handle, uint32_t width, uint32_t height, |
203 | int32_t hot_x, int32_t hot_y); | 203 | int32_t hot_x, int32_t hot_y); |
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index b03bd83703b4..1877a7c18d8e 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h | |||
@@ -147,9 +147,9 @@ void | |||
147 | __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state); | 147 | __drm_atomic_helper_connector_destroy_state(struct drm_connector_state *state); |
148 | void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, | 148 | void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, |
149 | struct drm_connector_state *state); | 149 | struct drm_connector_state *state); |
150 | void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, | 150 | int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, |
151 | u16 *red, u16 *green, u16 *blue, | 151 | u16 *red, u16 *green, u16 *blue, |
152 | uint32_t start, uint32_t size); | 152 | uint32_t size); |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC | 155 | * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index f59d8a2d8920..411be4f45506 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -479,8 +479,8 @@ struct drm_crtc_funcs { | |||
479 | * going on, which should eventually be unified to just one set of | 479 | * going on, which should eventually be unified to just one set of |
480 | * hooks. | 480 | * hooks. |
481 | */ | 481 | */ |
482 | void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 482 | int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
483 | uint32_t start, uint32_t size); | 483 | uint32_t size); |
484 | 484 | ||
485 | /** | 485 | /** |
486 | * @destroy: | 486 | * @destroy: |