Commit 6af70eb3 authored by Maxime Ripard's avatar Maxime Ripard

drm/atmel-hlcdc: Rename custom plane state variable

Subsequent reworks will pass the global atomic state in the function
prototype, and atomic_check and atomic_update already have such a
variable already. Let's change them to ease the rework.
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210219120032.260676-3-maxime@cerno.tech
parent ba5c1649
...@@ -596,16 +596,16 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, ...@@ -596,16 +596,16 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
struct drm_plane_state *s) struct drm_plane_state *s)
{ {
struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
struct atmel_hlcdc_plane_state *state = struct atmel_hlcdc_plane_state *hstate =
drm_plane_state_to_atmel_hlcdc_plane_state(s); drm_plane_state_to_atmel_hlcdc_plane_state(s);
const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc; const struct atmel_hlcdc_layer_desc *desc = plane->layer.desc;
struct drm_framebuffer *fb = state->base.fb; struct drm_framebuffer *fb = hstate->base.fb;
const struct drm_display_mode *mode; const struct drm_display_mode *mode;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int ret; int ret;
int i; int i;
if (!state->base.crtc || WARN_ON(!fb)) if (!hstate->base.crtc || WARN_ON(!fb))
return 0; return 0;
crtc_state = drm_atomic_get_existing_crtc_state(s->state, s->crtc); crtc_state = drm_atomic_get_existing_crtc_state(s->state, s->crtc);
...@@ -617,94 +617,94 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p, ...@@ -617,94 +617,94 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
if (ret || !s->visible) if (ret || !s->visible)
return ret; return ret;
state->src_x = s->src.x1; hstate->src_x = s->src.x1;
state->src_y = s->src.y1; hstate->src_y = s->src.y1;
state->src_w = drm_rect_width(&s->src); hstate->src_w = drm_rect_width(&s->src);
state->src_h = drm_rect_height(&s->src); hstate->src_h = drm_rect_height(&s->src);
state->crtc_x = s->dst.x1; hstate->crtc_x = s->dst.x1;
state->crtc_y = s->dst.y1; hstate->crtc_y = s->dst.y1;
state->crtc_w = drm_rect_width(&s->dst); hstate->crtc_w = drm_rect_width(&s->dst);
state->crtc_h = drm_rect_height(&s->dst); hstate->crtc_h = drm_rect_height(&s->dst);
if ((state->src_x | state->src_y | state->src_w | state->src_h) & if ((hstate->src_x | hstate->src_y | hstate->src_w | hstate->src_h) &
SUBPIXEL_MASK) SUBPIXEL_MASK)
return -EINVAL; return -EINVAL;
state->src_x >>= 16; hstate->src_x >>= 16;
state->src_y >>= 16; hstate->src_y >>= 16;
state->src_w >>= 16; hstate->src_w >>= 16;
state->src_h >>= 16; hstate->src_h >>= 16;
state->nplanes = fb->format->num_planes; hstate->nplanes = fb->format->num_planes;
if (state->nplanes > ATMEL_HLCDC_LAYER_MAX_PLANES) if (hstate->nplanes > ATMEL_HLCDC_LAYER_MAX_PLANES)
return -EINVAL; return -EINVAL;
for (i = 0; i < state->nplanes; i++) { for (i = 0; i < hstate->nplanes; i++) {
unsigned int offset = 0; unsigned int offset = 0;
int xdiv = i ? fb->format->hsub : 1; int xdiv = i ? fb->format->hsub : 1;
int ydiv = i ? fb->format->vsub : 1; int ydiv = i ? fb->format->vsub : 1;
state->bpp[i] = fb->format->cpp[i]; hstate->bpp[i] = fb->format->cpp[i];
if (!state->bpp[i]) if (!hstate->bpp[i])
return -EINVAL; return -EINVAL;
switch (state->base.rotation & DRM_MODE_ROTATE_MASK) { switch (hstate->base.rotation & DRM_MODE_ROTATE_MASK) {
case DRM_MODE_ROTATE_90: case DRM_MODE_ROTATE_90:
offset = (state->src_y / ydiv) * offset = (hstate->src_y / ydiv) *
fb->pitches[i]; fb->pitches[i];
offset += ((state->src_x + state->src_w - 1) / offset += ((hstate->src_x + hstate->src_w - 1) /
xdiv) * state->bpp[i]; xdiv) * hstate->bpp[i];
state->xstride[i] = -(((state->src_h - 1) / ydiv) * hstate->xstride[i] = -(((hstate->src_h - 1) / ydiv) *
fb->pitches[i]) - fb->pitches[i]) -
(2 * state->bpp[i]); (2 * hstate->bpp[i]);
state->pstride[i] = fb->pitches[i] - state->bpp[i]; hstate->pstride[i] = fb->pitches[i] - hstate->bpp[i];
break; break;
case DRM_MODE_ROTATE_180: case DRM_MODE_ROTATE_180:
offset = ((state->src_y + state->src_h - 1) / offset = ((hstate->src_y + hstate->src_h - 1) /
ydiv) * fb->pitches[i]; ydiv) * fb->pitches[i];
offset += ((state->src_x + state->src_w - 1) / offset += ((hstate->src_x + hstate->src_w - 1) /
xdiv) * state->bpp[i]; xdiv) * hstate->bpp[i];
state->xstride[i] = ((((state->src_w - 1) / xdiv) - 1) * hstate->xstride[i] = ((((hstate->src_w - 1) / xdiv) - 1) *
state->bpp[i]) - fb->pitches[i]; hstate->bpp[i]) - fb->pitches[i];
state->pstride[i] = -2 * state->bpp[i]; hstate->pstride[i] = -2 * hstate->bpp[i];
break; break;
case DRM_MODE_ROTATE_270: case DRM_MODE_ROTATE_270:
offset = ((state->src_y + state->src_h - 1) / offset = ((hstate->src_y + hstate->src_h - 1) /
ydiv) * fb->pitches[i]; ydiv) * fb->pitches[i];
offset += (state->src_x / xdiv) * state->bpp[i]; offset += (hstate->src_x / xdiv) * hstate->bpp[i];
state->xstride[i] = ((state->src_h - 1) / ydiv) * hstate->xstride[i] = ((hstate->src_h - 1) / ydiv) *
fb->pitches[i]; fb->pitches[i];
state->pstride[i] = -fb->pitches[i] - state->bpp[i]; hstate->pstride[i] = -fb->pitches[i] - hstate->bpp[i];
break; break;
case DRM_MODE_ROTATE_0: case DRM_MODE_ROTATE_0:
default: default:
offset = (state->src_y / ydiv) * fb->pitches[i]; offset = (hstate->src_y / ydiv) * fb->pitches[i];
offset += (state->src_x / xdiv) * state->bpp[i]; offset += (hstate->src_x / xdiv) * hstate->bpp[i];
state->xstride[i] = fb->pitches[i] - hstate->xstride[i] = fb->pitches[i] -
((state->src_w / xdiv) * ((hstate->src_w / xdiv) *
state->bpp[i]); hstate->bpp[i]);
state->pstride[i] = 0; hstate->pstride[i] = 0;
break; break;
} }
state->offsets[i] = offset + fb->offsets[i]; hstate->offsets[i] = offset + fb->offsets[i];
} }
/* /*
* Swap width and size in case of 90 or 270 degrees rotation * Swap width and size in case of 90 or 270 degrees rotation
*/ */
if (drm_rotation_90_or_270(state->base.rotation)) { if (drm_rotation_90_or_270(hstate->base.rotation)) {
swap(state->src_w, state->src_h); swap(hstate->src_w, hstate->src_h);
} }
if (!desc->layout.size && if (!desc->layout.size &&
(mode->hdisplay != state->crtc_w || (mode->hdisplay != hstate->crtc_w ||
mode->vdisplay != state->crtc_h)) mode->vdisplay != hstate->crtc_h))
return -EINVAL; return -EINVAL;
if ((state->crtc_h != state->src_h || state->crtc_w != state->src_w) && if ((hstate->crtc_h != hstate->src_h || hstate->crtc_w != hstate->src_w) &&
(!desc->layout.memsize || (!desc->layout.memsize ||
state->base.fb->format->has_alpha)) hstate->base.fb->format->has_alpha))
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -733,24 +733,24 @@ static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p, ...@@ -733,24 +733,24 @@ static void atmel_hlcdc_plane_atomic_update(struct drm_plane *p,
struct drm_plane_state *old_s) struct drm_plane_state *old_s)
{ {
struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
struct atmel_hlcdc_plane_state *state = struct atmel_hlcdc_plane_state *hstate =
drm_plane_state_to_atmel_hlcdc_plane_state(p->state); drm_plane_state_to_atmel_hlcdc_plane_state(p->state);
u32 sr; u32 sr;
if (!p->state->crtc || !p->state->fb) if (!p->state->crtc || !p->state->fb)
return; return;
if (!state->base.visible) { if (!hstate->base.visible) {
atmel_hlcdc_plane_atomic_disable(p, old_s); atmel_hlcdc_plane_atomic_disable(p, old_s);
return; return;
} }
atmel_hlcdc_plane_update_pos_and_size(plane, state); atmel_hlcdc_plane_update_pos_and_size(plane, hstate);
atmel_hlcdc_plane_update_general_settings(plane, state); atmel_hlcdc_plane_update_general_settings(plane, hstate);
atmel_hlcdc_plane_update_format(plane, state); atmel_hlcdc_plane_update_format(plane, hstate);
atmel_hlcdc_plane_update_clut(plane, state); atmel_hlcdc_plane_update_clut(plane, hstate);
atmel_hlcdc_plane_update_buffers(plane, state); atmel_hlcdc_plane_update_buffers(plane, hstate);
atmel_hlcdc_plane_update_disc_area(plane, state); atmel_hlcdc_plane_update_disc_area(plane, hstate);
/* Enable the overrun interrupts. */ /* Enable the overrun interrupts. */
atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_IER, atmel_hlcdc_layer_write_reg(&plane->layer, ATMEL_HLCDC_LAYER_IER,
......
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