Commit 114c6093 authored by dnicoara@chromium.org's avatar dnicoara@chromium.org

[Ozone] Rename software implementation files to use Dri

Avoiding the DRM prefix such that it isn't confused with Digital Rights
Management.

BUG=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232930 0039d316-1c4b-4281-b951-d872f2087c98
parent 6f3a9ec0
...@@ -138,18 +138,18 @@ ...@@ -138,18 +138,18 @@
'matrix3_f.cc', 'matrix3_f.cc',
'matrix3_f.h', 'matrix3_f.h',
'native_widget_types.h', 'native_widget_types.h',
'ozone/impl/drm_skbitmap_ozone.cc', 'ozone/impl/dri_skbitmap.cc',
'ozone/impl/drm_skbitmap_ozone.h', 'ozone/impl/dri_skbitmap.h',
'ozone/impl/drm_wrapper_ozone.cc', 'ozone/impl/dri_surface.cc',
'ozone/impl/drm_wrapper_ozone.h', 'ozone/impl/dri_surface.h',
'ozone/impl/file_surface_factory_ozone.cc', 'ozone/impl/dri_surface_factory.cc',
'ozone/impl/file_surface_factory_ozone.h', 'ozone/impl/dri_surface_factory.h',
'ozone/impl/hardware_display_controller_ozone.cc', 'ozone/impl/dri_wrapper.cc',
'ozone/impl/hardware_display_controller_ozone.h', 'ozone/impl/dri_wrapper.h',
'ozone/impl/software_surface_factory_ozone.cc', 'ozone/impl/file_surface_factory.cc',
'ozone/impl/software_surface_factory_ozone.h', 'ozone/impl/file_surface_factory.h',
'ozone/impl/software_surface_ozone.cc', 'ozone/impl/hardware_display_controller.cc',
'ozone/impl/software_surface_ozone.h', 'ozone/impl/hardware_display_controller.h',
'ozone/surface_factory_ozone.cc', 'ozone/surface_factory_ozone.cc',
'ozone/surface_factory_ozone.h', 'ozone/surface_factory_ozone.h',
'pango_util.cc', 'pango_util.cc',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include <errno.h> #include <errno.h>
#include <sys/mman.h> #include <sys/mman.h>
...@@ -29,14 +29,14 @@ void DestroyDumbBuffer(int fd, uint32_t handle) { ...@@ -29,14 +29,14 @@ void DestroyDumbBuffer(int fd, uint32_t handle) {
// in the SkPixelRef. // in the SkPixelRef.
// At the end of its life the SkPixelRef is responsible for deallocating the // At the end of its life the SkPixelRef is responsible for deallocating the
// pixel memory. // pixel memory.
class DrmSkPixelRef : public SkPixelRef { class DriSkPixelRef : public SkPixelRef {
public: public:
DrmSkPixelRef(void* pixels, DriSkPixelRef(void* pixels,
SkColorTable* color_table_, SkColorTable* color_table_,
size_t size, size_t size,
int fd, int fd,
uint32_t handle); uint32_t handle);
virtual ~DrmSkPixelRef(); virtual ~DriSkPixelRef();
virtual void* onLockPixels(SkColorTable** ct) OVERRIDE; virtual void* onLockPixels(SkColorTable** ct) OVERRIDE;
virtual void onUnlockPixels() OVERRIDE; virtual void onUnlockPixels() OVERRIDE;
...@@ -59,13 +59,13 @@ class DrmSkPixelRef : public SkPixelRef { ...@@ -59,13 +59,13 @@ class DrmSkPixelRef : public SkPixelRef {
// Handle for the allocated memory. // Handle for the allocated memory.
uint32_t handle_; uint32_t handle_;
DISALLOW_COPY_AND_ASSIGN(DrmSkPixelRef); DISALLOW_COPY_AND_ASSIGN(DriSkPixelRef);
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DrmSkPixelRef implementation // DriSkPixelRef implementation
DrmSkPixelRef::DrmSkPixelRef( DriSkPixelRef::DriSkPixelRef(
void* pixels, void* pixels,
SkColorTable* color_table, SkColorTable* color_table,
size_t size, size_t size,
...@@ -78,47 +78,47 @@ DrmSkPixelRef::DrmSkPixelRef( ...@@ -78,47 +78,47 @@ DrmSkPixelRef::DrmSkPixelRef(
handle_(handle) { handle_(handle) {
} }
DrmSkPixelRef::~DrmSkPixelRef() { DriSkPixelRef::~DriSkPixelRef() {
munmap(pixels_, size_); munmap(pixels_, size_);
DestroyDumbBuffer(fd_, handle_); DestroyDumbBuffer(fd_, handle_);
} }
void* DrmSkPixelRef::onLockPixels(SkColorTable** ct) { void* DriSkPixelRef::onLockPixels(SkColorTable** ct) {
*ct = color_table_; *ct = color_table_;
return pixels_; return pixels_;
} }
void DrmSkPixelRef::onUnlockPixels() { void DriSkPixelRef::onUnlockPixels() {
} }
} // namespace } // namespace
// Allocates pixel memory for a SkBitmap using DRM dumb buffers. // Allocates pixel memory for a SkBitmap using DRM dumb buffers.
class DrmAllocator : public SkBitmap::Allocator { class DriAllocator : public SkBitmap::Allocator {
public: public:
DrmAllocator(); DriAllocator();
virtual bool allocPixelRef(SkBitmap* bitmap, virtual bool allocPixelRef(SkBitmap* bitmap,
SkColorTable* color_table) OVERRIDE; SkColorTable* color_table) OVERRIDE;
private: private:
bool AllocatePixels(DrmSkBitmapOzone* bitmap, SkColorTable* color_table); bool AllocatePixels(DriSkBitmap* bitmap, SkColorTable* color_table);
DISALLOW_COPY_AND_ASSIGN(DrmAllocator); DISALLOW_COPY_AND_ASSIGN(DriAllocator);
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DrmAllocator implementation // DriAllocator implementation
DrmAllocator::DrmAllocator() { DriAllocator::DriAllocator() {
} }
bool DrmAllocator::allocPixelRef(SkBitmap* bitmap, bool DriAllocator::allocPixelRef(SkBitmap* bitmap,
SkColorTable* color_table) { SkColorTable* color_table) {
return AllocatePixels(static_cast<DrmSkBitmapOzone*>(bitmap), color_table); return AllocatePixels(static_cast<DriSkBitmap*>(bitmap), color_table);
} }
bool DrmAllocator::AllocatePixels(DrmSkBitmapOzone* bitmap, bool DriAllocator::AllocatePixels(DriSkBitmap* bitmap,
SkColorTable* color_table) { SkColorTable* color_table) {
struct drm_mode_create_dumb request; struct drm_mode_create_dumb request;
request.width = bitmap->width(); request.width = bitmap->width();
...@@ -158,7 +158,7 @@ bool DrmAllocator::AllocatePixels(DrmSkBitmapOzone* bitmap, ...@@ -158,7 +158,7 @@ bool DrmAllocator::AllocatePixels(DrmSkBitmapOzone* bitmap,
return false; return false;
} }
bitmap->setPixelRef(new DrmSkPixelRef( bitmap->setPixelRef(new DriSkPixelRef(
pixels, pixels,
color_table, color_table,
bitmap->getSize(), bitmap->getSize(),
...@@ -170,23 +170,23 @@ bool DrmAllocator::AllocatePixels(DrmSkBitmapOzone* bitmap, ...@@ -170,23 +170,23 @@ bool DrmAllocator::AllocatePixels(DrmSkBitmapOzone* bitmap,
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DrmSkBitmapOzone implementation // DriSkBitmap implementation
DrmSkBitmapOzone::DrmSkBitmapOzone(int fd) DriSkBitmap::DriSkBitmap(int fd)
: fd_(fd), : fd_(fd),
handle_(0), handle_(0),
framebuffer_(0) { framebuffer_(0) {
} }
DrmSkBitmapOzone::~DrmSkBitmapOzone() { DriSkBitmap::~DriSkBitmap() {
} }
bool DrmSkBitmapOzone::Initialize() { bool DriSkBitmap::Initialize() {
DrmAllocator drm_allocator; DriAllocator drm_allocator;
return allocPixels(&drm_allocator, NULL); return allocPixels(&drm_allocator, NULL);
} }
uint8_t DrmSkBitmapOzone::GetColorDepth() const { uint8_t DriSkBitmap::GetColorDepth() const {
switch (config()) { switch (config()) {
case SkBitmap::kNo_Config: case SkBitmap::kNo_Config:
case SkBitmap::kA1_Config: case SkBitmap::kA1_Config:
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_DRM_SKBITMAP_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_DRI_SKBITMAP_H_
#define UI_GFX_OZONE_IMPL_DRM_SKBITMAP_OZONE_H_ #define UI_GFX_OZONE_IMPL_DRI_SKBITMAP_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
...@@ -12,12 +12,12 @@ namespace gfx { ...@@ -12,12 +12,12 @@ namespace gfx {
// Extend the SkBitmap interface to keep track of additional parameters used by // Extend the SkBitmap interface to keep track of additional parameters used by
// the DRM stack when allocating buffers. // the DRM stack when allocating buffers.
class DrmSkBitmapOzone : public SkBitmap { class DriSkBitmap : public SkBitmap {
public: public:
DrmSkBitmapOzone(int fd); DriSkBitmap(int fd);
virtual ~DrmSkBitmapOzone(); virtual ~DriSkBitmap();
// Allocates the backing pixels using DRM. // Allocates the backing pixels using DRI.
// Return true on success, false otherwise. // Return true on success, false otherwise.
virtual bool Initialize(); virtual bool Initialize();
...@@ -31,26 +31,26 @@ class DrmSkBitmapOzone : public SkBitmap { ...@@ -31,26 +31,26 @@ class DrmSkBitmapOzone : public SkBitmap {
uint8_t GetColorDepth() const; uint8_t GetColorDepth() const;
private: private:
friend class DrmAllocator; friend class DriAllocator;
friend class HardwareDisplayControllerOzone; friend class HardwareDisplayController;
void set_handle(uint32_t handle) { handle_ = handle; }; void set_handle(uint32_t handle) { handle_ = handle; };
void set_framebuffer(uint32_t framebuffer) { framebuffer_ = framebuffer; }; void set_framebuffer(uint32_t framebuffer) { framebuffer_ = framebuffer; };
// File descriptor used by the DRM allocator to request buffers from the DRM // File descriptor used by the DRI allocator to request buffers from the DRI
// stack. // stack.
int fd_; int fd_;
// Buffer handle used by the DRM allocator. // Buffer handle used by the DRI allocator.
uint32_t handle_; uint32_t handle_;
// Buffer ID used by the DRM modesettings API. This is set when the buffer is // Buffer ID used by the DRI modesettings API. This is set when the buffer is
// registered with the CRTC. // registered with the CRTC.
uint32_t framebuffer_; uint32_t framebuffer_;
DISALLOW_COPY_AND_ASSIGN(DrmSkBitmapOzone); DISALLOW_COPY_AND_ASSIGN(DriSkBitmap);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_DRM_SKBITMAP_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_DRI_SKBITMAP_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include <errno.h> #include <errno.h>
#include <sys/mman.h> #include <sys/mman.h>
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkBitmapDevice.h" #include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
namespace gfx { namespace gfx {
...@@ -38,19 +38,19 @@ class CustomSkBitmapDevice : public SkBitmapDevice { ...@@ -38,19 +38,19 @@ class CustomSkBitmapDevice : public SkBitmapDevice {
} // namespace } // namespace
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SoftwareSurfaceOzone implementation // DriSurface implementation
SoftwareSurfaceOzone::SoftwareSurfaceOzone( DriSurface::DriSurface(
HardwareDisplayControllerOzone* controller) HardwareDisplayController* controller)
: controller_(controller), : controller_(controller),
bitmaps_(), bitmaps_(),
front_buffer_(0) { front_buffer_(0) {
} }
SoftwareSurfaceOzone::~SoftwareSurfaceOzone() { DriSurface::~DriSurface() {
} }
bool SoftwareSurfaceOzone::Initialize() { bool DriSurface::Initialize() {
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
bitmaps_[i].reset(CreateBuffer()); bitmaps_[i].reset(CreateBuffer());
// TODO(dnicoara) Should select the configuration based on what the // TODO(dnicoara) Should select the configuration based on what the
...@@ -71,14 +71,14 @@ bool SoftwareSurfaceOzone::Initialize() { ...@@ -71,14 +71,14 @@ bool SoftwareSurfaceOzone::Initialize() {
return true; return true;
} }
uint32_t SoftwareSurfaceOzone::GetFramebufferId() const { uint32_t DriSurface::GetFramebufferId() const {
CHECK(bitmaps_[0].get() && bitmaps_[1].get()); CHECK(bitmaps_[0].get() && bitmaps_[1].get());
return bitmaps_[front_buffer_ ^ 1]->get_framebuffer(); return bitmaps_[front_buffer_ ^ 1]->get_framebuffer();
} }
// This call is made after the hardware just started displaying our back buffer. // This call is made after the hardware just started displaying our back buffer.
// We need to update our pointer reference and synchronize the two buffers. // We need to update our pointer reference and synchronize the two buffers.
void SoftwareSurfaceOzone::SwapBuffers() { void DriSurface::SwapBuffers() {
CHECK(bitmaps_[0].get() && bitmaps_[1].get()); CHECK(bitmaps_[0].get() && bitmaps_[1].get());
// Update our front buffer pointer. // Update our front buffer pointer.
...@@ -102,12 +102,12 @@ void SoftwareSurfaceOzone::SwapBuffers() { ...@@ -102,12 +102,12 @@ void SoftwareSurfaceOzone::SwapBuffers() {
damage); damage);
} }
SkCanvas* SoftwareSurfaceOzone::GetDrawableForWidget() { SkCanvas* DriSurface::GetDrawableForWidget() {
return skia_canvas_.get(); return skia_canvas_.get();
} }
DrmSkBitmapOzone* SoftwareSurfaceOzone::CreateBuffer() { DriSkBitmap* DriSurface::CreateBuffer() {
return new DrmSkBitmapOzone(controller_->get_fd()); return new DriSkBitmap(controller_->get_fd());
} }
} // namespace gfx } // namespace gfx
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_DRI_SURFACE_H_
#define UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_OZONE_H_ #define UI_GFX_OZONE_IMPL_DRI_SURFACE_H_
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -14,28 +14,28 @@ class SkCanvas; ...@@ -14,28 +14,28 @@ class SkCanvas;
namespace gfx { namespace gfx {
class DrmSkBitmapOzone; class DriSkBitmap;
class HardwareDisplayControllerOzone; class HardwareDisplayController;
// SoftwareSurfaceOzone is used to represent a surface that can be scanned out // DriSurface is used to represent a surface that can be scanned out
// to a monitor. It will store the internal state associated with the drawing // to a monitor. It will store the internal state associated with the drawing
// surface associated with it. SoftwareSurfaceOzone also performs all the needed // surface associated with it. DriSurface also performs all the needed
// operations to initialize and update the drawing surface. // operations to initialize and update the drawing surface.
// //
// The implementation uses dumb buffers, which is used for software rendering. // The implementation uses dumb buffers, which is used for software rendering.
// The intent is to have one SoftwareSurfaceOzone implementation for a // The intent is to have one DriSurface implementation for a
// HardwareDisplayControllerOzone. // HardwareDisplayController.
// //
// DoubleBufferedSurface is intended to be the software analog to // DoubleBufferedSurface is intended to be the software analog to
// EGLNativeSurface while SoftwareSurfaceOzone is intended to provide the glue // EGLNativeSurface while DriSurface is intended to provide the glue
// necessary to initialize and display the surface to the screen. // necessary to initialize and display the surface to the screen.
// //
// The typical usage pattern is: // The typical usage pattern is:
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// HardwareDisplayControllerOzone controller; // HardwareDisplayController controller;
// // Initialize controller // // Initialize controller
// //
// SoftwareSurfaceOzone* surface = new SoftwareSurfaceOzone(controller); // DriSurface* surface = new DriSurface(controller);
// surface.Initialize(); // surface.Initialize();
// controller.BindSurfaceToController(surface); // controller.BindSurfaceToController(surface);
// //
...@@ -116,11 +116,11 @@ class HardwareDisplayControllerOzone; ...@@ -116,11 +116,11 @@ class HardwareDisplayControllerOzone;
// to the backbuffer. // to the backbuffer.
// //
// At this point we're back to step 1 and can start a new draw iteration. // At this point we're back to step 1 and can start a new draw iteration.
class SoftwareSurfaceOzone { class DriSurface {
public: public:
SoftwareSurfaceOzone(HardwareDisplayControllerOzone* controller); DriSurface(HardwareDisplayController* controller);
virtual ~SoftwareSurfaceOzone(); virtual ~DriSurface();
// Used to allocate all necessary buffers for this surface. If the // Used to allocate all necessary buffers for this surface. If the
// initialization succeeds, the device is ready to be used for drawing // initialization succeeds, the device is ready to be used for drawing
...@@ -138,17 +138,17 @@ class SoftwareSurfaceOzone { ...@@ -138,17 +138,17 @@ class SoftwareSurfaceOzone {
SkCanvas* GetDrawableForWidget(); SkCanvas* GetDrawableForWidget();
private: private:
friend class HardwareDisplayControllerOzone; friend class HardwareDisplayController;
// Used to create the backing buffers. // Used to create the backing buffers.
virtual DrmSkBitmapOzone* CreateBuffer(); virtual DriSkBitmap* CreateBuffer();
// Stores DRM information for this output device (connector, encoder, last // Stores DRM information for this output device (connector, encoder, last
// CRTC state). // CRTC state).
HardwareDisplayControllerOzone* controller_; HardwareDisplayController* controller_;
// The actual buffers used for painting. // The actual buffers used for painting.
scoped_ptr<DrmSkBitmapOzone> bitmaps_[2]; scoped_ptr<DriSkBitmap> bitmaps_[2];
// BitmapDevice for the current backbuffer. // BitmapDevice for the current backbuffer.
skia::RefPtr<SkBitmapDevice> skia_device_; skia::RefPtr<SkBitmapDevice> skia_device_;
...@@ -159,9 +159,9 @@ class SoftwareSurfaceOzone { ...@@ -159,9 +159,9 @@ class SoftwareSurfaceOzone {
// Keeps track of which bitmap is |buffers_| is the frontbuffer. // Keeps track of which bitmap is |buffers_| is the frontbuffer.
int front_buffer_; int front_buffer_;
DISALLOW_COPY_AND_ASSIGN(SoftwareSurfaceOzone); DISALLOW_COPY_AND_ASSIGN(DriSurface);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_DRI_SURFACE_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/software_surface_factory_ozone.h" #include "ui/gfx/ozone/impl/dri_surface_factory.h"
#include <drm.h> #include <drm.h>
#include <errno.h> #include <errno.h>
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkDevice.h" #include "third_party/skia/include/core/SkDevice.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
namespace gfx { namespace gfx {
...@@ -31,7 +31,7 @@ const gfx::AcceleratedWidget kDefaultWidgetHandle = 1; ...@@ -31,7 +31,7 @@ const gfx::AcceleratedWidget kDefaultWidgetHandle = 1;
// The old frontbuffer is no longer used by the hardware and can be used for // The old frontbuffer is no longer used by the hardware and can be used for
// future draw operations. // future draw operations.
// //
// |device| will contain a reference to the |SoftwareSurfaceOzone| object which // |device| will contain a reference to the |DriSurface| object which
// the event belongs to. // the event belongs to.
// //
// TODO(dnicoara) When we have a FD handler for the DRM calls in the message // TODO(dnicoara) When we have a FD handler for the DRM calls in the message
...@@ -41,11 +41,11 @@ void HandlePageFlipEvent(int fd, ...@@ -41,11 +41,11 @@ void HandlePageFlipEvent(int fd,
unsigned int seconds, unsigned int seconds,
unsigned int useconds, unsigned int useconds,
void* controller) { void* controller) {
static_cast<HardwareDisplayControllerOzone*>(controller)->get_surface() static_cast<HardwareDisplayController*>(controller)->get_surface()
->SwapBuffers(); ->SwapBuffers();
} }
uint32_t GetDrmProperty(int fd, drmModeConnector* connector, const char* name) { uint32_t GetDriProperty(int fd, drmModeConnector* connector, const char* name) {
for (int i = 0; i < connector->count_props; ++i) { for (int i = 0; i < connector->count_props; ++i) {
drmModePropertyPtr property = drmModeGetProperty(fd, connector->props[i]); drmModePropertyPtr property = drmModeGetProperty(fd, connector->props[i]);
if (!property) if (!property)
...@@ -97,19 +97,19 @@ uint32_t GetCrtc(int fd, drmModeRes* resources, drmModeConnector* connector) { ...@@ -97,19 +97,19 @@ uint32_t GetCrtc(int fd, drmModeRes* resources, drmModeConnector* connector) {
} // namespace } // namespace
SoftwareSurfaceFactoryOzone::SoftwareSurfaceFactoryOzone() DriSurfaceFactory::DriSurfaceFactory()
: drm_(), : drm_(),
state_(UNINITIALIZED), state_(UNINITIALIZED),
controller_() { controller_() {
} }
SoftwareSurfaceFactoryOzone::~SoftwareSurfaceFactoryOzone() { DriSurfaceFactory::~DriSurfaceFactory() {
if (state_ == INITIALIZED) if (state_ == INITIALIZED)
ShutdownHardware(); ShutdownHardware();
} }
SurfaceFactoryOzone::HardwareState SurfaceFactoryOzone::HardwareState
SoftwareSurfaceFactoryOzone::InitializeHardware() { DriSurfaceFactory::InitializeHardware() {
CHECK(state_ == UNINITIALIZED); CHECK(state_ == UNINITIALIZED);
// TODO(dnicoara): Short-cut right now. What we want is to look at all the // TODO(dnicoara): Short-cut right now. What we want is to look at all the
...@@ -126,7 +126,7 @@ SoftwareSurfaceFactoryOzone::InitializeHardware() { ...@@ -126,7 +126,7 @@ SoftwareSurfaceFactoryOzone::InitializeHardware() {
return state_; return state_;
} }
void SoftwareSurfaceFactoryOzone::ShutdownHardware() { void DriSurfaceFactory::ShutdownHardware() {
CHECK(state_ == INITIALIZED); CHECK(state_ == INITIALIZED);
controller_.reset(); controller_.reset();
...@@ -135,14 +135,14 @@ void SoftwareSurfaceFactoryOzone::ShutdownHardware() { ...@@ -135,14 +135,14 @@ void SoftwareSurfaceFactoryOzone::ShutdownHardware() {
state_ = UNINITIALIZED; state_ = UNINITIALIZED;
} }
gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::GetAcceleratedWidget() { gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() {
CHECK(state_ != FAILED); CHECK(state_ != FAILED);
// TODO(dnicoara) When there's more information on which display we want, // TODO(dnicoara) When there's more information on which display we want,
// then we can return the widget associated with the display. // then we can return the widget associated with the display.
// For now just assume we have 1 display device and return it. // For now just assume we have 1 display device and return it.
if (!controller_.get()) if (!controller_.get())
controller_.reset(new HardwareDisplayControllerOzone()); controller_.reset(new HardwareDisplayController());
// TODO(dnicoara) We only have 1 display for now, so only 1 AcceleratedWidget. // TODO(dnicoara) We only have 1 display for now, so only 1 AcceleratedWidget.
// When we'll support multiple displays this needs to be changed to return a // When we'll support multiple displays this needs to be changed to return a
...@@ -150,7 +150,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::GetAcceleratedWidget() { ...@@ -150,7 +150,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::GetAcceleratedWidget() {
return kDefaultWidgetHandle; return kDefaultWidgetHandle;
} }
gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget( gfx::AcceleratedWidget DriSurfaceFactory::RealizeAcceleratedWidget(
gfx::AcceleratedWidget w) { gfx::AcceleratedWidget w) {
CHECK(state_ == INITIALIZED); CHECK(state_ == INITIALIZED);
// TODO(dnicoara) Once we can handle multiple displays this needs to be // TODO(dnicoara) Once we can handle multiple displays this needs to be
...@@ -158,7 +158,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget( ...@@ -158,7 +158,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget(
CHECK(w == kDefaultWidgetHandle); CHECK(w == kDefaultWidgetHandle);
CHECK(controller_->get_state() == CHECK(controller_->get_state() ==
HardwareDisplayControllerOzone::UNASSOCIATED); HardwareDisplayController::UNASSOCIATED);
// Until now the controller is just a stub. Initializing it will link it to a // Until now the controller is just a stub. Initializing it will link it to a
// hardware display. // hardware display.
...@@ -168,7 +168,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget( ...@@ -168,7 +168,7 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget(
} }
// Create a surface suitable for the current controller. // Create a surface suitable for the current controller.
scoped_ptr<SoftwareSurfaceOzone> surface(CreateSurface(controller_.get())); scoped_ptr<DriSurface> surface(CreateSurface(controller_.get()));
if (!surface->Initialize()) { if (!surface->Initialize()) {
LOG(ERROR) << "Failed to initialize surface"; LOG(ERROR) << "Failed to initialize surface";
...@@ -186,19 +186,19 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget( ...@@ -186,19 +186,19 @@ gfx::AcceleratedWidget SoftwareSurfaceFactoryOzone::RealizeAcceleratedWidget(
return reinterpret_cast<gfx::AcceleratedWidget>(controller_->get_surface()); return reinterpret_cast<gfx::AcceleratedWidget>(controller_->get_surface());
} }
bool SoftwareSurfaceFactoryOzone::LoadEGLGLES2Bindings( bool DriSurfaceFactory::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library, AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) { SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
return false; return false;
} }
bool SoftwareSurfaceFactoryOzone::AttemptToResizeAcceleratedWidget( bool DriSurfaceFactory::AttemptToResizeAcceleratedWidget(
gfx::AcceleratedWidget w, gfx::AcceleratedWidget w,
const gfx::Rect& bounds) { const gfx::Rect& bounds) {
return false; return false;
} }
bool SoftwareSurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) { bool DriSurfaceFactory::SchedulePageFlip(gfx::AcceleratedWidget w) {
CHECK(state_ == INITIALIZED); CHECK(state_ == INITIALIZED);
// TODO(dnicoara) Change this CHECK once we're running with the threaded // TODO(dnicoara) Change this CHECK once we're running with the threaded
// compositor. // compositor.
...@@ -218,7 +218,7 @@ bool SoftwareSurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) { ...@@ -218,7 +218,7 @@ bool SoftwareSurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) {
// wait should happen in the message loop. The message loop would then // wait should happen in the message loop. The message loop would then
// schedule the next draw event. Alternatively, the VSyncProvider could be // schedule the next draw event. Alternatively, the VSyncProvider could be
// used to schedule the next draw. Unfortunately, at this point, // used to schedule the next draw. Unfortunately, at this point,
// SoftwareOutputDevice does not provide any means to use any of the above // DriOutputDevice does not provide any means to use any of the above
// solutions. Note that if the DRM callback does not schedule the next draw, // solutions. Note that if the DRM callback does not schedule the next draw,
// then some sort of synchronization needs to take place since starting a new // then some sort of synchronization needs to take place since starting a new
// draw before the page flip happened is considered an error. However we can // draw before the page flip happened is considered an error. However we can
...@@ -230,32 +230,32 @@ bool SoftwareSurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) { ...@@ -230,32 +230,32 @@ bool SoftwareSurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget w) {
return true; return true;
} }
SkCanvas* SoftwareSurfaceFactoryOzone::GetCanvasForWidget( SkCanvas* DriSurfaceFactory::GetCanvasForWidget(
gfx::AcceleratedWidget w) { gfx::AcceleratedWidget w) {
CHECK(state_ == INITIALIZED); CHECK(state_ == INITIALIZED);
return reinterpret_cast<SoftwareSurfaceOzone*>(w)->GetDrawableForWidget(); return reinterpret_cast<DriSurface*>(w)->GetDrawableForWidget();
} }
gfx::VSyncProvider* SoftwareSurfaceFactoryOzone::GetVSyncProvider( gfx::VSyncProvider* DriSurfaceFactory::GetVSyncProvider(
gfx::AcceleratedWidget w) { gfx::AcceleratedWidget w) {
return NULL; return NULL;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// SoftwareSurfaceFactoryOzone private // DriSurfaceFactory private
SoftwareSurfaceOzone* SoftwareSurfaceFactoryOzone::CreateSurface( DriSurface* DriSurfaceFactory::CreateSurface(
HardwareDisplayControllerOzone* controller) { HardwareDisplayController* controller) {
return new SoftwareSurfaceOzone(controller); return new DriSurface(controller);
} }
DrmWrapperOzone* SoftwareSurfaceFactoryOzone::CreateWrapper() { DriWrapper* DriSurfaceFactory::CreateWrapper() {
return new DrmWrapperOzone(kDefaultGraphicsCardPath); return new DriWrapper(kDefaultGraphicsCardPath);
} }
bool SoftwareSurfaceFactoryOzone::InitializeControllerForPrimaryDisplay( bool DriSurfaceFactory::InitializeControllerForPrimaryDisplay(
DrmWrapperOzone* drm, DriWrapper* drm,
HardwareDisplayControllerOzone* controller) { HardwareDisplayController* controller) {
CHECK(state_ == SurfaceFactoryOzone::INITIALIZED); CHECK(state_ == SurfaceFactoryOzone::INITIALIZED);
drmModeRes* resources = drmModeGetResources(drm->get_fd()); drmModeRes* resources = drmModeGetResources(drm->get_fd());
...@@ -280,7 +280,7 @@ bool SoftwareSurfaceFactoryOzone::InitializeControllerForPrimaryDisplay( ...@@ -280,7 +280,7 @@ bool SoftwareSurfaceFactoryOzone::InitializeControllerForPrimaryDisplay(
if (!crtc) if (!crtc)
continue; continue;
uint32_t dpms_property_id = GetDrmProperty(drm->get_fd(), uint32_t dpms_property_id = GetDriProperty(drm->get_fd(),
connector, connector,
kDPMSProperty); kDPMSProperty);
...@@ -302,7 +302,7 @@ bool SoftwareSurfaceFactoryOzone::InitializeControllerForPrimaryDisplay( ...@@ -302,7 +302,7 @@ bool SoftwareSurfaceFactoryOzone::InitializeControllerForPrimaryDisplay(
return false; return false;
} }
void SoftwareSurfaceFactoryOzone::WaitForPageFlipEvent(int fd) { void DriSurfaceFactory::WaitForPageFlipEvent(int fd) {
drmEventContext drm_event; drmEventContext drm_event;
drm_event.version = DRM_EVENT_CONTEXT_VERSION; drm_event.version = DRM_EVENT_CONTEXT_VERSION;
drm_event.page_flip_handler = HandlePageFlipEvent; drm_event.page_flip_handler = HandlePageFlipEvent;
......
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_DRI_SURFACE_FACTORY_H_
#define UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_ #define UI_GFX_OZONE_IMPL_DRI_SURFACE_FACTORY_H_
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/gfx/ozone/surface_factory_ozone.h" #include "ui/gfx/ozone/surface_factory_ozone.h"
namespace gfx { namespace gfx {
class DrmWrapperOzone; class DriSurface;
class HardwareDisplayControllerOzone; class DriWrapper;
class SoftwareSurfaceOzone; class HardwareDisplayController;
// SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers. // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers.
// This implementation is used in conjunction with the software rendering // This implementation is used in conjunction with the software rendering
// path. // path.
class SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone { class DriSurfaceFactory : public SurfaceFactoryOzone {
public: public:
SoftwareSurfaceFactoryOzone(); DriSurfaceFactory();
virtual ~SoftwareSurfaceFactoryOzone(); virtual ~DriSurfaceFactory();
virtual HardwareState InitializeHardware() OVERRIDE; virtual HardwareState InitializeHardware() OVERRIDE;
virtual void ShutdownHardware() OVERRIDE; virtual void ShutdownHardware() OVERRIDE;
...@@ -45,14 +45,14 @@ class SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone { ...@@ -45,14 +45,14 @@ class SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone {
gfx::AcceleratedWidget w) OVERRIDE; gfx::AcceleratedWidget w) OVERRIDE;
private: private:
virtual SoftwareSurfaceOzone* CreateSurface( virtual DriSurface* CreateSurface(
HardwareDisplayControllerOzone* controller); HardwareDisplayController* controller);
virtual DrmWrapperOzone* CreateWrapper(); virtual DriWrapper* CreateWrapper();
virtual bool InitializeControllerForPrimaryDisplay( virtual bool InitializeControllerForPrimaryDisplay(
DrmWrapperOzone* drm, DriWrapper* drm,
HardwareDisplayControllerOzone* controller); HardwareDisplayController* controller);
// Blocks until a DRM event is read. // Blocks until a DRM event is read.
// TODO(dnicoara) Remove once we can safely move DRM event processing in the // TODO(dnicoara) Remove once we can safely move DRM event processing in the
...@@ -60,17 +60,17 @@ class SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone { ...@@ -60,17 +60,17 @@ class SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone {
// pending frame. // pending frame.
virtual void WaitForPageFlipEvent(int fd); virtual void WaitForPageFlipEvent(int fd);
scoped_ptr<DrmWrapperOzone> drm_; scoped_ptr<DriWrapper> drm_;
HardwareState state_; HardwareState state_;
// Active output. // Active output.
scoped_ptr<HardwareDisplayControllerOzone> controller_; scoped_ptr<HardwareDisplayController> controller_;
DISALLOW_COPY_AND_ASSIGN(SoftwareSurfaceFactoryOzone); DISALLOW_COPY_AND_ASSIGN(DriSurfaceFactory);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_DRI_SURFACE_FACTORY_H_
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/dri_surface_factory.h"
#include "ui/gfx/ozone/impl/software_surface_factory_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
#include "ui/gfx/ozone/surface_factory_ozone.h" #include "ui/gfx/ozone/surface_factory_ozone.h"
namespace { namespace {
...@@ -30,16 +30,16 @@ const uint32_t kDPMSPropertyId = 1; ...@@ -30,16 +30,16 @@ const uint32_t kDPMSPropertyId = 1;
const gfx::AcceleratedWidget kDefaultWidgetHandle = 1; const gfx::AcceleratedWidget kDefaultWidgetHandle = 1;
// The real DrmWrapper makes actual DRM calls which we can't use in unit tests. // The real DriWrapper makes actual DRM calls which we can't use in unit tests.
class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { class MockDriWrapper : public gfx::DriWrapper {
public: public:
MockDrmWrapperOzone(int fd) : DrmWrapperOzone(""), MockDriWrapper(int fd) : DriWrapper(""),
add_framebuffer_expectation_(true), add_framebuffer_expectation_(true),
page_flip_expectation_(true) { page_flip_expectation_(true) {
fd_ = fd; fd_ = fd;
} }
virtual ~MockDrmWrapperOzone() { fd_ = -1; } virtual ~MockDriWrapper() { fd_ = -1; }
virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE { virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE {
return new drmModeCrtc; return new drmModeCrtc;
...@@ -74,7 +74,7 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { ...@@ -74,7 +74,7 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone {
virtual bool PageFlip(uint32_t crtc_id, virtual bool PageFlip(uint32_t crtc_id,
uint32_t framebuffer, uint32_t framebuffer,
void* data) OVERRIDE { void* data) OVERRIDE {
static_cast<gfx::HardwareDisplayControllerOzone*>(data)->get_surface() static_cast<gfx::HardwareDisplayController*>(data)->get_surface()
->SwapBuffers(); ->SwapBuffers();
return page_flip_expectation_; return page_flip_expectation_;
} }
...@@ -95,13 +95,13 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { ...@@ -95,13 +95,13 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone {
bool add_framebuffer_expectation_; bool add_framebuffer_expectation_;
bool page_flip_expectation_; bool page_flip_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockDrmWrapperOzone); DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
}; };
class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone { class MockDriSkBitmap : public gfx::DriSkBitmap {
public: public:
MockDrmSkBitmapOzone() : DrmSkBitmapOzone(kFd) {} MockDriSkBitmap() : DriSkBitmap(kFd) {}
virtual ~MockDrmSkBitmapOzone() {} virtual ~MockDriSkBitmap() {}
virtual bool Initialize() OVERRIDE { virtual bool Initialize() OVERRIDE {
allocPixels(); allocPixels();
...@@ -110,36 +110,36 @@ class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone { ...@@ -110,36 +110,36 @@ class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone {
} }
private: private:
DISALLOW_COPY_AND_ASSIGN(MockDrmSkBitmapOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSkBitmap);
}; };
class MockSoftwareSurfaceOzone : public gfx::SoftwareSurfaceOzone { class MockDriSurface : public gfx::DriSurface {
public: public:
MockSoftwareSurfaceOzone(gfx::HardwareDisplayControllerOzone* controller) MockDriSurface(gfx::HardwareDisplayController* controller)
: SoftwareSurfaceOzone(controller) {} : DriSurface(controller) {}
virtual ~MockSoftwareSurfaceOzone() {} virtual ~MockDriSurface() {}
private: private:
virtual gfx::DrmSkBitmapOzone* CreateBuffer() OVERRIDE { virtual gfx::DriSkBitmap* CreateBuffer() OVERRIDE {
return new MockDrmSkBitmapOzone(); return new MockDriSkBitmap();
} }
DISALLOW_COPY_AND_ASSIGN(MockSoftwareSurfaceOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSurface);
}; };
// SSFO would normally allocate DRM resources. We can't rely on having a DRM // SSFO would normally allocate DRM resources. We can't rely on having a DRM
// backend to allocate and display our buffers. Thus, we replace these // backend to allocate and display our buffers. Thus, we replace these
// resources with stubs. For DRM calls, we simply use stubs that do nothing and // resources with stubs. For DRM calls, we simply use stubs that do nothing and
// for buffers we use the default SkBitmap allocator. // for buffers we use the default SkBitmap allocator.
class MockSoftwareSurfaceFactoryOzone class MockDriSurfaceFactory
: public gfx::SoftwareSurfaceFactoryOzone { : public gfx::DriSurfaceFactory {
public: public:
MockSoftwareSurfaceFactoryOzone() MockDriSurfaceFactory()
: SoftwareSurfaceFactoryOzone(), : DriSurfaceFactory(),
mock_drm_(NULL), mock_drm_(NULL),
drm_wrapper_expectation_(true), drm_wrapper_expectation_(true),
initialize_controller_expectation_(true) {} initialize_controller_expectation_(true) {}
virtual ~MockSoftwareSurfaceFactoryOzone() {}; virtual ~MockDriSurfaceFactory() {};
void set_drm_wrapper_expectation(bool state) { void set_drm_wrapper_expectation(bool state) {
drm_wrapper_expectation_ = state; drm_wrapper_expectation_ = state;
...@@ -149,21 +149,21 @@ class MockSoftwareSurfaceFactoryOzone ...@@ -149,21 +149,21 @@ class MockSoftwareSurfaceFactoryOzone
initialize_controller_expectation_ = state; initialize_controller_expectation_ = state;
} }
MockDrmWrapperOzone* get_drm() const { MockDriWrapper* get_drm() const {
return mock_drm_; return mock_drm_;
} }
private: private:
virtual gfx::SoftwareSurfaceOzone* CreateSurface( virtual gfx::DriSurface* CreateSurface(
gfx::HardwareDisplayControllerOzone* controller) OVERRIDE { gfx::HardwareDisplayController* controller) OVERRIDE {
return new MockSoftwareSurfaceOzone(controller); return new MockDriSurface(controller);
} }
virtual gfx::DrmWrapperOzone* CreateWrapper() OVERRIDE { virtual gfx::DriWrapper* CreateWrapper() OVERRIDE {
if (drm_wrapper_expectation_) if (drm_wrapper_expectation_)
mock_drm_ = new MockDrmWrapperOzone(kFd); mock_drm_ = new MockDriWrapper(kFd);
else else
mock_drm_ = new MockDrmWrapperOzone(-1); mock_drm_ = new MockDriWrapper(-1);
return mock_drm_; return mock_drm_;
} }
...@@ -171,8 +171,8 @@ class MockSoftwareSurfaceFactoryOzone ...@@ -171,8 +171,8 @@ class MockSoftwareSurfaceFactoryOzone
// Normally we'd use DRM to figure out the controller configuration. But we // Normally we'd use DRM to figure out the controller configuration. But we
// can't use DRM in unit tests, so we just create a fake configuration. // can't use DRM in unit tests, so we just create a fake configuration.
virtual bool InitializeControllerForPrimaryDisplay( virtual bool InitializeControllerForPrimaryDisplay(
gfx::DrmWrapperOzone* drm, gfx::DriWrapper* drm,
gfx::HardwareDisplayControllerOzone* controller) OVERRIDE { gfx::HardwareDisplayController* controller) OVERRIDE {
if (initialize_controller_expectation_) { if (initialize_controller_expectation_) {
controller->SetControllerInfo(drm, controller->SetControllerInfo(drm,
kConnectorId, kConnectorId,
...@@ -187,51 +187,51 @@ class MockSoftwareSurfaceFactoryOzone ...@@ -187,51 +187,51 @@ class MockSoftwareSurfaceFactoryOzone
virtual void WaitForPageFlipEvent(int fd) OVERRIDE {} virtual void WaitForPageFlipEvent(int fd) OVERRIDE {}
MockDrmWrapperOzone* mock_drm_; MockDriWrapper* mock_drm_;
bool drm_wrapper_expectation_; bool drm_wrapper_expectation_;
bool initialize_controller_expectation_; bool initialize_controller_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockSoftwareSurfaceFactoryOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSurfaceFactory);
}; };
} // namespace } // namespace
class SoftwareSurfaceFactoryOzoneTest : public testing::Test { class DriSurfaceFactoryTest : public testing::Test {
public: public:
SoftwareSurfaceFactoryOzoneTest() {} DriSurfaceFactoryTest() {}
virtual void SetUp() OVERRIDE; virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE; virtual void TearDown() OVERRIDE;
protected: protected:
scoped_ptr<base::MessageLoop> message_loop_; scoped_ptr<base::MessageLoop> message_loop_;
scoped_ptr<MockSoftwareSurfaceFactoryOzone> factory_; scoped_ptr<MockDriSurfaceFactory> factory_;
private: private:
DISALLOW_COPY_AND_ASSIGN(SoftwareSurfaceFactoryOzoneTest); DISALLOW_COPY_AND_ASSIGN(DriSurfaceFactoryTest);
}; };
void SoftwareSurfaceFactoryOzoneTest::SetUp() { void DriSurfaceFactoryTest::SetUp() {
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
factory_.reset(new MockSoftwareSurfaceFactoryOzone()); factory_.reset(new MockDriSurfaceFactory());
} }
void SoftwareSurfaceFactoryOzoneTest::TearDown() { void DriSurfaceFactoryTest::TearDown() {
factory_.reset(); factory_.reset();
message_loop_.reset(); message_loop_.reset();
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, FailInitialization) { TEST_F(DriSurfaceFactoryTest, FailInitialization) {
factory_->set_drm_wrapper_expectation(false); factory_->set_drm_wrapper_expectation(false);
EXPECT_EQ(gfx::SurfaceFactoryOzone::FAILED, factory_->InitializeHardware()); EXPECT_EQ(gfx::SurfaceFactoryOzone::FAILED, factory_->InitializeHardware());
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, SuccessfulInitialization) { TEST_F(DriSurfaceFactoryTest, SuccessfulInitialization) {
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
factory_->InitializeHardware()); factory_->InitializeHardware());
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSurfaceInitialization) { TEST_F(DriSurfaceFactoryTest, FailSurfaceInitialization) {
factory_->set_initialize_controller_expectation(false); factory_->set_initialize_controller_expectation(false);
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
...@@ -243,7 +243,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSurfaceInitialization) { ...@@ -243,7 +243,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSurfaceInitialization) {
EXPECT_EQ(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w)); EXPECT_EQ(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w));
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, FailBindingSurfaceToController) { TEST_F(DriSurfaceFactoryTest, FailBindingSurfaceToController) {
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
factory_->InitializeHardware()); factory_->InitializeHardware());
...@@ -255,7 +255,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailBindingSurfaceToController) { ...@@ -255,7 +255,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailBindingSurfaceToController) {
EXPECT_EQ(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w)); EXPECT_EQ(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w));
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, SuccessfulWidgetRealization) { TEST_F(DriSurfaceFactoryTest, SuccessfulWidgetRealization) {
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
factory_->InitializeHardware()); factory_->InitializeHardware());
...@@ -265,7 +265,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, SuccessfulWidgetRealization) { ...@@ -265,7 +265,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, SuccessfulWidgetRealization) {
EXPECT_NE(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w)); EXPECT_NE(gfx::kNullAcceleratedWidget, factory_->RealizeAcceleratedWidget(w));
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSchedulePageFlip) { TEST_F(DriSurfaceFactoryTest, FailSchedulePageFlip) {
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
factory_->InitializeHardware()); factory_->InitializeHardware());
...@@ -279,7 +279,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSchedulePageFlip) { ...@@ -279,7 +279,7 @@ TEST_F(SoftwareSurfaceFactoryOzoneTest, FailSchedulePageFlip) {
EXPECT_FALSE(factory_->SchedulePageFlip(w)); EXPECT_FALSE(factory_->SchedulePageFlip(w));
} }
TEST_F(SoftwareSurfaceFactoryOzoneTest, SuccessfulSchedulePageFlip) { TEST_F(DriSurfaceFactoryTest, SuccessfulSchedulePageFlip) {
EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED, EXPECT_EQ(gfx::SurfaceFactoryOzone::INITIALIZED,
factory_->InitializeHardware()); factory_->InitializeHardware());
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkDevice.h" #include "third_party/skia/include/core/SkDevice.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
namespace { namespace {
...@@ -28,10 +28,10 @@ const uint32_t kCrtcId = 1; ...@@ -28,10 +28,10 @@ const uint32_t kCrtcId = 1;
// Mock DPMS property ID. // Mock DPMS property ID.
const uint32_t kDPMSPropertyId = 1; const uint32_t kDPMSPropertyId = 1;
class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { class MockDriWrapper : public gfx::DriWrapper {
public: public:
MockDrmWrapperOzone() : DrmWrapperOzone(""), id_(1) { fd_ = kFd; } MockDriWrapper() : DriWrapper(""), id_(1) { fd_ = kFd; }
virtual ~MockDrmWrapperOzone() { fd_ = -1; } virtual ~MockDriWrapper() { fd_ = -1; }
virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE { return NULL; } virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE { return NULL; }
virtual void FreeCrtc(drmModeCrtc* crtc) OVERRIDE {} virtual void FreeCrtc(drmModeCrtc* crtc) OVERRIDE {}
...@@ -63,16 +63,16 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { ...@@ -63,16 +63,16 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone {
private: private:
int id_; int id_;
DISALLOW_COPY_AND_ASSIGN(MockDrmWrapperOzone); DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
}; };
class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone { class MockDriSkBitmap : public gfx::DriSkBitmap {
public: public:
MockDrmSkBitmapOzone(int fd, MockDriSkBitmap(int fd,
bool initialize_expectation) bool initialize_expectation)
: DrmSkBitmapOzone(fd), : DriSkBitmap(fd),
initialize_expectation_(initialize_expectation) {} initialize_expectation_(initialize_expectation) {}
virtual ~MockDrmSkBitmapOzone() {} virtual ~MockDriSkBitmap() {}
virtual bool Initialize() OVERRIDE { virtual bool Initialize() OVERRIDE {
if (!initialize_expectation_) if (!initialize_expectation_)
...@@ -87,76 +87,76 @@ class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone { ...@@ -87,76 +87,76 @@ class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone {
private: private:
bool initialize_expectation_; bool initialize_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockDrmSkBitmapOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSkBitmap);
}; };
class MockSoftwareSurfaceOzone : public gfx::SoftwareSurfaceOzone { class MockDriSurface : public gfx::DriSurface {
public: public:
MockSoftwareSurfaceOzone(gfx::HardwareDisplayControllerOzone* controller) MockDriSurface(gfx::HardwareDisplayController* controller)
: SoftwareSurfaceOzone(controller), : DriSurface(controller),
initialize_expectation_(true) {} initialize_expectation_(true) {}
virtual ~MockSoftwareSurfaceOzone() {} virtual ~MockDriSurface() {}
void set_initialize_expectation(bool state) { void set_initialize_expectation(bool state) {
initialize_expectation_ = state; initialize_expectation_ = state;
} }
private: private:
virtual gfx::DrmSkBitmapOzone* CreateBuffer() OVERRIDE { virtual gfx::DriSkBitmap* CreateBuffer() OVERRIDE {
return new MockDrmSkBitmapOzone(kFd, initialize_expectation_); return new MockDriSkBitmap(kFd, initialize_expectation_);
} }
bool initialize_expectation_; bool initialize_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockSoftwareSurfaceOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSurface);
}; };
} // namespace } // namespace
class SoftwareSurfaceOzoneTest : public testing::Test { class DriSurfaceTest : public testing::Test {
public: public:
SoftwareSurfaceOzoneTest() {} DriSurfaceTest() {}
virtual void SetUp() OVERRIDE; virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE; virtual void TearDown() OVERRIDE;
protected: protected:
scoped_ptr<MockDrmWrapperOzone> drm_; scoped_ptr<MockDriWrapper> drm_;
scoped_ptr<gfx::HardwareDisplayControllerOzone> controller_; scoped_ptr<gfx::HardwareDisplayController> controller_;
scoped_ptr<MockSoftwareSurfaceOzone> surface_; scoped_ptr<MockDriSurface> surface_;
private: private:
DISALLOW_COPY_AND_ASSIGN(SoftwareSurfaceOzoneTest); DISALLOW_COPY_AND_ASSIGN(DriSurfaceTest);
}; };
void SoftwareSurfaceOzoneTest::SetUp() { void DriSurfaceTest::SetUp() {
drm_.reset(new MockDrmWrapperOzone()); drm_.reset(new MockDriWrapper());
controller_.reset(new gfx::HardwareDisplayControllerOzone()); controller_.reset(new gfx::HardwareDisplayController());
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
surface_.reset(new MockSoftwareSurfaceOzone(controller_.get())); surface_.reset(new MockDriSurface(controller_.get()));
} }
void SoftwareSurfaceOzoneTest::TearDown() { void DriSurfaceTest::TearDown() {
surface_.reset(); surface_.reset();
controller_.reset(); controller_.reset();
drm_.reset(); drm_.reset();
} }
TEST_F(SoftwareSurfaceOzoneTest, FailInitialization) { TEST_F(DriSurfaceTest, FailInitialization) {
surface_->set_initialize_expectation(false); surface_->set_initialize_expectation(false);
EXPECT_FALSE(surface_->Initialize()); EXPECT_FALSE(surface_->Initialize());
} }
TEST_F(SoftwareSurfaceOzoneTest, SuccessfulInitialization) { TEST_F(DriSurfaceTest, SuccessfulInitialization) {
EXPECT_TRUE(surface_->Initialize()); EXPECT_TRUE(surface_->Initialize());
} }
TEST_F(SoftwareSurfaceOzoneTest, CheckFBIDOnSwap) { TEST_F(DriSurfaceTest, CheckFBIDOnSwap) {
EXPECT_TRUE(surface_->Initialize()); EXPECT_TRUE(surface_->Initialize());
controller_->BindSurfaceToController( controller_->BindSurfaceToController(
surface_.PassAs<gfx::SoftwareSurfaceOzone>()); surface_.PassAs<gfx::DriSurface>());
// Check that the framebuffer ID is correct. // Check that the framebuffer ID is correct.
EXPECT_EQ(2u, controller_->get_surface()->GetFramebufferId()); EXPECT_EQ(2u, controller_->get_surface()->GetFramebufferId());
...@@ -166,7 +166,7 @@ TEST_F(SoftwareSurfaceOzoneTest, CheckFBIDOnSwap) { ...@@ -166,7 +166,7 @@ TEST_F(SoftwareSurfaceOzoneTest, CheckFBIDOnSwap) {
EXPECT_EQ(1u, controller_->get_surface()->GetFramebufferId()); EXPECT_EQ(1u, controller_->get_surface()->GetFramebufferId());
} }
TEST_F(SoftwareSurfaceOzoneTest, CheckPixelPointerOnSwap) { TEST_F(DriSurfaceTest, CheckPixelPointerOnSwap) {
EXPECT_TRUE(surface_->Initialize()); EXPECT_TRUE(surface_->Initialize());
void* bitmap_pixels1 = surface_->GetDrawableForWidget()->getDevice() void* bitmap_pixels1 = surface_->GetDrawableForWidget()->getDevice()
...@@ -182,7 +182,7 @@ TEST_F(SoftwareSurfaceOzoneTest, CheckPixelPointerOnSwap) { ...@@ -182,7 +182,7 @@ TEST_F(SoftwareSurfaceOzoneTest, CheckPixelPointerOnSwap) {
EXPECT_NE(bitmap_pixels1, bitmap_pixels2); EXPECT_NE(bitmap_pixels1, bitmap_pixels2);
} }
TEST_F(SoftwareSurfaceOzoneTest, CheckCorrectBufferSync) { TEST_F(DriSurfaceTest, CheckCorrectBufferSync) {
EXPECT_TRUE(surface_->Initialize()); EXPECT_TRUE(surface_->Initialize());
SkCanvas* canvas = surface_->GetDrawableForWidget(); SkCanvas* canvas = surface_->GetDrawableForWidget();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
...@@ -12,25 +12,25 @@ ...@@ -12,25 +12,25 @@
namespace gfx { namespace gfx {
DrmWrapperOzone::DrmWrapperOzone(const char* device_path) { DriWrapper::DriWrapper(const char* device_path) {
fd_ = open(device_path, O_RDWR | O_CLOEXEC); fd_ = open(device_path, O_RDWR | O_CLOEXEC);
} }
DrmWrapperOzone::~DrmWrapperOzone() { DriWrapper::~DriWrapper() {
if (fd_ >= 0) if (fd_ >= 0)
close(fd_); close(fd_);
} }
drmModeCrtc* DrmWrapperOzone::GetCrtc(uint32_t crtc_id) { drmModeCrtc* DriWrapper::GetCrtc(uint32_t crtc_id) {
CHECK(fd_ >= 0); CHECK(fd_ >= 0);
return drmModeGetCrtc(fd_, crtc_id); return drmModeGetCrtc(fd_, crtc_id);
} }
void DrmWrapperOzone::FreeCrtc(drmModeCrtc* crtc) { void DriWrapper::FreeCrtc(drmModeCrtc* crtc) {
drmModeFreeCrtc(crtc); drmModeFreeCrtc(crtc);
} }
bool DrmWrapperOzone::SetCrtc(uint32_t crtc_id, bool DriWrapper::SetCrtc(uint32_t crtc_id,
uint32_t framebuffer, uint32_t framebuffer,
uint32_t* connectors, uint32_t* connectors,
drmModeModeInfo* mode) { drmModeModeInfo* mode) {
...@@ -38,7 +38,7 @@ bool DrmWrapperOzone::SetCrtc(uint32_t crtc_id, ...@@ -38,7 +38,7 @@ bool DrmWrapperOzone::SetCrtc(uint32_t crtc_id,
return !drmModeSetCrtc(fd_, crtc_id, framebuffer, 0, 0, connectors, 1, mode); return !drmModeSetCrtc(fd_, crtc_id, framebuffer, 0, 0, connectors, 1, mode);
} }
bool DrmWrapperOzone::SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) { bool DriWrapper::SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) {
CHECK(fd_ >= 0); CHECK(fd_ >= 0);
return !drmModeSetCrtc(fd_, return !drmModeSetCrtc(fd_,
crtc->crtc_id, crtc->crtc_id,
...@@ -50,7 +50,7 @@ bool DrmWrapperOzone::SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) { ...@@ -50,7 +50,7 @@ bool DrmWrapperOzone::SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) {
&crtc->mode); &crtc->mode);
} }
bool DrmWrapperOzone::AddFramebuffer(const drmModeModeInfo& mode, bool DriWrapper::AddFramebuffer(const drmModeModeInfo& mode,
uint8_t depth, uint8_t depth,
uint8_t bpp, uint8_t bpp,
uint32_t stride, uint32_t stride,
...@@ -67,12 +67,12 @@ bool DrmWrapperOzone::AddFramebuffer(const drmModeModeInfo& mode, ...@@ -67,12 +67,12 @@ bool DrmWrapperOzone::AddFramebuffer(const drmModeModeInfo& mode,
framebuffer); framebuffer);
} }
bool DrmWrapperOzone::RemoveFramebuffer(uint32_t framebuffer) { bool DriWrapper::RemoveFramebuffer(uint32_t framebuffer) {
CHECK(fd_ >= 0); CHECK(fd_ >= 0);
return !drmModeRmFB(fd_, framebuffer); return !drmModeRmFB(fd_, framebuffer);
} }
bool DrmWrapperOzone::PageFlip(uint32_t crtc_id, bool DriWrapper::PageFlip(uint32_t crtc_id,
uint32_t framebuffer, uint32_t framebuffer,
void* data) { void* data) {
CHECK(fd_ >= 0); CHECK(fd_ >= 0);
...@@ -83,7 +83,7 @@ bool DrmWrapperOzone::PageFlip(uint32_t crtc_id, ...@@ -83,7 +83,7 @@ bool DrmWrapperOzone::PageFlip(uint32_t crtc_id,
data); data);
} }
bool DrmWrapperOzone::ConnectorSetProperty(uint32_t connector_id, bool DriWrapper::ConnectorSetProperty(uint32_t connector_id,
uint32_t property_id, uint32_t property_id,
uint64_t value) { uint64_t value) {
CHECK(fd_ >= 0); CHECK(fd_ >= 0);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_DRM_WRAPPER_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_DRI_WRAPPER_H_
#define UI_GFX_OZONE_IMPL_DRM_WRAPPER_OZONE_H_ #define UI_GFX_OZONE_IMPL_DRI_WRAPPER_H_
#include <stdint.h> #include <stdint.h>
...@@ -17,10 +17,10 @@ namespace gfx { ...@@ -17,10 +17,10 @@ namespace gfx {
// Wraps DRM calls into a nice interface. Used to provide different // Wraps DRM calls into a nice interface. Used to provide different
// implementations of the DRM calls. For the actual implementation the DRM API // implementations of the DRM calls. For the actual implementation the DRM API
// would be called. In unit tests this interface would be stubbed. // would be called. In unit tests this interface would be stubbed.
class DrmWrapperOzone { class DriWrapper {
public: public:
DrmWrapperOzone(const char* device_path); DriWrapper(const char* device_path);
virtual ~DrmWrapperOzone(); virtual ~DriWrapper();
// Get the CRTC state. This is generally used to save state before using the // Get the CRTC state. This is generally used to save state before using the
// CRTC. When the user finishes using the CRTC, the user should restore the // CRTC. When the user finishes using the CRTC, the user should restore the
...@@ -77,9 +77,9 @@ class DrmWrapperOzone { ...@@ -77,9 +77,9 @@ class DrmWrapperOzone {
int fd_; int fd_;
private: private:
DISALLOW_COPY_AND_ASSIGN(DrmWrapperOzone); DISALLOW_COPY_AND_ASSIGN(DriWrapper);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_DRM_WRAPPER_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_DRI_WRAPPER_H_
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/file_surface_factory_ozone.h" #include "ui/gfx/ozone/impl/file_surface_factory.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/file_util.h" #include "base/file_util.h"
...@@ -28,7 +28,7 @@ void WriteDataToFile(const base::FilePath& location, ...@@ -28,7 +28,7 @@ void WriteDataToFile(const base::FilePath& location,
namespace gfx { namespace gfx {
FileSurfaceFactoryOzone::FileSurfaceFactoryOzone( FileSurfaceFactory::FileSurfaceFactory(
const base::FilePath& dump_location) const base::FilePath& dump_location)
: location_(dump_location) { : location_(dump_location) {
CHECK(!base::DirectoryExists(location_)) CHECK(!base::DirectoryExists(location_))
...@@ -36,32 +36,32 @@ FileSurfaceFactoryOzone::FileSurfaceFactoryOzone( ...@@ -36,32 +36,32 @@ FileSurfaceFactoryOzone::FileSurfaceFactoryOzone(
CHECK(!base::PathExists(location_) || base::PathIsWritable(location_)); CHECK(!base::PathExists(location_) || base::PathIsWritable(location_));
} }
FileSurfaceFactoryOzone::~FileSurfaceFactoryOzone() {} FileSurfaceFactory::~FileSurfaceFactory() {}
SurfaceFactoryOzone::HardwareState SurfaceFactoryOzone::HardwareState
FileSurfaceFactoryOzone::InitializeHardware() { FileSurfaceFactory::InitializeHardware() {
return INITIALIZED; return INITIALIZED;
} }
void FileSurfaceFactoryOzone::ShutdownHardware() { void FileSurfaceFactory::ShutdownHardware() {
} }
AcceleratedWidget FileSurfaceFactoryOzone::GetAcceleratedWidget() { AcceleratedWidget FileSurfaceFactory::GetAcceleratedWidget() {
return 1; return 1;
} }
AcceleratedWidget FileSurfaceFactoryOzone::RealizeAcceleratedWidget( AcceleratedWidget FileSurfaceFactory::RealizeAcceleratedWidget(
AcceleratedWidget widget) { AcceleratedWidget widget) {
return 1; return 1;
} }
bool FileSurfaceFactoryOzone::LoadEGLGLES2Bindings( bool FileSurfaceFactory::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library, AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) { SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
return false; return false;
} }
bool FileSurfaceFactoryOzone::AttemptToResizeAcceleratedWidget( bool FileSurfaceFactory::AttemptToResizeAcceleratedWidget(
AcceleratedWidget widget, AcceleratedWidget widget,
const Rect& bounds) { const Rect& bounds) {
device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config, device_ = skia::AdoptRef(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
...@@ -71,7 +71,7 @@ bool FileSurfaceFactoryOzone::AttemptToResizeAcceleratedWidget( ...@@ -71,7 +71,7 @@ bool FileSurfaceFactoryOzone::AttemptToResizeAcceleratedWidget(
return true; return true;
} }
bool FileSurfaceFactoryOzone::SchedulePageFlip(AcceleratedWidget widget) { bool FileSurfaceFactory::SchedulePageFlip(AcceleratedWidget widget) {
SkBitmap bitmap; SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, bitmap.setConfig(SkBitmap::kARGB_8888_Config,
device_->width(), device_->width(),
...@@ -85,11 +85,11 @@ bool FileSurfaceFactoryOzone::SchedulePageFlip(AcceleratedWidget widget) { ...@@ -85,11 +85,11 @@ bool FileSurfaceFactoryOzone::SchedulePageFlip(AcceleratedWidget widget) {
return true; return true;
} }
SkCanvas* FileSurfaceFactoryOzone::GetCanvasForWidget(AcceleratedWidget w) { SkCanvas* FileSurfaceFactory::GetCanvasForWidget(AcceleratedWidget w) {
return canvas_.get(); return canvas_.get();
} }
VSyncProvider* FileSurfaceFactoryOzone::GetVSyncProvider(AcceleratedWidget w) { VSyncProvider* FileSurfaceFactory::GetVSyncProvider(AcceleratedWidget w) {
return NULL; return NULL;
} }
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_
#define UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_OZONE_H_ #define UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
...@@ -16,10 +16,10 @@ class SkCanvas; ...@@ -16,10 +16,10 @@ class SkCanvas;
namespace gfx { namespace gfx {
class FileSurfaceFactoryOzone : public SurfaceFactoryOzone { class FileSurfaceFactory : public SurfaceFactoryOzone {
public: public:
explicit FileSurfaceFactoryOzone(const base::FilePath& dump_location); explicit FileSurfaceFactory(const base::FilePath& dump_location);
virtual ~FileSurfaceFactoryOzone(); virtual ~FileSurfaceFactory();
private: private:
// SurfaceFactoryOzone: // SurfaceFactoryOzone:
...@@ -41,9 +41,9 @@ class FileSurfaceFactoryOzone : public SurfaceFactoryOzone { ...@@ -41,9 +41,9 @@ class FileSurfaceFactoryOzone : public SurfaceFactoryOzone {
skia::RefPtr<SkBitmapDevice> device_; skia::RefPtr<SkBitmapDevice> device_;
skia::RefPtr<SkCanvas> canvas_; skia::RefPtr<SkCanvas> canvas_;
DISALLOW_COPY_AND_ASSIGN(FileSurfaceFactoryOzone); DISALLOW_COPY_AND_ASSIGN(FileSurfaceFactory);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_FILE_SURFACE_FACTORY_H_
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/logging.h" #include "base/logging.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
namespace gfx { namespace gfx {
HardwareDisplayControllerOzone::HardwareDisplayControllerOzone() HardwareDisplayController::HardwareDisplayController()
: drm_(NULL), : drm_(NULL),
connector_id_(0), connector_id_(0),
crtc_id_(0), crtc_id_(0),
...@@ -25,8 +25,8 @@ HardwareDisplayControllerOzone::HardwareDisplayControllerOzone() ...@@ -25,8 +25,8 @@ HardwareDisplayControllerOzone::HardwareDisplayControllerOzone()
surface_() { surface_() {
} }
void HardwareDisplayControllerOzone::SetControllerInfo( void HardwareDisplayController::SetControllerInfo(
DrmWrapperOzone* drm, DriWrapper* drm,
uint32_t connector_id, uint32_t connector_id,
uint32_t crtc_id, uint32_t crtc_id,
uint32_t dpms_property_id, uint32_t dpms_property_id,
...@@ -40,7 +40,7 @@ void HardwareDisplayControllerOzone::SetControllerInfo( ...@@ -40,7 +40,7 @@ void HardwareDisplayControllerOzone::SetControllerInfo(
state_ = UNINITIALIZED; state_ = UNINITIALIZED;
} }
HardwareDisplayControllerOzone::~HardwareDisplayControllerOzone() { HardwareDisplayController::~HardwareDisplayController() {
if (saved_crtc_) { if (saved_crtc_) {
if (!drm_->SetCrtc(saved_crtc_, &connector_id_)) if (!drm_->SetCrtc(saved_crtc_, &connector_id_))
DLOG(ERROR) << "Failed to restore CRTC state: " << strerror(errno); DLOG(ERROR) << "Failed to restore CRTC state: " << strerror(errno);
...@@ -57,8 +57,8 @@ HardwareDisplayControllerOzone::~HardwareDisplayControllerOzone() { ...@@ -57,8 +57,8 @@ HardwareDisplayControllerOzone::~HardwareDisplayControllerOzone() {
} }
bool bool
HardwareDisplayControllerOzone::BindSurfaceToController( HardwareDisplayController::BindSurfaceToController(
scoped_ptr<SoftwareSurfaceOzone> surface) { scoped_ptr<DriSurface> surface) {
CHECK(state_ == UNINITIALIZED); CHECK(state_ == UNINITIALIZED);
// Register the buffers. // Register the buffers.
...@@ -82,7 +82,7 @@ HardwareDisplayControllerOzone::BindSurfaceToController( ...@@ -82,7 +82,7 @@ HardwareDisplayControllerOzone::BindSurfaceToController(
return true; return true;
} }
bool HardwareDisplayControllerOzone::SchedulePageFlip() { bool HardwareDisplayController::SchedulePageFlip() {
CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED); CHECK(state_ == SURFACE_INITIALIZED || state_ == INITIALIZED);
if (state_ == SURFACE_INITIALIZED) { if (state_ == SURFACE_INITIALIZED) {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ #ifndef UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_H_
#define UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ #define UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_H_
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
namespace gfx { namespace gfx {
class SoftwareSurfaceOzone; class DriSurface;
// The HDCOz will handle modesettings and scannout operations for hardware // The HDCOz will handle modesettings and scannout operations for hardware
// devices. // devices.
...@@ -75,7 +75,7 @@ class SoftwareSurfaceOzone; ...@@ -75,7 +75,7 @@ class SoftwareSurfaceOzone;
// //
// TODO(dnicoara) Need to have a way to detect events (such as monitor // TODO(dnicoara) Need to have a way to detect events (such as monitor
// connected or disconnected). // connected or disconnected).
class HardwareDisplayControllerOzone { class HardwareDisplayController {
public: public:
// Controller states. The state transitions will happen from top to bottom. // Controller states. The state transitions will happen from top to bottom.
enum State { enum State {
...@@ -100,21 +100,21 @@ class HardwareDisplayControllerOzone { ...@@ -100,21 +100,21 @@ class HardwareDisplayControllerOzone {
FAILED, FAILED,
}; };
HardwareDisplayControllerOzone(); HardwareDisplayController();
~HardwareDisplayControllerOzone(); ~HardwareDisplayController();
// Set the hardware configuration for this HDCO. Once this is set, the HDCO is // Set the hardware configuration for this HDCO. Once this is set, the HDCO is
// responsible for keeping track of the connector and CRTC and cleaning up // responsible for keeping track of the connector and CRTC and cleaning up
// when it is destroyed. // when it is destroyed.
void SetControllerInfo(DrmWrapperOzone* drm, void SetControllerInfo(DriWrapper* drm,
uint32_t connector_id, uint32_t connector_id,
uint32_t crtc_id, uint32_t crtc_id,
uint32_t dpms_property_id, uint32_t dpms_property_id,
drmModeModeInfo mode); drmModeModeInfo mode);
// Associate the HDCO with a surface implementation and initialize it. // Associate the HDCO with a surface implementation and initialize it.
bool BindSurfaceToController(scoped_ptr<SoftwareSurfaceOzone> surface); bool BindSurfaceToController(scoped_ptr<DriSurface> surface);
// Schedules the |surface_|'s framebuffer to be displayed on the next vsync // Schedules the |surface_|'s framebuffer to be displayed on the next vsync
// event. The event will be posted on the graphics card file descriptor |fd_| // event. The event will be posted on the graphics card file descriptor |fd_|
...@@ -140,12 +140,12 @@ class HardwareDisplayControllerOzone { ...@@ -140,12 +140,12 @@ class HardwareDisplayControllerOzone {
const drmModeModeInfo& get_mode() const { return mode_; }; const drmModeModeInfo& get_mode() const { return mode_; };
SoftwareSurfaceOzone* get_surface() const { return surface_.get(); }; DriSurface* get_surface() const { return surface_.get(); };
private: private:
// Object containing the connection to the graphics device and wraps the API // Object containing the connection to the graphics device and wraps the API
// calls to control it. // calls to control it.
DrmWrapperOzone* drm_; DriWrapper* drm_;
// TODO(dnicoara) Need to allow a CRTC to have multiple connectors. // TODO(dnicoara) Need to allow a CRTC to have multiple connectors.
uint32_t connector_id_; uint32_t connector_id_;
...@@ -163,11 +163,11 @@ class HardwareDisplayControllerOzone { ...@@ -163,11 +163,11 @@ class HardwareDisplayControllerOzone {
State state_; State state_;
scoped_ptr<SoftwareSurfaceOzone> surface_; scoped_ptr<DriSurface> surface_;
DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerOzone); DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
}; };
} // namespace gfx } // namespace gfx
#endif // UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_OZONE_H_ #endif // UI_GFX_OZONE_IMPL_HARDWARE_DISPLAY_CONTROLLER_H_
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/ozone/impl/drm_skbitmap_ozone.h" #include "ui/gfx/ozone/impl/dri_skbitmap.h"
#include "ui/gfx/ozone/impl/drm_wrapper_ozone.h" #include "ui/gfx/ozone/impl/dri_surface.h"
#include "ui/gfx/ozone/impl/hardware_display_controller_ozone.h" #include "ui/gfx/ozone/impl/dri_wrapper.h"
#include "ui/gfx/ozone/impl/software_surface_ozone.h" #include "ui/gfx/ozone/impl/hardware_display_controller.h"
namespace { namespace {
...@@ -25,10 +25,10 @@ const uint32_t kCrtcId = 1; ...@@ -25,10 +25,10 @@ const uint32_t kCrtcId = 1;
const uint32_t kDPMSPropertyId = 1; const uint32_t kDPMSPropertyId = 1;
// The real DrmWrapper makes actual DRM calls which we can't use in unit tests. // The real DriWrapper makes actual DRM calls which we can't use in unit tests.
class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { class MockDriWrapper : public gfx::DriWrapper {
public: public:
MockDrmWrapperOzone(int fd) : DrmWrapperOzone(""), MockDriWrapper(int fd) : DriWrapper(""),
get_crtc_call_count_(0), get_crtc_call_count_(0),
free_crtc_call_count_(0), free_crtc_call_count_(0),
restore_crtc_call_count_(0), restore_crtc_call_count_(0),
...@@ -40,7 +40,7 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { ...@@ -40,7 +40,7 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone {
fd_ = fd; fd_ = fd;
} }
virtual ~MockDrmWrapperOzone() { fd_ = -1; } virtual ~MockDriWrapper() { fd_ = -1; }
virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE { virtual drmModeCrtc* GetCrtc(uint32_t crtc_id) OVERRIDE {
get_crtc_call_count_++; get_crtc_call_count_++;
...@@ -132,165 +132,165 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone { ...@@ -132,165 +132,165 @@ class MockDrmWrapperOzone : public gfx::DrmWrapperOzone {
bool add_framebuffer_expectation_; bool add_framebuffer_expectation_;
bool page_flip_expectation_; bool page_flip_expectation_;
DISALLOW_COPY_AND_ASSIGN(MockDrmWrapperOzone); DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
}; };
class MockDrmSkBitmapOzone : public gfx::DrmSkBitmapOzone { class MockDriSkBitmap : public gfx::DriSkBitmap {
public: public:
MockDrmSkBitmapOzone(int fd) : DrmSkBitmapOzone(fd) {} MockDriSkBitmap(int fd) : DriSkBitmap(fd) {}
virtual ~MockDrmSkBitmapOzone() {} virtual ~MockDriSkBitmap() {}
virtual bool Initialize() OVERRIDE { virtual bool Initialize() OVERRIDE {
return allocPixels(); return allocPixels();
} }
private: private:
DISALLOW_COPY_AND_ASSIGN(MockDrmSkBitmapOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSkBitmap);
}; };
class MockSoftwareSurfaceOzone : public gfx::SoftwareSurfaceOzone { class MockDriSurface : public gfx::DriSurface {
public: public:
MockSoftwareSurfaceOzone(gfx::HardwareDisplayControllerOzone* controller) MockDriSurface(gfx::HardwareDisplayController* controller)
: SoftwareSurfaceOzone(controller) {} : DriSurface(controller) {}
virtual ~MockSoftwareSurfaceOzone() {} virtual ~MockDriSurface() {}
private: private:
virtual gfx::DrmSkBitmapOzone* CreateBuffer() OVERRIDE { virtual gfx::DriSkBitmap* CreateBuffer() OVERRIDE {
return new MockDrmSkBitmapOzone(kFd); return new MockDriSkBitmap(kFd);
} }
DISALLOW_COPY_AND_ASSIGN(MockSoftwareSurfaceOzone); DISALLOW_COPY_AND_ASSIGN(MockDriSurface);
}; };
} // namespace } // namespace
class HardwareDisplayControllerOzoneTest : public testing::Test { class HardwareDisplayControllerTest : public testing::Test {
public: public:
HardwareDisplayControllerOzoneTest() {} HardwareDisplayControllerTest() {}
virtual ~HardwareDisplayControllerOzoneTest() {} virtual ~HardwareDisplayControllerTest() {}
virtual void SetUp() OVERRIDE; virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE; virtual void TearDown() OVERRIDE;
protected: protected:
scoped_ptr<gfx::HardwareDisplayControllerOzone> controller_; scoped_ptr<gfx::HardwareDisplayController> controller_;
scoped_ptr<MockDrmWrapperOzone> drm_; scoped_ptr<MockDriWrapper> drm_;
private: private:
DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerOzoneTest); DISALLOW_COPY_AND_ASSIGN(HardwareDisplayControllerTest);
}; };
void HardwareDisplayControllerOzoneTest::SetUp() { void HardwareDisplayControllerTest::SetUp() {
controller_.reset(new gfx::HardwareDisplayControllerOzone()); controller_.reset(new gfx::HardwareDisplayController());
drm_.reset(new MockDrmWrapperOzone(kFd)); drm_.reset(new MockDriWrapper(kFd));
} }
void HardwareDisplayControllerOzoneTest::TearDown() { void HardwareDisplayControllerTest::TearDown() {
controller_.reset(); controller_.reset();
drm_.reset(); drm_.reset();
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckInitialState) { TEST_F(HardwareDisplayControllerTest, CheckInitialState) {
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::UNASSOCIATED, EXPECT_EQ(gfx::HardwareDisplayController::UNASSOCIATED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, TEST_F(HardwareDisplayControllerTest,
CheckStateAfterControllerIsInitialized) { CheckStateAfterControllerIsInitialized) {
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
EXPECT_EQ(1, drm_->get_get_crtc_call_count()); EXPECT_EQ(1, drm_->get_get_crtc_call_count());
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::UNINITIALIZED, EXPECT_EQ(gfx::HardwareDisplayController::UNINITIALIZED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckStateAfterSurfaceIsBound) { TEST_F(HardwareDisplayControllerTest, CheckStateAfterSurfaceIsBound) {
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
EXPECT_EQ(2, drm_->get_add_framebuffer_call_count()); EXPECT_EQ(2, drm_->get_add_framebuffer_call_count());
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::SURFACE_INITIALIZED, EXPECT_EQ(gfx::HardwareDisplayController::SURFACE_INITIALIZED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckStateIfBindingFails) { TEST_F(HardwareDisplayControllerTest, CheckStateIfBindingFails) {
drm_->set_add_framebuffer_expectation(false); drm_->set_add_framebuffer_expectation(false);
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_FALSE(controller_->BindSurfaceToController(surface.Pass()));
EXPECT_EQ(1, drm_->get_add_framebuffer_call_count()); EXPECT_EQ(1, drm_->get_add_framebuffer_call_count());
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::FAILED, EXPECT_EQ(gfx::HardwareDisplayController::FAILED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckStateAfterPageFlip) { TEST_F(HardwareDisplayControllerTest, CheckStateAfterPageFlip) {
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
controller_->SchedulePageFlip(); controller_->SchedulePageFlip();
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::INITIALIZED, EXPECT_EQ(gfx::HardwareDisplayController::INITIALIZED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckStateIfModesetFails) { TEST_F(HardwareDisplayControllerTest, CheckStateIfModesetFails) {
drm_->set_set_crtc_expectation(false); drm_->set_set_crtc_expectation(false);
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
controller_->SchedulePageFlip(); controller_->SchedulePageFlip();
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::FAILED, EXPECT_EQ(gfx::HardwareDisplayController::FAILED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckStateIfPageFlipFails) { TEST_F(HardwareDisplayControllerTest, CheckStateIfPageFlipFails) {
drm_->set_page_flip_expectation(false); drm_->set_page_flip_expectation(false);
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
controller_->SchedulePageFlip(); controller_->SchedulePageFlip();
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::FAILED, EXPECT_EQ(gfx::HardwareDisplayController::FAILED,
controller_->get_state()); controller_->get_state());
} }
TEST_F(HardwareDisplayControllerOzoneTest, CheckProperDestruction) { TEST_F(HardwareDisplayControllerTest, CheckProperDestruction) {
controller_->SetControllerInfo( controller_->SetControllerInfo(
drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode); drm_.get(), kConnectorId, kCrtcId, kDPMSPropertyId, kDefaultMode);
scoped_ptr<gfx::SoftwareSurfaceOzone> surface( scoped_ptr<gfx::DriSurface> surface(
new MockSoftwareSurfaceOzone(controller_.get())); new MockDriSurface(controller_.get()));
EXPECT_TRUE(surface->Initialize()); EXPECT_TRUE(surface->Initialize());
EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass())); EXPECT_TRUE(controller_->BindSurfaceToController(surface.Pass()));
EXPECT_EQ(gfx::HardwareDisplayControllerOzone::SURFACE_INITIALIZED, EXPECT_EQ(gfx::HardwareDisplayController::SURFACE_INITIALIZED,
controller_->get_state()); controller_->get_state());
controller_.reset(); controller_.reset();
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "base/command_line.h" #include "base/command_line.h"
#include "ui/gfx/ozone/impl/file_surface_factory_ozone.h"
#include "ui/gfx/ozone/impl/software_surface_factory_ozone.h"
namespace gfx { namespace gfx {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define UI_OZONE_PLATFORM_DRI_OZONE_PLATFORM_DRI_H_ #define UI_OZONE_PLATFORM_DRI_OZONE_PLATFORM_DRI_H_
#include "ui/events/ozone/evdev/event_factory.h" #include "ui/events/ozone/evdev/event_factory.h"
#include "ui/gfx/ozone/impl/software_surface_factory_ozone.h" #include "ui/gfx/ozone/impl/dri_surface_factory.h"
#include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_platform.h"
namespace ui { namespace ui {
...@@ -24,7 +24,7 @@ class OzonePlatformDri : public OzonePlatform { ...@@ -24,7 +24,7 @@ class OzonePlatformDri : public OzonePlatform {
virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE; virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE;
private: private:
gfx::SoftwareSurfaceFactoryOzone surface_factory_ozone_; gfx::DriSurfaceFactory surface_factory_ozone_;
ui::EventFactoryEvdev event_factory_ozone_; ui::EventFactoryEvdev event_factory_ozone_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "ui/events/ozone/evdev/event_factory.h" #include "ui/events/ozone/evdev/event_factory.h"
#include "ui/gfx/ozone/impl/file_surface_factory_ozone.h" #include "ui/gfx/ozone/impl/file_surface_factory.h"
#include "ui/ozone/ozone_platform.h" #include "ui/ozone/ozone_platform.h"
namespace ui { namespace ui {
...@@ -24,7 +24,7 @@ class OzonePlatformTest : public OzonePlatform { ...@@ -24,7 +24,7 @@ class OzonePlatformTest : public OzonePlatform {
virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE; virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE;
private: private:
gfx::FileSurfaceFactoryOzone surface_factory_ozone_; gfx::FileSurfaceFactory surface_factory_ozone_;
ui::EventFactoryEvdev event_factory_ozone_; ui::EventFactoryEvdev event_factory_ozone_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest);
......
...@@ -187,9 +187,9 @@ ...@@ -187,9 +187,9 @@
'gfx/font_list_unittest.cc', 'gfx/font_list_unittest.cc',
'gfx/image/image_mac_unittest.mm', 'gfx/image/image_mac_unittest.mm',
'gfx/image/image_util_unittest.cc', 'gfx/image/image_util_unittest.cc',
'gfx/ozone/impl/hardware_display_controller_ozone_unittest.cc', 'gfx/ozone/impl/hardware_display_controller_unittest.cc',
'gfx/ozone/impl/software_surface_factory_ozone_unittest.cc', 'gfx/ozone/impl/dri_surface_factory_unittest.cc',
'gfx/ozone/impl/software_surface_ozone_unittest.cc', 'gfx/ozone/impl/dri_surface_unittest.cc',
'gfx/platform_font_mac_unittest.mm', 'gfx/platform_font_mac_unittest.mm',
'gfx/render_text_unittest.cc', 'gfx/render_text_unittest.cc',
'gfx/sequential_id_generator_unittest.cc', 'gfx/sequential_id_generator_unittest.cc',
......
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