Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: ui/ozone/platform/dri/dri_surface_factory.cc

Issue 393233005: [Ozone-DRI] Convert HardwareDisplayController to use scanout buffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.cc ('k') | ui/ozone/platform/dri/dri_surface_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/dri_surface_factory.cc
diff --git a/ui/ozone/platform/dri/dri_surface_factory.cc b/ui/ozone/platform/dri/dri_surface_factory.cc
index c5d48596fb67c29e0d114891b528a1bb36546dbf..65efc2042bd1129d80884491be505fc685f8a377 100644
--- a/ui/ozone/platform/dri/dri_surface_factory.cc
+++ b/ui/ozone/platform/dri/dri_surface_factory.cc
@@ -45,7 +45,8 @@ void UpdateCursorImage(DriBuffer* cursor, const SkBitmap& image) {
class DriSurfaceAdapter : public ui::SurfaceOzoneCanvas {
public:
- DriSurfaceAdapter(const base::WeakPtr<HardwareDisplayController>& controller);
+ DriSurfaceAdapter(DriWrapper* dri,
+ const base::WeakPtr<HardwareDisplayController>& controller);
virtual ~DriSurfaceAdapter();
// SurfaceOzoneCanvas:
@@ -57,6 +58,8 @@ class DriSurfaceAdapter : public ui::SurfaceOzoneCanvas {
private:
void UpdateNativeSurface(const gfx::Rect& damage);
+ DriWrapper* dri_;
+ scoped_ptr<DriSurface> native_surface_;
skia::RefPtr<SkSurface> surface_;
gfx::Rect last_damage_;
base::WeakPtr<HardwareDisplayController> controller_;
@@ -65,8 +68,9 @@ class DriSurfaceAdapter : public ui::SurfaceOzoneCanvas {
};
DriSurfaceAdapter::DriSurfaceAdapter(
+ DriWrapper* dri,
const base::WeakPtr<HardwareDisplayController>& controller)
- : controller_(controller) {
+ : dri_(dri), controller_(controller) {
}
DriSurfaceAdapter::~DriSurfaceAdapter() {
@@ -80,6 +84,16 @@ void DriSurfaceAdapter::ResizeCanvas(const gfx::Size& viewport_size) {
SkImageInfo info = SkImageInfo::MakeN32(
viewport_size.width(), viewport_size.height(), kOpaque_SkAlphaType);
surface_ = skia::AdoptRef(SkSurface::NewRaster(info));
+
+ if (controller_) {
+ // Need to use the mode size rather than |viewport_size| since a display
+ // cannot scanout from a buffer smaller than the mode.
+ native_surface_.reset(
+ new DriSurface(dri_,
+ gfx::Size(controller_->get_mode().hdisplay,
+ controller_->get_mode().vdisplay)));
+ CHECK(native_surface_->Initialize());
+ }
}
void DriSurfaceAdapter::PresentCanvas(const gfx::Rect& damage) {
@@ -88,8 +102,10 @@ void DriSurfaceAdapter::PresentCanvas(const gfx::Rect& damage) {
return;
UpdateNativeSurface(damage);
- controller_->SchedulePageFlip(std::vector<OzoneOverlayPlane>(), NULL);
+ controller_->SchedulePageFlip(std::vector<OverlayPlane>(
+ 1, OverlayPlane(native_surface_->backbuffer())));
controller_->WaitForPageFlipEvent();
+ native_surface_->SwapBuffers();
}
scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() {
@@ -97,8 +113,7 @@ scoped_ptr<gfx::VSyncProvider> DriSurfaceAdapter::CreateVSyncProvider() {
}
void DriSurfaceAdapter::UpdateNativeSurface(const gfx::Rect& damage) {
- SkCanvas* canvas = static_cast<DriSurface*>(controller_->surface())
- ->GetDrawableForWidget();
+ SkCanvas* canvas = native_surface_->GetDrawableForWidget();
// The DriSurface is double buffered, so the current back buffer is
// missing the previous update. Expand damage region.
@@ -175,7 +190,7 @@ scoped_ptr<ui::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget(
ResetCursor(w);
return scoped_ptr<ui::SurfaceOzoneCanvas>(
- new DriSurfaceAdapter(screen_manager_->GetDisplayController(w)));
+ new DriSurfaceAdapter(drm_, screen_manager_->GetDisplayController(w)));
}
bool DriSurfaceFactory::LoadEGLGLES2Bindings(
« no previous file with comments | « ui/ozone/platform/dri/dri_surface.cc ('k') | ui/ozone/platform/dri/dri_surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698