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

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

Issue 804353003: Revert of Refactor Vaapi video decoder/encoder in preparation of Freon support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « content/common/gpu/media/rendering_helper.h ('k') | content/common/gpu/media/va.sigs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4e9b60caffd5f1254efdfa8f6f20cf16bf50129a..fcd0307f2e6810b7995b6f33c5c24730028c52c5 100644
--- a/content/common/gpu/media/rendering_helper.cc
+++ b/content/common/gpu/media/rendering_helper.cc
@@ -19,6 +19,8 @@
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface.h"
+#include "ui/gl/gl_surface_egl.h"
+#include "ui/gl/gl_surface_glx.h"
#if defined(OS_WIN)
#include <windows.h>
@@ -28,11 +30,9 @@
#include "ui/gfx/x/x11_types.h"
#endif
-#if defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
-#include "ui/gl/gl_surface_glx.h"
+#if !defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY)
#define GL_VARIANT_GLX 1
#else
-#include "ui/gl/gl_surface_egl.h"
#define GL_VARIANT_EGL 1
#endif
@@ -127,14 +127,16 @@
message_loop_ = base::MessageLoop::current();
#if defined(OS_WIN)
+ screen_size_ =
+ gfx::Size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
window_ = CreateWindowEx(0,
L"Static",
L"VideoDecodeAcceleratorTest",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0,
0,
- GetSystemMetrics(SM_CXSCREEN),
- GetSystemMetrics(SM_CYSCREEN),
+ screen_size_.width(),
+ screen_size_.height(),
NULL,
NULL,
NULL,
@@ -142,6 +144,7 @@
#elif defined(USE_X11)
Display* display = gfx::GetXDisplay();
Screen* screen = DefaultScreenOfDisplay(display);
+ screen_size_ = gfx::Size(XWidthOfScreen(screen), XHeightOfScreen(screen));
CHECK(display);
@@ -156,8 +159,8 @@
DefaultRootWindow(display),
0,
0,
- XWidthOfScreen(screen),
- XHeightOfScreen(screen),
+ screen_size_.width(),
+ screen_size_.height(),
0 /* border width */,
depth,
CopyFromParent /* class */,
@@ -173,11 +176,9 @@
CHECK(window_ != gfx::kNullAcceleratedWidget);
gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_);
- screen_size_ = gl_surface_->GetSize();
-
gl_context_ = gfx::GLContext::CreateGLContext(
NULL, gl_surface_.get(), gfx::PreferIntegratedGpu);
- CHECK(gl_context_->MakeCurrent(gl_surface_.get()));
+ gl_context_->MakeCurrent(gl_surface_.get());
CHECK_GT(params.window_sizes.size(), 0U);
videos_.resize(params.window_sizes.size());
@@ -303,16 +304,14 @@
glEnableVertexAttribArray(tc_location);
glVertexAttribPointer(tc_location, 2, GL_FLOAT, GL_FALSE, 0, kTextureCoords);
- if (frame_duration_ != base::TimeDelta()) {
- int warm_up_iterations = params.warm_up_iterations;
- WarmUpRendering(warm_up_iterations);
- }
+ if (frame_duration_ != base::TimeDelta())
+ WarmUpRendering(params.warm_up_iterations);
// It's safe to use Unretained here since |rendering_thread_| will be stopped
// in VideoDecodeAcceleratorTest.TearDown(), while the |rendering_helper_| is
// a member of that class. (See video_decode_accelerator_unittest.cc.)
gfx::VSyncProvider* vsync_provider = gl_surface_->GetVSyncProvider();
- if (vsync_provider && frame_duration_ != base::TimeDelta())
+ if (vsync_provider)
vsync_provider->GetVSyncParameters(base::Bind(
&RenderingHelper::UpdateVSyncParameters, base::Unretained(this), done));
else
@@ -324,7 +323,7 @@
// 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]());
+ scoped_ptr<GLubyte[]> emptyData(new GLubyte[screen_size_.GetArea() * 2]);
glGenTextures(1, &texture_id);
glBindTexture(GL_TEXTURE_2D, texture_id);
glTexImage2D(GL_TEXTURE_2D,
@@ -468,11 +467,7 @@
CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
}
-scoped_refptr<gfx::GLContext> RenderingHelper::GetGLContext() {
- return gl_context_;
-}
-
-void* RenderingHelper::GetGLContextHandle() {
+void* RenderingHelper::GetGLContext() {
return gl_context_->GetHandle();
}
@@ -494,7 +489,7 @@
#if defined(OS_WIN)
if (window_)
DestroyWindow(window_);
-#elif defined(USE_X11)
+#else
// Destroy resources acquired in Initialize, in reverse-acquisition order.
if (window_) {
CHECK(XUnmapWindow(gfx::GetXDisplay(), window_));
« no previous file with comments | « content/common/gpu/media/rendering_helper.h ('k') | content/common/gpu/media/va.sigs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698