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

drm/sti: use atomic_helper for commit

Since nonblocking atomic commits are now supported, the driver can
now use drm_atomic_helper_commit().

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Vincent Abriou <vincent.abriou@st.com>

authored by

Fabien DESSENNE and committed by
Vincent Abriou
5e60f595 13f62f54

+6 -84
+6 -78
drivers/gpu/drm/sti/sti_drv.c
··· 115 115 return ret; 116 116 } 117 117 118 - static void sti_atomic_schedule(struct sti_private *private, 119 - struct drm_atomic_state *state) 118 + static void sti_drm_dbg_cleanup(struct drm_minor *minor) 120 119 { 121 - private->commit.state = state; 122 - schedule_work(&private->commit.work); 123 - } 120 + drm_debugfs_remove_files(sti_drm_dbg_list, 121 + ARRAY_SIZE(sti_drm_dbg_list), minor); 124 122 125 - static void sti_atomic_complete(struct sti_private *private, 126 - struct drm_atomic_state *state) 127 - { 128 - struct drm_device *drm = private->drm_dev; 129 - 130 - /* 131 - * Everything below can be run asynchronously without the need to grab 132 - * any modeset locks at all under one condition: It must be guaranteed 133 - * that the asynchronous work has either been cancelled (if the driver 134 - * supports it, which at least requires that the framebuffers get 135 - * cleaned up with drm_atomic_helper_cleanup_planes()) or completed 136 - * before the new state gets committed on the software side with 137 - * drm_atomic_helper_swap_state(). 138 - * 139 - * This scheme allows new atomic state updates to be prepared and 140 - * checked in parallel to the asynchronous completion of the previous 141 - * update. Which is important since compositors need to figure out the 142 - * composition of the next frame right after having submitted the 143 - * current layout. 144 - */ 145 - 146 - drm_atomic_helper_commit_modeset_disables(drm, state); 147 - drm_atomic_helper_commit_planes(drm, state, 0); 148 - drm_atomic_helper_commit_modeset_enables(drm, state); 149 - 150 - drm_atomic_helper_wait_for_vblanks(drm, state); 151 - 152 - drm_atomic_helper_cleanup_planes(drm, state); 153 - drm_atomic_state_put(state); 154 - } 155 - 156 - static void sti_atomic_work(struct work_struct *work) 157 - { 158 - struct sti_private *private = container_of(work, 159 - struct sti_private, commit.work); 160 - 161 - sti_atomic_complete(private, private->commit.state); 123 + drm_debugfs_remove_files((struct drm_info_list *)&sti_drm_fps_fops, 124 + 1, minor); 162 125 } 163 126 164 127 static int sti_atomic_check(struct drm_device *dev, ··· 144 181 return ret; 145 182 } 146 183 147 - static int sti_atomic_commit(struct drm_device *drm, 148 - struct drm_atomic_state *state, bool nonblock) 149 - { 150 - struct sti_private *private = drm->dev_private; 151 - int err; 152 - 153 - err = drm_atomic_helper_prepare_planes(drm, state); 154 - if (err) 155 - return err; 156 - 157 - /* serialize outstanding nonblocking commits */ 158 - mutex_lock(&private->commit.lock); 159 - flush_work(&private->commit.work); 160 - 161 - /* 162 - * This is the point of no return - everything below never fails except 163 - * when the hw goes bonghits. Which means we can commit the new state on 164 - * the software side now. 165 - */ 166 - 167 - drm_atomic_helper_swap_state(state, true); 168 - 169 - drm_atomic_state_get(state); 170 - if (nonblock) 171 - sti_atomic_schedule(private, state); 172 - else 173 - sti_atomic_complete(private, state); 174 - 175 - mutex_unlock(&private->commit.lock); 176 - return 0; 177 - } 178 - 179 184 static void sti_output_poll_changed(struct drm_device *ddev) 180 185 { 181 186 struct sti_private *private = ddev->dev_private; ··· 155 224 .fb_create = drm_fb_cma_create, 156 225 .output_poll_changed = sti_output_poll_changed, 157 226 .atomic_check = sti_atomic_check, 158 - .atomic_commit = sti_atomic_commit, 227 + .atomic_commit = drm_atomic_helper_commit, 159 228 }; 160 229 161 230 static void sti_mode_config_init(struct drm_device *dev) ··· 234 303 ddev->dev_private = (void *)private; 235 304 dev_set_drvdata(ddev->dev, ddev); 236 305 private->drm_dev = ddev; 237 - 238 - mutex_init(&private->commit.lock); 239 - INIT_WORK(&private->commit.work, sti_atomic_work); 240 306 241 307 drm_mode_config_init(ddev); 242 308
-6
drivers/gpu/drm/sti/sti_drv.h
··· 25 25 struct drm_property *plane_zorder_property; 26 26 struct drm_device *drm_dev; 27 27 struct drm_fbdev_cma *fbdev; 28 - 29 - struct { 30 - struct drm_atomic_state *state; 31 - struct work_struct work; 32 - struct mutex lock; 33 - } commit; 34 28 }; 35 29 36 30 extern struct platform_driver sti_tvout_driver;