Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp216462lqo; Thu, 16 May 2024 04:27:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXiK+a5lsaDREd8uL32NJu257OoptnbXckOIgRgvG8Ny2dmDqDtqgdNU5nJ6yGxuR0qTz8XGjCvZtgU2/jYdvOvQMdTI6/X3PJ6o6wcSg== X-Google-Smtp-Source: AGHT+IHm3n3OJDRvtov2xZFtwBxMPjcXCn/mzOIH9dW71bXfnuxoR9rnpwN/2KABwqhJDp6dcVhw X-Received: by 2002:a50:f699:0:b0:572:4041:5637 with SMTP id 4fb4d7f45d1cf-5734d5cff1emr13665267a12.19.1715858862843; Thu, 16 May 2024 04:27:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715858862; cv=pass; d=google.com; s=arc-20160816; b=VU04Hf0WzMAaUqNqOgIqDnvt9ygUIU9/lpdBBa7+7alJZo5p3uggRrXbA6mRWQk1oU kFdgZQBYk35lLDTMJ9CulC35xJ3tr2+GFlNwVBe9AwcqoXqJRIvKbBO2ClBrYpAG1K6D vAsCMMQyQAzi6ro1ZanToTxfaNKPk0sIislJqt8XAwhNZLv89X5zGTkMLF03ggtIClLv L/G1fQbyaU4TaQuVqWz2TfLCqiPa3x5rjBbPAT9fxi159EVSS5qG09r9pF9RJ8BEsvQD QE37DUHYXmdXViybbJYzn0fM+KMxkCLetBgq6bulcGW/Oz/4rY6dYy4+0vmq4acSwQ1w cw5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kp/tspDKa9g8TwDKyM40GixYWk1k9A2N3cZCtEd82Y8=; fh=C5iXqRanG+kiX537dzcfZBfemA8pf9JzS6KliUcywlo=; b=ZoGalFQVZgh3q3hBNLnUxeR91rq8yAoBYfN9LrtwTaYe/C46leFHDHllWVbTTxHOwH 0N0oPro2TrCsUAZQvmMXSDMqvzjnCmZjIzCHpzVRiaGtRXlA/qr3XmlUTPZXPxYV4MyH ZjAgyK1WSs8nDPgjlCQu8enJT+OntKkDCDN7MZ3Pr6BqRmtd8lpPkotVhWL/qqYPZbSV nTA/X2iJKMjsJhfFFfKesEBMrANUqKGMpzIhMcgYa1/wb4j1iP8XZ3Nb1CSal/jOehU7 2/GeVwSrBwD+BFZs5Ue/sTL2TVM5Yj7gjH2IaNwKUyqpHHfsBM7VD9CSaYJ3XZsQndZz esgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DazUIU2R; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-180940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180940-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c379436si8485699a12.690.2024.05.16.04.27.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:27:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DazUIU2R; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-180940-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180940-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 93FE01F2328C for ; Thu, 16 May 2024 11:27:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B04CE1459FF; Thu, 16 May 2024 11:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DazUIU2R" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7704B1459E7; Thu, 16 May 2024 11:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715858852; cv=none; b=TCqacHq6oYveFSEUlQhjOH7QYOiboX9CCVn2AFOS9MFRqe6dPqLC0uzR0Ro5ICdApYkZh/uK8P0ELZeL3fYe8AlQrpRwQnovmsbepERk3Ko9J+ieoP7BWjx3/gGvumnEXccfBPxiyuvewK8g1Fqc6LSWPZzoSH3Z76//CVcKg/4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715858852; c=relaxed/simple; bh=XWllrDJgXCsAZy9Z5sDYfrb6ed2DyF9I1Pdx9ZRRR5A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tJNZBe533gsuE5zK6DyAZQPb5jfhofPrdxaW6p7aInruPJb/OrqW9Q2qSCUIS4oSDSYhr7zGpzBaS/pumOwzQSU6frnQtP0Sd3xVkfrPnpRsP/eAuSbi1QpOe4nnI1qUVxq4k6s0KBwPGHntBwICsg1mp/8f/WgEwGJF2YWFmKk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=DazUIU2R; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2F16227C; Thu, 16 May 2024 13:27:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1715858840; bh=XWllrDJgXCsAZy9Z5sDYfrb6ed2DyF9I1Pdx9ZRRR5A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DazUIU2RgiGQFEFJXxUSK4kgQ7916AjDz6UDMMDf0sUg66jj5Ief2/k3l4SiOJY1T rnHjgLlRS6wvNnIMFzrdrSkJHjaCdyXVUCwUf8P5s0pkAOp2ewDQr3QjnyAWqL8z+l 1Zj0EfYQsxWsbAn5eGUALpLIoiKGKibN5/TJpyPQ= Date: Thu, 16 May 2024 14:27:20 +0300 From: Laurent Pinchart To: nicolas.dufresne@collabora.corp-partner.google.com Cc: Maxime Ripard , Bryan O'Donoghue , Dmitry Baryshkov , Hans de Goede , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , Christian =?utf-8?B?S8O2bmln?= , Lennart Poettering , Robert Mader , Sebastien Bacher , Linux Media Mailing List , "dri-devel@lists.freedesktop.org" , linaro-mm-sig@lists.linaro.org, Linux Kernel Mailing List , Milan Zamazal , Andrey Konovalov Subject: Re: Safety of opening up /dev/dma_heap/* to physically present users (udev uaccess tag) ? Message-ID: <20240516112720.GA12714@pendragon.ideasonboard.com> References: <20240507183613.GB20390@pendragon.ideasonboard.com> <4f59a9d78662831123cc7e560218fa422e1c5eca.camel@collabora.com> <20240513-heretic-didactic-newt-1d6daf@penduick> <20240513083417.GA18630@pendragon.ideasonboard.com> <20240514204223.GN32013@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Nicolas, On Wed, May 15, 2024 at 01:43:58PM -0400, nicolas.dufresne@collabora.corp-partner.google.com wrote: > Le mardi 14 mai 2024 à 23:42 +0300, Laurent Pinchart a écrit : > > > You'll hit the same limitation as we hit in GStreamer, which is that KMS driver > > > only offer allocation for render buffers and most of them are missing allocators > > > for YUV buffers, even though they can import in these formats. (kms allocators, > > > except dumb, which has other issues, are format aware). > > > > My experience on Arm platforms is that the KMS drivers offer allocation > > for scanout buffers, not render buffers, and mostly using the dumb > > allocator API. If the KMS device can scan out YUV natively, YUV buffer > > allocation should be supported. Am I missing something here ? > > There is two APIs, Dumb is the legacy allocation API, only used by display Is it legacy only ? I understand the dumb buffers API to be officially supported, to allocate scanout buffers suitable for software rendering. > drivers indeed, and the API does not include a pixel format or a modifier. The > allocation of YUV buffer has been made through a small hack, > > bpp = number of bits per component (of luma plane if multiple planes) > width = width > height = height * X > > Where X will vary, "3 / 2" is used for 420 subsampling, "2" for 422 and "3" for > 444. It is far from idea, requires deep knowledge of each formats in the > application I'm not sure I see that as an issue, but our experiences and uses cases may vary :-) > and cannot allocate each planes seperatly. For semi-planar or planar formats, unless I'm mistaken, you can either allocate a single buffer and use it with appropriate offsets when constructing your framebuffer (with DRM_IOCTL_MODE_ADDFB2), or allocate one buffer per plane. > The second is to use the driver specific allocation API. This is then abstracted > by GBM. This allows allocating render buffers with notably modifiers and/or use > cases. But no support for YUV formats or multi-planar formats. GBM is the way to go for render buffers indeed. It has been designed with only graphics buffer management use cases in mind, so it's unfortunately not an option as a generic allocator, at least in its current form. -- Regards, Laurent Pinchart