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

Side by Side Diff: ui/gl/gl_surface_egl.cc

Issue 1084173004: Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ozone demo Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_surface_egl.h" 5 #include "ui/gl/gl_surface_egl.h"
6 6
7 #if defined(OS_ANDROID) 7 #if defined(OS_ANDROID)
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 #endif 9 #endif
10 10
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 } 654 }
655 } 655 }
656 return config_; 656 return config_;
657 #endif 657 #endif
658 } 658 }
659 659
660 bool NativeViewGLSurfaceEGL::IsOffscreen() { 660 bool NativeViewGLSurfaceEGL::IsOffscreen() {
661 return false; 661 return false;
662 } 662 }
663 663
664 bool NativeViewGLSurfaceEGL::SwapBuffers() { 664 gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffers() {
665 TRACE_EVENT2("gpu", "NativeViewGLSurfaceEGL:RealSwapBuffers", 665 TRACE_EVENT2("gpu", "NativeViewGLSurfaceEGL:RealSwapBuffers",
666 "width", GetSize().width(), 666 "width", GetSize().width(),
667 "height", GetSize().height()); 667 "height", GetSize().height());
668 668
669 #if defined(OS_WIN) 669 #if defined(OS_WIN)
670 if (swap_interval_ != 0) { 670 if (swap_interval_ != 0) {
671 // This code is a simple way of enforcing that we only vsync if one surface 671 // This code is a simple way of enforcing that we only vsync if one surface
672 // is swapping per frame. This provides single window cases a stable refresh 672 // is swapping per frame. This provides single window cases a stable refresh
673 // while allowing multi-window cases to not slow down due to multiple syncs 673 // while allowing multi-window cases to not slow down due to multiple syncs
674 // on a single thread. A better way to fix this problem would be to have 674 // on a single thread. A better way to fix this problem would be to have
(...skipping 22 matching lines...) Expand all
697 vsync_override_ = false; 697 vsync_override_ = false;
698 } 698 }
699 699
700 swaps_this_generation_++; 700 swaps_this_generation_++;
701 } 701 }
702 #endif 702 #endif
703 703
704 if (!eglSwapBuffers(GetDisplay(), surface_)) { 704 if (!eglSwapBuffers(GetDisplay(), surface_)) {
705 DVLOG(1) << "eglSwapBuffers failed with error " 705 DVLOG(1) << "eglSwapBuffers failed with error "
706 << GetLastEGLErrorString(); 706 << GetLastEGLErrorString();
707 return false; 707 return gfx::SwapResult::SWAP_FAILED;
708 } 708 }
709 709
710 return true; 710 return gfx::SwapResult::SWAP_ACK;
711 } 711 }
712 712
713 gfx::Size NativeViewGLSurfaceEGL::GetSize() { 713 gfx::Size NativeViewGLSurfaceEGL::GetSize() {
714 EGLint width; 714 EGLint width;
715 EGLint height; 715 EGLint height;
716 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) || 716 if (!eglQuerySurface(GetDisplay(), surface_, EGL_WIDTH, &width) ||
717 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) { 717 !eglQuerySurface(GetDisplay(), surface_, EGL_HEIGHT, &height)) {
718 NOTREACHED() << "eglQuerySurface failed with error " 718 NOTREACHED() << "eglQuerySurface failed with error "
719 << GetLastEGLErrorString(); 719 << GetLastEGLErrorString();
720 return gfx::Size(); 720 return gfx::Size();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 759 }
760 760
761 EGLSurface NativeViewGLSurfaceEGL::GetHandle() { 761 EGLSurface NativeViewGLSurfaceEGL::GetHandle() {
762 return surface_; 762 return surface_;
763 } 763 }
764 764
765 bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() { 765 bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() {
766 return supports_post_sub_buffer_; 766 return supports_post_sub_buffer_;
767 } 767 }
768 768
769 bool NativeViewGLSurfaceEGL::PostSubBuffer( 769 gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(int x,
770 int x, int y, int width, int height) { 770 int y,
771 int width,
772 int height) {
771 DCHECK(supports_post_sub_buffer_); 773 DCHECK(supports_post_sub_buffer_);
772 if (!eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height)) { 774 if (!eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height)) {
773 DVLOG(1) << "eglPostSubBufferNV failed with error " 775 DVLOG(1) << "eglPostSubBufferNV failed with error "
774 << GetLastEGLErrorString(); 776 << GetLastEGLErrorString();
775 return false; 777 return gfx::SwapResult::SWAP_FAILED;
776 } 778 }
777 return true; 779 return gfx::SwapResult::SWAP_ACK;
778 } 780 }
779 781
780 VSyncProvider* NativeViewGLSurfaceEGL::GetVSyncProvider() { 782 VSyncProvider* NativeViewGLSurfaceEGL::GetVSyncProvider() {
781 return vsync_provider_.get(); 783 return vsync_provider_.get();
782 } 784 }
783 785
784 void NativeViewGLSurfaceEGL::OnSetSwapInterval(int interval) { 786 void NativeViewGLSurfaceEGL::OnSetSwapInterval(int interval) {
785 swap_interval_ = interval; 787 swap_interval_ = interval;
786 } 788 }
787 789
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 850 }
849 851
850 EGLConfig PbufferGLSurfaceEGL::GetConfig() { 852 EGLConfig PbufferGLSurfaceEGL::GetConfig() {
851 return g_config; 853 return g_config;
852 } 854 }
853 855
854 bool PbufferGLSurfaceEGL::IsOffscreen() { 856 bool PbufferGLSurfaceEGL::IsOffscreen() {
855 return true; 857 return true;
856 } 858 }
857 859
858 bool PbufferGLSurfaceEGL::SwapBuffers() { 860 gfx::SwapResult PbufferGLSurfaceEGL::SwapBuffers() {
859 NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL."; 861 NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL.";
860 return false; 862 return gfx::SwapResult::SWAP_FAILED;
861 } 863 }
862 864
863 gfx::Size PbufferGLSurfaceEGL::GetSize() { 865 gfx::Size PbufferGLSurfaceEGL::GetSize() {
864 return size_; 866 return size_;
865 } 867 }
866 868
867 bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) { 869 bool PbufferGLSurfaceEGL::Resize(const gfx::Size& size) {
868 if (size == size_) 870 if (size == size_)
869 return true; 871 return true;
870 872
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 936 }
935 937
936 bool SurfacelessEGL::IsOffscreen() { 938 bool SurfacelessEGL::IsOffscreen() {
937 return true; 939 return true;
938 } 940 }
939 941
940 bool SurfacelessEGL::IsSurfaceless() const { 942 bool SurfacelessEGL::IsSurfaceless() const {
941 return true; 943 return true;
942 } 944 }
943 945
944 bool SurfacelessEGL::SwapBuffers() { 946 gfx::SwapResult SurfacelessEGL::SwapBuffers() {
945 LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL."; 947 LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL.";
946 return false; 948 return gfx::SwapResult::SWAP_FAILED;
947 } 949 }
948 950
949 gfx::Size SurfacelessEGL::GetSize() { 951 gfx::Size SurfacelessEGL::GetSize() {
950 return size_; 952 return size_;
951 } 953 }
952 954
953 bool SurfacelessEGL::Resize(const gfx::Size& size) { 955 bool SurfacelessEGL::Resize(const gfx::Size& size) {
954 size_ = size; 956 size_ = size;
955 return true; 957 return true;
956 } 958 }
957 959
958 EGLSurface SurfacelessEGL::GetHandle() { 960 EGLSurface SurfacelessEGL::GetHandle() {
959 return EGL_NO_SURFACE; 961 return EGL_NO_SURFACE;
960 } 962 }
961 963
962 void* SurfacelessEGL::GetShareHandle() { 964 void* SurfacelessEGL::GetShareHandle() {
963 return NULL; 965 return NULL;
964 } 966 }
965 967
966 SurfacelessEGL::~SurfacelessEGL() { 968 SurfacelessEGL::~SurfacelessEGL() {
967 } 969 }
968 970
969 } // namespace gfx 971 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698