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

Side by Side Diff: cc/resources/resource_provider.h

Issue 1157943004: cc: [WIP] Use worker context and OrderingBarrierCHROMIUM for one-copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments + command completed check. Created 5 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_RESOURCES_RESOURCE_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 15 matching lines...) Expand all
26 #include "cc/resources/return_callback.h" 26 #include "cc/resources/return_callback.h"
27 #include "cc/resources/shared_bitmap.h" 27 #include "cc/resources/shared_bitmap.h"
28 #include "cc/resources/single_release_callback_impl.h" 28 #include "cc/resources/single_release_callback_impl.h"
29 #include "cc/resources/texture_mailbox.h" 29 #include "cc/resources/texture_mailbox.h"
30 #include "cc/resources/transferable_resource.h" 30 #include "cc/resources/transferable_resource.h"
31 #include "third_party/khronos/GLES2/gl2.h" 31 #include "third_party/khronos/GLES2/gl2.h"
32 #include "third_party/khronos/GLES2/gl2ext.h" 32 #include "third_party/khronos/GLES2/gl2ext.h"
33 #include "third_party/skia/include/core/SkBitmap.h" 33 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "third_party/skia/include/core/SkCanvas.h" 34 #include "third_party/skia/include/core/SkCanvas.h"
35 #include "ui/gfx/geometry/size.h" 35 #include "ui/gfx/geometry/size.h"
36 #include "ui/gfx/gpu_memory_buffer.h"
36 37
37 class GrContext; 38 class GrContext;
38 39
39 namespace gpu { 40 namespace gpu {
40 class GpuMemoryBufferManager; 41 class GpuMemoryBufferManager;
41 namespace gles { 42 namespace gles {
42 class GLES2Interface; 43 class GLES2Interface;
43 } 44 }
44 } 45 }
45 46
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ResourceProvider::Resource* resource_; 325 ResourceProvider::Resource* resource_;
325 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 326 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
326 gfx::GpuMemoryBuffer* gpu_memory_buffer_; 327 gfx::GpuMemoryBuffer* gpu_memory_buffer_;
327 gfx::Size size_; 328 gfx::Size size_;
328 ResourceFormat format_; 329 ResourceFormat format_;
329 base::ThreadChecker thread_checker_; 330 base::ThreadChecker thread_checker_;
330 331
331 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); 332 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
332 }; 333 };
333 334
335 class CC_EXPORT ScopedWriteLockGpuMemoryBufferForThread {
336 public:
337 ScopedWriteLockGpuMemoryBufferForThread(ResourceProvider* resource_provider,
338 ResourceId resource_id,
339 unsigned dest_texture_id);
340 ~ScopedWriteLockGpuMemoryBufferForThread();
341
342 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer();
343 void CreateAndBindImage();
344 ContextProvider* worker_context() { return worker_context_; }
345 void BeginCopyTexture();
346 void EndCopyTexture();
347 ResourceFormat format() { return format_; }
348 gfx::Size size() { return size_; }
349 unsigned source_gl_id() { return source_gl_id_; }
350 unsigned dest_gl_id() { return dest_gl_id_; }
351
352 private:
353 ResourceProvider* resource_provider_;
354 ResourceProvider::Resource* resource_;
355 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
356 gfx::GpuMemoryBuffer* gpu_memory_buffer_;
357 base::ThreadChecker thread_checker_;
358 ContextProvider* worker_context_;
359 unsigned image_id_;
360 unsigned bound_image_id_;
361 bool allocated_;
362 bool dirty_image_;
363 bool read_lock_fences_enabled_;
364 unsigned source_gl_id_;
365 unsigned dest_gl_id_;
366 gfx::Size size_;
367 ResourceFormat format_;
368 GLenum internal_format_;
369 bool did_bind_image_;
370 unsigned query_id_;
371 bool using_sync_query_;
372 gfx::GpuMemoryBuffer::Usage usage_;
373
374 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBufferForThread);
375 };
376
334 class CC_EXPORT ScopedWriteLockGr { 377 class CC_EXPORT ScopedWriteLockGr {
335 public: 378 public:
336 ScopedWriteLockGr(ResourceProvider* resource_provider, 379 ScopedWriteLockGr(ResourceProvider* resource_provider,
337 ResourceId resource_id); 380 ResourceId resource_id);
338 ~ScopedWriteLockGr(); 381 ~ScopedWriteLockGr();
339 382
340 void InitSkSurface(bool use_distance_field_text, 383 void InitSkSurface(bool use_distance_field_text,
341 bool can_use_lcd_text, 384 bool can_use_lcd_text,
342 int msaa_sample_count); 385 int msaa_sample_count);
343 void ReleaseSkSurface(); 386 void ReleaseSkSurface();
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return format_gl_data_format[format]; 701 return format_gl_data_format[format];
659 } 702 }
660 703
661 inline GLenum GLInternalFormat(ResourceFormat format) { 704 inline GLenum GLInternalFormat(ResourceFormat format) {
662 return GLDataFormat(format); 705 return GLDataFormat(format);
663 } 706 }
664 707
665 } // namespace cc 708 } // namespace cc
666 709
667 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 710 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698