Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDispmanx fails with zero-copied MMAL buffer? #386
Comments
|
Everything looks sane in your code, but you are perfectly correct that dispmanx rejects the buffer.
firing every time the dispmanx call is being made. That is a VCHI bulk receive call failing @pelwell Any immediate thoughts? vchiq_bulk_transfer in vchiq_core.c is failing through the |
|
I might be talking rubbish, but why is dispmanx even doing bulk
receive if we're doing zero copy?
…On 29 March 2017 at 10:50, 6by9 ***@***.***> wrote:
Everything looks sane in your code, but you are perfectly correct that
dispmanx rejects the buffer.
Enabling VPU side asserts I see
assert( !success ) failed;
../../../../../applications/vmcs/dispserve/display_server.c::ds_dispmanx_bulk_write
line 1593 rev 50fff83
firing every time the dispmanx call is being made. That is a VCHI bulk
receive call failing
The cause appears to be the bulk transfer aborting, but I've not drilled
down into why.
@pelwell Any immediate thoughts? vchiq_bulk_transfer in vchiq_core.c is
failing through the
else if (bulk_waiter.actual == VCHIQ_BULK_ACTUAL_ABORTED) {
clause on the bulk receive on the VPU side.
Is the transfer going to get upset that source and destination are both in
the reloc heap?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
MMAL is doing zero copy. DispmanX is doing the bulk transfer back the other way. Nothing fundamentally wrong with that as Now there is a potential win by using
instead. However you've then got to manually set up the MMAL buffer headers instead of allowing zero copy and |
|
No, that sounds like a reasonable question. The bulk transmit is failing on the ARM side because the kernel doesn't know how to map the buffer it is given:
That -14 is EFAULT. Contrast it with the ZERO_COPY=0 case:
The buffer pointer in this case is clearly a regular user buffer. What exactly is being sent when ZERO_COPY=1? |
VCSM should be doing the allocation via mmal_vc_shm_alloc (https://github.com/raspberrypi/userland/blob/master/interface/mmal/vc/mmal_vc_shm.c#L145). As the buffer comes back from the VPU, A guess: If the ARM hasn't touched the actual buffers then we haven't called the |
Nope. not that. |
|
It seems that |
I think you're correct there. They are both writing data into an existing DispmanX resource, so they have to copy the pixel data. |
|
Excuse me for wandering from the subject, but I found that since MMAL's |
|
Yes, video_render gives you an alternative route to the same result. Using a MMAL_CONNECTION_T with the tunnelling flag can also pass the buffers between the components without needing any intervention from the ARM at all. |
|
Yes. I want VPU to do alpha blending if possible. |
|
I've just hit this same issue when trying to take a CMA allocation made using V4L2, mmaped into the user process, and then passing that user pointer into VCHIQ as a MMAL buffer.
That looks all valid, but having |
|
Just to clarify, |
|
Yes, bad wording by me. Sorry. They are both set due to I'm trying to find my way through the maze of twisty passages all alike to work out how VCHIQ can get that |
|
@6by9 Any progress? I know there been quite a bit of work in this area. |
|
I have a patch queued that has a chance of solving this, but it's not a case I've specifically tested. |
|
Would you please tell me where the patch is and I'll be able to test it. |
|
I have a long patchset of cleaning up the V4L2 camera driver and adding a V4L2 codec driver. Not ready for a PR yet, but I've pushed it to https://github.com/6by9/linux/tree/rpi-4.14.y-codecs-push2. |
|
Thanks. By the way, what is your final goal of implementing V4L2 multimedia driver though there already is MMAL which works well? |
|
Standards. |
|
Oh, that's great! Please continue rocking! |
|
I've just tried your test app again - no joy. The call doesn't fail anymore, but the data copied is incorrect. |
|
Yeah, I ended up with the same result, and the kernel sometimes crashes when executed the app multiple times |
|
@6by9 Anything happened recently on this? |
|
Sort of. |
It seems that Dispmanx fails with zero-copied MMAL buffer.
Please try with this code:

https://github.com/Terminus-IMRC/dispmanx-fails-with-zero-copied-mmal-buffer
This code gets 128x128 random image from
vc.ril.sourcecomponent and feeds it to dispmanx to display it on screen.If you keep
#define ZERO_COPY 0, it will work.If you change this to
#define ZERO_COPY 1, it will fail with this error:main.c:85: Dispmanx call failed: 0xffffffffI also confirmed this issue with
vc.ril.cameracomponent.Am I wrong in usage of the APIs?
Thanks.