Skip to content

Commit

Permalink
Remove GLStreamTextureImage
Browse files Browse the repository at this point in the history
GLStreamTextureImage had two functions to support
CHROMIUM_stream_texture_matrix extension. After this extension was
removed there is no need for special gl::Image subclass.

We still need SetLevelStreamTextureImage as it binds external texture
id with the level. This CL replaces it to gl::GLImage.

Bug: 1076564
Change-Id: I8d09947090edc6456a91436428fb3b0fc0018415
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2282892
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Jonathan Backer <backer@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787319}
  • Loading branch information
vasilyt authored and Commit Bot committed Jul 10, 2020
1 parent e13566a commit 1db6a8b
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 351 deletions.
1 change: 0 additions & 1 deletion build/check_gn_headers_whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ gpu/command_buffer/common/command_buffer_shared.h
gpu/command_buffer/common/gles2_cmd_utils_autogen.h
gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
gpu/command_buffer/common/gpu_memory_allocation.h
gpu/command_buffer/service/gl_stream_texture_image.h
gpu/command_buffer/service/gles2_cmd_decoder_unittest_extensions_autogen.h
gpu/command_buffer/service/memory_tracking.h
gpu/config/gpu_lists_version.h
Expand Down
2 changes: 0 additions & 2 deletions gpu/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ test("gpu_unittests") {
"command_buffer/service/gl_context_mock.cc",
"command_buffer/service/gl_context_mock.h",
"command_buffer/service/gl_context_virtual_unittest.cc",
"command_buffer/service/gl_stream_texture_image_stub.cc",
"command_buffer/service/gl_stream_texture_image_stub.h",
"command_buffer/service/gl_surface_mock.cc",
"command_buffer/service/gl_surface_mock.h",
"command_buffer/service/gles2_cmd_decoder_unittest.cc",
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/service/abstract_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class GLImage;

namespace gpu {
namespace gles2 {
class GLStreamTextureImage;

// An AbstractTexture enables access to GL textures from the GPU process, for
// things that set up textures using some client's decoder. Creating an
Expand Down Expand Up @@ -64,7 +63,7 @@ class GPU_GLES2_EXPORT AbstractTexture {
// It is not required to SetCleared() if one binds an image.
//
// The context must be current.
virtual void BindStreamTextureImage(GLStreamTextureImage* image,
virtual void BindStreamTextureImage(gl::GLImage* image,
GLuint service_id) = 0;

// Attaches |image| to the AbstractTexture. If |client_managed| is true, then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void AbstractTextureImplOnSharedContext::SetParameteri(GLenum pname,
}

void AbstractTextureImplOnSharedContext::BindStreamTextureImage(
GLStreamTextureImage* image,
gl::GLImage* image,
GLuint service_id) {
const GLint level = 0;
const GLuint target = texture_->target();
Expand Down Expand Up @@ -193,7 +193,7 @@ void AbstractTextureImplOnSharedContextPassthrough::SetParameteri(GLenum pname,
}

void AbstractTextureImplOnSharedContextPassthrough::BindStreamTextureImage(
GLStreamTextureImage* image,
gl::GLImage* image,
GLuint service_id) {
NOTIMPLEMENTED();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class GPU_GLES2_EXPORT AbstractTextureImplOnSharedContext
// AbstractTexture implementation.
TextureBase* GetTextureBase() const override;
void SetParameteri(GLenum pname, GLint param) override;
void BindStreamTextureImage(GLStreamTextureImage* image,
GLuint service_id) override;
void BindStreamTextureImage(gl::GLImage* image, GLuint service_id) override;
void BindImage(gl::GLImage* image, bool client_managed) override;
gl::GLImage* GetImage() const override;
void SetCleared() override;
Expand Down Expand Up @@ -68,8 +67,7 @@ class GPU_GLES2_EXPORT AbstractTextureImplOnSharedContextPassthrough
// AbstractTexture implementation.
TextureBase* GetTextureBase() const override;
void SetParameteri(GLenum pname, GLint param) override;
void BindStreamTextureImage(GLStreamTextureImage* image,
GLuint service_id) override;
void BindStreamTextureImage(gl::GLImage* image, GLuint service_id) override;
void BindImage(gl::GLImage* image, bool client_managed) override;
gl::GLImage* GetImage() const override;
void SetCleared() override;
Expand Down
34 changes: 0 additions & 34 deletions gpu/command_buffer/service/gl_stream_texture_image.h

This file was deleted.

55 changes: 0 additions & 55 deletions gpu/command_buffer/service/gl_stream_texture_image_stub.cc

This file was deleted.

58 changes: 0 additions & 58 deletions gpu/command_buffer/service/gl_stream_texture_image_stub.h

This file was deleted.

1 change: 0 additions & 1 deletion gpu/command_buffer/service/gles2_cmd_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/framebuffer_manager.h"
#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "build/build_config.h"
#include "gpu/command_buffer/common/discardable_handle.h"
#include "gpu/command_buffer/service/decoder_client.h"
#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/gpu_fence_manager.h"
#include "gpu/command_buffer/service/gpu_tracer.h"
#include "gpu/command_buffer/service/image_factory.h"
Expand Down
6 changes: 2 additions & 4 deletions gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/gl_stream_texture_image_stub.h"
#include "gpu/command_buffer/service/gl_surface_mock.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/image_manager.h"
Expand Down Expand Up @@ -331,13 +330,12 @@ TEST_P(GLES2DecoderTest, CreateAbstractTexture) {

// Attach a stream image, and verify that the image changes and the service_id
// matches the one we provide.
scoped_refptr<gpu::gles2::GLStreamTextureImage> stream_image(
new gpu::gles2::GLStreamTextureImageStub);
scoped_refptr<gl::GLImage> stream_image(new gl::GLImageStub);
const GLuint surface_texture_service_id = service_id + 1;
abstract_texture->BindStreamTextureImage(stream_image.get(),
surface_texture_service_id);
EXPECT_EQ(texture->SafeToRenderFrom(), true);
EXPECT_EQ(texture->GetLevelStreamTextureImage(target, 0), stream_image.get());
EXPECT_EQ(texture->GetLevelImage(target, 0), stream_image.get());
EXPECT_EQ(abstract_texture->service_id(), surface_texture_service_id);

// Deleting |abstract_texture| should delete the platform texture as well,
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/service/mock_abstract_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class MockAbstractTexture
MOCK_CONST_METHOD0(GetTextureBase, gpu::TextureBase*());
MOCK_METHOD2(SetParameteri, void(GLenum pname, GLint param));
MOCK_METHOD2(BindStreamTextureImage,
void(gpu::gles2::GLStreamTextureImage* image,
GLuint service_id));
void(gl::GLImage* image, GLuint service_id));
MOCK_METHOD2(BindImage, void(gl::GLImage* image, bool client_managed));
MOCK_METHOD0(ReleaseImage, void());
MOCK_CONST_METHOD0(GetImage, gl::GLImage*());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "gpu/command_buffer/service/abstract_texture.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/passthrough_abstract_texture_impl.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gl/gl_context.h"
Expand Down Expand Up @@ -71,9 +70,8 @@ void PassthroughAbstractTextureImpl::BindImage(gl::GLImage* image,
texture_passthrough_->SetLevelImage(target, level, image);
}

void PassthroughAbstractTextureImpl::BindStreamTextureImage(
GLStreamTextureImage* image,
GLuint service_id) {
void PassthroughAbstractTextureImpl::BindStreamTextureImage(gl::GLImage* image,
GLuint service_id) {
DCHECK(image);
DCHECK(!decoder_managed_image_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
namespace gpu {
namespace gles2 {

class GLStreamTextureImage;
class TexturePassthrough;
class GLES2DecoderPassthroughImpl;

Expand All @@ -31,8 +30,7 @@ class GPU_GLES2_EXPORT PassthroughAbstractTextureImpl : public AbstractTexture {
TextureBase* GetTextureBase() const override;
void SetParameteri(GLenum pname, GLint param) override;
void BindImage(gl::GLImage* image, bool client_managed) override;
void BindStreamTextureImage(GLStreamTextureImage* image,
GLuint service_id) override;
void BindStreamTextureImage(gl::GLImage* image, GLuint service_id) override;
gl::GLImage* GetImage() const override;
void SetCleared() override;
void SetCleanupCallback(CleanupCallback cb) override;
Expand Down
21 changes: 0 additions & 21 deletions gpu/command_buffer/service/raster_decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "gpu/command_buffer/service/decoder_client.h"
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_tex_image.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
Expand Down Expand Up @@ -2163,26 +2162,6 @@ void RasterDecoderImpl::DoCopySubTextureINTERNALGL(
if (!InitializeCopyTextureCHROMIUM())
return;

// GL_TEXTURE_EXTERNAL_OES texture requires apply a transform matrix
// before presenting.
if (source_target == GL_TEXTURE_EXTERNAL_OES) {
if (gles2::GLStreamTextureImage* image =
source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES,
source_level)) {
copy_texture_chromium_->DoCopySubTexture(
this, source_target, source_texture->service_id(), source_level,
source_internal_format, dest_target, dest_texture->service_id(),
dest_level, dest_internal_format, xoffset, yoffset, x, y, width,
height, dest_size.width(), dest_size.height(), source_size.width(),
source_size.height(), unpack_flip_y, unpack_premultiply_alpha,
/*unpack_unmultiply_alpha=*/false, /*dither=*/false,
gles2::CopyTextureMethod::DIRECT_DRAW, copy_tex_image_blit_.get());
dest_texture->SetLevelClearedRect(dest_target, dest_level,
new_cleared_rect);
return;
}
}

gles2::CopyTextureMethod method = GetCopyTextureCHROMIUMMethod(
GetFeatureInfo(), source_target, source_level, source_internal_format,
source_type, dest_target, dest_level, dest_internal_format, unpack_flip_y,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_STREAM_TEXTURE_SHARED_IMAGE_INTERFACE_H_
#define GPU_COMMAND_BUFFER_SERVICE_STREAM_TEXTURE_SHARED_IMAGE_INTERFACE_H_

#include "gpu/command_buffer/service/gl_stream_texture_image.h"
#include "gpu/gpu_gles2_export.h"
#include "ui/gl/gl_image.h"

namespace gpu {
class TextureOwner;
class TextureBase;

// This class is a specialized GLImage that lets SharedImageVideo draw video
// frames.
class GPU_GLES2_EXPORT StreamTextureSharedImageInterface
: public gles2::GLStreamTextureImage {
class GPU_GLES2_EXPORT StreamTextureSharedImageInterface : public gl::GLImage {
public:
enum class BindingsMode {
// Ensures that the TextureOwner's texture is bound to the latest image, if
Expand Down
Loading

0 comments on commit 1db6a8b

Please sign in to comment.