From patchwork Mon Feb 19 12:01:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10227607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4448460392 for ; Mon, 19 Feb 2018 12:01:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21CD3289F6 for ; Mon, 19 Feb 2018 12:01:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 161B228A30; Mon, 19 Feb 2018 12:01:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43304289F6 for ; Mon, 19 Feb 2018 12:01:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FF0B89D3E; Mon, 19 Feb 2018 12:01:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id D07BC89D3E for ; Mon, 19 Feb 2018 12:01:12 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1JC17ms021164; Mon, 19 Feb 2018 06:01:07 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519041667; bh=tovvYmBZLMzkMWUQt431wdc1WjDE2co81fsYkzRDzlM=; h=Subject:To:References:From:Date:In-Reply-To; b=hPWbALR3eSsbgNN/1ml71H3cuchzNRN5n36Hb0qXoK18LvlHl05lrjv0ddRPoGMTm DNXfIWd8sW9gu59/Tw9PjJbEICCtWK1x+EIqBuE+hweecF4aRr9YwjtOv10njW9J6C iEs/0czaFBDVdphXKcH1BlTLaI0ChrqYXG+XJpkM= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1JC175s011751; Mon, 19 Feb 2018 06:01:07 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 19 Feb 2018 06:01:07 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 19 Feb 2018 06:01:07 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1JC16Cx022374; Mon, 19 Feb 2018 06:01:06 -0600 Subject: Re: [PATCH RFC 1/9] drm/omap: Update omapdss API to allow alternative DSS implementations To: Jyri Sarha , , References: From: Tomi Valkeinen Message-ID: <1d908693-dfb2-7775-3c74-42fe73c2114a@ti.com> Date: Mon, 19 Feb 2018 14:01:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 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-Virus-Scanned: ClamAV using ClamSMTP Hi Jyri, Laurent, On 16/02/18 13:25, Jyri Sarha wrote: > After this patch OMAP_DSS_BASE module is not including any OMAP2_DSS > headers, only the API omapdss.h. "sturct dss_data", the piece of the > data structure needed for base.c is defined in omapdss.h and added as > a member to struct dss_device, and later to struct dss6_device. > > The patch is still a bit hackish. The struct dispc_device declaration > is currently shared between alternative dss implementations, with > different internal definitions. It should be relatively simple to use > a similar struct dispc_data as struct dss_data is for dss_device, move > some common parts - maybe the dispc_ops itself - there and find the > private data with container_of macro. Also the contents of struct > dss_data in side dss_device is currently redundant. These should be > easy enough to fix, if we decide to take this route. > > Signed-off-by: Jyri Sarha > --- > drivers/gpu/drm/omapdrm/dss/base.c | 11 +++++------ > drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++++ > drivers/gpu/drm/omapdrm/dss/dss.c | 2 +- > drivers/gpu/drm/omapdrm/dss/dss.h | 2 ++ > drivers/gpu/drm/omapdrm/dss/omapdss.h | 13 +++++++++---- > drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- > 6 files changed, 22 insertions(+), 12 deletions(-) I think something in this direction would be good. I'd really like to keep it possible to run dss6 on top of omapdrm. But I think this can be done slightly simpler like this: Yes, it adds two new globals. But I don't think those are a big issue. Note that I left the dss->dispc there, for dss internal use. Laurent, what do you think? If this is fine, can you squash to your series? Or I can even have this on top as well. I think otherwise it's good for merging. Can you also have a quick look at patches 2, 3, 4, 5, 6 and 7. While their aim is to get dss6 working, I think they're ok cleanups and shouldn't cause issues with the main dss rework. Tomi diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 99e8cb8dc65b..08913e006e93 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -19,10 +19,11 @@ #include #include -#include "dss.h" #include "omapdss.h" static struct dss_device *dss_device; +static struct dispc_device *s_dispc_device; +static const struct dispc_ops *s_dispc_ops; static struct list_head omapdss_comp_list; @@ -46,16 +47,23 @@ EXPORT_SYMBOL(omapdss_set_dss); struct dispc_device *dispc_get_dispc(struct dss_device *dss) { - return dss->dispc; + return s_dispc_device; } EXPORT_SYMBOL(dispc_get_dispc); const struct dispc_ops *dispc_get_ops(struct dss_device *dss) { - return dss->dispc_ops; + return s_dispc_ops; } EXPORT_SYMBOL(dispc_get_ops); +void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops* dispc_ops) +{ + s_dispc_device = dispc; + s_dispc_ops = dispc_ops; +} +EXPORT_SYMBOL(omapdss_set_dispc); + static bool omapdss_list_contains(const struct device_node *node) { struct omapdss_comp_node *comp; diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ce470b51e326..b72f981d660e 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -4786,7 +4786,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) dispc_runtime_put(dispc); dss->dispc = dispc; - dss->dispc_ops = &dispc_ops; + omapdss_set_dispc(dispc, &dispc_ops); dispc->debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs, dispc); @@ -4807,8 +4807,8 @@ static void dispc_unbind(struct device *dev, struct device *master, void *data) dss_debugfs_remove_file(dispc->debugfs); + omapdss_set_dispc(NULL, NULL); dss->dispc = NULL; - dss->dispc_ops = NULL; pm_runtime_disable(dev); diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 6f6fd3d1b159..3d23232ec1f7 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -274,7 +274,6 @@ struct dss_device { struct dss_pll *video2_pll; struct dispc_device *dispc; - const struct dispc_ops *dispc_ops; }; /* core */ diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index a4f71e082c1c..b724dae22d7a 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -751,6 +751,7 @@ struct dispc_ops { struct dispc_device *dispc_get_dispc(struct dss_device *dss); const struct dispc_ops *dispc_get_ops(struct dss_device *dss); +void omapdss_set_dispc(struct dispc_device *dispc, const struct dispc_ops* dispc_ops); bool omapdss_component_is_display(struct device_node *node); bool omapdss_component_is_output(struct device_node *node);