Dmabuf + YV12 encoding fails on MTK device |
|||
Issue descriptionI tried to encode YV12 format buffer in DMABUF mode on MTK (hana). The device is crashed. kernel log is attached. The local patches are Chrome: https://chromium-review.googlesource.com/c/chromium/src/+/1341428 Chrome OS: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1319829 tfiga@, could you take a look?
,
Nov 19
The problem seems to be that the .gem_prime_vmap() callback of the Mediatek DRM driver, which we use to allocate the buffers, is not implemented (i.e. NULL pointer), but the drm_gem_dmabuf_vmap() helper assumes that it's always there, so it calls into a NULL function pointer and crashes. Generally the Mediatek DRM driver seems to be implemented with an assumption that kernel CPU access is not needed. Creating such a mapping after the buffer is allocated is generally non-trivial and I'd recommend against doing so. My quick look through the mtk-vcodec drive didn't reveal any real need to have this virtual mapping of source buffers for encoder, so maybe we can just remove the call to vb2_plane_vaddr() and keep .va = 0 for frame buffers and be done with it. The driver is quite complicated and with several layers of abstraction, though, so maybe I missed something. Perhaps one could quickly change the driver as above and do some experiments?
,
Nov 19
hiroh@ did the experiment and it seems to work fine. (Thanks!) This CL should clean up the driver not to use virtual addresses for encoder frame buffers: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1341646
,
Nov 19
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/bab96f53ff882dd56a8b4af502e33bf49d9c5bb3 commit bab96f53ff882dd56a8b4af502e33bf49d9c5bb3 Author: Tomasz Figa <tfiga@chromium.org> Date: Mon Nov 19 19:22:18 2018 CHROMIUM: media: mtk-vcodec: Remove VA from encoder frame buffers The encoder driver has no need to do any CPU access to the source frame buffers. Use a separate structure for holding DMA addresses and sizes without a field for VA for those, so we do not end up introducing any erroneous dereferences of the VAs in the old struct. BUG= chromium:906473 TEST=emerge-hana chromeos-kernel-3_18 (no dereferences of the removed field) Change-Id: I48e59b43a587f87fbb1cdbea2c7357a78a320b80 Signed-off-by: Tomasz Figa <tfiga@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1341646 Reviewed-by: Hirokazu Honda <hiroh@chromium.org> [modify] https://crrev.com/bab96f53ff882dd56a8b4af502e33bf49d9c5bb3/drivers/media/platform/mtk-vcodec/venc_drv_if.h [modify] https://crrev.com/bab96f53ff882dd56a8b4af502e33bf49d9c5bb3/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h [modify] https://crrev.com/bab96f53ff882dd56a8b4af502e33bf49d9c5bb3/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
,
Nov 20
|
|||
►
Sign in to add a comment |
|||
Comment 1 by tfiga@chromium.org
, Nov 19