mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-11 17:40:15 +01:00
Windows: Fix OSR rendering with shared texture enabled (issue #2559)
This commit is contained in:
parent
995dd0ba19
commit
710021be15
@ -81,17 +81,15 @@ class CefCompositorFrameSinkClient
|
|||||||
|
|
||||||
void DidReceiveCompositorFrameAck(
|
void DidReceiveCompositorFrameAck(
|
||||||
const std::vector<viz::ReturnedResource>& resources) override {
|
const std::vector<viz::ReturnedResource>& resources) override {
|
||||||
|
if (render_widget_host_view_) {
|
||||||
|
render_widget_host_view_->OnPresentCompositorFrame();
|
||||||
|
}
|
||||||
forward_->DidReceiveCompositorFrameAck(resources);
|
forward_->DidReceiveCompositorFrameAck(resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnBeginFrame(const viz::BeginFrameArgs& args,
|
void OnBeginFrame(const viz::BeginFrameArgs& args,
|
||||||
const base::flat_map<uint32_t, gfx::PresentationFeedback>&
|
const base::flat_map<uint32_t, gfx::PresentationFeedback>&
|
||||||
feedbacks) override {
|
feedbacks) override {
|
||||||
if (render_widget_host_view_) {
|
|
||||||
for (const auto& pair : feedbacks) {
|
|
||||||
render_widget_host_view_->OnPresentCompositorFrame(pair.first);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
forward_->OnBeginFrame(args, feedbacks);
|
forward_->OnBeginFrame(args, feedbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,8 +583,7 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame(
|
void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame() {
|
||||||
uint32_t presentation_token) {
|
|
||||||
// Is Chromium rendering to a shared texture?
|
// Is Chromium rendering to a shared texture?
|
||||||
void* shared_texture = nullptr;
|
void* shared_texture = nullptr;
|
||||||
ui::Compositor* compositor = GetCompositor();
|
ui::Compositor* compositor = GetCompositor();
|
||||||
@ -606,10 +603,13 @@ void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame(
|
|||||||
// view size for a full redraw.
|
// view size for a full redraw.
|
||||||
base::AutoLock lock_scope(damage_rect_lock_);
|
base::AutoLock lock_scope(damage_rect_lock_);
|
||||||
|
|
||||||
|
// TODO: in the future we need to correlate the presentation
|
||||||
|
// notification with the sequence number from BeginFrame
|
||||||
gfx::Rect damage;
|
gfx::Rect damage;
|
||||||
auto const i = damage_rects_.find(presentation_token);
|
auto const i = damage_rects_.begin();
|
||||||
if (i != damage_rects_.end()) {
|
if (i != damage_rects_.end()) {
|
||||||
damage = i->second;
|
damage = i->second;
|
||||||
|
damage_rects_.erase(i);
|
||||||
} else {
|
} else {
|
||||||
damage = GetViewBounds();
|
damage = GetViewBounds();
|
||||||
}
|
}
|
||||||
@ -623,7 +623,7 @@ void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t presentation_token,
|
void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
||||||
const gfx::Rect& rect) {
|
const gfx::Rect& rect) {
|
||||||
// Associate the given damage rect with the presentation token.
|
// Associate the given damage rect with the presentation token.
|
||||||
// For OnAcceleratedPaint we'll lookup the corresponding damage area based on
|
// For OnAcceleratedPaint we'll lookup the corresponding damage area based on
|
||||||
@ -636,7 +636,7 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t presentation_token,
|
|||||||
while (damage_rects_.size() >= kMaxDamageRects) {
|
while (damage_rects_.size() >= kMaxDamageRects) {
|
||||||
damage_rects_.erase(damage_rects_.begin());
|
damage_rects_.erase(damage_rects_.begin());
|
||||||
}
|
}
|
||||||
damage_rects_[presentation_token] = rect;
|
damage_rects_[sequence] = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||||
@ -700,13 +700,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
|||||||
damage_rect.Intersect(gfx::Rect(frame_size));
|
damage_rect.Intersect(gfx::Rect(frame_size));
|
||||||
|
|
||||||
if (shared_texture) {
|
if (shared_texture) {
|
||||||
// Indicate that we want feedback every frame.
|
AddDamageRect(frame.metadata.begin_frame_ack.sequence_number,
|
||||||
if (!++presentation_token_)
|
damage_rect);
|
||||||
++presentation_token_;
|
|
||||||
|
|
||||||
AddDamageRect(presentation_token_, damage_rect);
|
|
||||||
|
|
||||||
frame.metadata.frame_token = presentation_token_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||||
|
@ -267,7 +267,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OnPresentCompositorFrame(uint32_t presentation_token);
|
void OnPresentCompositorFrame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
|
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
|
||||||
@ -301,7 +301,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
|
|
||||||
viz::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
|
viz::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
|
||||||
|
|
||||||
void AddDamageRect(uint32_t presentation_token, const gfx::Rect& rect);
|
void AddDamageRect(uint32_t sequence, const gfx::Rect& rect);
|
||||||
|
|
||||||
// Applies background color without notifying the RenderWidget about
|
// Applies background color without notifying the RenderWidget about
|
||||||
// opaqueness changes.
|
// opaqueness changes.
|
||||||
@ -394,7 +394,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
bool is_showing_;
|
bool is_showing_;
|
||||||
bool is_destroyed_;
|
bool is_destroyed_;
|
||||||
gfx::Rect popup_position_;
|
gfx::Rect popup_position_;
|
||||||
uint32_t presentation_token_ = 0;
|
|
||||||
base::Lock damage_rect_lock_;
|
base::Lock damage_rect_lock_;
|
||||||
std::map<uint32_t, gfx::Rect> damage_rects_;
|
std::map<uint32_t, gfx::Rect> damage_rects_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user