diff options
author | Marek Vasut <marex@denx.de> | 2016-11-14 05:07:32 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-11-15 02:25:06 -0500 |
commit | 782ea2a493ba908008cbf2ce50d1b4047c1bba0f (patch) | |
tree | a912c7e9095098d461bf82f934e715750c2ea611 /drivers/gpu/drm/imx/imx-drm-core.c | |
parent | 14d7f96f90fb65c2ca0e0ac7df237e06ff001c29 (diff) |
drm/imx: Switch to drm_fb_cma_prepare_fb() helper
Remove the common code from the driver and use the
drm_fb_cma_prepare_fb() helper instead.
Moveover, call the helper from prepare_fb() plane hook .
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161114100732.3446-2-marex@denx.de
Link: http://patchwork.freedesktop.org/patch/msgid/1476451342-146510-1-git-send-email-dvyukov@google.com
Diffstat (limited to 'drivers/gpu/drm/imx/imx-drm-core.c')
-rw-r--r-- | drivers/gpu/drm/imx/imx-drm-core.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index a16e8b7df120..33404295b447 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/dma-buf.h> | 18 | #include <linux/dma-buf.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/reservation.h> | ||
22 | #include <drm/drmP.h> | 21 | #include <drm/drmP.h> |
23 | #include <drm/drm_atomic.h> | 22 | #include <drm/drm_atomic.h> |
24 | #include <drm/drm_atomic_helper.h> | 23 | #include <drm/drm_atomic_helper.h> |
@@ -151,40 +150,11 @@ static int imx_drm_atomic_check(struct drm_device *dev, | |||
151 | return ret; | 150 | return ret; |
152 | } | 151 | } |
153 | 152 | ||
154 | static int imx_drm_atomic_commit(struct drm_device *dev, | ||
155 | struct drm_atomic_state *state, | ||
156 | bool nonblock) | ||
157 | { | ||
158 | struct drm_plane_state *plane_state; | ||
159 | struct drm_plane *plane; | ||
160 | struct dma_buf *dma_buf; | ||
161 | struct dma_fence *fence; | ||
162 | int i; | ||
163 | |||
164 | /* | ||
165 | * If the plane fb has an dma-buf attached, fish out the exclusive | ||
166 | * fence for the atomic helper to wait on. | ||
167 | */ | ||
168 | for_each_plane_in_state(state, plane, plane_state, i) { | ||
169 | if ((plane->state->fb != plane_state->fb) && plane_state->fb) { | ||
170 | dma_buf = drm_fb_cma_get_gem_obj(plane_state->fb, | ||
171 | 0)->base.dma_buf; | ||
172 | if (!dma_buf) | ||
173 | continue; | ||
174 | fence = reservation_object_get_excl_rcu(dma_buf->resv); | ||
175 | |||
176 | drm_atomic_set_fence_for_plane(plane_state, fence); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | return drm_atomic_helper_commit(dev, state, nonblock); | ||
181 | } | ||
182 | |||
183 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { | 153 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { |
184 | .fb_create = drm_fb_cma_create, | 154 | .fb_create = drm_fb_cma_create, |
185 | .output_poll_changed = imx_drm_output_poll_changed, | 155 | .output_poll_changed = imx_drm_output_poll_changed, |
186 | .atomic_check = imx_drm_atomic_check, | 156 | .atomic_check = imx_drm_atomic_check, |
187 | .atomic_commit = imx_drm_atomic_commit, | 157 | .atomic_commit = drm_atomic_helper_commit, |
188 | }; | 158 | }; |
189 | 159 | ||
190 | static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state) | 160 | static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state) |