summaryrefslogtreecommitdiff
path: root/chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h')
-rw-r--r--chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h b/chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
index 13dbd84ab90..910b9a7056e 100644
--- a/chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
+++ b/chromium/ui/ozone/platform/wayland/gpu/gbm_surfaceless_wayland.h
@@ -7,6 +7,7 @@
#include <memory>
+#include "base/containers/small_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ui/gfx/native_widget_types.h"
@@ -19,6 +20,8 @@ namespace ui {
class WaylandBufferManagerGpu;
+using BufferId = uint32_t;
+
// A GLSurface for Wayland 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
@@ -29,7 +32,7 @@ class GbmSurfacelessWayland : public gl::SurfacelessEGL,
GbmSurfacelessWayland(WaylandBufferManagerGpu* buffer_manager,
gfx::AcceleratedWidget widget);
- void QueueOverlayPlane(OverlayPlane plane, uint32_t buffer_id);
+ void QueueOverlayPlane(OverlayPlane plane, BufferId buffer_id);
// gl::GLSurface:
bool ScheduleOverlayPlane(int z_order,
@@ -62,22 +65,19 @@ class GbmSurfacelessWayland : public gl::SurfacelessEGL,
private:
FRIEND_TEST_ALL_PREFIXES(WaylandSurfaceFactoryTest,
GbmSurfacelessWaylandCheckOrderOfCallbacksTest);
+ FRIEND_TEST_ALL_PREFIXES(WaylandSurfaceFactoryTest,
+ GbmSurfacelessWaylandCommitOverlaysCallbacksTest);
+ FRIEND_TEST_ALL_PREFIXES(WaylandSurfaceFactoryTest,
+ GbmSurfacelessWaylandGroupOnSubmissionCallbacksTest);
~GbmSurfacelessWayland() override;
// WaylandSurfaceGpu overrides:
- void OnSubmission(uint32_t buffer_id,
+ void OnSubmission(BufferId buffer_id,
const gfx::SwapResult& swap_result) override;
- void OnPresentation(uint32_t buffer_id,
+ void OnPresentation(BufferId buffer_id,
const gfx::PresentationFeedback& feedback) override;
- struct PlaneData {
- OverlayPlane plane;
- // The id of the buffer, which represents buffer that backs this overlay
- // plane.
- const uint32_t buffer_id;
- };
-
struct PendingFrame {
PendingFrame();
~PendingFrame();
@@ -89,24 +89,25 @@ class GbmSurfacelessWayland : public gl::SurfacelessEGL,
bool ready = false;
// The id of the buffer, which represents this frame.
- uint32_t buffer_id = 0;
+ BufferId buffer_id = 0;
// A region of the updated content in a corresponding frame. It's used to
// advice Wayland which part of a buffer is going to be updated. Passing {0,
// 0, 0, 0} results in a whole buffer update on the Wayland compositor side.
gfx::Rect damage_region_ = gfx::Rect();
+ // TODO(fangzhoug): This should be changed to support Vulkan.
std::vector<gl::GLSurfaceOverlay> overlays;
SwapCompletionCallback completion_callback;
PresentationCallback presentation_callback;
bool schedule_planes_succeeded = false;
- std::vector<PlaneData> planes;
- // TODO(fangzhoug): This is a temporary solution to barrier swap/present
- // acks of a frame that contains multiple buffer commits. Next step is to
- // barrier in browser process to avoid extra IPC hops.
- size_t unacked_submissions;
- size_t unacked_presentations;
+ // Maps |buffer_id| to an OverlayPlane, used for committing overlays and
+ // wait for OnSubmission's.
+ base::small_map<std::map<BufferId, OverlayPlane>> planes;
+ base::flat_set<BufferId> pending_presentation_buffers;
+ gfx::SwapResult swap_result = gfx::SwapResult::SWAP_ACK;
+ gfx::PresentationFeedback feedback;
};
void MaybeSubmitFrames();