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

Unified Diff: content/common/gpu/media/rendering_helper.cc

Issue 583503002: rendering_helper - Warm up the rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and nit Created 6 years, 2 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
Index: content/common/gpu/media/rendering_helper.cc
diff --git a/content/common/gpu/media/rendering_helper.cc b/content/common/gpu/media/rendering_helper.cc
index 6693f5f07dd5a2cb2b983ea5d289d1a1dc7b835c..37e7d92b0ddc2c8f00b39d426e5d3254cc735121 100644
--- a/content/common/gpu/media/rendering_helper.cc
+++ b/content/common/gpu/media/rendering_helper.cc
@@ -58,7 +58,9 @@ static void CreateShader(GLuint program,
namespace content {
-RenderingHelperParams::RenderingHelperParams() {}
+RenderingHelperParams::RenderingHelperParams()
+ : rendering_fps(0), warm_up_iterations(0), render_as_thumbnails(false) {
+}
RenderingHelperParams::~RenderingHelperParams() {}
@@ -302,9 +304,36 @@ void RenderingHelper::Initialize(const RenderingHelperParams& params,
glEnableVertexAttribArray(tc_location);
glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords);
+ if (frame_duration_ != base::TimeDelta())
+ WarmUpRendering(params.warm_up_iterations);
+
done->Signal();
}
+// The rendering for the first few frames is slow (e.g., 100ms on Peach Pit).
+// This affects the numbers measured in the performance test. We try to render
+// several frames here to warm up the rendering.
+void RenderingHelper::WarmUpRendering(int warm_up_iterations) {
+ unsigned int texture_id;
+ scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]);
+ glGenTextures(1, &texture_id);
+ glBindTexture(GL_TEXTURE_2D, texture_id);
+ glTexImage2D(GL_TEXTURE_2D,
+ 0,
+ GL_RGB,
+ screen_size_.width(),
+ screen_size_.height(),
+ 0,
+ GL_RGB,
+ GL_UNSIGNED_SHORT_5_6_5,
+ emptyData.get());
+ for (int i = 0; i < warm_up_iterations; ++i) {
+ RenderTexture(GL_TEXTURE_2D, texture_id);
+ gl_surface_->SwapBuffers();
+ }
+ glDeleteTextures(1, &texture_id);
+}
+
void RenderingHelper::UnInitialize(base::WaitableEvent* done) {
CHECK_EQ(base::MessageLoop::current(), message_loop_);
« no previous file with comments | « content/common/gpu/media/rendering_helper.h ('k') | content/common/gpu/media/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698