Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4601866imm; Tue, 7 Aug 2018 04:27:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc9GSWd9Eb8WYIe/WkW2hr6OKP2bGcOALWJRRZkWkYZfGLGpoWPWQ2QH8tEhXwls8ULgFFx X-Received: by 2002:a17:902:8486:: with SMTP id c6-v6mr17610163plo.105.1533641275058; Tue, 07 Aug 2018 04:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533641275; cv=none; d=google.com; s=arc-20160816; b=XuQt1Lzm3/OfCLCzmGXDLhLIgiN6gRaDhE6FfX9HM8yOBz542n/4sXvHSj42x/3B8T I7eSLN1+q8+goWkVzklVdDR+BV5h4tCdEr22L4rIfWiX9pzMkEmtDinBRkBi+3609TzI 4JQb/feMgDIbf6t2LQb1/jC1RXomqxbvYHwAKIfx8fCtLKP/aLiDB8vCwptu/44doksO uC3PVsxxbhFRpHOYDeKpGJxg/oQZjX9tQwCpg3KXgyOzerLxxNgHo5MesxDRWZDvyp4u O9MB1u9AGfQ8xM2ZqGLMfl+dYkl+uzKdiM+6pDarSJnVNDTodl6DqFzDi4xUABH0NNco RhiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=JfFDy50f8k+rF9zVUA29SlVOmGYP2ZMLDAJ5Z5F3E/A=; b=DduIOngTn9Vhp3RKPUy0YERnVYm/K98l2ZYP1tauHjURREvFCbNS6w089qToKUkTSy TDwFICXfrVJP12v8YpihxvDOXVllf0MfLZ9fKRYXZLRgaVC/CoXGx6GNAaMRcA67BCgC 6CZE52Vz/Wa53x6pXMvG+2uq3sLElxEqIcSVWFr5WZmR/3kgpJZOUCmpLhx1ug8/Iw44 d6UsuE+iPseSo3hr7K75k/aywuyssiFWR7n4tP1opLfXLG5GCDsyodcHzZsW239NGxq7 btXj+gi6rAb3PRb9Z39BRFWt6zDjJ9R/Ni5dGBAaatoqaiMa1Zkaml1APoS3o+a+lJri IQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cTILfX72; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si1215735pfc.352.2018.08.07.04.27.40; Tue, 07 Aug 2018 04:27:55 -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=@gmail.com header.s=20161025 header.b=cTILfX72; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731608AbeHGNPk (ORCPT + 99 others); Tue, 7 Aug 2018 09:15:40 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52139 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbeHGNPj (ORCPT ); Tue, 7 Aug 2018 09:15:39 -0400 Received: by mail-wm0-f68.google.com with SMTP id y2-v6so16980525wma.1 for ; Tue, 07 Aug 2018 04:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JfFDy50f8k+rF9zVUA29SlVOmGYP2ZMLDAJ5Z5F3E/A=; b=cTILfX72N0JH+JxTDN3V3MWYa9mYF5ieWt+LtvQJeF0yLHRULWOVq1T8kjeTT8Q6oq okJAJWBAySP+U+gTRHPKOnLg9HiFJVYeq1dVC0KnrGNBB72/3QXQ4Q3zuaNySd2THKtm +xfLCs2dtQbhCo84qD3yzOxdoX5iTx1MqanIXb/T5Jap/PcAdHzR4yRQMoEr1uQbuYL/ phNqvckDwFlJZPg+hiBC9C+JV1SaQ4Xj6vzsm4Vglfk2Y5lzwHrJpN/KWfzD5Uo64QEG Kp6pxYlGjJ0Gh20jq3VtXQ0Om3creKjViLfTgV9ogYLAmPGld+DDuPXtm+N1tEqubR0q bYqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JfFDy50f8k+rF9zVUA29SlVOmGYP2ZMLDAJ5Z5F3E/A=; b=HIDC7BHQ6tT53VmAXme0uKL/HzPe98hlXe0tN4VZ2PU+eDENYa6uR7tM5/IEONAfLi pkOAGtD++UJdsWuUNYDBF2cFdJYw3qIhuGe+p8Bmddklb8zPaWDmCw/k7ZS+aibO7XUh UQPqpdcv6zLOT1zmZTJqHs0UqN1G5iT7q3yPtnpMhzb0QUQu9FS6Y/7ASB1C5En3QWhy fxMA+xhVVLmEo6Y4NK4Ybm/041i3nfHksMTKuP3BrliPBfSBPI56RPgtNkQ2NUBX0B0g 3Yjg61zB4G1b74novoYMfbVseuPhVwGOp5Vx5RaKMzwFHsZEOnL/OYCNDsmNr0hReknW R44A== X-Gm-Message-State: AOUpUlGqatJytqsonn2P6LUfRuBBkCbcSyMyPoTLMSg8hB5WS2Z57opO 0pvr8eoqJ9dX22JVO3eHXdemzacmyFfjM41wzBs= X-Received: by 2002:a1c:e595:: with SMTP id c143-v6mr1396927wmh.85.1533639711543; Tue, 07 Aug 2018 04:01:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:178a:0:0:0:0:0 with HTTP; Tue, 7 Aug 2018 04:01:50 -0700 (PDT) In-Reply-To: <20180803195025.GO20303@art_vandelay> References: <20180724082213.25677-1-robert.foss@collabora.com> <20180803195025.GO20303@art_vandelay> From: Emil Velikov Date: Tue, 7 Aug 2018 12:01:50 +0100 Message-ID: Subject: Re: [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes To: Sean Paul Cc: Martin Fuzzey , Robert Foss , David Airlie , Brian Paul , ML dri-devel , Eric Engestrom , Gustavo Padovan , "Linux-Kernel@Vger. Kernel. Org" , Maarten Lankhorst , Nicolas Norvez , Rob Herring , Tomasz Figa , Tomeu Vizoso Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3 August 2018 at 20:50, Sean Paul wrote: > On Fri, Aug 03, 2018 at 06:03:50PM +0100, Emil Velikov wrote: >> On 3 August 2018 at 16:06, Martin Fuzzey wrote: >> > Hi Emil, >> > >> > On 03/08/18 14:35, Emil Velikov wrote: >> >> >> >> Hi Martin, >> >> >> >> On 1 August 2018 at 15:24, Martin Fuzzey >> >> wrote: >> >> >> >> Let's start with the not-so obvious question: >> >> Why does one open the imx as render node? >> >> >> >> Of the top of my head: >> >> There is nothing in egl/android that should require an authenticated >> >> device. >> >> Hence, using a card node should be fine - the etnaviv code opens the >> >> render node it needs. >> > >> > >> > Yes, the problem is not in egl/android but in the scanout buffer allocation >> > code. >> > >> > etnaviv opens the render node on the *GPU* (for submitting GPU commands), >> > that part is fine. >> > >> > But scanout buffers need to be allocated from imx-drm not etnaviv. >> > >> > This done by renderonly_create_kms_dumb_buffer_for_resource() >> > [src/gallium/auxiliary/renderonly/renderonly.c] >> > Which uses DRM_IOCTL_MODE_CREATE_DUMB followed by >> > DRM_IOCTL_PRIME_FD_TO_HANDLE >> > on the "kms_fd" (probably poorly named because it's not actually used for >> > modesetting) >> > see imx_drm_screen_create()[ src/gallium/winsys/imx/drm/imx_drm_winsys.c] >> > >> > >> > If the card node is used DRM_IOCTL_MODE_CREATE_DUMB works but >> > DRM_IOCTL_PRIME_FD_TO_HANDLE fails, because the permissions are >> > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW >> > >> Right I missed the DRM_AUTH, in the fd <> handle IOCTLs. >> So in order for things to work, we'd need to either: >> - allow dumb buffers for render nodes, or >> - drop the DRM_AUTH for fd <> handle imports >> >> Pointing an alternative solution, for kernel developers to analyse and >> make a decision. >> >> > >> > In android 8.1 the hardware composer runs in a seperate process and it has >> > to use the card node and be drm master (to use the KMS API), >> > therefore, when the surface flinger calls >> > renderonly_create_kms_dumb_buffer_for_resource() it is not authenticated. >> > >> > Making surface flinger use a render node fixes the problem for >> > DRM_IOCTL_PRIME_FD_TO_HANDLE (because that already has DRM_RENDER_ALLOW), >> > but DRM_IOCTL_MODE_CREATE_DUMB now fails without the patch. >> > >> > >> > This probably worked in previous versions of Android where surface flinger >> > and hwc were all in the same process. >> > >> There has been varying hacks for Android through the years. Bringing >> details into the discussion will result in a significant diversion. >> Something we could avoid, for the time being ;-) > > Did someone say diversion?!? The way this was handled prior to using > render/control nodes in drm_hwc/[drm/gbm]_gralloc is that all modesetting was > done via gralloc which was master. The hwc implementation was basically a proxy > backchanneling all of the work to gralloc. > > Anyways, we probably don't want to go back there. > Now that we got the diversion out of the way, any input on my proposal to drop the DRM_AUTH for fd <> imports. Am I missing something pretty obvious that makes the idea a no-go? Thanks Emil