Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp578282imm; Fri, 3 Aug 2018 08:07:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd2NP+8Z+tNqB2+3YtlmFpdilnrNYlS1H45do1pgCEq9iU6OkveaSaATU0r6oOZkgESwN+T X-Received: by 2002:a62:1647:: with SMTP id 68-v6mr4974245pfw.6.1533308855783; Fri, 03 Aug 2018 08:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533308855; cv=none; d=google.com; s=arc-20160816; b=d5FbqUnscHj7bS5f+2CePLtqFWEz5ga9T2RAfvaO4NtSDnCWq/7xIdYfSAI+1qNQ4h 8P5JK2liJZBJjrNwe3R2BdCW4ADQ4F4L7As98cw2xggXI/GxayUKeelc/5Lnuc1hDjGv AlRQPva3tj490czzZaoHmZBdDC8dcz0kU5yZPXQHFHGW+WF908FuNzhvGgO0lnF2ftaf MXRxr/HvFkFEa1LbGenwov7acdUyapWSV3oI5hOHe8s13WG8Gtrcuospzdyt6L4WjJvq Kgo/2IAY145GMFAmGmu8AQslMgDch5bkOJeBKMJ/Slahkq3Nf6qjFk9rm+klcWZv/jzX RVVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=XIyeTbKGMPJqb9N+akrt6JNyr01K5RyKHQ80SQ9fQXY=; b=JWTuF6VMWRFhOGShZskCg1BJxR2yJxz/98IrmOnwMTxfNB607l8YC43vUyq3qk8Ohq l2glcmCuSqa5gP9aCx9Slrx4GB+ViB5vb+BRvUFZ3dfHucZXlXZaP4SshxJEBwGfV7Rd 2FEcB4W+OUoWNLSAPrreog+Fi+eaZeElKILS/KMbJPQAJwGUsx+9Q8o+/wR+6rc49Kyl kbBcm7MLwZiKJethwJ7cPB6gu+OqQnN6IqQighAKnHpqJmZ8V3Z2gAJDVP0sCR7WpQWq SeWoivOjG2cpes3mysPY80HysbBShQnWUGLBNo9INcOx10BGZC9r2ZjImO36XdGUsZXS POgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flowbird.group header.s=google header.b=GAe+crku; 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=NONE dis=NONE) header.from=flowbird.group Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65-v6si4967265pgc.524.2018.08.03.08.07.20; Fri, 03 Aug 2018 08:07:35 -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=@flowbird.group header.s=google header.b=GAe+crku; 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=NONE dis=NONE) header.from=flowbird.group Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732433AbeHCRDN (ORCPT + 99 others); Fri, 3 Aug 2018 13:03:13 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52576 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732205AbeHCRDM (ORCPT ); Fri, 3 Aug 2018 13:03:12 -0400 Received: by mail-wm0-f68.google.com with SMTP id o11-v6so6582792wmh.2 for ; Fri, 03 Aug 2018 08:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flowbird.group; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=XIyeTbKGMPJqb9N+akrt6JNyr01K5RyKHQ80SQ9fQXY=; b=GAe+crkuGsX9YrDjCdE+OD2kQOlLEbSXtslLTe+VpYb6RuYUlCFiyKDdGjYJbuA+Sj D/SCZfLuxMP6IsEv7yiafUPZo6OzXk9RpjGdldL2jucUfRIh3RsUWgi4wWtC0yDKOtaF cejf4ETJwuB0GqG+HIwjoQ0hXVKGy8hx9Pol8H12zyD7uFVr4gBFxJklgvo4TtqC6sui Qz/WwitRW0ePQFhvqKql57TjM0swxn/xPi3Dzg/jW9aGgPGff8WZUgKDES2cmhMihSbc +1ImrfOVOXewhitoJDExwsliqVp3+lX9LJH8MxB+LOQGsUakjpkOY4ku9N1Ay7QHq5sD j4gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=XIyeTbKGMPJqb9N+akrt6JNyr01K5RyKHQ80SQ9fQXY=; b=UHsdAEMpAOBgqQ7JeIFpitA8uZhKrrVb+TxnuKQcz8ZZsLXUr+tnkDtPXPRU7Oz/NI zg9syMC/XVFZnVj6GJliLguifzDqqpTOamv16DvojBPI1YcRSBf2/n8ngDT2JwOynK89 0LIdh3QwZdC5e9XQxyUvjFI+yBy36r7UU5lbImtnt4ve1IH+pNjLQXqkrz8dULg2nv08 xnuyRgLKv0UdLf/SRAfst2a7lJ/6Dct5GyXWBo+tEYjnJMkDyq4focxyyAYpdij984lg 7kdaLyxoAbWWtHk3uOVsw3vewrBOgdhcQAKw9Y/CQfIC1xqGZmFVJbCgrMdOWx3eA4qJ p/nQ== X-Gm-Message-State: AOUpUlF5ywpr+ykkmNJee9IUCql9Zv+1RnSD1sJXmRD0g54lqTcT45mR GMBOfv0CM1ejGI6Y0V4YgaO2Yw== X-Received: by 2002:a7b:c0d5:: with SMTP id s21-v6mr4996993wmh.106.1533308787850; Fri, 03 Aug 2018 08:06:27 -0700 (PDT) Received: from [10.32.51.159] ([185.149.63.251]) by smtp.gmail.com with ESMTPSA id m2-v6sm3494345wrw.76.2018.08.03.08.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 08:06:26 -0700 (PDT) Subject: Re: [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes To: Emil Velikov Cc: Robert Foss , David Airlie , Brian Paul , ML dri-devel , Eric Engestrom , Gustavo Padovan , "Linux-Kernel@Vger. Kernel. Org" , Maarten Lankhorst , Nicolas Norvez , Rob Herring , Sean Paul , Tomasz Figa , Tomeu Vizoso References: <20180724082213.25677-1-robert.foss@collabora.com> From: Martin Fuzzey Message-ID: Date: Fri, 3 Aug 2018 17:06:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: fr Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. Regards, Martin