From patchwork Thu Jun 4 09:02:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 6545941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 059B7C0020 for ; Thu, 4 Jun 2015 11:07:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F05A7206D6 for ; Thu, 4 Jun 2015 11:07:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ADE14207B3 for ; Thu, 4 Jun 2015 11:07:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C79EF6EB2A; Thu, 4 Jun 2015 04:06:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by gabe.freedesktop.org (Postfix) with ESMTP id 159A36EA73 for ; Thu, 4 Jun 2015 02:11:54 -0700 (PDT) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t54949pQ010372; Thu, 4 Jun 2015 04:04:09 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t54949mW011995; Thu, 4 Jun 2015 04:04:09 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Thu, 4 Jun 2015 04:04:09 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5493YwR014785; Thu, 4 Jun 2015 04:04:08 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 25/45] drm: omapdrm: Move plane info and win out of the plane structure Date: Thu, 4 Jun 2015 12:02:42 +0300 Message-ID: <1433408582-9828-26-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> References: <1433408582-9828-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 04 Jun 2015 04:06:34 -0700 Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart 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: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_plane.c | 92 ++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 7011cb23d3eb..465fd9cafd7b 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -39,10 +39,7 @@ struct omap_plane { struct drm_plane base; int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ const char *name; - struct omap_overlay_info info; - /* position/orientation of scanout within the fb: */ - struct omap_drm_window win; bool enabled; uint32_t nformats; @@ -67,8 +64,9 @@ static int omap_plane_setup(struct omap_plane *omap_plane) { struct drm_plane_state *state = omap_plane->base.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 omap_overlay_info info; + struct omap_drm_window win; int ret; DBG("%s, enabled=%d", omap_plane->name, omap_plane->enabled); @@ -78,22 +76,53 @@ static int omap_plane_setup(struct omap_plane *omap_plane) 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: */ - 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, - info->out_width, info->out_height, - info->screen_width); - DBG("%d,%d %pad %pad", info->pos_x, info->pos_y, - &info->paddr, &info->p_uv_addr); + DBG("%dx%d -> %dx%d (%d)", info.width, info.height, + info.out_width, info.out_height, + info.screen_width); + DBG("%d,%d %pad %pad", info.pos_x, info.pos_y, + &info.paddr, &info.p_uv_addr); dispc_ovl_set_channel_out(omap_plane->id, omap_crtc_channel(state->crtc)); /* 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); if (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, struct drm_plane_state *old_state) { struct omap_plane *omap_plane = to_omap_plane(plane); - struct omap_drm_window *win = &omap_plane->win; struct drm_plane_state *state = plane->state; - uint32_t src_w; - uint32_t src_h; if (!state->fb || !state->crtc) 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_setup(omap_plane); } @@ -358,7 +358,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct omap_plane *omap_plane; - struct omap_overlay_info *info; int ret; DBG("%s: type=%d", plane_names[id], type); @@ -389,15 +388,6 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, 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; error: