From bb241590382f7feca9d6406bb30fa5e1309ac128 Mon Sep 17 00:00:00 2001 From: Kaiyi Li Date: Sun, 3 Apr 2022 10:14:00 -0700 Subject: [PATCH] gfxstream: fix renderer callbacks definitions Test: launch_cvd --gpu_mode=gfxstream Change-Id: I1cbfdd6107101e966763e6a2c70cdf66cefe216a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3567644 Reviewed-by: Gurchetan Singh Reviewed-by: Daniel Verkamp Tested-by: kokoro Commit-Queue: Kaiyi Li --- rutabaga_gfx/src/gfxstream.rs | 36 +++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/rutabaga_gfx/src/gfxstream.rs b/rutabaga_gfx/src/gfxstream.rs index 286b940e57..06781c6280 100644 --- a/rutabaga_gfx/src/gfxstream.rs +++ b/rutabaga_gfx/src/gfxstream.rs @@ -29,12 +29,35 @@ use crate::rutabaga_utils::*; use data_model::VolatileSlice; +#[repr(C)] +pub struct VirglRendererGlCtxParam { + pub version: c_int, + pub shared: bool, + pub major_ver: c_int, + pub minor_ver: c_int, +} + // In gfxstream, only write_fence is used (for synchronization of commands delivered) #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct GfxstreamRendererCallbacks { +pub struct VirglRendererCallbacks { pub version: c_int, pub write_fence: unsafe extern "C" fn(cookie: *mut c_void, fence: u32), + pub create_gl_context: Option< + unsafe extern "C" fn( + cookie: *mut c_void, + scanout_idx: c_int, + param: *mut VirglRendererGlCtxParam, + ) -> *mut c_void, + >, + pub destroy_gl_context: Option, + pub make_current: Option< + unsafe extern "C" fn(cookie: *mut c_void, scanout_idx: c_int, ctx: *mut c_void) -> c_int, + >, + + pub get_drm_fd: Option c_int>, + pub write_context_fence: + Option, } #[repr(C)] @@ -58,7 +81,7 @@ extern "C" { display_type: u32, renderer_cookie: *mut c_void, renderer_flags: i32, - renderer_callbacks: *mut GfxstreamRendererCallbacks, + renderer_callbacks: *mut VirglRendererCallbacks, gfxstream_callbacks: *mut c_void, ); @@ -200,9 +223,14 @@ impl Drop for GfxstreamContext { } } -const GFXSTREAM_RENDERER_CALLBACKS: &GfxstreamRendererCallbacks = &GfxstreamRendererCallbacks { - version: 1, +const GFXSTREAM_RENDERER_CALLBACKS: &VirglRendererCallbacks = &VirglRendererCallbacks { + version: 3, write_fence, + create_gl_context: None, + destroy_gl_context: None, + make_current: None, + get_drm_fd: None, + write_context_fence: None, }; fn map_func(resource_id: u32) -> ExternalMappingResult<(u64, usize)> {