Closed belveder79 closed 2 days ago
Ok, so I found that there might be something missing.
The actual pointer from the data is stored here: https://github.com/rockchip-linux/mpp/blob/ee946af015c350c926a0fca2f02da8e429f8b079/utils/camera_source.c#L37
However, the MPPBuffer does not have the respective info->ptr set - it is NULL. The function returns the buf, but as soon as you try to get the ptr or do read or access, there is this error from the previous post.
Not sure if it is ok to put it here, but it does the trick: https://github.com/rockchip-linux/mpp/blob/ee946af015c350c926a0fca2f02da8e429f8b079/utils/camera_source.c#L429
This one should read somewhat like:
#include "mpp_buffer_impl.h"
...
MppBuffer camera_frame_to_buf(CamSource *ctx, RK_S32 idx)
{
MppBuffer buf = NULL;
if (idx < 0)
return buf;
buf = ctx->fbuf[idx].buffer;
MppBufferImpl *p = (MppBufferImpl*)buf;
p->info.ptr = ctx->fbuf[idx].start;
if (buf)
mpp_buffer_sync_end(buf);
return buf;
}
and then the buffer can be used as normal.
I did not find that it has any further implications and worked with my UVC camera. @HermanChen please comment if it is a bug and should get a fix...
0001-fix-ext_dma-Refine-mmap-permission-configuration.patch Thank you for your feedback and providing suggestions for modification. In mpp_buffer_get_ptr(), the pointer is obtained through mmap with the file descriptor (fd). The buffer_type of the camera adopts the ext_dma mode, which has some deficiencies in the mmap process. Therefore, modifications have been made. Please apply the patch to verify if the issue is resolved.
Thx a lot for the patch. It works flawlessly now!
are you going to integrate it in the repo? then the issue can be closed...
Yes, sure.
I want to grab the MPPBuffer that comes right from a CamSource and dump it to a file. Unfortunately I can't get around an error related to the memory mapping, but I don't understand why... The code was essentially taken from the encoder test example.
The critical call is this one:
mpp_buffer_get_ptr
The output basically looks like this:
Any hint highly appreciated...
PS: Any of https://github.com/rockchip-linux/mpp/issues/418#issuecomment-1734916224 did not work...