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

Side by Side Diff: components/viz/display_compositor/gl_helper.h

Issue 2873243002: Move components/display_compositor to components/viz/display_compositor (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_DISPLAY_COMPOSITOR_GL_HELPER_H_ 5 #ifndef COMPONENTS_VIZ_DISPLAY_COMPOSITOR_GL_HELPER_H_
6 #define COMPONENTS_DISPLAY_COMPOSITOR_GL_HELPER_H_ 6 #define COMPONENTS_VIZ_DISPLAY_COMPOSITOR_GL_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/display_compositor/display_compositor_export.h" 13 #include "components/viz/viz_export.h"
14 #include "gpu/command_buffer/client/gles2_interface.h" 14 #include "gpu/command_buffer/client/gles2_interface.h"
15 #include "gpu/command_buffer/common/mailbox_holder.h" 15 #include "gpu/command_buffer/common/mailbox_holder.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
17 17
18 namespace gfx { 18 namespace gfx {
19 class Point; 19 class Point;
20 class Rect; 20 class Rect;
21 class Size; 21 class Size;
22 } 22 }
23 23
24 namespace gpu { 24 namespace gpu {
25 class ContextSupport; 25 class ContextSupport;
26 struct Mailbox; 26 struct Mailbox;
27 } 27 }
28 28
29 class SkRegion; 29 class SkRegion;
30 30
31 namespace display_compositor { 31 namespace viz {
32 32
33 class GLHelperScaling; 33 class GLHelperScaling;
34 34
35 class DISPLAY_COMPOSITOR_EXPORT ScopedGLuint { 35 class VIZ_EXPORT ScopedGLuint {
36 public: 36 public:
37 typedef void (gpu::gles2::GLES2Interface::*GenFunc)(GLsizei n, GLuint* ids); 37 typedef void (gpu::gles2::GLES2Interface::*GenFunc)(GLsizei n, GLuint* ids);
38 typedef void (gpu::gles2::GLES2Interface::*DeleteFunc)(GLsizei n, 38 typedef void (gpu::gles2::GLES2Interface::*DeleteFunc)(GLsizei n,
39 const GLuint* ids); 39 const GLuint* ids);
40 ScopedGLuint(gpu::gles2::GLES2Interface* gl, 40 ScopedGLuint(gpu::gles2::GLES2Interface* gl,
41 GenFunc gen_func, 41 GenFunc gen_func,
42 DeleteFunc delete_func) 42 DeleteFunc delete_func)
43 : gl_(gl), id_(0u), delete_func_(delete_func) { 43 : gl_(gl), id_(0u), delete_func_(delete_func) {
44 (gl_->*gen_func)(1, &id_); 44 (gl_->*gen_func)(1, &id_);
45 } 45 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ScopedTextureBinder(gpu::gles2::GLES2Interface* gl, GLuint id) 127 ScopedTextureBinder(gpu::gles2::GLES2Interface* gl, GLuint id)
128 : ScopedBinder<Target>(gl, id, &gpu::gles2::GLES2Interface::BindTexture) { 128 : ScopedBinder<Target>(gl, id, &gpu::gles2::GLES2Interface::BindTexture) {
129 } 129 }
130 }; 130 };
131 131
132 class ReadbackYUVInterface; 132 class ReadbackYUVInterface;
133 class GLHelperReadbackSupport; 133 class GLHelperReadbackSupport;
134 134
135 // Provides higher level operations on top of the gpu::gles2::GLES2Interface 135 // Provides higher level operations on top of the gpu::gles2::GLES2Interface
136 // interfaces. 136 // interfaces.
137 class DISPLAY_COMPOSITOR_EXPORT GLHelper { 137 class VIZ_EXPORT GLHelper {
138 public: 138 public:
139 GLHelper(gpu::gles2::GLES2Interface* gl, 139 GLHelper(gpu::gles2::GLES2Interface* gl,
140 gpu::ContextSupport* context_support); 140 gpu::ContextSupport* context_support);
141 ~GLHelper(); 141 ~GLHelper();
142 142
143 enum ScalerQuality { 143 enum ScalerQuality {
144 // Bilinear single pass, fastest possible. 144 // Bilinear single pass, fastest possible.
145 SCALER_QUALITY_FAST = 1, 145 SCALER_QUALITY_FAST = 1,
146 146
147 // Bilinear upscale + N * 50% bilinear downscales. 147 // Bilinear upscale + N * 50% bilinear downscales.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 // Force commands in the current command buffer to be executed before commands 274 // Force commands in the current command buffer to be executed before commands
275 // in other command buffers from the same process (ie channel to the GPU 275 // in other command buffers from the same process (ie channel to the GPU
276 // process). 276 // process).
277 void InsertOrderingBarrier(); 277 void InsertOrderingBarrier();
278 278
279 // A scaler will cache all intermediate textures and programs 279 // A scaler will cache all intermediate textures and programs
280 // needed to scale from a specified size to a destination size. 280 // needed to scale from a specified size to a destination size.
281 // If the source or destination sizes changes, you must create 281 // If the source or destination sizes changes, you must create
282 // a new scaler. 282 // a new scaler.
283 class DISPLAY_COMPOSITOR_EXPORT ScalerInterface { 283 class VIZ_EXPORT ScalerInterface {
284 public: 284 public:
285 ScalerInterface() {} 285 ScalerInterface() {}
286 virtual ~ScalerInterface() {} 286 virtual ~ScalerInterface() {}
287 287
288 // Note that the src_texture will have the min/mag filter set to GL_LINEAR 288 // Note that the src_texture will have the min/mag filter set to GL_LINEAR
289 // and wrap_s/t set to CLAMP_TO_EDGE in this call. 289 // and wrap_s/t set to CLAMP_TO_EDGE in this call.
290 virtual void Scale(GLuint source_texture, GLuint dest_texture) = 0; 290 virtual void Scale(GLuint source_texture, GLuint dest_texture) = 0;
291 virtual const gfx::Size& SrcSize() = 0; 291 virtual const gfx::Size& SrcSize() = 0;
292 virtual const gfx::Rect& SrcSubrect() = 0; 292 virtual const gfx::Rect& SrcSubrect() = 0;
293 virtual const gfx::Size& DstSize() = 0; 293 virtual const gfx::Size& DstSize() = 0;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 void InitScalerImpl(); 336 void InitScalerImpl();
337 337
338 enum ReadbackSwizzle { kSwizzleNone = 0, kSwizzleBGRA }; 338 enum ReadbackSwizzle { kSwizzleNone = 0, kSwizzleBGRA };
339 339
340 gpu::gles2::GLES2Interface* gl_; 340 gpu::gles2::GLES2Interface* gl_;
341 gpu::ContextSupport* context_support_; 341 gpu::ContextSupport* context_support_;
342 std::unique_ptr<CopyTextureToImpl> copy_texture_to_impl_; 342 std::unique_ptr<CopyTextureToImpl> copy_texture_to_impl_;
343 std::unique_ptr<GLHelperScaling> scaler_impl_; 343 std::unique_ptr<GLHelperScaling> scaler_impl_;
344 std::unique_ptr<GLHelperReadbackSupport> readback_support_; 344 std::unique_ptr<GLHelperReadbackSupport> readback_support_;
345 345
346 private:
346 DISALLOW_COPY_AND_ASSIGN(GLHelper); 347 DISALLOW_COPY_AND_ASSIGN(GLHelper);
347 }; 348 };
348 349
349 // Similar to a ScalerInterface, a yuv readback pipeline will 350 // Similar to a ScalerInterface, a yuv readback pipeline will
350 // cache a scaler and all intermediate textures and frame buffers 351 // cache a scaler and all intermediate textures and frame buffers
351 // needed to scale, crop, letterbox and read back a texture from 352 // needed to scale, crop, letterbox and read back a texture from
352 // the GPU into CPU-accessible RAM. A single readback pipeline 353 // the GPU into CPU-accessible RAM. A single readback pipeline
353 // can handle multiple outstanding readbacks at the same time, but 354 // can handle multiple outstanding readbacks at the same time, but
354 // if the source or destination sizes change, you'll need to create 355 // if the source or destination sizes change, you'll need to create
355 // a new readback pipeline. 356 // a new readback pipeline.
356 class DISPLAY_COMPOSITOR_EXPORT ReadbackYUVInterface { 357 class VIZ_EXPORT ReadbackYUVInterface {
357 public: 358 public:
358 ReadbackYUVInterface() {} 359 ReadbackYUVInterface() {}
359 virtual ~ReadbackYUVInterface() {} 360 virtual ~ReadbackYUVInterface() {}
360 361
361 // Note that |target| must use YV12 format. |paste_location| specifies where 362 // Note that |target| must use YV12 format. |paste_location| specifies where
362 // the captured pixels that are read back will be placed in the video frame. 363 // the captured pixels that are read back will be placed in the video frame.
363 // The region defined by the |paste_location| and the |dst_size| specified in 364 // The region defined by the |paste_location| and the |dst_size| specified in
364 // the call to CreateReadbackPipelineYUV() must be fully contained within 365 // the call to CreateReadbackPipelineYUV() must be fully contained within
365 // |target->visible_rect()|. 366 // |target->visible_rect()|.
366 virtual void ReadbackYUV(const gpu::Mailbox& mailbox, 367 virtual void ReadbackYUV(const gpu::Mailbox& mailbox,
367 const gpu::SyncToken& sync_token, 368 const gpu::SyncToken& sync_token,
368 const gfx::Rect& target_visible_rect, 369 const gfx::Rect& target_visible_rect,
369 int y_plane_row_stride_bytes, 370 int y_plane_row_stride_bytes,
370 unsigned char* y_plane_data, 371 unsigned char* y_plane_data,
371 int u_plane_row_stride_bytes, 372 int u_plane_row_stride_bytes,
372 unsigned char* u_plane_data, 373 unsigned char* u_plane_data,
373 int v_plane_row_stride_bytes, 374 int v_plane_row_stride_bytes,
374 unsigned char* v_plane_data, 375 unsigned char* v_plane_data,
375 const gfx::Point& paste_location, 376 const gfx::Point& paste_location,
376 const base::Callback<void(bool)>& callback) = 0; 377 const base::Callback<void(bool)>& callback) = 0;
377 virtual GLHelper::ScalerInterface* scaler() = 0; 378 virtual GLHelper::ScalerInterface* scaler() = 0;
378 }; 379 };
379 380
380 } // namespace display_compositor 381 } // namespace viz
381 382
382 #endif // COMPONENTS_DISPLAY_COMPOSITOR_GL_HELPER_H_ 383 #endif // COMPONENTS_VIZ_DISPLAY_COMPOSITOR_GL_HELPER_H_
OLDNEW
« no previous file with comments | « components/viz/display_compositor/display_compositor_test_suite.cc ('k') | components/viz/display_compositor/gl_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698