mediatek: get prime fd with drv_bo_get_plane_fd

Instead of calling drmPrimeHandleToFD directly, call drv_bo_get_plane_fd
so that the FD is exported with DRM_RDWR if possible.

When a handle is exported, the drm framework caches the underlying
dma_buf struct, even if all fd references are closed. This means that
the flags from the first export operation end up being the primary flags
for all subsequent export attempts. This change ensures that the O_RDWR
flag is set on the first call, to prevent permission checks in
PlatformSharedMemoryRegion from failing.

BUG=b:151394062
TEST=youtube on arcvm on kukui

Change-Id: I9de7bb67b45b3669704f3487889b10ed62493418
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2101054
Tested-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
1 file changed