Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1184549imm; Fri, 12 Oct 2018 13:18:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jfn6pOjcYwwHpAaMwJOVIZN4nrjmqSTkwPzLZeVAjqHV+2Tb5MC+j19gonB1ujHJfSXOB X-Received: by 2002:a63:fc46:: with SMTP id r6-v6mr6873375pgk.345.1539375489221; Fri, 12 Oct 2018 13:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539375489; cv=none; d=google.com; s=arc-20160816; b=WiuLnjv6r0I8nqadD/vS+YRAaHtC4Gms6aoVrYKEtezNwtXYleyFXjLzE1y2wj8PUA i8NVPmhxIqGiFjhp7UIoL3fFrSjEB8qWR2bj462VZUl4+kES/pGgvsoBdm+W4EAXy/5K bcaWVKsSD/OlAnZzUBow3tOWpQlIcmxygiyUnSYKhmc53D8UN6vuqRceOMe2wk0cYQ/M wX7Na3OnYDjx/0cEZGSH8F0MgnMvNAXiZid0aiL9/xWl3qNOIxGoUEhsh6YXfvz3bBOj +9mc+JLM7F2S7NJFkSwJuAjSysqfIHuLOFqdQ4ihNlAvUUbYTXpQM+O4+6PFLmPK5W9y 5CHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=An4E+64yKtOQ88PawPMsiZdEeCgH+ov5Gtx/Kgk4Xwc=; b=d+GpxF2eRBaIqDW8g3Xo5xK0qHXmihGL2vswzeP3ro9WJhjAKYW/Z0MJC15JoJu0eS T4pxvpr+LXk+kcG6u7Fol1iuwL29n7Z+QqKhsrxw/HGHtSqvTo0MhsKoTH12/bTP4dCP tTCfzEqTTAnpjkGzw9Z96m5NSdwTE+OMVHav4B+kBNxSmEQnPTaWHB45VR7+5kyWqoOC 00xRBrfgtoDvqd9TiKH8r9iT/GhRRjFedK3IFatW0jenhA5VG6N4inUaU00KVFf9y1Kl zpT3dEgvaZIMTHsA3E20HlLjxVpd4KDY20Cke5JtSY+JRLZhtwopZAgvwwKBaHLvo4pp tp1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cvpKz248; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w24-v6si2280649pga.3.2018.10.12.13.17.54; Fri, 12 Oct 2018 13:18:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cvpKz248; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727129AbeJMDv3 (ORCPT + 99 others); Fri, 12 Oct 2018 23:51:29 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:35490 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727071AbeJMDv2 (ORCPT ); Fri, 12 Oct 2018 23:51:28 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w9CKHFiY028899; Fri, 12 Oct 2018 15:17:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1539375435; bh=An4E+64yKtOQ88PawPMsiZdEeCgH+ov5Gtx/Kgk4Xwc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cvpKz248TeYjQw3OFgNNKLhhAlkG+oOqLg+Q2GdNjI14u9TuE93q9GWW7qaGtK9wI AbmmDzodDqVVK/bg4/mGs5jyLOANSa0iddRiFWsgqGsDZFz0ClsgN2BDiwIqIX5zc7 bb0PFn9BwZylKEwBmFaeJwyGRpa3Q3yjF2JHo32M= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w9CKHEJ1030211; Fri, 12 Oct 2018 15:17:14 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 12 Oct 2018 15:17:14 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 12 Oct 2018 15:17:14 -0500 Received: from uda0869644a.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w9CKH7EY000402; Fri, 12 Oct 2018 15:17:14 -0500 From: Benoit Parrot To: , , Laurent Pinchart , Daniel Vetter CC: Tomi Valkeinen , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [Patch v4 4/8] drm/omap: omap_plane: subclass drm_plane_state Date: Fri, 12 Oct 2018 15:16:59 -0500 Message-ID: <20181012201703.29065-5-bparrot@ti.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20181012201703.29065-1-bparrot@ti.com> References: <20181012201703.29065-1-bparrot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to add omap plane state specific extensions we need to subclass drm_plane_state and add the relevant helpers. The addition of specific extension will be done separately. Signed-off-by: Benoit Parrot --- drivers/gpu/drm/omapdrm/omap_plane.c | 48 +++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 26c2c78d020f..b0e60119c0a1 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -26,6 +26,12 @@ * plane funcs */ +#define to_omap_plane_state(x) container_of(x, struct omap_plane_state, base) + +struct omap_plane_state { + struct drm_plane_state base; +}; + #define to_omap_plane(x) container_of(x, struct omap_plane, base) struct omap_plane { @@ -202,14 +208,29 @@ void omap_plane_install_properties(struct drm_plane *plane, drm_object_attach_property(obj, priv->zorder_prop, 0); } +static void omap_plane_atomic_destroy_state(struct drm_plane *plane, + struct drm_plane_state *state) +{ + __drm_atomic_helper_plane_destroy_state(state); + kfree(to_omap_plane_state(state)); +} + static void omap_plane_reset(struct drm_plane *plane) { struct omap_plane *omap_plane = to_omap_plane(plane); + struct omap_plane_state *omap_state; - drm_atomic_helper_plane_reset(plane); - if (!plane->state) + if (plane->state) + omap_plane_atomic_destroy_state(plane, plane->state); + + omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL); + if (!omap_state) return; + omap_state->base.plane = plane; + plane->state = &omap_state->base; + plane->state->plane = plane; + plane->state->rotation = DRM_MODE_ROTATE_0; /* * Set the zpos default depending on whether we are a primary or overlay * plane. @@ -218,6 +239,25 @@ static void omap_plane_reset(struct drm_plane *plane) ? 0 : omap_plane->overlay->overlay_id; } +static struct drm_plane_state * +omap_plane_atomic_duplicate_state(struct drm_plane *plane) +{ + struct omap_plane_state *state; + struct omap_plane_state *copy; + + if (WARN_ON(!plane->state)) + return NULL; + + state = to_omap_plane_state(plane->state); + copy = kmemdup(state, sizeof(*state), GFP_KERNEL); + if (!copy) + return NULL; + + __drm_atomic_helper_plane_duplicate_state(plane, ©->base); + + return ©->base; +} + static int omap_plane_atomic_set_property(struct drm_plane *plane, struct drm_plane_state *state, struct drm_property *property, @@ -253,8 +293,8 @@ static const struct drm_plane_funcs omap_plane_funcs = { .disable_plane = drm_atomic_helper_disable_plane, .reset = omap_plane_reset, .destroy = omap_plane_destroy, - .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, + .atomic_duplicate_state = omap_plane_atomic_duplicate_state, + .atomic_destroy_state = omap_plane_atomic_destroy_state, .atomic_set_property = omap_plane_atomic_set_property, .atomic_get_property = omap_plane_atomic_get_property, }; -- 2.9.0