<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Robert,<br>
<br>
Latest update: it works!<br>
<br>
Thank you for your help!<br>
<br>
<br>
On 12/07/18 14:45, Robert Foss wrote:<br>
</div>
<blockquote type="cite"
cite="mid:7b3e96ed-5037-9f86-a202-8b9be1216d19@collabora.com">Hey
Martin (& Chris),
<br>
<br>
This has been a re-occuring pain point on devices with multiple
DRM nodes to chose from, but recently I added node probing support
to mesa which lets you avoid hardcoded paths.
<br>
<br>
<a class="moz-txt-link-freetext" href="https://cgit.freedesktop.org/mesa/mesa/commit/?id=c7bb82136b48b99427465ba4fa3ce477cf09e097">https://cgit.freedesktop.org/mesa/mesa/commit/?id=c7bb82136b48b99427465ba4fa3ce477cf09e097</a>
<br>
<br>
</blockquote>
<br>
Yes indeed thank you, I just saw that. It should let me get rid of
the hack below<br>
<br>
<blockquote type="cite"
cite="mid:7b3e96ed-5037-9f86-a202-8b9be1216d19@collabora.com">
<blockquote type="cite">
<br>
I also tried leaving the gbm_gralloc allocation parameter alone
and modifying imx_drm_screen_create() to use /dev/dri/card1 for
.kms_fd with the same result.
<br>
<br>
--- a/src/gallium/winsys/imx/drm/imx_drm_winsys.c
<br>
+++ b/src/gallium/winsys/imx/drm/imx_drm_winsys.c
<br>
struct pipe_screen *imx_drm_screen_create(int fd)
<br>
{
<br>
struct renderonly ro = {
<br>
.create_for_resource =
renderonly_create_kms_dumb_buffer_for_resource,
<br>
- .kms_fd = fd,
<br>
+ //.kms_fd = fd,
<br>
+ .kms_fd = open("/dev/dri/card1", O_RDWR | O_CLOEXEC), //
MF Hack
<br>
.gpu_fd = open("/dev/dri/renderD128", O_RDWR |
O_CLOEXEC)
<br>
};
<br>
<br>
<br>
</blockquote>
Rob Herrings has mentioned that pushing a dev branch for the
gbm_gralloc handle support is on his Todo list.
<br>
But for now there is another branch, which reportedly has been
working better.
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/robherring/gbm_gralloc/commits/handle-rework-v2">https://github.com/robherring/gbm_gralloc/commits/handle-rework-v2</a>
<br>
<br>
</blockquote>
<br>
Yes, just found that this morning too.<br>
<br>
That is the key to getting it to work due to this patch which is on
that branch:<br>
<br>
commit 137cc39aaa57f8c64db3397cd6ec7600a191a88d<br>
Author: Mauro Rossi <a class="moz-txt-link-rfc2396E" href="mailto:issor.oruam@gmail.com"><issor.oruam@gmail.com></a><br>
Date: Fri Jun 29 13:45:10 2018 +0200<br>
<br>
Update usage flag handling for hwc<br>
<br>
Add support for GRALLOC_USAGE_HW_COMPOSER usage flag<br>
mapping it to GBM flags, inspired by minigbm implementation.<br>
<br>
Fixes the artifacts issues with vulkan hal radv with the
following apps<br>
with benefit to all apps using HWC layers:<br>
V1 - GPU Benchmark Pro (Vulkan API)<br>
PPSSPP - PSP emulator<br>
Sascha Willems Vulkan Examples (e.g. Vulkan Gears, Vulkan
Texture)<br>
<br>
Signed-off-by: Mauro Rossi <a class="moz-txt-link-rfc2396E" href="mailto:issor.oruam@gmail.com"><issor.oruam@gmail.com></a><br>
Signed-off-by: Rob Herring <a class="moz-txt-link-rfc2396E" href="mailto:robh@kernel.org"><robh@kernel.org></a><br>
<br>
diff --git a/gralloc_gbm.cpp b/gralloc_gbm.cpp<br>
index 247fba7..cd37f4d 100644<br>
--- a/gralloc_gbm.cpp<br>
+++ b/gralloc_gbm.cpp<br>
@@ -147,6 +147,8 @@ static unsigned int get_pipe_bind(int usage)<br>
bind |= GBM_BO_USE_RENDERING;<br>
if (usage & GRALLOC_USAGE_HW_FB)<br>
bind |= GBM_BO_USE_SCANOUT;<br>
+ if (usage & GRALLOC_USAGE_HW_COMPOSER)<br>
+ bind |= GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;<br>
<br>
return bind;<br>
}<br>
<br>
<br>
Since android tags buffers that will be sent to HWC with
GRALLOC_USAGE_HW_COMPOSER they will now be allocated from imx-drm
rather than etnaviv which solves the import problem.<br>
<br>
That branch also fixes the structure mismatch problem I mentionned
but requires cherry picking this commit from mesa master so that egl
will compile<br>
<br>
commit 3f7bca44d9a9f07eaafc5de850ec65bdd00707b9<br>
Author: Rob Herring <a class="moz-txt-link-rfc2396E" href="mailto:robh@kernel.org"><robh@kernel.org></a><br>
Date: Thu Apr 26 16:02:01 2018 +0200<br>
<br>
egl/android: #ifdef out flink name support<br>
<br>
<br>
So, I now have it all working, at least to the bootanimation (my
boot doesn't go further for the moment, for reasons unrelated to the
graphics stack).<br>
<br>
<br>
The only nasty thing remaining is the DRM permissions hack in the
kernel. <br>
<br>
This is required because the renderonly code uses the imx-drm node
to allocate scanout and hw composer buffers and also to do
drmPrimeHandleToFD() from the graphics allocator process.<br>
<br>
But the same device node is opened by the HWC process and it is HWC
that is DRM master.<br>
<br>
So, without the kernel hack, drmPrimeHandleToFD() for the scanout /
hw composer buffers fails.<br>
<br>
<br>
Ways I can think of to fix this:<br>
<br>
1) Use AUTHMAGIC ? (But I think that's more or less deprecated
today) and it would require communicating the token between HWC and
gralloc<br>
2) Share the fd between gralloc and hwc? Seems to be creating
unwanted coupling.<br>
3) Modify the imx-drm kernel driver to provide a render node and use
that in the renderonly code<br>
<br>
<span style="color: rgb(64, 64, 64); font-family: Lato,
proxima-nova, "Helvetica Neue", Arial, sans-serif;
font-size: 16px; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal; font-weight: 400;
letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(252, 252, 252); text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"></span>#3 looks the best to me at the
moment.<br>
<br>
Regards,<br>
<br>
Martin<br>
<br>
<br>
</body>
</html>