public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Fuzzey <martin.fuzzey@flowbird.group>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Robert Foss <robert.foss@collabora.com>,
	David Airlie <airlied@linux.ie>, Brian Paul <brianp@vmware.com>,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Eric Engestrom <eric.engestrom@intel.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Nicolas Norvez <norvez@chromium.org>,
	Rob Herring <robh@kernel.org>, Sean Paul <seanpaul@chromium.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>
Subject: Re: [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes
Date: Fri, 3 Aug 2018 17:06:25 +0200	[thread overview]
Message-ID: <c05f1d94-bf9e-cf9b-e575-dc220b9ca163@flowbird.group> (raw)
In-Reply-To: <CACvgo53h=8q-xuJBPP1T2JWkb7SffXas94=moS1x76=BejyVJA@mail.gmail.com>

Hi Emil,

On 03/08/18 14:35, Emil Velikov wrote:
> Hi Martin,
>
> On 1 August 2018 at 15:24, Martin Fuzzey <martin.fuzzey@flowbird.group> 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



  reply	other threads:[~2018-08-03 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24  8:22 [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes Robert Foss
2018-08-01 14:24 ` Martin Fuzzey
2018-08-03 12:35   ` Emil Velikov
2018-08-03 15:06     ` Martin Fuzzey [this message]
2018-08-03 17:03       ` Emil Velikov
2018-08-03 19:50         ` Sean Paul
2018-08-06 19:05           ` Rob Herring
2018-08-07  9:18             ` Martin Fuzzey
2018-08-07 11:01           ` Emil Velikov
2018-08-07 12:28             ` Daniel Vetter
2018-08-07 13:26               ` Emil Velikov
2018-08-03 12:25 ` Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c05f1d94-bf9e-cf9b-e575-dc220b9ca163@flowbird.group \
    --to=martin.fuzzey@flowbird.group \
    --cc=airlied@linux.ie \
    --cc=brianp@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=eric.engestrom@intel.com \
    --cc=gustavo@padovan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=norvez@chromium.org \
    --cc=robert.foss@collabora.com \
    --cc=robh@kernel.org \
    --cc=seanpaul@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox