Skip to content

Commit 38d868e

Browse files
vsyrjaladanvet
authored andcommitted
drm: Don't force all planes to be added to the state due to zpos
We don't want all planes to be added to the state whenever a plane with fixed zpos gets enabled/disabled. This is true especially for eg. cursor planes on i915, as we want cursor updates to go through w/o throttling. Same holds for drivers that don't support zpos at all (i915 actually falls into this category right now since we've not yet added zpos support). Allow drivers more freedom by letting them deal with zpos themselves instead of doing it in drm_atomic_helper_check_planes() unconditionally. Let's just inline the required calls into all the driver that currently depend on this. v2: Inline the stuff into the drivers instead of adding another helper, document things better (Daniel) Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Joonyoung Shim <jy0922.shim@samsung.com> Cc: Seung-Woo Kim <sw0312.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Lyude <cpaul@redhat.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: stable@vger.kernel.org Fixes: 44d1240 ("drm: add generic zpos property") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1476111056-12734-1-git-send-email-ville.syrjala@linux.intel.com
1 parent 7dfcb36 commit 38d868e

File tree

7 files changed

+60
-9
lines changed

7 files changed

+60
-9
lines changed

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,6 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
594594
struct drm_plane_state *plane_state;
595595
int i, ret = 0;
596596

597-
ret = drm_atomic_normalize_zpos(dev, state);
598-
if (ret)
599-
return ret;
600-
601597
for_each_plane_in_state(state, plane, plane_state, i) {
602598
const struct drm_plane_helper_funcs *funcs;
603599

drivers/gpu/drm/exynos/exynos_drm_drv.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,26 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
262262
return 0;
263263
}
264264

265+
int exynos_atomic_check(struct drm_device *dev,
266+
struct drm_atomic_state *state)
267+
{
268+
int ret;
269+
270+
ret = drm_atomic_helper_check_modeset(dev, state);
271+
if (ret)
272+
return ret;
273+
274+
ret = drm_atomic_normalize_zpos(dev, state);
275+
if (ret)
276+
return ret;
277+
278+
ret = drm_atomic_helper_check_planes(dev, state);
279+
if (ret)
280+
return ret;
281+
282+
return ret;
283+
}
284+
265285
static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
266286
{
267287
struct drm_exynos_file_private *file_priv;

drivers/gpu/drm/exynos/exynos_drm_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ static inline int exynos_dpi_bind(struct drm_device *dev,
301301

302302
int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
303303
bool nonblock);
304+
int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state);
304305

305306

306307
extern struct platform_driver fimd_driver;

drivers/gpu/drm/exynos/exynos_drm_fb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ dma_addr_t exynos_drm_fb_dma_addr(struct drm_framebuffer *fb, int index)
190190
static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
191191
.fb_create = exynos_user_fb_create,
192192
.output_poll_changed = exynos_drm_output_poll_changed,
193-
.atomic_check = drm_atomic_helper_check,
193+
.atomic_check = exynos_atomic_check,
194194
.atomic_commit = exynos_atomic_commit,
195195
};
196196

drivers/gpu/drm/rcar-du/rcar_du_kms.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,16 @@ static int rcar_du_atomic_check(struct drm_device *dev,
231231
struct rcar_du_device *rcdu = dev->dev_private;
232232
int ret;
233233

234-
ret = drm_atomic_helper_check(dev, state);
235-
if (ret < 0)
234+
ret = drm_atomic_helper_check_modeset(dev, state);
235+
if (ret)
236+
return ret;
237+
238+
ret = drm_atomic_normalize_zpos(dev, state);
239+
if (ret)
240+
return ret;
241+
242+
ret = drm_atomic_helper_check_planes(dev, state);
243+
if (ret)
236244
return ret;
237245

238246
if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))

drivers/gpu/drm/sti/sti_drv.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,26 @@ static void sti_atomic_work(struct work_struct *work)
195195
sti_atomic_complete(private, private->commit.state);
196196
}
197197

198+
static int sti_atomic_check(struct drm_device *dev,
199+
struct drm_atomic_state *state)
200+
{
201+
int ret;
202+
203+
ret = drm_atomic_helper_check_modeset(dev, state);
204+
if (ret)
205+
return ret;
206+
207+
ret = drm_atomic_normalize_zpos(dev, state);
208+
if (ret)
209+
return ret;
210+
211+
ret = drm_atomic_helper_check_planes(dev, state);
212+
if (ret)
213+
return ret;
214+
215+
return ret;
216+
}
217+
198218
static int sti_atomic_commit(struct drm_device *drm,
199219
struct drm_atomic_state *state, bool nonblock)
200220
{
@@ -248,7 +268,7 @@ static void sti_output_poll_changed(struct drm_device *ddev)
248268
static const struct drm_mode_config_funcs sti_mode_config_funcs = {
249269
.fb_create = drm_fb_cma_create,
250270
.output_poll_changed = sti_output_poll_changed,
251-
.atomic_check = drm_atomic_helper_check,
271+
.atomic_check = sti_atomic_check,
252272
.atomic_commit = sti_atomic_commit,
253273
};
254274

include/drm/drm_plane.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ struct drm_crtc;
4747
* @src_h: height of visible portion of plane (in 16.16)
4848
* @rotation: rotation of the plane
4949
* @zpos: priority of the given plane on crtc (optional)
50+
* Note that multiple active planes on the same crtc can have an identical
51+
* zpos value. The rule to solving the conflict is to compare the plane
52+
* object IDs; the plane with a higher ID must be stacked on top of a
53+
* plane with a lower ID.
5054
* @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
51-
* where N is the number of active planes for given crtc
55+
* where N is the number of active planes for given crtc. Note that
56+
* the driver must call drm_atomic_normalize_zpos() to update this before
57+
* it can be trusted.
5258
* @src: clipped source coordinates of the plane (in 16.16)
5359
* @dst: clipped destination coordinates of the plane
5460
* @visible: visibility of the plane

0 commit comments

Comments
 (0)