mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
gpu_display: android: rename ANativeWindow struct
... to reflect changes from aosp/3127803 where an internal struct is now used to allow for updates to the underlying ANativeWindow when the viewer app is stopped/resumed. Bug: b/334903567 Test: presubmit Change-Id: I96e258e864e2265a66e253af400afba9e5c50073 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5637775 Reviewed-by: Jiyong Park <jiyong@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Jason Macnak <natsu@google.com>
This commit is contained in:
parent
5260a5ebe3
commit
35d59da127
2 changed files with 17 additions and 11 deletions
|
@ -35,7 +35,7 @@ pub(crate) struct AndroidDisplayContext {
|
|||
|
||||
// Opaque blob
|
||||
#[repr(C)]
|
||||
pub(crate) struct ANativeWindow {
|
||||
pub(crate) struct AndroidDisplaySurface {
|
||||
_data: [u8; 0],
|
||||
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
|
||||
}
|
||||
|
@ -79,11 +79,14 @@ extern "C" {
|
|||
width: u32,
|
||||
height: u32,
|
||||
for_cursor: bool,
|
||||
) -> *mut ANativeWindow;
|
||||
) -> *mut AndroidDisplaySurface;
|
||||
|
||||
/// Destroys the Android surface created from `create_android_surface`.
|
||||
#[allow(dead_code)]
|
||||
fn destroy_android_surface(ctx: *mut AndroidDisplayContext, surface: *mut ANativeWindow);
|
||||
fn destroy_android_surface(
|
||||
ctx: *mut AndroidDisplayContext,
|
||||
surface: *mut AndroidDisplaySurface,
|
||||
);
|
||||
|
||||
/// Obtains one buffer from the given Android Surface. The information about the buffer (buffer
|
||||
/// address, size, stride, etc) is reported via the `ANativeWindow_Buffer` struct. It shouldn't
|
||||
|
@ -94,7 +97,7 @@ extern "C" {
|
|||
/// returned), then the caller shouldn't try to read `out_buffer` or use the buffer in any way.
|
||||
fn get_android_surface_buffer(
|
||||
ctx: *mut AndroidDisplayContext,
|
||||
surface: *mut ANativeWindow,
|
||||
surface: *mut AndroidDisplaySurface,
|
||||
out_buffer: *mut ANativeWindow_Buffer,
|
||||
) -> bool;
|
||||
|
||||
|
@ -103,7 +106,10 @@ extern "C" {
|
|||
/// Posts the buffer obtained from `get_android_surface_buffer` to the Android display system
|
||||
/// so that it can be displayed on the screen. Once this is called, the caller shouldn't use
|
||||
/// the buffer any more.
|
||||
fn post_android_surface_buffer(ctx: *mut AndroidDisplayContext, surface: *mut ANativeWindow);
|
||||
fn post_android_surface_buffer(
|
||||
ctx: *mut AndroidDisplayContext,
|
||||
surface: *mut AndroidDisplaySurface,
|
||||
);
|
||||
}
|
||||
|
||||
unsafe extern "C" fn error_callback(message: *const c_char) {
|
||||
|
@ -156,7 +162,7 @@ impl From<ANativeWindow_Buffer> for GpuDisplayFramebuffer<'_> {
|
|||
|
||||
struct AndroidSurface {
|
||||
context: Rc<AndroidDisplayContextWrapper>,
|
||||
surface: NonNull<ANativeWindow>,
|
||||
surface: NonNull<AndroidDisplaySurface>,
|
||||
}
|
||||
|
||||
impl GpuDisplaySurface for AndroidSurface {
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
use std::ffi::c_char;
|
||||
|
||||
use crate::gpu_display_android::ANativeWindow;
|
||||
use crate::gpu_display_android::ANativeWindow_Buffer;
|
||||
use crate::gpu_display_android::AndroidDisplayContext;
|
||||
use crate::gpu_display_android::AndroidDisplaySurface;
|
||||
use crate::gpu_display_android::ErrorCallback;
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -34,14 +34,14 @@ extern "C" fn create_android_surface(
|
|||
_width: u32,
|
||||
_height: u32,
|
||||
_for_cursor: bool,
|
||||
) -> *mut ANativeWindow {
|
||||
) -> *mut AndroidDisplaySurface {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn destroy_android_surface(
|
||||
_ctx: *mut AndroidDisplayContext,
|
||||
_surface: *mut ANativeWindow,
|
||||
_surface: *mut AndroidDisplaySurface,
|
||||
) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ extern "C" fn set_android_surface_position(_ctx: *mut AndroidDisplayContext, _x:
|
|||
#[no_mangle]
|
||||
extern "C" fn get_android_surface_buffer(
|
||||
_ctx: *mut AndroidDisplayContext,
|
||||
_surface: *mut ANativeWindow,
|
||||
_surface: *mut AndroidDisplaySurface,
|
||||
_out_buffer: *mut ANativeWindow_Buffer,
|
||||
) -> u32 {
|
||||
unimplemented!();
|
||||
|
@ -63,7 +63,7 @@ extern "C" fn get_android_surface_buffer(
|
|||
#[no_mangle]
|
||||
extern "C" fn post_android_surface_buffer(
|
||||
_ctx: *mut AndroidDisplayContext,
|
||||
_surface: *mut ANativeWindow,
|
||||
_surface: *mut AndroidDisplaySurface,
|
||||
) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue