Commit 5333b7b2 authored by Dongseong Hwang's avatar Dongseong Hwang Committed by Commit Bot

ozone: remove unused ProcessBufferCallback.

It's used to scale an overlay plane using external hardware (e.g. video
processing), but not anymore. Chrome makes display controller scale by itself.

Note: this code never shipped on any devices because it requires
--enable-hardware-overlays flags on Intel, which never used by a product.

TBR=danakj@chromium.org
TEST=run chrome with --enable-hardware-overlays using amd64-generic
BUG=683347

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I32f2b1384f4a64510aa5d692c628e874255ea6b8
Reviewed-on: https://chromium-review.googlesource.com/552926
Commit-Queue: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Reviewed-by: default avatarDavid Reveman <reveman@chromium.org>
Reviewed-by: default avatarDongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#486841}
parent 6b811691
......@@ -65,9 +65,6 @@ bool VaapiDrmPicture::Initialize() {
return false;
}
pixmap_->SetProcessingCallback(
base::Bind(&VaapiWrapper::ProcessPixmap, vaapi_wrapper_));
if (texture_id_ != 0 && !make_context_current_cb_.is_null()) {
if (!make_context_current_cb_.Run())
return false;
......
......@@ -666,31 +666,6 @@ scoped_refptr<VASurface> VaapiWrapper::CreateVASurfaceForPixmap(
return va_surface;
}
bool VaapiWrapper::ProcessPixmap(
const scoped_refptr<gfx::NativePixmap>& source_pixmap,
scoped_refptr<gfx::NativePixmap> target_pixmap) {
scoped_refptr<VASurface> va_surface = CreateVASurfaceForPixmap(source_pixmap);
if (!va_surface) {
LOG(ERROR) << "Failed creating VA Surface for source_pixmap";
return false;
}
scoped_refptr<VASurface> processed_va_surface =
CreateVASurfaceForPixmap(target_pixmap);
if (!processed_va_surface) {
LOG(ERROR) << "Failed creating processed VA Surface for pixmap";
return false;
}
if (!BlitSurface(va_surface, processed_va_surface)) {
LOG(ERROR) << "Failed scaling NativePixmap";
return false;
}
return true;
}
#endif
void VaapiWrapper::DestroyUnownedSurface(VASurfaceID va_surface_id) {
......
......@@ -119,12 +119,6 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// CreateSurfaces(), where VaapiWrapper is the owner of the surfaces.
scoped_refptr<VASurface> CreateVASurfaceForPixmap(
const scoped_refptr<gfx::NativePixmap>& pixmap);
// Use VPP to process |source_pixmap| to |target_pixmap| with scaling and
// color space conversion.
bool ProcessPixmap(const scoped_refptr<gfx::NativePixmap>& source_pixmap,
scoped_refptr<gfx::NativePixmap> target_pixmap);
#endif
// Submit parameters or slice data of |va_buffer_type|, copying them from
......
......@@ -50,17 +50,6 @@ class NativePixmap : public base::RefCountedThreadSafe<NativePixmap> {
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) = 0;
// This represents a callback function pointing to processing unit like VPP to
// do post-processing operations like scaling and color space conversion on
// |source_pixmap| and save processed result to |target_pixmap|.
typedef base::Callback<bool(const scoped_refptr<NativePixmap>& source_pixmap,
scoped_refptr<NativePixmap> target_pixmap)>
ProcessingCallback;
// Set callback function for the pixmap used for post processing.
virtual void SetProcessingCallback(
const ProcessingCallback& processing_callback) = 0;
// Export the buffer for sharing across processes.
// Any file descriptors in the exported handle are owned by the caller.
virtual gfx::NativePixmapHandle ExportHandle() = 0;
......
......@@ -72,8 +72,6 @@ class CastPixmap : public gfx::NativePixmap {
parent_->OnOverlayScheduled(display_bounds);
return true;
}
void SetProcessingCallback(
const ProcessingCallback& processing_callback) override {}
gfx::NativePixmapHandle ExportHandle() override {
return gfx::NativePixmapHandle();
}
......
......@@ -137,8 +137,7 @@ void DrmOverlayValidatorTest::AddPlane(const ui::OverlayCheck_Params& params) {
params.buffer_size);
ui::OverlayPlane plane(std::move(scanout_buffer), params.plane_z_order,
params.transform, params.display_rect,
params.crop_rect,
ui::OverlayPlane::ProcessBufferCallback());
params.crop_rect);
plane_list_.push_back(plane);
}
......
......@@ -298,12 +298,6 @@ GbmPixmap::GbmPixmap(GbmSurfaceFactory* surface_manager,
const scoped_refptr<GbmBuffer>& buffer)
: surface_manager_(surface_manager), buffer_(buffer) {}
void GbmPixmap::SetProcessingCallback(
const ProcessingCallback& processing_callback) {
DCHECK(processing_callback_.is_null());
processing_callback_ = processing_callback;
}
gfx::NativePixmapHandle GbmPixmap::ExportHandle() {
gfx::NativePixmapHandle handle;
gfx::BufferFormat format =
......@@ -373,44 +367,10 @@ bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) {
DCHECK(buffer_->GetFlags() & GBM_BO_USE_SCANOUT);
OverlayPlane::ProcessBufferCallback processing_callback;
if (!processing_callback_.is_null())
processing_callback = base::Bind(&GbmPixmap::ProcessBuffer, this);
surface_manager_->GetSurface(widget)->QueueOverlayPlane(
OverlayPlane(buffer_, plane_z_order, plane_transform, display_bounds,
crop_rect, processing_callback));
surface_manager_->GetSurface(widget)->QueueOverlayPlane(OverlayPlane(
buffer_, plane_z_order, plane_transform, display_bounds, crop_rect));
return true;
}
scoped_refptr<ScanoutBuffer> GbmPixmap::ProcessBuffer(const gfx::Size& size,
uint32_t format) {
DCHECK(GetBufferSize() != size ||
buffer_->GetFramebufferPixelFormat() != format);
if (!processed_pixmap_ || size != processed_pixmap_->GetBufferSize() ||
format != processed_pixmap_->buffer()->GetFramebufferPixelFormat()) {
// Release any old processed pixmap.
processed_pixmap_ = nullptr;
scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer(
buffer_->drm().get(), format, size, buffer_->GetFlags());
if (!buffer)
return nullptr;
// ProcessBuffer is called on DrmThread. We could have used
// CreateNativePixmap to initialize the pixmap, however it posts a
// synchronous task to DrmThread resulting in a deadlock.
processed_pixmap_ = new GbmPixmap(surface_manager_, buffer);
}
DCHECK(!processing_callback_.is_null());
if (!processing_callback_.Run(this, processed_pixmap_)) {
LOG(ERROR) << "Failed processing NativePixmap";
return nullptr;
}
return processed_pixmap_->buffer();
}
} // namespace ui
......@@ -109,9 +109,6 @@ class GbmPixmap : public gfx::NativePixmap {
GbmPixmap(GbmSurfaceFactory* surface_manager,
const scoped_refptr<GbmBuffer>& buffer);
void SetProcessingCallback(
const ProcessingCallback& processing_callback) override;
// NativePixmap:
void* GetEGLClientBuffer() const override;
bool AreDmaBufFdsValid() const override;
......@@ -139,11 +136,6 @@ class GbmPixmap : public gfx::NativePixmap {
GbmSurfaceFactory* surface_manager_;
scoped_refptr<GbmBuffer> buffer_;
// OverlayValidator can request scaling or format conversions as needed for
// this Pixmap. This holds the processed buffer.
scoped_refptr<GbmPixmap> processed_pixmap_;
ProcessingCallback processing_callback_;
DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
};
......
......@@ -32,19 +32,6 @@ OverlayPlane::OverlayPlane(const OverlayPlane& other) = default;
OverlayPlane::~OverlayPlane() {
}
OverlayPlane::OverlayPlane(const scoped_refptr<ScanoutBuffer>& buffer,
int z_order,
gfx::OverlayTransform plane_transform,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect,
const ProcessBufferCallback& processing_callback)
: buffer(buffer),
z_order(z_order),
plane_transform(plane_transform),
display_bounds(display_bounds),
crop_rect(crop_rect),
processing_callback(processing_callback) {}
bool OverlayPlane::operator<(const OverlayPlane& plane) const {
return std::tie(z_order, display_bounds, crop_rect, plane_transform) <
std::tie(plane.z_order, plane.display_bounds, plane.crop_rect,
......
......@@ -31,19 +31,6 @@ struct OverlayPlane {
const gfx::RectF& crop_rect);
OverlayPlane(const OverlayPlane& other);
// This represents a callback function which can handle post processing
// operations like scaling, format conversion etc of the buffer bound to this
// plane and return the processed buffer.
typedef base::Callback<scoped_refptr<ScanoutBuffer>(const gfx::Size& size,
uint32_t format)>
ProcessBufferCallback;
OverlayPlane(const scoped_refptr<ScanoutBuffer>& buffer,
int z_order,
gfx::OverlayTransform plane_transform,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect,
const ProcessBufferCallback& processing_callback);
bool operator<(const OverlayPlane& plane) const;
~OverlayPlane();
......@@ -56,8 +43,6 @@ struct OverlayPlane {
gfx::OverlayTransform plane_transform;
gfx::Rect display_bounds;
gfx::RectF crop_rect;
// TODO(dshwang): remove unused |processing_callback|. crbug.com/683347
ProcessBufferCallback processing_callback;
};
} // namespace ui
......
......@@ -89,8 +89,6 @@ class TestPixmap : public gfx::NativePixmap {
const gfx::RectF& crop_rect) override {
return true;
}
void SetProcessingCallback(
const ProcessingCallback& processing_callback) override {}
gfx::NativePixmapHandle ExportHandle() override {
return gfx::NativePixmapHandle();
}
......
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