#include "content/common/content_export.h"
#include "content/common/gpu/gpu_memory_uma_stats.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/common/gpu/gpu_result_codes.h"
#include "content/public/browser/browser_child_process_host_delegate.h"
#include "content/public/browser/gpu_data_manager.h"
#include "gpu/command_buffer/common/constants.h"
#include "url/gurl.h"
struct GPUCreateCommandBufferConfig;
-struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
-struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
-struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
+
+namespace gfx {
+struct GpuMemoryBufferHandle;
+}
namespace IPC {
struct ChannelHandle;
typedef base::Callback<void(const IPC::ChannelHandle&, const gpu::GPUInfo&)>
EstablishChannelCallback;
- typedef base::Callback<void(bool)> CreateCommandBufferCallback;
+ typedef base::Callback<void(CreateCommandBufferResult)>
+ CreateCommandBufferCallback;
- typedef base::Callback<void(const gfx::Size)> CreateImageCallback;
+ typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
+ CreateGpuMemoryBufferCallback;
static bool gpu_enabled() { return gpu_enabled_; }
+ static int gpu_crash_count() { return gpu_crash_count_; }
// Creates a new GpuProcessHost or gets an existing one, resulting in the
// launching of a GPU process if required. Returns null on failure. It
// and GPUInfo, we call the callback.
void EstablishGpuChannel(int client_id,
bool share_context,
+ bool allow_future_sync_points,
const EstablishChannelCallback& callback);
// Tells the GPU process to create a new command buffer that draws into the
int route_id,
const CreateCommandBufferCallback& callback);
- // Tells the GPU process to create a new image using the given window.
- void CreateImage(
- gfx::PluginWindowHandle window,
- int client_id,
- int image_id,
- const CreateImageCallback& callback);
+ // Tells the GPU process to create a new GPU memory buffer using the given
+ // handle.
+ void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
+ const gfx::Size& size,
+ unsigned internalformat,
+ unsigned usage,
+ const CreateGpuMemoryBufferCallback& callback);
- // Tells the GPU process to delete image.
- void DeleteImage(int client_id, int image_id, int sync_point);
+ // Tells the GPU process to destroy GPU memory buffer.
+ void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
+ int sync_point);
// What kind of GPU process, e.g. sandboxed or unsandboxed.
GpuProcessKind kind();
// Message handlers.
void OnInitialized(bool result, const gpu::GPUInfo& gpu_info);
void OnChannelEstablished(const IPC::ChannelHandle& channel_handle);
- void OnCommandBufferCreated(bool succeeded);
+ void OnCommandBufferCreated(CreateCommandBufferResult result);
void OnDestroyCommandBuffer(int32 surface_id);
- void OnImageCreated(const gfx::Size size);
+ void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle);
void OnDidCreateOffscreenContext(const GURL& url);
void OnDidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
void OnDidDestroyOffscreenContext(const GURL& url);
void OnGpuMemoryUmaStatsReceived(const GPUMemoryUmaStats& stats);
#if defined(OS_MACOSX)
- void OnAcceleratedSurfaceBuffersSwapped(
- const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
+ void OnAcceleratedSurfaceBuffersSwapped(const IPC::Message& message);
#endif
void CreateChannelCache(int32 client_id);
void BlockLiveOffscreenContexts();
+ // Update GPU crash counters. Disable GPU if crash limit is reached.
+ void RecordProcessCrash();
+
std::string GetShaderPrefixKey();
// The serial number of the GpuProcessHost / GpuProcessHostUIShim pair.
// The pending create command buffer requests we need to reply to.
std::queue<CreateCommandBufferCallback> create_command_buffer_requests_;
- // The pending create image requests we need to reply to.
- std::queue<CreateImageCallback> create_image_requests_;
-
+ // The pending create gpu memory buffer requests we need to reply to.
+ std::queue<CreateGpuMemoryBufferCallback> create_gpu_memory_buffer_requests_;
// Qeueud messages to send when the process launches.
std::queue<IPC::Message*> queued_messages_;
// Time Init started. Used to log total GPU process startup time to UMA.
base::TimeTicks init_start_time_;
+ // Whether this host recorded a GPU crash or not.
+ bool gpu_crash_recorded_;
+
// Master switch for enabling/disabling GPU acceleration for the current
// browser session. It does not change the acceleration settings for
// existing tabs, just the future ones.
static bool hardware_gpu_enabled_;
+ static int gpu_crash_count_;
+ static int gpu_recent_crash_count_;
+ static bool crashed_before_;
+ static int swiftshader_crash_count_;
+
scoped_ptr<BrowserChildProcessHostImpl> process_;
// Track the URLs of the pages which have live offscreen contexts,