linux: mount all possible render nodes

Originally, we only mount 1 render node "/dev/dri/renderD128".
However, the working node might not be this one. This CL mounts all
the possible render nodes.

BUG=b:202352463
BUG=b:201738023
TEST=tast run $(DUT) arc.Boot.vm and confirm all render nodes are bound

Change-Id: I10331a1fba724ae2f75a96f59b1a9931e108e213
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3317006
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
This commit is contained in:
Chih-Yu Huang 2021-12-06 14:09:59 +09:00 committed by Commit Bot
parent 4eec83452d
commit d2c2bd1ba3

View file

@ -957,9 +957,19 @@ fn create_video_device(
#[cfg(feature = "libvda")]
// Render node for libvda.
if backend == VideoBackendType::Libvda {
let dev_dri_path = Path::new("/dev/dri/renderD128");
// follow the implementation at:
// https://source.corp.google.com/chromeos_public/src/platform/minigbm/cros_gralloc/cros_gralloc_driver.cc;l=90;bpv=0;cl=c06cc9cccb3cf3c7f9d2aec706c27c34cd6162a0
const DRM_NUM_NODES: u32 = 63;
const DRM_RENDER_NODE_START: u32 = 128;
for offset in 0..DRM_NUM_NODES {
let path_str = format!("/dev/dri/renderD{}", DRM_RENDER_NODE_START + offset);
let dev_dri_path = Path::new(&path_str);
if !dev_dri_path.exists() {
break;
}
jail.mount_bind(dev_dri_path, dev_dri_path, false)?;
}
}
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
{