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

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

Issue 1930193002: cc: Add GpuMemoryBufferHandle to TextureMailbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix exo 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TEXTURE_MAILBOX_H_ 5 #ifndef CC_RESOURCES_TEXTURE_MAILBOX_H_
6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_ 6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
15 #include "gpu/command_buffer/common/mailbox_holder.h" 15 #include "gpu/command_buffer/common/mailbox_holder.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/gpu_memory_buffer.h"
17 18
18 namespace cc { 19 namespace cc {
19 class SharedBitmap; 20 class SharedBitmap;
20 21
21 // TODO(skaslev, danakj) Rename this class more apropriately since now it 22 // TODO(skaslev, danakj) Rename this class more apropriately since now it
22 // can hold a shared memory resource as well as a texture mailbox. 23 // can hold a shared memory resource as well as a texture mailbox.
23 class CC_EXPORT TextureMailbox { 24 class CC_EXPORT TextureMailbox {
24 public: 25 public:
25 TextureMailbox(); 26 TextureMailbox();
26 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); 27 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder);
27 TextureMailbox(const gpu::Mailbox& mailbox, 28 TextureMailbox(const gpu::Mailbox& mailbox,
28 const gpu::SyncToken& sync_token, 29 const gpu::SyncToken& sync_token,
29 uint32_t target); 30 uint32_t target);
30 TextureMailbox(const gpu::Mailbox& mailbox, 31 TextureMailbox(const gpu::Mailbox& mailbox,
31 const gpu::SyncToken& sync_token, 32 const gpu::SyncToken& sync_token,
32 uint32_t target, 33 uint32_t target,
33 const gfx::Size& size_in_pixels, 34 const gfx::Size& size_in_pixels,
35 const gfx::GpuMemoryBufferHandle& gpu_memory_buffer_handle,
34 bool is_overlay_candidate, 36 bool is_overlay_candidate,
35 bool secure_output_only); 37 bool secure_output_only);
36 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels); 38 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels);
39 TextureMailbox(const TextureMailbox& other);
37 40
38 ~TextureMailbox(); 41 ~TextureMailbox();
39 42
40 bool IsValid() const { return IsTexture() || IsSharedMemory(); } 43 bool IsValid() const { return IsTexture() || IsSharedMemory(); }
41 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } 44 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); }
42 bool IsSharedMemory() const { return shared_bitmap_ != NULL; } 45 bool IsSharedMemory() const { return shared_bitmap_ != NULL; }
43 bool HasSyncToken() const { return mailbox_holder_.sync_token.HasData(); } 46 bool HasSyncToken() const { return mailbox_holder_.sync_token.HasData(); }
44 47
45 int8_t* GetSyncTokenData() { return mailbox_holder_.sync_token.GetData(); } 48 int8_t* GetSyncTokenData() { return mailbox_holder_.sync_token.GetData(); }
46 49
(...skipping 19 matching lines...) Expand all
66 // This is valid if allow_overlau() or IsSharedMemory() is true. 69 // This is valid if allow_overlau() or IsSharedMemory() is true.
67 gfx::Size size_in_pixels() const { return size_in_pixels_; } 70 gfx::Size size_in_pixels() const { return size_in_pixels_; }
68 71
69 SharedBitmap* shared_bitmap() const { return shared_bitmap_; } 72 SharedBitmap* shared_bitmap() const { return shared_bitmap_; }
70 size_t SharedMemorySizeInBytes() const; 73 size_t SharedMemorySizeInBytes() const;
71 74
72 private: 75 private:
73 gpu::MailboxHolder mailbox_holder_; 76 gpu::MailboxHolder mailbox_holder_;
74 SharedBitmap* shared_bitmap_; 77 SharedBitmap* shared_bitmap_;
75 gfx::Size size_in_pixels_; 78 gfx::Size size_in_pixels_;
79 gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle_;
reveman 2016/04/29 10:05:05 Can this be a "gfx::GpuMemoryBuffer*" and the hand
ccameron 2016/04/29 17:33:32 To me it felt much more natural to use a gfx::GpuM
76 bool is_overlay_candidate_; 80 bool is_overlay_candidate_;
77 bool secure_output_only_; 81 bool secure_output_only_;
78 bool nearest_neighbor_; 82 bool nearest_neighbor_;
79 }; 83 };
80 84
81 } // namespace cc 85 } // namespace cc
82 86
83 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ 87 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698