Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: services/gfx/compositor/backend/gpu_output.h

Issue 2009503003: Mozart: Reduce pipeline depth and unify frame queue. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | services/gfx/compositor/backend/gpu_output.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/backend/gpu_output.h
diff --git a/services/gfx/compositor/backend/gpu_output.h b/services/gfx/compositor/backend/gpu_output.h
index d7fe5f559cefef592824f44c0640c4f11c67efca..74aa3e7527ddbb6a57d802077d655819d1af59aa 100644
--- a/services/gfx/compositor/backend/gpu_output.h
+++ b/services/gfx/compositor/backend/gpu_output.h
@@ -34,22 +34,25 @@ class GpuOutput : public Output, private GpuRasterizer::Callbacks {
void SubmitFrame(const scoped_refptr<RenderFrame>& frame) override;
private:
- struct FrameData : public base::RefCountedThreadSafe<FrameData> {
+ struct FrameData {
+ enum class State {
+ Pending, // initial state waiting for draw to start
+ Drawing, // draw has started
+ Finished // draw has finished
+ };
+
FrameData(const scoped_refptr<RenderFrame>& frame, int64_t submit_time);
+ ~FrameData();
- void Recycle();
+ void ResetDrawState();
const scoped_refptr<RenderFrame> frame;
const int64_t submit_time;
- bool drawn = false; // set when DrawFrame is called
- int64_t draw_time = 0; // 0 if not drawn
- int64_t wait_time = 0; // 0 if not drawn
+ State state = State::Pending;
+ int64_t draw_started_time = 0; // time when drawing began
+ int64_t draw_issued_time = 0; // time when awaiting for finish began
private:
- friend class base::RefCountedThreadSafe<FrameData>;
-
- ~FrameData();
-
DISALLOW_COPY_AND_ASSIGN(FrameData);
};
@@ -86,12 +89,20 @@ class GpuOutput : public Output, private GpuRasterizer::Callbacks {
struct {
std::mutex mutex; // guards all shared state
- // The most recently submitted frame.
- // Only null until the first frame has been submitted.
- scoped_refptr<FrameData> current_frame_data;
-
- // Frames drawn and awaiting completion by the rasterizer.
- std::queue<scoped_refptr<FrameData>> drawn_frames_awaiting_finish;
+ // Queue of frames.
+ //
+ // The head of this queue consists of up to |pipeline_depth| frames
+ // which are drawn and awaiting finish. These frames are popped off
+ // the queue when finished unless the queue would become empty (such
+ // that we always retain the current frame as the tail).
+ //
+ // The tail of this queue is a single frame which is either drawn or
+ // finished and represents the current (most recently submitted)
+ // content.
+ //
+ // The queue is only ever empty until the first frame is submitted.
+ // Subsequently, it always contains at least one frame.
+ std::queue<std::unique_ptr<FrameData>> frames;
// Set to true when the rasterizer is ready to draw.
bool rasterizer_ready = false;
« no previous file with comments | « no previous file | services/gfx/compositor/backend/gpu_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698