Commit fb730c9b authored by Laurent Pinchart's avatar Laurent Pinchart

drm: omapdrm: Move plane info and win out of the plane structure

The plane info and win structures are only used to setup the plane
through the DSS API. Move them from the plane structure to local
variables in omap_plane_setup().
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent afc34932
...@@ -39,10 +39,7 @@ struct omap_plane { ...@@ -39,10 +39,7 @@ struct omap_plane {
struct drm_plane base; struct drm_plane base;
int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */
const char *name; const char *name;
struct omap_overlay_info info;
/* position/orientation of scanout within the fb: */
struct omap_drm_window win;
bool enabled; bool enabled;
uint32_t nformats; uint32_t nformats;
...@@ -67,8 +64,9 @@ static int omap_plane_setup(struct omap_plane *omap_plane) ...@@ -67,8 +64,9 @@ static int omap_plane_setup(struct omap_plane *omap_plane)
{ {
struct drm_plane_state *state = omap_plane->base.state; struct drm_plane_state *state = omap_plane->base.state;
struct omap_plane_state *omap_state = to_omap_plane_state(state); struct omap_plane_state *omap_state = to_omap_plane_state(state);
struct omap_overlay_info *info = &omap_plane->info;
struct drm_device *dev = omap_plane->base.dev; struct drm_device *dev = omap_plane->base.dev;
struct omap_overlay_info info;
struct omap_drm_window win;
int ret; int ret;
DBG("%s, enabled=%d", omap_plane->name, omap_plane->enabled); DBG("%s, enabled=%d", omap_plane->name, omap_plane->enabled);
...@@ -78,22 +76,53 @@ static int omap_plane_setup(struct omap_plane *omap_plane) ...@@ -78,22 +76,53 @@ static int omap_plane_setup(struct omap_plane *omap_plane)
return 0; return 0;
} }
info->zorder = omap_state->zorder; memset(&info, 0, sizeof(info));
info.rotation_type = OMAP_DSS_ROT_DMA;
info.rotation = OMAP_DSS_ROT_0;
info.global_alpha = 0xff;
info.mirror = 0;
info.zorder = omap_state->zorder;
memset(&win, 0, sizeof(win));
win.rotation = state->rotation;
win.crtc_x = state->crtc_x;
win.crtc_y = state->crtc_y;
win.crtc_w = state->crtc_w;
win.crtc_h = state->crtc_h;
/*
* src values are in Q16 fixed point, convert to integer.
* omap_framebuffer_update_scanout() takes adjusted src.
*/
win.src_x = state->src_x >> 16;
win.src_y = state->src_y >> 16;
switch (state->rotation & 0xf) {
case BIT(DRM_ROTATE_90):
case BIT(DRM_ROTATE_270):
win.src_w = state->src_h >> 16;
win.src_h = state->src_w >> 16;
break;
default:
win.src_w = state->src_w >> 16;
win.src_h = state->src_h >> 16;
break;
}
/* update scanout: */ /* update scanout: */
omap_framebuffer_update_scanout(state->fb, &omap_plane->win, info); omap_framebuffer_update_scanout(state->fb, &win, &info);
DBG("%dx%d -> %dx%d (%d)", info->width, info->height, DBG("%dx%d -> %dx%d (%d)", info.width, info.height,
info->out_width, info->out_height, info.out_width, info.out_height,
info->screen_width); info.screen_width);
DBG("%d,%d %pad %pad", info->pos_x, info->pos_y, DBG("%d,%d %pad %pad", info.pos_x, info.pos_y,
&info->paddr, &info->p_uv_addr); &info.paddr, &info.p_uv_addr);
dispc_ovl_set_channel_out(omap_plane->id, dispc_ovl_set_channel_out(omap_plane->id,
omap_crtc_channel(state->crtc)); omap_crtc_channel(state->crtc));
/* and finally, update omapdss: */ /* and finally, update omapdss: */
ret = dispc_ovl_setup(omap_plane->id, info, false, ret = dispc_ovl_setup(omap_plane->id, &info, false,
omap_crtc_timings(state->crtc), false); omap_crtc_timings(state->crtc), false);
if (ret) { if (ret) {
dev_err(dev->dev, "dispc_ovl_setup failed: %d\n", ret); dev_err(dev->dev, "dispc_ovl_setup failed: %d\n", ret);
...@@ -140,40 +169,11 @@ static void omap_plane_atomic_update(struct drm_plane *plane, ...@@ -140,40 +169,11 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_plane *omap_plane = to_omap_plane(plane);
struct omap_drm_window *win = &omap_plane->win;
struct drm_plane_state *state = plane->state; struct drm_plane_state *state = plane->state;
uint32_t src_w;
uint32_t src_h;
if (!state->fb || !state->crtc) if (!state->fb || !state->crtc)
return; return;
win->rotation = state->rotation;
/* omap_framebuffer_update_scanout() takes adjusted src */
switch (state->rotation & 0xf) {
case BIT(DRM_ROTATE_90):
case BIT(DRM_ROTATE_270):
src_w = state->src_h;
src_h = state->src_w;
break;
default:
src_w = state->src_w;
src_h = state->src_h;
break;
}
/* src values are in Q16 fixed point, convert to integer. */
win->crtc_x = state->crtc_x;
win->crtc_y = state->crtc_y;
win->crtc_w = state->crtc_w;
win->crtc_h = state->crtc_h;
win->src_x = state->src_x >> 16;
win->src_y = state->src_y >> 16;
win->src_w = src_w >> 16;
win->src_h = src_h >> 16;
omap_plane->enabled = true; omap_plane->enabled = true;
omap_plane_setup(omap_plane); omap_plane_setup(omap_plane);
} }
...@@ -358,7 +358,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ...@@ -358,7 +358,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
struct drm_plane *plane; struct drm_plane *plane;
struct omap_plane *omap_plane; struct omap_plane *omap_plane;
struct omap_overlay_info *info;
int ret; int ret;
DBG("%s: type=%d", plane_names[id], type); DBG("%s: type=%d", plane_names[id], type);
...@@ -389,15 +388,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ...@@ -389,15 +388,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
omap_plane_install_properties(plane, &plane->base); omap_plane_install_properties(plane, &plane->base);
/* get our starting configuration, set defaults for parameters
* we don't currently use, etc:
*/
info = &omap_plane->info;
info->rotation_type = OMAP_DSS_ROT_DMA;
info->rotation = OMAP_DSS_ROT_0;
info->global_alpha = 0xff;
info->mirror = 0;
return plane; return plane;
error: error:
......
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