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

Unified Diff: ui/ozone/platform/drm/gpu/gbm_surfaceless.h

Issue 2165303002: Convert Ozone GBM to use new surface API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone_impl
Patch Set: Add missing dep. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surface_factory.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surfaceless.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/gbm_surfaceless.h
diff --git a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
index 50e38caa75256a148c6075570ad6be82526bfdfd..303ededa7da6fb082c8c418a431e7cd5bea6cfd6 100644
--- a/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
+++ b/ui/ozone/platform/drm/gpu/gbm_surfaceless.h
@@ -1,56 +1,105 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_
#define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACELESS_H_
+#include <memory>
#include <vector>
#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/gl/gl_image.h"
+#include "ui/gl/gl_surface_egl.h"
+#include "ui/gl/gl_surface_overlay.h"
+#include "ui/gl/scoped_binders.h"
#include "ui/ozone/platform/drm/gpu/overlay_plane.h"
-#include "ui/ozone/public/surface_ozone_egl.h"
-
-namespace gfx {
-class Size;
-}
namespace ui {
class DrmWindowProxy;
class GbmSurfaceFactory;
-// In surfaceless mode drawing and displaying happens directly through
-// NativePixmap buffers. CC would call into SurfaceFactoryOzone to allocate the
-// buffers and then call ScheduleOverlayPlane(..) to schedule the buffer for
-// presentation.
-class GbmSurfaceless : public SurfaceOzoneEGL {
+// A GLSurface for GBM Ozone platform that uses surfaceless drawing. Drawing and
+// displaying happens directly through NativePixmap buffers. CC would call into
+// SurfaceFactoryOzone to allocate the buffers and then call
+// ScheduleOverlayPlane(..) to schedule the buffer for presentation.
+class GbmSurfaceless : public gl::SurfacelessEGL {
public:
- GbmSurfaceless(std::unique_ptr<DrmWindowProxy> window,
- GbmSurfaceFactory* surface_manager);
- ~GbmSurfaceless() override;
+ GbmSurfaceless(GbmSurfaceFactory* surface_factory,
+ std::unique_ptr<DrmWindowProxy> window,
+ gfx::AcceleratedWidget widget);
void QueueOverlayPlane(const OverlayPlane& plane);
- // SurfaceOzoneEGL:
- intptr_t GetNativeWindow() override;
- bool ResizeNativeWindow(const gfx::Size& viewport_size) override;
- bool OnSwapBuffers() override;
- void OnSwapBuffersAsync(const SwapCompletionCallback& callback) override;
- std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override;
- bool IsUniversalDisplayLinkDevice() override;
- void* /* EGLConfig */ GetEGLSurfaceConfig(
- const EglConfigCallbacks& egl) override;
+ // gl::GLSurface:
+ bool Initialize(GLSurface::Format format) override;
+ gfx::SwapResult SwapBuffers() override;
+ bool ScheduleOverlayPlane(int z_order,
+ gfx::OverlayTransform transform,
+ gl::GLImage* image,
+ const gfx::Rect& bounds_rect,
+ const gfx::RectF& crop_rect) override;
+ bool IsOffscreen() override;
+ gfx::VSyncProvider* GetVSyncProvider() override;
+ bool SupportsAsyncSwap() override;
+ bool SupportsPostSubBuffer() override;
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
+ void SwapBuffersAsync(const SwapCompletionCallback& callback) override;
+ void PostSubBufferAsync(int x,
+ int y,
+ int width,
+ int height,
+ const SwapCompletionCallback& callback) override;
+ EGLConfig GetConfig() override;
protected:
- std::unique_ptr<DrmWindowProxy> window_;
+ ~GbmSurfaceless() override;
+
+ gfx::AcceleratedWidget widget() { return widget_; }
+ GbmSurfaceFactory* surface_factory() { return surface_factory_; }
+
+ private:
+ struct PendingFrame {
+ PendingFrame();
+ ~PendingFrame();
+
+ bool ScheduleOverlayPlanes(gfx::AcceleratedWidget widget);
+ void Flush();
- GbmSurfaceFactory* surface_manager_;
+ bool ready = false;
+ std::vector<gl::GLSurfaceOverlay> overlays;
+ SwapCompletionCallback callback;
+ };
+ void SubmitFrame();
+
+ EGLSyncKHR InsertFence(bool implicit);
+ void FenceRetired(EGLSyncKHR fence, PendingFrame* frame);
+
+ void SwapCompleted(const SwapCompletionCallback& callback,
+ gfx::SwapResult result);
+
+ bool IsUniversalDisplayLinkDevice();
+
+ GbmSurfaceFactory* surface_factory_;
+ std::unique_ptr<DrmWindowProxy> window_;
std::vector<OverlayPlane> planes_;
- private:
+ // The native surface. Deleting this is allowed to free the EGLNativeWindow.
+ gfx::AcceleratedWidget widget_;
+ std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
+ ScopedVector<PendingFrame> unsubmitted_frames_;
+ bool has_implicit_external_sync_;
+ bool has_image_flush_external_;
+ bool last_swap_buffers_result_ = true;
+ bool swap_buffers_pending_ = false;
+
+ base::WeakPtrFactory<GbmSurfaceless> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(GbmSurfaceless);
};
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surface_factory.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surfaceless.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698