Skip to content

Commit

Permalink
[GL] Eliminate GLImageEGLPixmap and helper class taking in BufferFormat
Browse files Browse the repository at this point in the history
Following recent refactorings, these classes no longer need to know
about BufferFormat for any reason.

Bug: 1412693
Change-Id: I8a3c29f6a9bfaa48925a4f6825c2ef6917b883a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4316315
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115591}
  • Loading branch information
colinblundell authored and Chromium LUCI CQ committed Mar 10, 2023
1 parent f8a327c commit 441da7a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ VaapiStatus VaapiPictureNativePixmapAngle::Allocate(gfx::BufferFormat format) {
return VaapiStatus::Codes::kBadContext;

auto image = base::WrapRefCounted<gl::GLImageEGLPixmap>(
new gl::GLImageEGLPixmap(visible_size_, format));
new gl::GLImageEGLPixmap(visible_size_));
if (!image)
return VaapiStatus::Codes::kNoImage;

Expand Down
5 changes: 2 additions & 3 deletions ui/gl/gl_image_egl_pixmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

namespace gl {

GLImageEGLPixmap::GLImageEGLPixmap(const gfx::Size& size,
gfx::BufferFormat format)
: binding_helper_(size, format) {}
GLImageEGLPixmap::GLImageEGLPixmap(const gfx::Size& size)
: binding_helper_(size) {}

GLImageEGLPixmap::~GLImageEGLPixmap() = default;

Expand Down
3 changes: 1 addition & 2 deletions ui/gl/gl_image_egl_pixmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef UI_GL_GL_IMAGE_EGL_PIXMAP_H_
#define UI_GL_GL_IMAGE_EGL_PIXMAP_H_

#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/x/glx.h"
#include "ui/gl/gl_export.h"
Expand All @@ -24,7 +23,7 @@ class GL_EXPORT GLImageEGLPixmap : public GLImage {
private:
friend class media::VaapiPictureNativePixmapAngle;

GLImageEGLPixmap(const gfx::Size& size, gfx::BufferFormat format);
explicit GLImageEGLPixmap(const gfx::Size& size);

GLImageEGLPixmap(const GLImageEGLPixmap&) = delete;
GLImageEGLPixmap& operator=(const GLImageEGLPixmap&) = delete;
Expand Down
6 changes: 2 additions & 4 deletions ui/gl/native_pixmap_egl_x11_binding_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>

#include "ui/gfx/x/connection.h"
#include "ui/gl/buffer_format_utils.h"
#include "ui/gl/gl_bindings.h"

namespace gl {
Expand All @@ -18,9 +17,8 @@ inline EGLDisplay FromXDisplay() {
}

NativePixmapEGLX11BindingHelper::NativePixmapEGLX11BindingHelper(
const gfx::Size& size,
gfx::BufferFormat format)
: size_(size), format_(format), display_(FromXDisplay()) {}
const gfx::Size& size)
: size_(size), display_(FromXDisplay()) {}

NativePixmapEGLX11BindingHelper::~NativePixmapEGLX11BindingHelper() {
if (surface_) {
Expand Down
7 changes: 1 addition & 6 deletions ui/gl/native_pixmap_egl_x11_binding_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <stdint.h>

#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/x/glx.h"
#include "ui/gl/gl_export.h"
Expand All @@ -19,8 +18,7 @@ namespace gl {

class GL_EXPORT NativePixmapEGLX11BindingHelper {
public:
NativePixmapEGLX11BindingHelper(const gfx::Size& size,
gfx::BufferFormat format);
explicit NativePixmapEGLX11BindingHelper(const gfx::Size& size);

NativePixmapEGLX11BindingHelper(const NativePixmapEGLX11BindingHelper&) =
delete;
Expand All @@ -41,11 +39,8 @@ class GL_EXPORT NativePixmapEGLX11BindingHelper {
~NativePixmapEGLX11BindingHelper();

private:
gfx::BufferFormat format() const { return format_; }

EGLSurface surface_ = nullptr;
const gfx::Size size_;
gfx::BufferFormat format_;
EGLDisplay display_;
};

Expand Down
4 changes: 2 additions & 2 deletions ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ std::unique_ptr<NativePixmapGLBinding> NativePixmapEGLX11Binding::Create(
return nullptr;
}

auto binding_helper = std::make_unique<gl::NativePixmapEGLX11BindingHelper>(
plane_size, plane_format);
auto binding_helper =
std::make_unique<gl::NativePixmapEGLX11BindingHelper>(plane_size);
x11::Pixmap pixmap =
gl::XPixmapFromNativePixmap(*native_pixmap, plane_format);
if (pixmap == x11::Pixmap::None) {
Expand Down

0 comments on commit 441da7a

Please sign in to comment.