Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions kernel-open/nvidia-drm/nvidia-drm-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,21 +937,25 @@ int nv_drm_reset_input_colorspace(struct drm_device *dev)
bool do_reset = false;
NvU32 flags = 0;

state = drm_atomic_state_alloc(dev);
if (!state)
return -ENOMEM;

#if defined(DRM_MODESET_ACQUIRE_INTERRUPTIBLE)
flags |= DRM_MODESET_ACQUIRE_INTERRUPTIBLE;
#endif
drm_modeset_acquire_init(&ctx, flags);

retry:
do_reset = false;
state = drm_atomic_state_alloc(dev);
if (!state) {
ret = -ENOMEM;
goto out;
}
state->acquire_ctx = &ctx;

nv_drm_for_each_plane(plane, dev) {
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
ret = PTR_ERR(plane_state);
goto out;
goto put_state;
}

nv_drm_plane_state = to_nv_drm_plane_state(plane_state);
Expand All @@ -967,8 +971,17 @@ int nv_drm_reset_input_colorspace(struct drm_device *dev)
ret = drm_atomic_commit(state);
}

out:
put_state:
drm_atomic_state_put(state);

if (ret == -EDEADLK) {
ret = drm_modeset_backoff(&ctx);
if (!ret) {
goto retry;
}
}

out:
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);

Expand Down