Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp657119rdh; Wed, 14 Feb 2024 07:48:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXoQrExIIywUD+FcJ9Rrt7/N8/eHvr8tG6LKenK+yzqxGaus+WJGrcezxRhS1i6q6uY8JK7KUrGs+gv0WkVhhCIRNprpmtOY92UnhJX/w== X-Google-Smtp-Source: AGHT+IFcuSWRdNwOfyamwIkoLqRPivlN28wIt/LW4293XK9BQoQrdcGq6XrdH0VM7+QenbQqHtde X-Received: by 2002:a05:6a20:6f07:b0:19e:cbe9:64b with SMTP id gt7-20020a056a206f0700b0019ecbe9064bmr3299841pzb.50.1707925680938; Wed, 14 Feb 2024 07:48:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707925680; cv=pass; d=google.com; s=arc-20160816; b=zHia1/JZCQRupiTQ9FDvhSD5W2Z7u0FxnBWLRFtqLk4hD9o3Jjih60gIW+DMQqxxPI onJWfa74Oj2yn9YZcejH6eHq4JTvcrVl80v6LegfidGKAZn+1U6El16XPjMhCjXFUrMK MdGWXXxObn+OtPQF0v4JoF3O7arduY8NUeAfft9ukRraWTNduQKpfpx2btTOWXHfx2cM dG9vJ7Q/x7kvDSQw3Y2c0kEh/RVlVP/E2xb3u+WFj+Zt80MruivUgKaYn1SuRWdA+Mbi uR6iayc1x5bE8qtsgWs+kpqYxHf9Amgfd878xxBCdXy+jiGRm+z49j4QNMgwVmUAtQIg 3K/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=42OOgF4IEsciCzy4HGPu7+BcjYJ3RR40X6NYVnnz8qE=; fh=GVYXG9I0QiQ7+xvUJkg6byCbPnDInkbLEnprYfzm/08=; b=aewY6JYczDBXd9NvsEm1t84W9ZFxJTaXPXCA8R9jbTkwMMeP0RVAPFLM1UK6C1Gk8H j1yBBsJYNkmlWvSMQlkoh21bysSsaLXS88RSVOZ0x/RtRUg4PszC/iwMeSc/wf+2ROxT Vp8qvVOIbTaYjcgiH10wXN4KOfyxVOX5tmsugBaWcryD/K6S3wXYVf49GhaLyTWpy6CD FNgcojAvhXdmN8RqjHyY1QX58PY5i+OGoMFJwR2Zh9eohBNzbPRkZMNAPgS3i3Wmc/Od ly2pb2JF4DAJdQG8hchBhyb7/T+cPG0C6T7PCTgv2NcA09rodCmT/ViaQwHseKVPL8c+ 7QiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jugqqVoC; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-65451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCWwz5un5HYDf6dn9unggC5P811RCkkdH47fR1VDO7ttk5b0ItgBeMVPTZYouHGPdB/L1CTdDk9IwaNIyYXOeldIl8EFas56Lxt7YPZmJQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f28-20020a63381c000000b005ce0a1164aesi3790882pga.616.2024.02.14.07.48.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 07:48:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jugqqVoC; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-65451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 90B37289703 for ; Wed, 14 Feb 2024 15:48:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6344A5D8F9; Wed, 14 Feb 2024 15:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="jugqqVoC" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2B535D463; Wed, 14 Feb 2024 15:47:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707925672; cv=none; b=lD8eeNDHVavuzQilfMJ6rYnnsMRTOrszKK7OQb4WFvkfjAlSL8+APdJ+QHS/8e1REQKHUfRF9iak7aebubSA9mbgvneXD9tTEjTVaV69tzaVuFV5uZetKDir2vJiYF9U+zRHOV8PMTnzxr42gpMkza9mnYliokKmGMDTMGmcKjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707925672; c=relaxed/simple; bh=+3p8aCcaMIzczD0Sp/wH5oFAdSV/eWhqmd1tX646IV4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=Qt+YHxC/rcoOqc0EgBhTcdXxF3zvUSD+cr4MtoF/3dsbTJmLt6reiOvHyh3RxN5u9WEZjaWM42azqpzJK0moPV7w4cqyos7pD+z63WemY9BerAlW4WRHa1ueTTCkJmWsWu8/jvzXqM1cgO1EkLZ7pwkQgSNm6f/2cYJNpOuVJJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=jugqqVoC; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41EFlJKq059688; Wed, 14 Feb 2024 09:47:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707925639; bh=42OOgF4IEsciCzy4HGPu7+BcjYJ3RR40X6NYVnnz8qE=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=jugqqVoCuwykHtv+V+RHovowjbVT0dMBwGRm75SNMdD8jr/39Jk9z52BxcXTPTCG7 j/CS8ikCqgCT3FdvlaY4OKVFgwIHquVY/xQp4U/yOyuNmZCMuj9pNsqSxOBnMPhxAz JJ1RPu6S1Eim6LTEggNcUv7QF/XRruh4koR4lNg8= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41EFlJtg030857 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Feb 2024 09:47:19 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 14 Feb 2024 09:47:19 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 14 Feb 2024 09:47:19 -0600 Received: from [172.24.227.193] (devarsht.dhcp.ti.com [172.24.227.193]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41EFlC25046625; Wed, 14 Feb 2024 09:47:13 -0600 Message-ID: <2f4cf2a7-ce7a-bb34-f722-7e66ea41def7@ti.com> Date: Wed, 14 Feb 2024 21:17:12 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [RFC PATCH 2/3] drm/tidss: Add support for display sharing Content-Language: en-US To: Maxime Ripard CC: , , , , , , , , , , , , , , , , , , References: <20240116134142.2092483-1-devarsht@ti.com> <20240116134142.2092483-3-devarsht@ti.com> <88018f5f-a7db-7278-e5c3-bb1dbf0e3f14@ti.com> From: Devarsh Thakkar In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Hi Maxime, Thanks for the quick reply. On 13/02/24 19:34, Maxime Ripard wrote: > Hi Devarsh, > > On Thu, Feb 08, 2024 at 06:26:17PM +0530, Devarsh Thakkar wrote: >> Hi Maxime, >> >> Thanks a lot for checking on this. >> >> On 26/01/24 17:45, Maxime Ripard wrote: >>> Hi, >>> >>> Thanks a lot for working on that. >>> >>> On Tue, Jan 16, 2024 at 07:11:41PM +0530, Devarsh Thakkar wrote: >>>> Display subsystem present in TI Keystone family of devices supports sharing >>>> of display between multiple hosts as it provides separate register space >>>> (common* region) for each host to programming display controller and also a >>>> unique interrupt line for each host. >>>> >>>> This adds support for display sharing, by allowing partitioning of >>>> resources either at video port level or at video plane level as >>>> described below : >>>> >>>> 1) Linux can own (i.e have write access) completely one or more of video >>>> ports along with corresponding resources (viz. overlay managers, >>>> video planes) used by Linux in context of those video ports. >>>> Even if Linux is owning >>>> these video ports it can still share this video port with a remote core >>>> which can own one or more video planes associated with this video port. >>>> >>>> 2) Linux owns one or more of the video planes with video port >>>> (along with corresponding overlay manager) associated with these planes >>>> being owned and controlled by a remote core. Linux still has read-only >>>> access to the associated video port and overlay managers so that it can >>>> parse the settings made by remote core. >>> >>> So, just to make sure we're on the same page. 1) means Linux drives the >>> whole display engine, but can lend planes to the R5? How does that work, >>> is Linux aware of the workload being there (plane size, format, etc) ? >>> >> >> Well, there is no dynamic procedure being followed for lending. The >> partitioning scheme is decided and known before hand, and the remote >> core firmware updated and compiled accordingly, and similarly the >> device-tree overlay for Linux is also updated with partitioning >> information before bootup. >> >> What would happen here is that Linux will know before-hand this >> partitioning information via device-tree properties and won't enumerate >> the plane owned by RTOS, but it will enumerate the rest of the display >> components and initialize the DSS, after which user can load the DSS >> firmware on remote core and this firmware will only have control of >> plane as it was compiled with that configuration. > > Right. If the RTOS is in control of a single plane, how it is expected > to deal with Linux shutting the CRTC down, or enforcing a configuration > that isn't compatible with what the RTOS expects (like a plane with a > higher zpos masking its plane), what is the mechanism to reconcile it? > Just for the note, for this "RTOS control single plane" mode, we don't have a firmware available to test (right now we are only supporting example for "RTOS controlling the display mode" as shared here [1]) and hence this is not validated but the idea was to keep dt-bindings generic enough to support them in future and that's why I referred to it here. Coming back to your questions, with the current scheme the Linux (tidss) would be expected to make sure the CRTC being shared with RTOS is never shutdown and the RTOS plane should never gets masked. I think the IPC based scheme would have been mainly needed for the case where you have a single entity controlling the display for e.g you have a single display controller register space and a single IRQ but you have multiple planes and say you want to divide these planes to different host processors. In that case you want a single entity to act as a main entity and be in control of DSS and rest of the processors communicate with the "main entity" to request display resources and plane updates and main entity also programs dss on their behalf. But unlike above, TI DSS7 is designed to support static partitioning of display resources among multiple hosts, where each host can program the display hardware independently using separate register space and having a separate irq and without requirement of any communication between the hosts. Now as this feature is unique to TI DSS7 we want to support this feature in tidss driver. The DSS resource partitioning feature is described in detail here [2] >>> And 2) would mean that the display engine is under the R5 control and >>> Linux only gets to fill the plane and let the firmware know of what it >>> wants? >>> >> >> Here too the partitioning information is pre-decided and remote core >> firmware and device-tree overlay for Linux updated accordingly. But in >> this case as remote core firmware owns the display (minus the plane >> owned by Linux) it is started and initialized during the bootloader >> phase itself where it initializes the DSS and starts rendering using the >> plane owned by it and Linux just latches to the DSS without >> re-initializing it, with write access only to the plane that is owned by >> Linux. You can refer [1] for more details on this. >> >>> If so, do we even need the tidss driver in the second case? We could >>> just write a fwkms driver of some sorts that could be used by multiple >>> implementations of the same "defer to firmware" logic. >>> >> >> This feature of static partitioning of DSS resources is specific to DSS7 >> hardware (which is controlled by tidss driver) which supports dedicated >> register space and interrupt line for each of the hosts [0], so that >> multiple hosts can drive the display controller simultaneously as per >> the desired static partitioning of resources, and so I don't think a >> separate driver is required here and tidss seems the right place to >> support this, where using this device-tree approach different resource >> partitioning schemas can be achieved as described here [1]. This was >> also aligned with Tomi too where we discussed that tidss is the right >> place to support this as we are simply leveraging the DSS hardware >> capabilities of static partitioning here. > > If the only thing tidss does in the "owned by RTOS" is forwarding KMS > atomic states to the RTOS, then I'm still not sure why we need to > involve tidss at all. > I think maybe here is the point of misunderstanding. We are not forwarding atomic states to RTOS here. Linux (tidss) is infact, accessing the display register space assigned to it (common1 assigned to Linux, commmon0 assigned to RTOS) and also writing to DSS plane registers for the plane assigned to it (say VID assigned to Linux and VIDL assigned to RTOS). > It's not just about interrupts, it's also about how your arbitrate > between what Linux wants and what the RTOS wants. Like if the RTOS still > wants to output something but Linux wants to disable it, how do you > reconcile the two? > The scheme involves static partitioning of display resource which are assigned compile-time to RTOS and Linux. Here the RTOS firmware is compiled with specific ownership/display resources as desired by user and this assignment stays intact. If there is a more complex use-case which requires dynamic assignment/arbitration of resources then I agree those require some sort of IPC scheme but this is not what we target with these series. This series is simply to support static partitioning feature (separate register space, separate irq, firewalling support etc) of TI DSS hardware across the multiple hosts and there are use-cases too for which this scheme suffices. > You have to have something that reconciles both, and typically for > firmware-based setup this will be the firmware's job. > > That's very similar to what the RaspberryPi did with fkms, and I believe > that having a generic KMS-on-remoteproc driver when the firmware has > control over the display is the path forward. > The kms-on-remoteproc scheme is different and maybe more useful for those processors not supporting this static partitioning hardware feature. On the other hand, I believe there are still use-cases where this unique static partitioning hardware feature of TI DSS will suffice without any requirement of IPC. And it makes the firmware simpler (and the job of RTOS developer easier too) as no IPC is required. I am curious to understand Rpi DSS hardware and take a look at fkms and it's firmware code though if it is public ? >>>> For both the cases, the resources used in context of processing core >>>> running Linux along with ownership information are exposed by user as >>>> part of device-tree blob and driver uses an updated feature list tailored >>>> for this shared mode accordingly. The driver also auto-populates >>>> matching overlay managers and output types from shared video >>>> port list provided in device-tree blob. >>>> In dispc_feature struct remove const access specfier for output_type >>>> array as it is required to be updated dynamically in run-time for shared >>>> mode. >>> >>> I'm also not entirely sure that the device tree is the right path there. >>> Surely the firmware capabilities will evolve over time, while the device >>> tree won't. Is there some way to make it discoverable at probe time by >>> the driver? >> >> I think the main highlight of the sharing feature is the hardware >> capability where each host is provided separate irq and register space >> to program display for their display context independently > > Wait, what do you mean by display context here? > By context I mean to what that specific host wants to display. For e.g. if RTOS is owning a plane, then it can update it's framebuffer and update plane registers independently. [1] https://software-dl.ti.com/processor-sdk-linux/esd/AM62PX/09_01_00_08/exports/docs/system/Demo_User_Guides/Display_Cluster_User_Guide.html [2] https://www.ti.com/lit/zip/spruj52 ((Section 12.6.3.14 DISPC Resources Sharing)) Regards Devarsh > Maxime