Commit 09ad807b authored by Daniel Vetter's avatar Daniel Vetter

drm/rcar-du: Use for_each_*_in_state

We want to hide drm_atomic_state internals better.

v2: Use drm_crtc_mask (Maarten).

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1464818821-5736-5-git-send-email-daniel.vetter@ffwll.ch
parent 8d76b79f
...@@ -288,6 +288,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev, ...@@ -288,6 +288,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
{ {
struct rcar_du_device *rcdu = dev->dev_private; struct rcar_du_device *rcdu = dev->dev_private;
struct rcar_du_commit *commit; struct rcar_du_commit *commit;
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -309,10 +311,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev, ...@@ -309,10 +311,8 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
/* Wait until all affected CRTCs have completed previous commits and /* Wait until all affected CRTCs have completed previous commits and
* mark them as pending. * mark them as pending.
*/ */
for (i = 0; i < dev->mode_config.num_crtc; ++i) { for_each_crtc_in_state(state, crtc, crtc_state, i)
if (state->crtcs[i]) commit->crtcs |= drm_crtc_mask(crtc);
commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]);
}
spin_lock(&rcdu->commit.wait.lock); spin_lock(&rcdu->commit.wait.lock);
ret = wait_event_interruptible_locked(rcdu->commit.wait, ret = wait_event_interruptible_locked(rcdu->commit.wait,
......
...@@ -140,18 +140,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev, ...@@ -140,18 +140,17 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
bool needs_realloc = false; bool needs_realloc = false;
unsigned int groups = 0; unsigned int groups = 0;
unsigned int i; unsigned int i;
struct drm_plane *drm_plane;
struct drm_plane_state *drm_plane_state;
/* Check if hardware planes need to be reallocated. */ /* Check if hardware planes need to be reallocated. */
for (i = 0; i < dev->mode_config.num_total_plane; ++i) { for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
struct rcar_du_plane_state *plane_state; struct rcar_du_plane_state *plane_state;
struct rcar_du_plane *plane; struct rcar_du_plane *plane;
unsigned int index; unsigned int index;
if (!state->planes[i]) plane = to_rcar_plane(drm_plane);
continue; plane_state = to_rcar_plane_state(drm_plane_state);
plane = to_rcar_plane(state->planes[i]);
plane_state = to_rcar_plane_state(state->plane_states[i]);
dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__, dev_dbg(rcdu->dev, "%s: checking plane (%u,%tu)\n", __func__,
plane->group->index, plane - plane->group->planes); plane->group->index, plane - plane->group->planes);
...@@ -247,18 +246,15 @@ int rcar_du_atomic_check_planes(struct drm_device *dev, ...@@ -247,18 +246,15 @@ int rcar_du_atomic_check_planes(struct drm_device *dev,
} }
/* Reallocate hardware planes for each plane that needs it. */ /* Reallocate hardware planes for each plane that needs it. */
for (i = 0; i < dev->mode_config.num_total_plane; ++i) { for_each_plane_in_state(state, drm_plane, drm_plane_state, i) {
struct rcar_du_plane_state *plane_state; struct rcar_du_plane_state *plane_state;
struct rcar_du_plane *plane; struct rcar_du_plane *plane;
unsigned int crtc_planes; unsigned int crtc_planes;
unsigned int free; unsigned int free;
int idx; int idx;
if (!state->planes[i]) plane = to_rcar_plane(drm_plane);
continue; plane_state = to_rcar_plane_state(drm_plane_state);
plane = to_rcar_plane(state->planes[i]);
plane_state = to_rcar_plane_state(state->plane_states[i]);
dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__, dev_dbg(rcdu->dev, "%s: allocating plane (%u,%tu)\n", __func__,
plane->group->index, plane - plane->group->planes); plane->group->index, plane - plane->group->planes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment