me-cafebabe-aosp-mainline / android_device_virt_virtio-common

0 stars 0 forks source link

About the color issue with crosvm #1

Open Xtr126 opened 3 months ago

Xtr126 commented 3 months ago

When running Android-x86 (Bliss OS) in crosvm, I found that it has the color issue only when libminigbm is not compiled with native DRI backend ( CFLAGS=-DDRV_I915 )

me-cafebabe commented 1 month ago

I915 is the driver for Intel GPU, in crosvm we uses Virtio GPU, do they relate?

Xtr126 commented 1 month ago

I915 is the driver for Intel GPU, in crosvm we uses Virtio GPU, do they relate?

Sorry, I forgot to mention that it is libminigbm on host and not on the guest, rutabaga_gfx/build.rs in crosvm source code builds libminigbm as a static library. So I use CFLAGS=-DDRV_I915 cargo build --features gpu,virgl_renderer,wl-dmabuf --release when building crosvm. And patching third_party/virglrenderer to enable minigbm_allocation:

diff --git a/meson.build b/meson.build
index de6d16b5..26c6816a 100644
--- a/meson.build
+++ b/meson.build
@@ -274,7 +274,10 @@ with_render_server_worker = get_option('render-server-worker')
 render_server_install_dir = get_option('prefix') / get_option('libexecdir')
 if with_venus
    if with_minigbm_allocation
-      gbm_dep = dependency('gbm')
+         gbm_dep = declare_dependency(
+                     dependencies : cc.find_library('minigbm.pie', dirs : [meson.current_build_dir() / '../minigbm']),
+                     include_directories : include_directories('../minigbm'),
+                  )
    endif
    venus_dep = dependency('vulkan')

Patching rutabaga_gfx/build.rs

diff --git a/rutabaga_gfx/build.rs b/rutabaga_gfx/build.rs
index 3acb58ea4..674c8b482 100644
--- a/rutabaga_gfx/build.rs
+++ b/rutabaga_gfx/build.rs
@@ -185,6 +185,9 @@ fn build_and_probe_virglrenderer(out_dir: &Path) -> Result<()> {
         .args(get_meson_cross_args())
         .arg(format!("-Dplatforms={}", platforms.join(",")))
         .arg("-Ddefault_library=static")
+        .arg("-Dminigbm_allocation=true")
+        .arg("-Dvenus=true")
+        .arg("-Dbuildtype=release")
         .arg(out_dir.as_os_str());

     let setup_status = setup.status()?;
@@ -194,6 +197,7 @@ fn build_and_probe_virglrenderer(out_dir: &Path) -> Result<()> {

     let mut compile = Command::new("meson");
     compile
+        .env("CPATH", "../../../../../../third_party")
         .arg("compile")
         .arg("src/virglrenderer")
         .current_dir(out_dir);
me-cafebabe commented 1 month ago

oh, I got it. so, My host has a amdgpu, I specified DRV_AMDGPU instead of DRV_I915, applied your patches, built and ran it, sadly the color still looks the same... Screenshot_20240908_174725

me-cafebabe commented 1 month ago

whoops, my bad, I've ran a older build instead of the new build...

on the new crosvm build, I can't see the window popping up and this appears:

[2024-09-08T09:57:25.364386741+00:00 ERROR devices::virtio::gpu] failed to open display: unsupported by the implementation

UPDATE: I missed "x" in features... After it's booted, it's still looking the same

Xtr126 commented 1 month ago

whoops, my bad, I've ran a older build instead of the new build...

on the new crosvm build, I can't see the window popping up and this appears:

[2024-09-08T09:57:25.364386741+00:00 ERROR devices::virtio::gpu] failed to open display: unsupported by the implementation

UPDATE: I missed "x" in features... After it's booted, it's still looking the same

I only tested wayland display using --wayland-sock=, with X11 the color issue remains unresolved even with the patch. Screenshot_20240908_190550