Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4978491pxj; Tue, 22 Jun 2021 12:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaaNkeOradE9mCmQKiRy5Iwi67x7+vd7KNR8p4Up3/FLD0oeahqS4UUVS1DDo6sUFk34xO X-Received: by 2002:a02:cbd9:: with SMTP id u25mr5458733jaq.49.1624389254136; Tue, 22 Jun 2021 12:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624389254; cv=none; d=google.com; s=arc-20160816; b=dt/C4JUcOsLAZPwwV9LTs7eb5OScYKOb4id7EDhRb2UhmOeLKX4GFDOZwmnGGtdXSP a03CFgoXIYko958BDYpfcGVdUYvfTHyifFw3hzwI6sBB9PqsRHx8/Vq0UEYsek+ZR7Q5 wVwLA7poYOcmiFlmTCSBnwyFlELBN6I6rez0wlGA9e1GZklqu9FT5FlfePOdB2xybdp7 C1ufcPezQ9sQVp0T9b7PAdyFP7i0l/Y3rjRx0sjgfi4+guozCgo33zLoUFPKUPZpa1NH ty5IRZiX8O53WPyjuYbgs3LF4ZXzVII2edqgSbEavkru+hm73M0fV+hm91A099GzB4QQ kGEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=w+PkCKWzFX6ch68xMO5vdAGxWd4TzqP1oTkPZJt/SU8=; b=XZnuQIDyAi9KV72hQGF0XHk4eOAHCnPjdWPuJFfSjDWwCJa3ktuJy7UnYNcXxrp6Og RBRMuySCd4TZvkR2H00bX27nAehZRb9ACs90BMk8s/xOly2DhXhAJfiqIx4zIyDwYNv4 wv8bly1wSnsgQoM7OvA+edTK9cTrT/W48hQVtyxlitDEX5jWufxFrD/nV/iGElUV3maU zvLdrRU9cXL3LyvOrU6eI65GBAioIXMhIq94eG/pTH1iJ+F+TLM5k/gfK8L2V3YXf9Jm +xru+Z07aYfP9Vt3IGSUhCTXd8uU6oEX731O4mZZ3anoHCe8A9kDlTzMMiUyNpFxbXeo id2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=ekUmPFB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si1705001ilg.12.2021.06.22.12.14.00; Tue, 22 Jun 2021 12:14:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=ekUmPFB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232681AbhFVTPN (ORCPT + 99 others); Tue, 22 Jun 2021 15:15:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbhFVTPN (ORCPT ); Tue, 22 Jun 2021 15:15:13 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DB4C061756 for ; Tue, 22 Jun 2021 12:12:57 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id d19so524932oic.7 for ; Tue, 22 Jun 2021 12:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w+PkCKWzFX6ch68xMO5vdAGxWd4TzqP1oTkPZJt/SU8=; b=ekUmPFB2M5VXXbkvlmuIKKlnSZHE29amdGhmgguDVqbcLNLaIs1QogG56KPe2c/vyH 47uJ2q9OZDaYEG6CEUo7/rardPggTELJZvSoOfm61uUlH+6CfCG34FrFSWa9h55lCXn0 VhP3FsAkxvxFYJIxZtygDVHH2mDIhjNb+GaYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w+PkCKWzFX6ch68xMO5vdAGxWd4TzqP1oTkPZJt/SU8=; b=Eng/foVJiYOPBJHHGbT2ba1IkoyXKgfZbA1sjClVxS39Wz5L8E21MA5VhDOpZOf7PI en3owZHmtetlvStY5BAaYSJQdX9BUNpNcpqLAsGru+2ga+qv3koD2/9m25ZhKcXzPixo T9CU4nW3PSgMeSS2aCsB1runPm1/SE7GKh+kM/9+KGcLrk/07kqr8nSipLbnN1QprS2r fwtXYQ6R2lXwID0iRwfTwpqVI/dyYKefJOZGVvxlx2WWoCKm5vnwF8GmYnefMGQz+TjO l9EIs+RO04C4JE0jVpEgdBAc8eL9EzGpHlJaSViXo2tW8Wh1NcWfLgB1Q1pUY21gd4e9 fzmg== X-Gm-Message-State: AOAM530u3cM9Hznjn9F1k4A3c/wAOGT/k5gvamB1nqfgoeahzbReAW/h vs0e87xCm07i8ZGhd3iivQ1V7PeXy5cAfbfngFAx6Q== X-Received: by 2002:aca:1a0c:: with SMTP id a12mr253218oia.14.1624389176394; Tue, 22 Jun 2021 12:12:56 -0700 (PDT) MIME-Version: 1.0 References: <20210621062742.26073-1-etom@igel.co.jp> <7cde82a9-c60c-e527-eeac-eaad0c5842a1@metux.net> <1cfab5f9-f275-aa53-00de-5da3fcea71c5@igel.co.jp> <20210622111239.73aa87aa@eldfell> In-Reply-To: <20210622111239.73aa87aa@eldfell> From: Daniel Vetter Date: Tue, 22 Jun 2021 21:12:45 +0200 Message-ID: Subject: Re: [PATH 0/4] [RFC] Support virtual DRM To: Pekka Paalanen Cc: Esaki Tomohito , devicetree , Takanari Hayama , Linux Doc Mailing List , David Airlie , Linux Kernel Mailing List , dri-devel , "open list:DRM DRIVERS FOR RENESAS" , Kieran Bingham , "Enrico Weigelt, metux IT consult" , Laurent Pinchart , Thomas Zimmermann , Damian Hobson-Garcia Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 10:12 AM Pekka Paalanen wrote: > > On Tue, 22 Jun 2021 13:03:39 +0900 > Esaki Tomohito wrote: > > > Hi, Enrico Weigelt > > Thank you for reply. > > > > On 2021/06/22 1:05, Enrico Weigelt, metux IT consult wrote: > > > On 21.06.21 08:27, Tomohito Esaki wrote: > > > > > > Hi, > > > > > >> Virtual DRM splits the overlay planes of a display controller into multiple > > >> virtual devices to allow each plane to be accessed by each process. > > >> > > >> This makes it possible to overlay images output from multiple processes on a > > >> display. For example, one process displays the camera image without compositor > > >> while another process overlays the UI. > > > > > > Are you attempting to create an simple in-kernel compositor ? > > > > I think the basic idea is the same as DRMlease. > > Hi, > > indeed. Why not use DRM leases instead? > > > We want to separate the resources from the master in units of planes, > > so we proposed virtual DRM. > > I think the advantage of vDRM is that you can use general DRM APIs > > in userland. > > You do that with DRM leases too. > > > > I don't think that's not the way to go, at least not by touching each > > > single display driver, and not hardcoding the planes in DT. > > > > Thank you for comment. I will reconsider about DT. > > > > > What's the actual use case you're doing that for ? Why not using some > > > userland compositor ? > > > > I think when latency is important (e.g., AR, VR, for displaying camera > > images in IVI systems), there may be use cases where the compositor > > cannot be used. > > Normally, when the image is passed through the compositor, it is > > displayed after 2 VSYNC at most, because the compositor combines the > > image with VSYNC synchronization. On the other hand, if we use vDRM, the > > image will be displayed at the next VSYNC, so it will be displayed after > > 1 VSYNC at most. > > As I said in my other email, this is false in the general sense. > > > Also, since the compositor is a single point of failure, we may not want > > to make it dependent on it. > > This... I'm not quite sure I buy it. If any of all the programs using > virtual KMS crashes, you still lose some crucial components from your > display. Maybe that program, while crashing, uploads such a bad state > to its very own KMS plane, that it causes other KMS planes to > malfunction. Then you need to detect this situation and still restart > everything, not just the crashed program. This, a hundred times. At least in general it's impossible to guarantee resource isolation between different parts of a kms device - everything is shared at least in some driver in funny ways. The only thing we try to guarantee is that if you keep flipping the same plane with same pixel format, stride, offset, absolutely everything except the memory block unchanged, then that's guaranteed to work. Everything else is off the table. This is why the drm-lease design ended up with revoke support, because if something goes wrong a superior instance (the compositor, the kernel can't decide that for userspace) needs to decide whom to shoot and revoke their access. > I would think a userspace compositor approach is actually more > reliable. You write the compositor to be extremely robust. Exactly > because the compositor is in control of the complete display device and > not just little pieces of it, it can see what is happening and it can > mitigate problems. If you have more unreliable components needing > access to display, make those clients to the compositor, so they can > crash and malfunction on their own without potentially killing the > whole display device. If you are as concerned about latency as XR > people are, then use DRM leases. > > Also, what if your virtual KMS driver has a bug? Restarting the kernel > is much harder that restarting a userspace compositor that hands out > DRM leases. > > The userspace compositor could even be such that it does nothing more > than handing out DRM leases. However, DRM leases have the problem that > there is no single entity responsible for keeping the display device > working, but that responsibility is split between several processes and > none of them sees the whole picture. Yeah I think a compositor for this use-case, written in Rust and heavily audited/proofed is probably a lot more reliable than cobbling ill-defined kernel driver code on top of barely-defined hw semantics in resource-sharing cases. > Btw. VKMS is an existing DRM driver, so your name choice is conflicting. Yeah that too :-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch