~oxide-developers/oxide/oxide.trunk

« back to all changes in this revision

Viewing changes to shared/port/content/common/gpu_service_shim_oxide.h

  • Committer: Chris Coulson
  • Date: 2015-03-25 01:40:08 UTC
  • mfrom: (1007.2.15 support-eglimage)
  • Revision ID: chris.coulson@canonical.com-20150325014008-rklnpn9pc0e0rxu8
Add an EGLImage compositing path for when share groups aren't reliable, and improve synchronization between the WebView compositor and UI compositor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
 
// Copyright (C) 2014 Canonical Ltd.
 
2
// Copyright (C) 2014-2015 Canonical Ltd.
3
3
 
4
4
// This library is free software; you can redistribute it and/or
5
5
// modify it under the terms of the GNU Lesser General Public
15
15
// License along with this library; if not, write to the Free Software
16
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
 
#ifndef _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
19
 
#define _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
20
 
 
21
 
#include <cstdint>
22
 
 
23
 
#include "base/macros.h"
24
 
#include "base/memory/scoped_ptr.h"
25
 
#include "base/memory/weak_ptr.h"
 
18
#ifndef _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_
 
19
#define _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_
 
20
 
 
21
#include <stdint.h>
 
22
 
26
23
#include "content/common/content_export.h"
27
24
 
28
 
typedef unsigned int GLuint;
29
 
 
30
25
namespace gfx {
31
26
class GLShareGroup;
32
27
}
33
28
 
34
29
namespace gpu {
35
 
class Mailbox;
36
30
namespace gles2 {
37
 
class TextureManager;
38
 
class TextureRef;
 
31
class GLES2Decoder;
39
32
}
40
33
}
41
34
 
42
35
namespace content {
43
 
 
44
 
class ContextProviderCommandBuffer;
45
 
class GpuCommandBufferStub;
46
 
 
47
36
namespace oxide_gpu_shim {
48
37
 
49
 
// Wrapper class for TextureRef. This is not thread-safe, and should only
50
 
// be used on the GPU thread
51
 
class CONTENT_EXPORT Texture {
52
 
 public:
53
 
  Texture(content::GpuCommandBufferStub* command_buffer,
54
 
          gpu::gles2::TextureRef* ref);
55
 
  ~Texture();
56
 
 
57
 
  // Return the real texture ID
58
 
  GLuint GetServiceID() const;
59
 
 
60
 
  // Returns the TextureManager associated with the share group that the
61
 
  // TextureRef belongs to
62
 
  gpu::gles2::TextureManager* GetTextureManager() const;
63
 
 
64
 
  // Destroy the underlying TextureRef. This can fail, eg, if the context
65
 
  // is lost. On success, |this| can be deleted. On failure, |this| must not
66
 
  // be deleted until its TextureManager is deing destroyed
67
 
  // Returns: true on success, false on failure
68
 
  bool Destroy();  
69
 
 
70
 
 private:
71
 
  // We use a WeakPtr, but it's a bug if this class outlives command_buffer_
72
 
  base::WeakPtr<content::GpuCommandBufferStub> command_buffer_;
73
 
 
74
 
  scoped_refptr<gpu::gles2::TextureRef> ref_;
75
 
 
76
 
  DISALLOW_COPY_AND_ASSIGN(Texture);
77
 
};
78
 
 
79
 
// Create and return a Texture instance for the corresponding client process,
80
 
// command buffer and mailbox. The caller takes ownership of Texture
81
 
CONTENT_EXPORT Texture* ConsumeTextureFromMailbox(
82
 
    int32_t client_id,
83
 
    int32_t route_id,
84
 
    const gpu::Mailbox& mailbox);
85
 
 
86
 
CONTENT_EXPORT int32_t GetContextProviderRouteID(
87
 
    content::ContextProviderCommandBuffer* provider);
88
 
 
89
 
CONTENT_EXPORT gfx::GLShareGroup* GetGLShareGroup();
 
38
CONTENT_EXPORT gpu::gles2::GLES2Decoder* GetGLES2Decoder(int32_t client_id,
 
39
                                                         int32_t route_id);
 
40
 
 
41
gfx::GLShareGroup* GetGLShareGroup();
90
42
CONTENT_EXPORT void SetGLShareGroup(gfx::GLShareGroup* share_group);
91
43
 
92
44
} // oxide_gpu_shim
93
45
} // content
94
46
 
95
 
#endif // _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
 
47
#endif // _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_