From patchwork Wed Feb 25 21:54:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 5884601 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F4149F269 for ; Wed, 25 Feb 2015 21:54:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFB2420304 for ; Wed, 25 Feb 2015 21:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 823F620381 for ; Wed, 25 Feb 2015 21:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932369AbbBYVyX (ORCPT ); Wed, 25 Feb 2015 16:54:23 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:52083 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932371AbbBYVyT (ORCPT ); Wed, 25 Feb 2015 16:54:19 -0500 Received: from avalon.ideasonboard.com (dsl-hkibrasgw3-50ddcc-40.dhcp.inet.fi [80.221.204.40]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 8ABDF20B74; Wed, 25 Feb 2015 22:53:28 +0100 (CET) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 33/38] drm: rcar-du: Replace plane crtc and enabled fields by plane state Date: Wed, 25 Feb 2015 23:54:53 +0200 Message-Id: <1424901298-6829-34-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1424901298-6829-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1424901298-6829-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The crtc and enabled fields duplicates information stored in the plane state. Use the plane state instead and remove the fields. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 6 ++---- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 15 +++------------ drivers/gpu/drm/rcar-du/rcar_du_plane.h | 3 --- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index faa46ed23a62..3f64707412e6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -212,7 +212,7 @@ static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; unsigned int j; - if (plane->crtc != &rcrtc->crtc || !plane->enabled) + if (plane->plane.state->crtc != &rcrtc->crtc) continue; /* Insert the plane in the sorted planes array. */ @@ -379,7 +379,7 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) { struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; - if (plane->crtc != crtc || !plane->enabled) + if (plane->plane.state->crtc != crtc) continue; rcar_du_plane_setup(plane); @@ -608,8 +608,6 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) rcrtc->enabled = false; rcrtc->plane = &rgrp->planes.planes[index % 2]; - rcrtc->plane->crtc = crtc; - ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, &rcrtc->plane->plane, NULL, &crtc_funcs); if (ret < 0) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index f28d13dc6fc9..c5cb2ade2722 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -140,7 +140,8 @@ static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane) bool interlaced; u32 mwr; - interlaced = plane->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE; + interlaced = plane->plane.state->crtc->state->adjusted_mode.flags + & DRM_MODE_FLAG_INTERLACE; /* Memory pitch (expressed in pixels). Must be doubled for interlaced * operation with 32bpp formats. @@ -354,16 +355,11 @@ static int rcar_du_plane_atomic_check(struct drm_plane *plane, static void rcar_du_plane_disable(struct rcar_du_plane *rplane) { - if (!rplane->enabled) + if (!rplane->plane.state->crtc) return; - mutex_lock(&rplane->group->planes.lock); - rplane->enabled = false; - mutex_unlock(&rplane->group->planes.lock); - rcar_du_plane_release(rplane); - rplane->crtc = NULL; rplane->format = NULL; } @@ -391,14 +387,9 @@ static void rcar_du_plane_atomic_update(struct drm_plane *plane, rcar_du_plane_reserve(rplane, format); } - rplane->crtc = state->crtc; rplane->format = format; rcar_du_plane_setup(rplane); - - mutex_lock(&rplane->group->planes.lock); - rplane->enabled = true; - mutex_unlock(&rplane->group->planes.lock); } static const struct drm_plane_helper_funcs rcar_du_plane_helper_funcs = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index 012f2185ca1f..7050fc1e11ec 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -34,9 +34,6 @@ struct rcar_du_plane { struct drm_plane plane; struct rcar_du_group *group; - struct drm_crtc *crtc; - - bool enabled; int hwindex; /* 0-based, -1 means unused */