fix: move tab to new window, black screen (#8016)

* fix: move tab to new window, black screen

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* fix: can remove

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2024-05-11 08:54:17 +08:00 committed by GitHub
parent b6d6a4360f
commit d851bf8b69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 7 deletions

View File

@ -40,7 +40,7 @@ class _PixelbufferTexture {
final ptr = await textureRenderer.getTexturePtr(_textureKey);
platformFFI.registerPixelbufferTexture(sessionId, display, ptr);
debugPrint(
"create pixelbuffer texture: peerId: ${ffi.id} display:$_display, textureId:$id");
"create pixelbuffer texture: peerId: ${ffi.id} display:$_display, textureId:$id, texturePtr:$ptr");
}
});
}

View File

@ -330,11 +330,26 @@ impl VideoRenderer {
fn register_pixelbuffer_texture(&self, display: usize, ptr: usize) {
let mut sessions_lock = self.map_display_sessions.write().unwrap();
if ptr == 0 {
if let Some(info) = sessions_lock.get_mut(&display) {
if info.texture_rgba_ptr != usize::default() {
info.texture_rgba_ptr = usize::default();
}
#[cfg(feature = "vram")]
if info.gpu_output_ptr != usize::default() {
return;
}
}
sessions_lock.remove(&display);
} else {
if let Some(info) = sessions_lock.get_mut(&display) {
if info.texture_rgba_ptr != 0 && info.texture_rgba_ptr != ptr as TextureRgbaPtr {
log::error!("unreachable, texture_rgba_ptr is not null and not equal to ptr");
if info.texture_rgba_ptr != usize::default()
&& info.texture_rgba_ptr != ptr as TextureRgbaPtr
{
log::warn!(
"texture_rgba_ptr is not null and not equal to ptr, replace {} to {}",
info.texture_rgba_ptr,
ptr
);
}
info.texture_rgba_ptr = ptr as _;
info.notify_render_type = None;
@ -359,21 +374,34 @@ impl VideoRenderer {
pub fn register_gpu_output(&self, display: usize, ptr: usize) {
let mut sessions_lock = self.map_display_sessions.write().unwrap();
if ptr == 0 {
if let Some(info) = sessions_lock.get_mut(&display) {
if info.gpu_output_ptr != usize::default() {
info.gpu_output_ptr = usize::default();
}
#[cfg(feature = "flutter_texture_render")]
if info.texture_rgba_ptr != usize::default() {
return;
}
}
sessions_lock.remove(&display);
} else {
if let Some(info) = sessions_lock.get_mut(&display) {
if info.gpu_output_ptr != 0 && info.gpu_output_ptr != ptr {
log::error!("unreachable, gpu_output_ptr is not null and not equal to ptr");
if info.gpu_output_ptr != usize::default() && info.gpu_output_ptr != ptr {
log::error!(
"gpu_output_ptr is not null and not equal to ptr, relace {} to {}",
info.gpu_output_ptr,
ptr
);
}
info.gpu_output_ptr = ptr as _;
info.notify_render_type = None;
} else {
if ptr != 0 {
if ptr != usize::default() {
sessions_lock.insert(
display,
DisplaySessionInfo {
#[cfg(feature = "flutter_texture_render")]
texture_rgba_ptr: 0,
texture_rgba_ptr: usize::default(),
#[cfg(feature = "flutter_texture_render")]
size: (0, 0),
gpu_output_ptr: ptr,