Commit 6b6d7dfd authored by yukishiino's avatar yukishiino Committed by Commit bot

Revert of Simplify ppapi Graphics3D size propagation a bit (patchset #5...

Revert of Simplify ppapi Graphics3D size propagation a bit (patchset #5 id:80001 of https://codereview.chromium.org/2136743002/ )

Reason for revert:
Build breakage on Win8 GYP.
https://build.chromium.org/p/chromium.win/builders/Win8%20GYP%20%28dbg%29/builds/507

FAILED: nacl64.exe nacl64.exe.pdb
E:\b\depot_tools\python276_bin\python.exe gyp-win-tool link-with-manifests environment.x64 True nacl64.exe "E:\b\depot_tools\python276_bin\python.exe gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:nacl64.exe @nacl64.exe.rsp" 1 mt.exe rc.exe "obj\chrome\chrome_nacl_win64.nacl64.exe.intermediate.manifest" obj\chrome\chrome_nacl_win64.nacl64.exe.generated.manifest ..\..\build\win\compatibility.manifest
ppapi_ipc_win64.lib(ppapi_ipc_win64.ppapi_messages.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl gfx::Size::Size(void)" (__imp_??0Size@gfx@@QEAA@XZ) referenced in function "public: __cdecl std::_Tuple_val<class gfx::Size>::_Tuple_val<class gfx::Size>(void)" (??0?$_Tuple_val@VSize@gfx@@@std@@QEAA@XZ)

nacl64.exe : fatal error LNK1120: 1 unresolved externals

Original issue's description:
> Simplify ppapi Graphics3D size propagation a bit
>
> - after https://codereview.chromium.org/2104403003/ we parse the attributes from
>   the plugin side, so we know the correct size from the start, and we don't need
>   to track the original size.
> - we can also pass gfx::Size through IPC with some extra validation (negative
>   coordinates) in common code.
> - overall net fewer lines
>
> BUG=None
>
> Committed: https://crrev.com/1135d428cd8f5b19d458c5e67ba90776c4e09381
> Cr-Commit-Position: refs/heads/master@{#404580}

TBR=erikchen@chromium.org,bbudge@chromium.org,dcheng@chromium.org,danakj@chromium.org,piman@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=None

Review-Url: https://codereview.chromium.org/2135063002
Cr-Commit-Position: refs/heads/master@{#404582}
parent c14d86fd
......@@ -168,7 +168,8 @@ gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() {
}
int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token,
const gfx::Size& size) {
int32_t width,
int32_t height) {
DCHECK(command_buffer_);
if (taken_front_buffer_.IsZero()) {
DLOG(ERROR) << "TakeFrontBuffer should be called before DoSwapBuffers";
......@@ -183,11 +184,16 @@ int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token,
//
// Don't need to check for NULL from GetPluginInstance since when we're
// bound, we know our instance is valid.
if (width < 0 || height < 0) {
width = original_width_;
height = original_height_;
}
bool is_overlay_candidate = use_image_chromium_;
GLenum target =
is_overlay_candidate ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D;
cc::TextureMailbox texture_mailbox(taken_front_buffer_, sync_token, target,
size, is_overlay_candidate, false);
gfx::Size(width, height),
is_overlay_candidate, false);
taken_front_buffer_.SetZero();
HostGlobals::Get()
->GetInstance(pp_instance())
......@@ -255,6 +261,8 @@ bool PPB_Graphics3D_Impl::InitRaw(
std::move(channel), gpu::kNullSurfaceHandle, share_buffer,
gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL, attrib_helper,
GURL::EmptyGURL(), base::ThreadTaskRunnerHandle::Get());
original_width_ = attrib_helper.offscreen_framebuffer_size.width();
original_height_ = attrib_helper.offscreen_framebuffer_size.height();
if (!command_buffer_)
return false;
......
......@@ -75,7 +75,8 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
gpu::CommandBuffer* GetCommandBuffer() override;
gpu::GpuControl* GetGpuControl() override;
int32_t DoSwapBuffers(const gpu::SyncToken& sync_token,
const gfx::Size& size) override;
int32_t width,
int32_t height) override;
private:
explicit PPB_Graphics3D_Impl(PP_Instance instance);
......@@ -115,6 +116,12 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared,
bool lost_context_ = false;
#endif
// The width and height of the command buffer back buffer are first sized from
// this process, but then resized by the pepper process. Cache the original
// size.
int32_t original_width_ = 0;
int32_t original_height_ = 0;
bool has_alpha_;
bool use_image_chromium_;
std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_;
......
......@@ -53,7 +53,6 @@
'../media/media.gyp:shared_memory_support',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
'../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/surface/surface.gyp:surface',
'../url/url.gyp:url_lib',
'ppapi.gyp:ppapi_c',
......@@ -88,7 +87,6 @@
'../gpu/gpu.gyp:command_buffer_traits',
'../ipc/ipc.gyp:ipc',
'../skia/skia.gyp:skia',
'../ui/gfx/ipc/geometry/gfx_ipc_geometry.gyp:gfx_ipc_geometry',
'ppapi.gyp:ppapi_c',
'ppapi_shared',
],
......@@ -170,7 +168,6 @@
'../third_party/icu/icu.gyp:icuuc',
'../third_party/icu/icu.gyp:icui18n',
'../ui/gfx/gfx.gyp:gfx_geometry',
'../ui/gfx/ipc/geometry/gfx_ipc_geometry.gyp:gfx_ipc_geometry',
'../ui/surface/surface.gyp:surface',
'ppapi.gyp:ppapi_c',
'ppapi_shared',
......@@ -224,7 +221,6 @@
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
'../gpu/gpu.gyp:command_buffer_common_win64',
'../ipc/ipc.gyp:ipc_win64',
'../ui/gfx/gfx.gyp:gfx_geometry_win64',
],
'defines': [
'<@(nacl_win64_defines)',
......@@ -251,7 +247,6 @@
'../base/base.gyp:base_win64',
'../ipc/ipc.gyp:ipc_win64',
'../gpu/gpu.gyp:command_buffer_traits_win64',
'../ui/gfx/ipc/geometry/gfx_ipc_geometry.gyp:gfx_ipc_geometry_win64',
'ppapi.gyp:ppapi_c',
'ppapi_shared_win64',
],
......
......@@ -47,8 +47,6 @@
'../ppapi/ppapi_shared_nacl.gyp:ppapi_shared_nacl',
'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
'../third_party/khronos/khronos.gyp:khronos_headers',
'../ui/gfx/gfx_nacl.gyp:gfx_geometry_nacl',
'../ui/gfx/ipc/geometry/gfx_ipc_geometry_nacl.gyp:gfx_ipc_geometry_nacl',
],
},
],
......
......@@ -38,7 +38,6 @@
'../gpu/gpu_nacl.gyp:gles2_implementation_nacl',
'../media/media_nacl.gyp:shared_memory_support_nacl',
'../third_party/khronos/khronos.gyp:khronos_headers',
'../ui/gfx/gfx_nacl.gyp:gfx_geometry_nacl',
],
},
],
......
......@@ -287,8 +287,6 @@ component("proxy") {
"//mojo/edk/system",
"//ppapi/c",
"//ppapi/shared_impl",
"//ui/gfx/geometry",
"//ui/gfx/ipc/geometry",
]
if (!is_nacl) {
......
......@@ -1087,10 +1087,11 @@ IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
// after this message is sent.
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_TakeFrontBuffer,
ppapi::HostResource /* graphics_3d */)
IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
IPC_MESSAGE_ROUTED4(PpapiHostMsg_PPBGraphics3D_SwapBuffers,
ppapi::HostResource /* graphics_3d */,
gpu::SyncToken /* sync_token */,
gfx::Size /* size */)
int32_t /* width*/,
int32_t /* height*/)
IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible,
ppapi::HostResource /* context */)
......
......@@ -48,8 +48,8 @@ gpu::CommandBuffer::State GetErrorState() {
} // namespace
Graphics3D::Graphics3D(const HostResource& resource, const gfx::Size& size)
: PPB_Graphics3D_Shared(resource, size) {
Graphics3D::Graphics3D(const HostResource& resource)
: PPB_Graphics3D_Shared(resource) {
}
Graphics3D::~Graphics3D() {
......@@ -118,7 +118,8 @@ gpu::GpuControl* Graphics3D::GetGpuControl() {
}
int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token,
const gfx::Size& size) {
int32_t width,
int32_t height) {
// A valid sync token would indicate a swap buffer already happened somehow.
DCHECK(!sync_token.HasData());
......@@ -136,7 +137,8 @@ int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token,
gl->GenSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData());
IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers(
API_ID_PPB_GRAPHICS_3D, host_resource(), new_sync_token, size);
API_ID_PPB_GRAPHICS_3D, host_resource(), new_sync_token, width,
height);
msg->set_unblock(true);
PluginDispatcher::GetForResource(this)->Send(msg);
......@@ -213,8 +215,7 @@ PP_Resource PPB_Graphics3D_Proxy::CreateProxyResource(
if (result.is_null())
return 0;
scoped_refptr<Graphics3D> graphics_3d(
new Graphics3D(result, attrib_helper.offscreen_framebuffer_size));
scoped_refptr<Graphics3D> graphics_3d(new Graphics3D(result));
if (!graphics_3d->Init(share_gles2, capabilities, shared_state,
command_buffer_id)) {
return 0;
......@@ -360,13 +361,14 @@ void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(
void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context,
const gpu::SyncToken& sync_token,
const gfx::Size& size) {
int32_t width,
int32_t height) {
EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter(
context, callback_factory_,
&PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context);
if (enter.succeeded())
enter.SetResult(enter.object()->SwapBuffersWithSyncToken(
enter.callback(), sync_token, size));
enter.callback(), sync_token, width, height));
}
void PPB_Graphics3D_Proxy::OnMsgTakeFrontBuffer(const HostResource& context) {
......
......@@ -39,7 +39,7 @@ class PpapiCommandBufferProxy;
class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
public:
Graphics3D(const HostResource& resource, const gfx::Size& size);
explicit Graphics3D(const HostResource& resource);
~Graphics3D() override;
bool Init(gpu::gles2::GLES2Implementation* share_gles2,
......@@ -65,7 +65,8 @@ class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
gpu::CommandBuffer* GetCommandBuffer() override;
gpu::GpuControl* GetGpuControl() override;
int32_t DoSwapBuffers(const gpu::SyncToken& sync_token,
const gfx::Size& size) override;
int32_t width,
int32_t height) override;
std::unique_ptr<PpapiCommandBufferProxy> command_buffer_;
......@@ -115,7 +116,8 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy {
void OnMsgDestroyTransferBuffer(const HostResource& context, int32_t id);
void OnMsgSwapBuffers(const HostResource& context,
const gpu::SyncToken& sync_token,
const gfx::Size& size);
int32_t width,
int32_t height);
void OnMsgTakeFrontBuffer(const HostResource& context);
void OnMsgEnsureWorkVisible(const HostResource& context);
// Renderer->plugin message handlers.
......
......@@ -109,7 +109,7 @@ class VideoDecoderResourceTest : public PluginProxyTest {
HostResource host_resource;
host_resource.SetHostResource(pp_instance(), kGraphics3D);
scoped_refptr<ppapi::proxy::Graphics3D> graphics_3d(
new ppapi::proxy::Graphics3D(host_resource, gfx::Size(640, 480)));
new ppapi::proxy::Graphics3D(host_resource));
return graphics_3d->GetReference();
}
......
......@@ -4,7 +4,6 @@ include_rules = [
"+media/audio",
"+media/base",
"+skia",
"+ui/gfx/geometry",
"-ppapi/cpp",
"-ppapi/proxy",
......
......@@ -17,9 +17,8 @@ namespace ppapi {
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(PP_Instance instance)
: Resource(OBJECT_IS_IMPL, instance) {}
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource,
const gfx::Size& size)
: Resource(OBJECT_IS_PROXY, host_resource), size_(size) {}
PPB_Graphics3D_Shared::PPB_Graphics3D_Shared(const HostResource& host_resource)
: Resource(OBJECT_IS_PROXY, host_resource) {}
PPB_Graphics3D_Shared::~PPB_Graphics3D_Shared() {
// Make sure that GLES2 implementation has already been destroyed.
......@@ -52,20 +51,22 @@ int32_t PPB_Graphics3D_Shared::ResizeBuffers(int32_t width, int32_t height) {
return PP_ERROR_BADARGUMENT;
gles2_impl()->ResizeCHROMIUM(width, height, 1.f, true);
size_ = gfx::Size(width, height);
width_ = width;
height_ = height;
// TODO(alokp): Check if resize succeeded and return appropriate error code.
return PP_OK;
}
int32_t PPB_Graphics3D_Shared::SwapBuffers(
scoped_refptr<TrackedCallback> callback) {
return SwapBuffersWithSyncToken(callback, gpu::SyncToken(), size_);
return SwapBuffersWithSyncToken(callback, gpu::SyncToken(), width_, height_);
}
int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken(
scoped_refptr<TrackedCallback> callback,
const gpu::SyncToken& sync_token,
const gfx::Size& size) {
int32_t width,
int32_t height) {
if (HasPendingSwap()) {
Log(PP_LOGLEVEL_ERROR,
"PPB_Graphics3D.SwapBuffers: Plugin attempted swap "
......@@ -75,7 +76,7 @@ int32_t PPB_Graphics3D_Shared::SwapBuffersWithSyncToken(
}
swap_callback_ = callback;
return DoSwapBuffers(sync_token, size);
return DoSwapBuffers(sync_token, width, height);
}
int32_t PPB_Graphics3D_Shared::GetAttribMaxValue(int32_t attribute,
......
......@@ -15,7 +15,6 @@
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/ppb_graphics_3d_api.h"
#include "ui/gfx/geometry/size.h"
namespace gpu {
class CommandBuffer;
......@@ -45,7 +44,8 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
int32_t SwapBuffers(scoped_refptr<TrackedCallback> callback) override;
int32_t SwapBuffersWithSyncToken(scoped_refptr<TrackedCallback> callback,
const gpu::SyncToken& sync_token,
const gfx::Size& size) override;
int32_t width,
int32_t height) override;
int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) override;
void* MapTexSubImage2DCHROMIUM(GLenum target,
......@@ -67,14 +67,14 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
protected:
PPB_Graphics3D_Shared(PP_Instance instance);
PPB_Graphics3D_Shared(const HostResource& host_resource,
const gfx::Size& size);
PPB_Graphics3D_Shared(const HostResource& host_resource);
~PPB_Graphics3D_Shared() override;
virtual gpu::CommandBuffer* GetCommandBuffer() = 0;
virtual gpu::GpuControl* GetGpuControl() = 0;
virtual int32_t DoSwapBuffers(const gpu::SyncToken& sync_token,
const gfx::Size& size) = 0;
int32_t width,
int32_t height) = 0;
bool HasPendingSwap() const;
bool CreateGLES2Impl(int32_t command_buffer_size,
......@@ -87,9 +87,9 @@ class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared
std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
// A local cache of the size of the viewport. This is only valid in plugin
// resources.
gfx::Size size_;
// A local cache of the size of the viewport.
int32_t width_ = -1;
int32_t height_ = -1;
// Callback that needs to be executed when swap-buffers is completed.
scoped_refptr<TrackedCallback> swap_callback_;
......
......@@ -13,10 +13,6 @@
#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/thunk/ppapi_thunk_export.h"
namespace gfx {
class Size;
}
namespace gpu {
struct SyncToken;
}
......@@ -40,7 +36,8 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
virtual int32_t SwapBuffersWithSyncToken(
scoped_refptr<TrackedCallback> callback,
const gpu::SyncToken& sync_token,
const gfx::Size& size) = 0;
int32_t width,
int32_t height) = 0;
virtual int32_t GetAttribMaxValue(int32_t attribute, int32_t* value) = 0;
// Graphics3DTrusted API.
......
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