Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Add acquire ctx to ->gamma_set hook

Atomic helpers really want this instead of the hacked-up legacy
backoff trick, which unfortunately prevents drivers from using their
own private drm_modeset_locks.

Aside: There's a few atomic drivers (nv50, vc4, soon vmwgfx) which
don't yet use the new atomic color mgmt/gamma table stuff. Would be
nice if they could switch over and just hook up
drm_atomic_helper_legacy_gamma_set() instead.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170403083304.9083-13-daniel.vetter@ffwll.ch

+43 -21
+2 -1
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
··· 2631 2631 } 2632 2632 2633 2633 static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 2634 - u16 *blue, uint32_t size) 2634 + u16 *blue, uint32_t size, 2635 + struct drm_modeset_acquire_ctx *ctx) 2635 2636 { 2636 2637 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2637 2638 int i;
+2 -1
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
··· 2651 2651 } 2652 2652 2653 2653 static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 2654 - u16 *blue, uint32_t size) 2654 + u16 *blue, uint32_t size, 2655 + struct drm_modeset_acquire_ctx *ctx) 2655 2656 { 2656 2657 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2657 2658 int i;
+2 -1
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
··· 1998 1998 } 1999 1999 2000 2000 static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 2001 - u16 *blue, uint32_t size) 2001 + u16 *blue, uint32_t size, 2002 + struct drm_modeset_acquire_ctx *ctx) 2002 2003 { 2003 2004 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2004 2005 int i;
+2 -1
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
··· 2482 2482 } 2483 2483 2484 2484 static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 2485 - u16 *blue, uint32_t size) 2485 + u16 *blue, uint32_t size, 2486 + struct drm_modeset_acquire_ctx *ctx) 2486 2487 { 2487 2488 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2488 2489 int i;
+2 -1
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
··· 165 165 } 166 166 167 167 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 170 { 170 171 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 171 172 int i;
+2 -1
drivers/gpu/drm/ast/ast_mode.c
··· 645 645 } 646 646 647 647 static int ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 648 - u16 *blue, uint32_t size) 648 + u16 *blue, uint32_t size, 649 + struct drm_modeset_acquire_ctx *ctx) 649 650 { 650 651 struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 651 652 int i;
+2 -1
drivers/gpu/drm/cirrus/cirrus_mode.c
··· 327 327 * but it's a requirement that we provide the function 328 328 */ 329 329 static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 330 - u16 *blue, uint32_t size) 330 + u16 *blue, uint32_t size, 331 + struct drm_modeset_acquire_ctx *ctx) 331 332 { 332 333 struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); 333 334 int i;
+3 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 3479 3479 * @green: green correction table 3480 3480 * @blue: green correction table 3481 3481 * @size: size of the tables 3482 + * @ctx: lock acquire context 3482 3483 * 3483 3484 * Implements support for legacy gamma correction table for drivers 3484 3485 * that support color management through the DEGAMMA_LUT/GAMMA_LUT ··· 3487 3486 */ 3488 3487 int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, 3489 3488 u16 *red, u16 *green, u16 *blue, 3490 - uint32_t size) 3489 + uint32_t size, 3490 + struct drm_modeset_acquire_ctx *ctx) 3491 3491 { 3492 3492 struct drm_device *dev = crtc->dev; 3493 3493 struct drm_mode_config *config = &dev->mode_config;
+2 -1
drivers/gpu/drm/drm_color_mgmt.c
··· 261 261 goto out; 262 262 } 263 263 264 - ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); 264 + ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 265 + crtc->gamma_size, &ctx); 265 266 266 267 out: 267 268 if (ret == -EDEADLK) {
+2 -1
drivers/gpu/drm/drm_fb_helper.c
··· 256 256 g_base = r_base + crtc->gamma_size; 257 257 b_base = g_base + crtc->gamma_size; 258 258 259 - crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); 259 + crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 260 + crtc->gamma_size, NULL); 260 261 } 261 262 262 263 /**
+2 -1
drivers/gpu/drm/gma500/gma_display.c
··· 177 177 } 178 178 179 179 int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, 180 - u32 size) 180 + u32 size, 181 + struct drm_modeset_acquire_ctx *ctx) 181 182 { 182 183 struct gma_crtc *gma_crtc = to_gma_crtc(crtc); 183 184 int i;
+2 -1
drivers/gpu/drm/gma500/gma_display.h
··· 73 73 extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); 74 74 extern void gma_crtc_load_lut(struct drm_crtc *crtc); 75 75 extern int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 76 - u16 *blue, u32 size); 76 + u16 *blue, u32 size, 77 + struct drm_modeset_acquire_ctx *ctx); 77 78 extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode); 78 79 extern void gma_crtc_prepare(struct drm_crtc *crtc); 79 80 extern void gma_crtc_commit(struct drm_crtc *crtc);
+2 -1
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 1393 1393 * but it's a requirement that we provide the function 1394 1394 */ 1395 1395 static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 1396 - u16 *blue, uint32_t size) 1396 + u16 *blue, uint32_t size, 1397 + struct drm_modeset_acquire_ctx *ctx) 1397 1398 { 1398 1399 struct mga_crtc *mga_crtc = to_mga_crtc(crtc); 1399 1400 int i;
+2 -1
drivers/gpu/drm/nouveau/dispnv04/crtc.c
··· 788 788 789 789 static int 790 790 nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 791 - uint32_t size) 791 + uint32_t size, 792 + struct drm_modeset_acquire_ctx *ctx) 792 793 { 793 794 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 794 795 int i;
+2 -1
drivers/gpu/drm/nouveau/nv50_display.c
··· 2218 2218 2219 2219 static int 2220 2220 nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 2221 - uint32_t size) 2221 + uint32_t size, 2222 + struct drm_modeset_acquire_ctx *ctx) 2222 2223 { 2223 2224 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2224 2225 u32 i;
+2 -1
drivers/gpu/drm/radeon/radeon_display.c
··· 232 232 } 233 233 234 234 static int radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 235 - u16 *blue, uint32_t size) 235 + u16 *blue, uint32_t size, 236 + struct drm_modeset_acquire_ctx *ctx) 236 237 { 237 238 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 238 239 int i;
+2 -1
drivers/gpu/drm/vc4/vc4_crtc.c
··· 314 314 315 315 static int 316 316 vc4_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 317 - uint32_t size) 317 + uint32_t size, 318 + struct drm_modeset_acquire_ctx *ctx) 318 319 { 319 320 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); 320 321 u32 i;
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 2026 2026 2027 2027 int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, 2028 2028 u16 *r, u16 *g, u16 *b, 2029 - uint32_t size) 2029 + uint32_t size, 2030 + struct drm_modeset_acquire_ctx *ctx) 2030 2031 { 2031 2032 struct vmw_private *dev_priv = vmw_priv(crtc->dev); 2032 2033 int i;
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
··· 254 254 void vmw_du_crtc_restore(struct drm_crtc *crtc); 255 255 int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, 256 256 u16 *r, u16 *g, u16 *b, 257 - uint32_t size); 257 + uint32_t size, 258 + struct drm_modeset_acquire_ctx *ctx); 258 259 int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, 259 260 uint32_t handle, uint32_t width, uint32_t height, 260 261 int32_t hot_x, int32_t hot_y);
+2 -1
include/drm/drm_atomic_helper.h
··· 176 176 struct drm_connector_state *state); 177 177 int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, 178 178 u16 *red, u16 *green, u16 *blue, 179 - uint32_t size); 179 + uint32_t size, 180 + struct drm_modeset_acquire_ctx *ctx); 180 181 181 182 /** 182 183 * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC
+2 -1
include/drm/drm_crtc.h
··· 322 322 * hooks. 323 323 */ 324 324 int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 325 - uint32_t size); 325 + uint32_t size, 326 + struct drm_modeset_acquire_ctx *ctx); 326 327 327 328 /** 328 329 * @destroy: