Skip to content

Commit

Permalink
[MappableSI] Remove unused service side code for MappableSI.
Browse files Browse the repository at this point in the history
Client side code no longer uses CreateSharedImageBackedByBuffer
to send IPC to service side to create shared image backed by
native buffers. Hence remove unused service side code.

Note that SharedImageInterfaceInProcess still
uses  SharedImageFactory::CreateSharedImage() version created
to be used for MappableSI. So keeping it for now.

Bug: 1433317, 1433318
Change-Id: I6660cf5a4b5bba800d901e23797c1c5b83e8f3ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4896536
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Auto-Submit: vikas soni <vikassoni@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1204688}
  • Loading branch information
vikaschromie authored and Chromium LUCI CQ committed Oct 3, 2023
1 parent 05a5101 commit 034fa47
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ void SharedImageInterfaceInProcess::CreateSharedImageWithBufferUsageOnGpuThread(
}

DCHECK(shared_image_factory_);

// Note that SharedImageInterfaceInProcess implementation here uses
// SharedImageFactory::CreateSharedImage() to create a shared image backed by
// native buffer/shared memory in GPU process. This is different
// implementation and code path compared to ClientSharedImage implementation
// which creates native buffer/shared memory on IO thread and then creates a
// mailbox from it on GPU thread.
if (!shared_image_factory_->CreateSharedImage(
mailbox, format, size, color_space, surface_origin, alpha_type,
surface_handle, usage, std::move(debug_label), buffer_usage)) {
Expand Down
38 changes: 0 additions & 38 deletions gpu/ipc/common/gpu_channel.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,6 @@ union DeferredSharedImageRequest {
// See CreateSharedImageParams.
CreateSharedImageParams create_shared_image;

// See CreateSharedImageBackedByBufferParams.
CreateSharedImageBackedByBufferParams create_shared_image_backed_by_buffer;

// See CreateSharedImageWithDataParams.
CreateSharedImageWithDataParams create_shared_image_with_data;

Expand Down Expand Up @@ -553,41 +550,6 @@ struct CreateSharedImageParams {
skia.mojom.AlphaType alpha_type;
};

// Creates a new shared image backed by native buffer or shared memory.
struct CreateSharedImageBackedByBufferParams {
// The mailbox used to identify the shared image.
Mailbox mailbox;

// The pixel format of the image.
viz.mojom.SharedImageFormat format;

// Size in pixels.
gfx.mojom.Size size;

// Color space.
gfx.mojom.ColorSpace color_space;

// Usage flags corresponding to values defined in
// gpu/command_buffer/common/shared_image_usage.h.
uint32 usage;

// Retained for heap dumps and passed to graphics APIs for tracing tools.
// Pick a name that is unique to the allocation site.
string debug_label;

// The fence to release once the image is created.
uint32 release_id;

// Which corner is considered the origin of the new image.
skia.mojom.SurfaceOrigin surface_origin;

// Indicates how the alpha component of each pixel is interpreted.
skia.mojom.AlphaType alpha_type;

// Usage flags which decides what GPU memory buffer can be supported.
gfx.mojom.BufferUsage buffer_usage;
};

// Creates a new shared image and populates it with pixel data from a shared
// memory region previously configured by the client.
struct CreateSharedImageWithDataParams {
Expand Down
34 changes: 0 additions & 34 deletions gpu/ipc/service/shared_image_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ void SharedImageStub::ExecuteDeferredRequest(
OnCreateSharedImage(std::move(request->get_create_shared_image()));
break;

case mojom::DeferredSharedImageRequest::Tag::
kCreateSharedImageBackedByBuffer:
OnCreateSharedImageBackedByBuffer(
std::move(request->get_create_shared_image_backed_by_buffer()));
break;

case mojom::DeferredSharedImageRequest::Tag::kCreateSharedImageWithData:
OnCreateSharedImageWithData(
std::move(request->get_create_shared_image_with_data()));
Expand Down Expand Up @@ -317,34 +311,6 @@ void SharedImageStub::OnCreateSharedImage(
sync_point_client_state_->ReleaseFenceSync(params->release_id);
}

void SharedImageStub::OnCreateSharedImageBackedByBuffer(
mojom::CreateSharedImageBackedByBufferParamsPtr params) {
TRACE_EVENT2("gpu", "SharedImageStub::OnCreateSharedImageBackedByBuffer",
"width", params->size.width(), "height", params->size.height());
if (!params->mailbox.IsSharedImage()) {
LOG(ERROR) << kInvalidMailboxOnCreateError;
OnError();
return;
}

bool needs_gl = params->usage & SHARED_IMAGE_USAGE_GLES2;
if (!MakeContextCurrent(needs_gl)) {
OnError();
return;
}

if (!factory_->CreateSharedImage(
params->mailbox, params->format, params->size, params->color_space,
params->surface_origin, params->alpha_type, gpu::kNullSurfaceHandle,
params->usage, GetLabel(params->debug_label), params->buffer_usage)) {
LOG(ERROR) << kSICreationFailureError;
OnError();
return;
}

sync_point_client_state_->ReleaseFenceSync(params->release_id);
}

void SharedImageStub::OnCreateSharedImageWithData(
mojom::CreateSharedImageWithDataParamsPtr params) {
TRACE_EVENT2("gpu", "SharedImageStub::OnCreateSharedImageWithData", "width",
Expand Down
2 changes: 0 additions & 2 deletions gpu/ipc/service/shared_image_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ class GPU_IPC_SERVICE_EXPORT SharedImageStub : public MemoryTracker {
SharedImageStub(GpuChannel* channel, int32_t route_id);

void OnCreateSharedImage(mojom::CreateSharedImageParamsPtr params);
void OnCreateSharedImageBackedByBuffer(
mojom::CreateSharedImageBackedByBufferParamsPtr params);
void OnCreateSharedImageWithData(
mojom::CreateSharedImageWithDataParamsPtr params);
void OnCreateSharedImageWithBuffer(
Expand Down

0 comments on commit 034fa47

Please sign in to comment.