Commit 5cca218b authored by Weiliang Chen's avatar Weiliang Chen Committed by Commit Bot

viz: Improve Comments Quality for Overlay Code

Follow up on previous CL by improving comments quality.

R=rjkroege

Bug: 979788
Change-Id: I110404464582bdf6490100fb601dda39ee0aca73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023481
Commit-Queue: weiliangc <weiliangc@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736189}
parent e06b5796
...@@ -109,7 +109,7 @@ void OverlayProcessorAndroid::ScheduleOverlays( ...@@ -109,7 +109,7 @@ void OverlayProcessorAndroid::ScheduleOverlays(
void OverlayProcessorAndroid::OverlayPresentationComplete() { void OverlayProcessorAndroid::OverlayPresentationComplete() {
// This is a signal from Display::DidReceiveSwapBuffersAck. We use this to // This is a signal from Display::DidReceiveSwapBuffersAck. We use this to
// help clear locks on resources from old frame. // help clear locks on resources from the old frame.
committed_overlay_locks_.clear(); committed_overlay_locks_.clear();
std::swap(committed_overlay_locks_, pending_overlay_locks_.front()); std::swap(committed_overlay_locks_, pending_overlay_locks_.front());
pending_overlay_locks_.pop_front(); pending_overlay_locks_.pop_front();
......
...@@ -91,7 +91,9 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid ...@@ -91,7 +91,9 @@ class VIZ_SERVICE_EXPORT OverlayProcessorAndroid
using OverlayResourceLock = using OverlayResourceLock =
DisplayResourceProvider::ScopedReadLockSharedImage; DisplayResourceProvider::ScopedReadLockSharedImage;
// Locks for overlays are pending for OverlayPresentationComplete. // Keep locks on overlay resources to keep them alive. Since we don't have
// an exact signal on when the overlays are done presenting, use
// OverlayPresentationComplete as a signal to clear locks from the older frames.
base::circular_deque<std::vector<OverlayResourceLock>> pending_overlay_locks_; base::circular_deque<std::vector<OverlayResourceLock>> pending_overlay_locks_;
// Locks for overlays have been committed. |pending_overlay_locks_| will // Locks for overlays have been committed. |pending_overlay_locks_| will
// be moved to |committed_overlay_locks_| after OverlayPresentationComplete. // be moved to |committed_overlay_locks_| after OverlayPresentationComplete.
......
...@@ -134,18 +134,20 @@ class VIZ_SERVICE_EXPORT OverlayProcessorInterface { ...@@ -134,18 +134,20 @@ class VIZ_SERVICE_EXPORT OverlayProcessorInterface {
// Before the overlay refactor to use OverlayProcessorOnGpu, overlay // Before the overlay refactor to use OverlayProcessorOnGpu, overlay
// candidates are stored inside DirectRenderer. Those overlay candidates are // candidates are stored inside DirectRenderer. Those overlay candidates are
// later sent over to the GPU thread by GLRenderer or SkiaRenderer. This is a // later sent over to the GPU thread by GLRenderer or SkiaRenderer. This
// helper function to take these overlay candidates inside overlay processor // helper function will be called by DirectRenderer to take these overlay
// to avoid sending over DirectRenderer implementation. This is overridden by // candidates inside overlay processor to avoid sending over DirectRenderer
// each platform that is ready to send overlay candidates inside overlay // implementation. This is overridden by each platform that is ready to send
// processo. Must be called before ScheduleOverlays(). // overlay candidates inside |OverlayProcessor|. Must be called before
// ScheduleOverlays().
virtual void TakeOverlayCandidates(CandidateList* candidate_list) {} virtual void TakeOverlayCandidates(CandidateList* candidate_list) {}
// TODO(weiliangc): Make it pure virtual after it is implemented by every // TODO(weiliangc): Make it pure virtual after it is implemented by every
// subclass. // subclass.
virtual void ScheduleOverlays( virtual void ScheduleOverlays(
DisplayResourceProvider* display_resource_provider); DisplayResourceProvider* display_resource_provider);
// This is a signal from Display::DidReceiveSwapBuffersAck. // This is a signal from Display::DidReceiveSwapBuffersAck. This is used as
// approximate signale for when the overlays are presented.
virtual void OverlayPresentationComplete(); virtual void OverlayPresentationComplete();
// These two functions are used by Android SurfaceControl. // These two functions are used by Android SurfaceControl.
......
...@@ -30,16 +30,16 @@ void OverlayProcessorOnGpu::ScheduleOverlays( ...@@ -30,16 +30,16 @@ void OverlayProcessorOnGpu::ScheduleOverlays(
for (auto& overlay : overlay_candidates) { for (auto& overlay : overlay_candidates) {
auto shared_image_overlay = auto shared_image_overlay =
shared_image_representation_factory_->ProduceOverlay(overlay.mailbox); shared_image_representation_factory_->ProduceOverlay(overlay.mailbox);
// When display is re-opened, the first few frames might not have video // When the display is re-opened, the first few frames might not have a video
// resource ready. Possible investigation crbug.com/1023971. // resource ready. Possible investigation crbug.com/1023971.
if (!shared_image_overlay) if (!shared_image_overlay)
continue; continue;
// In current implementation, the BeginReadAccess will ends up calling // In the current implementation, the BeginReadAccess will end up calling
// CodecImage::RenderToOverlay. Currently this code path is only used for // CodecImage::RenderToOverlay. Currently this code path is only used for
// Android Classic video overlay, where update of the overlay plane is // Android Classic video overlay, where update of the overlay plane is
// within media code. Since we are not actually passing an overlay plane to // within the media code. Since we are not actually passing an overlay plane
// the display controller here, we are able to call EndReadAccess directly // to the display controller here, we are able to call EndReadAccess
// after BeginReadAccess. // directly after BeginReadAccess.
shared_image_overlay->NotifyOverlayPromotion( shared_image_overlay->NotifyOverlayPromotion(
true, ToNearestRect(overlay.display_rect)); true, ToNearestRect(overlay.display_rect));
std::unique_ptr<gpu::SharedImageRepresentationOverlay::ScopedReadAccess> std::unique_ptr<gpu::SharedImageRepresentationOverlay::ScopedReadAccess>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment