From 1c89c645b27edd9b1d5fd77908d822f38308ebf0 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 6 Aug 2018 15:42:36 +0530 Subject: [PATCH] fixup! [M63 Dev][EFL] Integrate EvasGL Delegated Renderer This commit removes the left over files. Change-Id: I7c0a2c6951eafbbcaa96d925c3fc1d58f3358fee Signed-off-by: Chandan Padhi --- .../compositor/mailbox_output_surface_efl.cc | 335 --------------------- .../compositor/mailbox_output_surface_efl.h | 91 ------ 2 files changed, 426 deletions(-) delete mode 100644 tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.cc delete mode 100644 tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.h diff --git a/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.cc b/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.cc deleted file mode 100644 index 28f3957..0000000 --- a/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.cc +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) 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. - -#include "content/browser/compositor/mailbox_output_surface_efl.h" - -#include "base/threading/thread_task_runner_handle.h" -#include "build/tizen_version.h" -//#include "cc/output/output_surface_client.h" -#include "components/viz/service/display/output_surface_client.h" -//#include "cc/output/output_surface_frame.h" -#include "cc/raster/single_thread_task_graph_runner.h" -#include "components/viz/service/display/output_surface_frame.h" -#include "content/browser/renderer_host/render_widget_host_impl.h" -#include "gpu/command_buffer/client/context_support.h" -#include "gpu/command_buffer/client/gles2_interface.h" -#include "third_party/khronos/GLES2/gl2.h" -#include "third_party/khronos/GLES2/gl2ext.h" - -using gpu::gles2::GLES2Interface; - -namespace content { - -MailboxOutputSurfaceEfl::MailboxOutputSurfaceEfl( - const scoped_refptr& context_provider, - viz::ResourceFormat format) - : viz::OutputSurface(context_provider), - swap_buffers_completion_callback_( - base::Bind(&MailboxOutputSurfaceEfl::OnSwapBuffersCompleted, - base::Unretained(this))), - fbo_(0), - is_backbuffer_discarded_(false), - texture_upload_pending_(false), - format_(format) { - capabilities_.max_frames_pending = 1; - capabilities_.uses_default_gl_framebuffer = false; -} - -MailboxOutputSurfaceEfl::~MailboxOutputSurfaceEfl() {} - -void MailboxOutputSurfaceEfl::EnsureBackbuffer() { - is_backbuffer_discarded_ = false; - - GLES2Interface* gl = context_provider_->ContextGL(); - - if (!current_backing_.texture_id) { - // Find a texture of matching size to recycle. - while (!returned_textures_.empty()) { - TransferableFrame& texture = returned_textures_.front(); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // surface_size_ variable was removed in - // cc/output/output_surface.h - if (texture.size == surface_size_) { - current_backing_ = texture; - if (current_backing_.sync_token.HasData()) - gl->WaitSyncTokenCHROMIUM(current_backing_.sync_token.GetConstData()); - returned_textures_.pop(); - break; - } -#endif // !defined(EWK_BRINGUP) - - gl->DeleteTextures(1, &texture.texture_id); - returned_textures_.pop(); - } - - if (!current_backing_.texture_id) { - gl->GenTextures(1, ¤t_backing_.texture_id); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // surface_size_ variable was removed in - // cc/output/output_surface.h - current_backing_.size = surface_size_; -#endif // !defined(EWK_BRINGUP) - gl->BindTexture(GL_TEXTURE_2D, current_backing_.texture_id); - gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // surface_size_ variable was removed in - // cc/output/output_surface.h - gl->TexImage2D(GL_TEXTURE_2D, 0, GLInternalFormat(format_), - surface_size_.width(), surface_size_.height(), 0, - GLDataFormat(format_), GLDataType(format_), NULL); -#endif // !defined(EWK_BRINGUP) - gl->GenMailboxCHROMIUM(current_backing_.mailbox.name); - gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, current_backing_.mailbox.name); - texture_upload_pending_ = true; - } - } -} - -/*void MailboxOutputSurfaceEfl::fvDiscardBackbuffer() { - is_backbuffer_discarded_ = true; - - GLES2Interface* gl = context_provider_->ContextGL(); - - if (current_backing_.texture_id) { - gl->DeleteTextures(1, ¤t_backing_.texture_id); - current_backing_ = TransferableFrame(); - } - - while (!returned_textures_.empty()) { - const TransferableFrame& frame = returned_textures_.front(); - gl->DeleteTextures(1, &frame.texture_id); - returned_textures_.pop(); - } - - if (fbo_) { - gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); - gl->DeleteFramebuffers(1, &fbo_); - fbo_ = 0; - } -}*/ - -void MailboxOutputSurfaceEfl::Reshape(const gfx::Size& size, - float scale_factor, - const gfx::ColorSpace& color_space, - bool has_alpha, - bool use_stencil) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // surface_size_ variable was removed in cc/output/output_surface.h - if (size == surface_size_) - return; - - surface_size_ = size; - device_scale_factor_ = scale_factor; -#endif // !defined(EWK_BRINGUP) - DiscardBackbuffer(); - EnsureBackbuffer(); -} - -void MailboxOutputSurfaceEfl::BindFramebuffer() { - EnsureBackbuffer(); - DCHECK(current_backing_.texture_id); - - GLES2Interface* gl = context_provider_->ContextGL(); - - if (!fbo_) - gl->GenFramebuffers(1, &fbo_); - gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); - gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - current_backing_.texture_id, 0); -} - -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup -// FIXME: EWK_BRINGUP definition should be removed. -// cc::GLFrameData was removed in cc/output/gl_frame_data.h -void MailboxOutputSurfaceEfl::DrawTexture( - std::unique_ptr gl_frame_data) { - // Draw texture on RWHV - if (gl_frame_data) { - compositor_client_->GetTextureFromMailbox(&gl_frame_data->mailbox, - surface_size_); - } -} - -void MailboxOutputSurfaceEfl::OnSwapAck( - std::unique_ptr gl_frame_data) { - // Ignore message if it's a stale one coming from a different output surface - // (e.g. after a lost context). - - if (!gl_frame_data->mailbox.IsZero()) { - DCHECK(!gl_frame_data->size.IsEmpty()); - // The browser could be returning the oldest or any other pending texture - // if it decided to skip a frame. - std::deque::iterator it; - for (it = pending_textures_.begin(); it != pending_textures_.end(); it++) { - DCHECK(!it->mailbox.IsZero()); - if (!memcmp(it->mailbox.name, gl_frame_data->mailbox.name, - sizeof(it->mailbox.name))) { - DCHECK(it->size == gl_frame_data->size); - break; - } - } - DCHECK(it != pending_textures_.end()); - it->sync_token = gl_frame_data->sync_token; - - if (!is_backbuffer_discarded_) { - returned_textures_.push(*it); - } else { - context_provider_->ContextGL()->DeleteTextures(1, &it->texture_id); - } - - pending_textures_.erase(it); - } else { - DCHECK(!pending_textures_.empty()); - // The browser always keeps one texture as the frontbuffer. - // If it does not return a mailbox, it discarded the frontbuffer which is - // the oldest texture we sent. - uint32_t texture_id = pending_textures_.front().texture_id; - if (texture_id) - context_provider_->ContextGL()->DeleteTextures(1, &texture_id); - pending_textures_.pop_front(); - } - - if (gl_frame_data) { - base::Closure closure = - base::Bind(&MailboxOutputSurfaceEfl::DrawTexture, - base::Unretained(this), base::Passed(&gl_frame_data)); - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure); - } - client_->DidSwapBuffersComplete(); -} -#endif // !defined(EWK_BRINGUP) - -void MailboxOutputSurfaceEfl::SwapBuffers(viz::OutputSurfaceFrame frame) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // The type of frame was changed, so gl_frame_data isn't member of - // frame - DCHECK(frame.gl_frame_data); - DCHECK(!surface_size_.IsEmpty()); - DCHECK(surface_size_ == current_backing_.size); - DCHECK(frame.gl_frame_data->size == current_backing_.size); - DCHECK(!current_backing_.mailbox.IsZero() || - context_provider_->ContextGL()->GetGraphicsResetStatusKHR() != - GL_NO_ERROR); - frame.gl_frame_data->mailbox = current_backing_.mailbox; - -// Using glFinish call instead of glFlush, fixes black screen issue with -// static pages and IE Fish page. -// Black screen issue is seen on page in Tizen 2.4 product TV. -#if TIZEN_VERSION_EQ(2, 4, 0) && defined(OS_TIZEN_TV) - context_provider_->ContextGL()->Finish(); -#else - if (texture_upload_pending_) { - context_provider_->ContextGL()->Finish(); - texture_upload_pending_ = false; - } else { - context_provider_->ContextGL()->Flush(); - } -#endif - - gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL(); - const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); - gl->Flush(); - - gpu::SyncToken sync_token; - gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); - - frame.gl_frame_data->sync_token = sync_token; - - base::Closure closure = - base::Bind(&MailboxOutputSurfaceEfl::OnSwapAck, base::Unretained(this), - base::Passed(&frame.gl_frame_data)); - - context_provider()->ContextSupport()->SignalSyncToken(sync_token, closure); - - client_->DidSwapBuffers(); - - pending_textures_.push_back(current_backing_); - current_backing_ = TransferableFrame(); -#endif // !defined(EWK_BRINGUP) -} - -uint32_t MailboxOutputSurfaceEfl::GetFramebufferCopyTextureFormat() { - auto* gl = - static_cast(context_provider_.get()); - return gl->GetCopyTextureInternalFormat(); -} - -void MailboxOutputSurfaceEfl::BindToClient(viz::OutputSurfaceClient* client) { - OutputSurface::BindToClient(client); - GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( - swap_buffers_completion_callback_.callback()); - return; -} - -gpu::CommandBufferProxyImpl* MailboxOutputSurfaceEfl::GetCommandBufferProxy() { - ui::ContextProviderCommandBuffer* provider_command_buffer = - static_cast(context_provider_.get()); - gpu::CommandBufferProxyImpl* command_buffer_proxy = - provider_command_buffer->GetCommandBufferProxy(); - DCHECK(command_buffer_proxy); - return command_buffer_proxy; -} - -/*void MailboxOutputSurfaceEfl::OnSwapBuffersCompleted( - const std::vector& latency_info, - gfx::SwapResult result, - const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { - RenderWidgetHostImpl::CompositorFrameDrawn(latency_info); -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // OnSwapBuffersComplete was removed in cc/output/output_surface.h - OutputSurface::OnSwapBuffersComplete(); -#endif // !defined(EWK_BRINGUP) -}*/ - -MailboxOutputSurfaceEfl::TransferableFrame::TransferableFrame() - : texture_id(0) {} - -MailboxOutputSurfaceEfl::TransferableFrame::TransferableFrame( - uint32_t texture_id, - const gpu::Mailbox& mailbox, - const gfx::Size size) - : texture_id(texture_id), mailbox(mailbox), size(size) {} - -void MailboxOutputSurfaceEfl::SetDrawRectangle(const gfx::Rect& rect) {} - -bool MailboxOutputSurfaceEfl::HasExternalStencilTest() const { - NOTIMPLEMENTED(); - return false; -} - -void MailboxOutputSurfaceEfl::ApplyExternalStencil() { - NOTIMPLEMENTED(); -} - -viz::OverlayCandidateValidator* -MailboxOutputSurfaceEfl::GetOverlayCandidateValidator() const { - return nullptr; -} - -bool MailboxOutputSurfaceEfl::IsDisplayedAsOverlayPlane() const { - return false; -} - -unsigned MailboxOutputSurfaceEfl::GetOverlayTextureId() const { - return 0; -} - -gfx::BufferFormat MailboxOutputSurfaceEfl::GetOverlayBufferFormat() const { - return gfx::BufferFormat::RGBX_8888; -} - -bool MailboxOutputSurfaceEfl::SurfaceIsSuspendForRecycle() const { - return false; -} - -} // namespace content diff --git a/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.h b/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.h deleted file mode 100644 index e1a2913..0000000 --- a/tizen_src/chromium_impl/content/browser/compositor/mailbox_output_surface_efl.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 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 CONTENT_BROWSER_COMPOSITOR_MAILBOX_OUTPUT_SURFACE_EFL_H_ -#define CONTENT_BROWSER_COMPOSITOR_MAILBOX_OUTPUT_SURFACE_EFL_H_ - -#include "base/cancelable_callback.h" -#include "components/viz/common/resources/resource_format.h" -#include "components/viz/service/display/output_surface.h" -#include "gpu/ipc/client/command_buffer_proxy_impl.h" -#include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" -#include "ui/compositor/compositor.h" -#include "ui/gfx/swap_result.h" - -namespace content { - -class MailboxOutputSurfaceEfl : public viz::OutputSurface { - public: - MailboxOutputSurfaceEfl( - const scoped_refptr& context_provider, - viz::ResourceFormat format); - ~MailboxOutputSurfaceEfl() override; - - // viz::OutputSurface implementation. - void BindToClient(viz::OutputSurfaceClient* client) override; - void EnsureBackbuffer() override; - void DiscardBackbuffer() override; - void BindFramebuffer() override; - void SetDrawRectangle(const gfx::Rect& rect) override; - void Reshape(const gfx::Size& size, - float scale_factor, - const gfx::ColorSpace& color_space, - bool has_alpha, - bool use_stencil) override; - void SwapBuffers(viz::OutputSurfaceFrame frame) override; - bool HasExternalStencilTest() const override; - void ApplyExternalStencil() override; - uint32_t GetFramebufferCopyTextureFormat() override; - viz::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; - bool IsDisplayedAsOverlayPlane() const override; - unsigned GetOverlayTextureId() const override; - gfx::BufferFormat GetOverlayBufferFormat() const override; - bool SurfaceIsSuspendForRecycle() const override; - - private: -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: EWK_BRINGUP definition should be removed. - // cc::GLFrameData was removed in cc/output/gl_frame_data.h - void OnSwapAck(std::unique_ptr gl_frame_data); - void DrawTexture(std::unique_ptr gl_frame_data); -#endif // !defined(EWK_BRINGUP) - gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); - void OnSwapBuffersCompleted( - const std::vector& latency_info, - gfx::SwapResult result, - const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); - - struct TransferableFrame { - TransferableFrame(); - TransferableFrame(uint32_t texture_id, - const gpu::Mailbox& mailbox, - const gfx::Size size); - - uint32_t texture_id; - gpu::Mailbox mailbox; - gpu::SyncToken sync_token; - gfx::Size size; - }; - - base::CancelableCallback&, - gfx::SwapResult, - const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> - swap_buffers_completion_callback_; - - ui::CompositorClient* compositor_client_; - - TransferableFrame current_backing_; - std::deque pending_textures_; - std::queue returned_textures_; - - uint32_t fbo_; - bool is_backbuffer_discarded_; - bool texture_upload_pending_; - viz::ResourceFormat format_; -}; - -} // namespace content - -#endif // CONTENT_BROWSER_COMPOSITOR_MAILBOX_OUTPUT_SURFACE_EFL_H_ -- 2.7.4