Commit 97c1d4d2 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Support presentation callback for GLSurfaceOSMesaX11

Bug: 776877
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ia388f02926202777ac9c7461715947ed97e2082b
Reviewed-on: https://chromium-review.googlesource.com/1011675Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551090}
parent 9811b184
...@@ -159,8 +159,6 @@ gfx::SwapResult GLSurfaceOSMesaX11::PostSubBuffer( ...@@ -159,8 +159,6 @@ gfx::SwapResult GLSurfaceOSMesaX11::PostSubBuffer(
int width, int width,
int height, int height,
const PresentationCallback& callback) { const PresentationCallback& callback) {
// TODO(penghuang): Provide useful presentation feedback.
// https://crbug.com/776877
gfx::Size size = GetSize(); gfx::Size size = GetSize();
// Move (0,0) from lower-left to upper-left // Move (0,0) from lower-left to upper-left
...@@ -182,9 +180,20 @@ gfx::SwapResult GLSurfaceOSMesaX11::PostSubBuffer( ...@@ -182,9 +180,20 @@ gfx::SwapResult GLSurfaceOSMesaX11::PostSubBuffer(
XCopyArea(xdisplay_, pixmap_, window_, window_graphics_context_, x, y, width, XCopyArea(xdisplay_, pixmap_, window_, window_graphics_context_, x, y, width,
height, x, y); height, x, y);
constexpr int64_t kRefreshIntervalInMicroseconds =
base::Time::kMicrosecondsPerSecond / 60;
callback.Run(gfx::PresentationFeedback(
base::TimeTicks::Now(),
base::TimeDelta::FromMicroseconds(kRefreshIntervalInMicroseconds),
0 /* flags */));
return gfx::SwapResult::SWAP_ACK; return gfx::SwapResult::SWAP_ACK;
} }
bool GLSurfaceOSMesaX11::SupportsPresentationCallback() {
return true;
}
GLSurfaceOSMesaX11::~GLSurfaceOSMesaX11() { GLSurfaceOSMesaX11::~GLSurfaceOSMesaX11() {
Destroy(); Destroy();
} }
......
...@@ -37,6 +37,7 @@ class GL_EXPORT GLSurfaceOSMesaX11 : public GLSurfaceOSMesa { ...@@ -37,6 +37,7 @@ class GL_EXPORT GLSurfaceOSMesaX11 : public GLSurfaceOSMesa {
int width, int width,
int height, int height,
const PresentationCallback& callback) override; const PresentationCallback& callback) override;
bool SupportsPresentationCallback() override;
protected: protected:
~GLSurfaceOSMesaX11() override; ~GLSurfaceOSMesaX11() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment