Commit 40a16f97 authored by stevenjb@chromium.org's avatar stevenjb@chromium.org

Revert 288137 "With the overlay path moving back to passing Acce..."

> With the overlay path moving back to passing AcceleratedWidgets, move the implementation back into the surface factory.
> 
> Review URL: https://codereview.chromium.org/445163003

TBR=achaulk@chromium.org

Review URL: https://codereview.chromium.org/447073004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288144 0039d316-1c4b-4281-b951-d872f2087c98
parent 1c7cf3f8
......@@ -71,10 +71,11 @@ void DriSurface::PresentCanvas(const gfx::Rect& damage) {
if (!controller_)
return;
controller_->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1]));
std::vector<OverlayPlane> planes(
1, OverlayPlane(buffers_[front_buffer_ ^ 1]));
UpdateNativeSurface(damage);
controller_->SchedulePageFlip();
controller_->SchedulePageFlip(planes);
controller_->WaitForPageFlipEvent();
// Update our front buffer pointer.
......
......@@ -135,7 +135,7 @@ bool GbmSurface::OnSwapBuffers() {
}
// The primary buffer is a special case.
controller_->QueueOverlayPlane(OverlayPlane(primary));
queued_planes_.push_back(OverlayPlane(primary));
if (!GbmSurfaceless::OnSwapBuffers())
return false;
......
......@@ -123,30 +123,6 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer));
}
bool GbmSurfaceFactory::ScheduleOverlayPlane(
gfx::AcceleratedWidget widget,
int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) {
scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get());
if (!pixmap) {
LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer.";
return false;
}
base::WeakPtr<HardwareDisplayController> hdc =
screen_manager_->GetDisplayController(widget);
if (!hdc)
return true;
hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(),
plane_z_order,
plane_transform,
display_bounds,
crop_rect));
return true;
}
bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
return allow_surfaceless_;
}
......
......@@ -32,12 +32,6 @@ class GbmSurfaceFactory : public DriSurfaceFactory {
virtual scoped_refptr<ui::NativePixmap> CreateNativePixmap(
gfx::Size size,
BufferFormat format) OVERRIDE;
virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) OVERRIDE;
virtual bool CanShowPrimaryPlaneAsOverlay() OVERRIDE;
private:
......
......@@ -29,7 +29,10 @@ bool GbmSurfaceless::OnSwapBuffers() {
if (!controller_)
return true;
bool success = controller_->SchedulePageFlip();
bool success = controller_->SchedulePageFlip(queued_planes_);
queued_planes_.clear();
// Even on failure we may have scheduled some planes. Allow the controller to
// wait for the events for the scheduled planes.
controller_->WaitForPageFlipEvent();
return success;
......@@ -39,4 +42,25 @@ scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_));
}
bool GbmSurfaceless::ScheduleOverlayPlane(
int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<ui::NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) {
scoped_refptr<GbmPixmap> pixmap =
static_cast<GbmPixmap*>(buffer.get());
if (!pixmap) {
LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer.";
return false;
}
queued_planes_.push_back(OverlayPlane(pixmap->buffer(),
plane_z_order,
plane_transform,
display_bounds,
crop_rect));
return true;
}
} // namespace ui
......@@ -30,8 +30,15 @@ class GbmSurfaceless : public SurfaceOzoneEGL {
virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE;
virtual bool OnSwapBuffers() OVERRIDE;
virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE;
virtual bool ScheduleOverlayPlane(int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<ui::NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) OVERRIDE;
protected:
base::WeakPtr<HardwareDisplayController> controller_;
OverlayPlaneList queued_planes_;
DISALLOW_COPY_AND_ASSIGN(GbmSurfaceless);
};
......
......@@ -111,7 +111,6 @@ bool HardwareDisplayController::Modeset(const OverlayPlane& primary,
bool HardwareDisplayController::Enable() {
TRACE_EVENT0("dri", "HDC::Enable");
DCHECK(!current_planes_.empty());
OverlayPlane primary = GetPrimaryPlane(current_planes_);
DCHECK(primary.buffer);
pending_page_flips_ = 0;
......@@ -131,20 +130,18 @@ void HardwareDisplayController::Disable() {
}
}
void HardwareDisplayController::QueueOverlayPlane(const OverlayPlane& plane) {
pending_planes_.push_back(plane);
}
bool HardwareDisplayController::SchedulePageFlip() {
DCHECK(!pending_planes_.empty());
bool HardwareDisplayController::SchedulePageFlip(
const OverlayPlaneList& overlays) {
DCHECK_LE(1u, overlays.size());
DCHECK_EQ(0u, pending_page_flips_);
pending_planes_ = overlays;
bool status = true;
for (size_t i = 0; i < crtc_states_.size(); ++i) {
if (crtc_states_[i]->is_disabled())
continue;
status &= SchedulePageFlipOnCrtc(pending_planes_, crtc_states_[i]);
status &= SchedulePageFlipOnCrtc(overlays, crtc_states_[i]);
}
return status;
......
......@@ -120,8 +120,6 @@ class HardwareDisplayController
// Disables the CRTC.
void Disable();
void QueueOverlayPlane(const OverlayPlane& plane);
// Schedules the |overlays|' framebuffers to be displayed on the next vsync
// event. The event will be posted on the graphics card file descriptor |fd_|
// and it can be read and processed by |drmHandleEvent|. That function can
......@@ -138,7 +136,7 @@ class HardwareDisplayController
// called again before the page flip occurrs.
//
// Returns true if the page flip was successfully registered, false otherwise.
bool SchedulePageFlip();
bool SchedulePageFlip(const OverlayPlaneList& overlays);
// TODO(dnicoara) This should be on the MessageLoop when Ozone can have
// BeginFrame can be triggered explicitly by Ozone.
......
......@@ -180,6 +180,14 @@ class SurfaceOzoneEgltest : public SurfaceOzoneEGL {
return scoped_ptr<gfx::VSyncProvider>();
}
virtual bool ScheduleOverlayPlane(int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<ui::NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) OVERRIDE {
return false;
}
private:
LibeglplatformShimLoader* eglplatform_shim_;
intptr_t native_window_;
......
......@@ -63,16 +63,6 @@ scoped_refptr<ui::NativePixmap> SurfaceFactoryOzone::CreateNativePixmap(
return NULL;
}
bool SurfaceFactoryOzone::ScheduleOverlayPlane(
gfx::AcceleratedWidget widget,
int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) {
return false;
}
bool SurfaceFactoryOzone::CanShowPrimaryPlaneAsOverlay() {
return false;
}
......
......@@ -119,24 +119,6 @@ class OZONE_BASE_EXPORT SurfaceFactoryOzone {
gfx::Size size,
BufferFormat format);
// Sets the overlay plane to switch to at the next page flip.
// |w| specifies the screen to display this overlay plane on.
// |plane_z_order| specifies the stacking order of the plane relative to the
// main framebuffer located at index 0.
// |plane_transform| specifies how the buffer is to be transformed during.
// composition.
// |buffer| to be presented by the overlay.
// |display_bounds| specify where it is supposed to be on the screen.
// |crop_rect| specifies the region within the buffer to be placed
// inside |display_bounds|. This is specified in texture coordinates, in the
// range of [0,1].
virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect);
// Returns true if overlays can be shown at z-index 0, replacing the main
// surface. Combined with surfaceless extensions, it allows for an
// overlay-only mode.
......
......@@ -44,6 +44,22 @@ class OZONE_BASE_EXPORT SurfaceOzoneEGL {
// outside of the sandbox, they must have been completed in
// InitializeHardware. Returns an empty scoped_ptr on error.
virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;
// Sets the overlay plane to switch to at the next page flip.
// |plane_z_order| specifies the stacking order of the plane relative to the
// main framebuffer located at index 0.
// |plane_transform| specifies how the buffer is to be transformed during.
// composition.
// |buffer| to be presented by the overlay.
// |display_bounds| specify where it is supposed to be on the screen.
// |crop_rect| specifies the region within the buffer to be placed
// inside |display_bounds|. This is specified in texture coordinates, in the
// range of [0,1].
virtual bool ScheduleOverlayPlane(int plane_z_order,
gfx::OverlayTransform plane_transform,
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) = 0;
};
} // namespace ui
......
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