Commit 47cdc66b authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

ozone: drm: Use DrmBuffer instead of ScanoutBuffer for cursors

Use the concrete type of the dumb buffer for cursors. We don't need
polymorphism here, and since cursors don't have framebuffers, this is
needed before evolving ScanoutBuffer into a concrete framebuffer type.

Bug: 869206

Change-Id: I5ee8162cd103d55df320cbc8e35be29e9ac15562
Reviewed-on: https://chromium-review.googlesource.com/1155911
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579535}
parent 0723e43e
......@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/time/time.h"
#include "ui/gfx/presentation_feedback.h"
#include "ui/ozone/platform/drm/gpu/drm_buffer.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/hardware_display_plane.h"
#include "ui/ozone/platform/drm/gpu/page_flip_request.h"
......@@ -91,7 +92,7 @@ std::vector<uint64_t> CrtcController::GetFormatModifiers(uint32_t format) {
return drm_->plane_manager()->GetFormatModifiers(crtc_, format);
}
bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) {
bool CrtcController::SetCursor(const scoped_refptr<DrmBuffer>& buffer) {
DCHECK(!is_disabled_ || !buffer);
cursor_buffer_ = buffer;
......
......@@ -20,6 +20,7 @@
namespace ui {
class DrmBuffer;
class DrmDevice;
// Wrapper around a CRTC.
......@@ -60,8 +61,7 @@ class CrtcController {
// gbm will pick a modifier as it allocates the bo.
std::vector<uint64_t> GetFormatModifiers(uint32_t fourcc_format);
bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer);
bool SetCursor(const scoped_refptr<DrmBuffer>& buffer);
bool MoveCursor(const gfx::Point& location);
private:
......@@ -71,7 +71,7 @@ class CrtcController {
// Buffers need to be declared first so that they are destroyed last. Needed
// since the controllers may reference the buffers.
scoped_refptr<ScanoutBuffer> cursor_buffer_;
scoped_refptr<DrmBuffer> cursor_buffer_;
uint32_t crtc_;
......
......@@ -89,6 +89,10 @@ SkCanvas* DrmBuffer::GetCanvas() const {
return surface_->getCanvas();
}
uint32_t DrmBuffer::GetHandle() const {
return handle_;
}
uint32_t DrmBuffer::GetFramebufferId() const {
return framebuffer_;
}
......@@ -109,10 +113,6 @@ uint64_t DrmBuffer::GetFormatModifier() const {
return DRM_FORMAT_MOD_NONE;
}
uint32_t DrmBuffer::GetHandle() const {
return handle_;
}
gfx::Size DrmBuffer::GetSize() const {
return gfx::Size(surface_->width(), surface_->height());
}
......
......@@ -35,13 +35,14 @@ class DrmBuffer : public ScanoutBuffer {
SkCanvas* GetCanvas() const;
uint32_t GetHandle() const;
// ScanoutBuffer:
uint32_t GetFramebufferId() const override;
uint32_t GetFramebufferPixelFormat() const override;
uint32_t GetOpaqueFramebufferId() const override;
uint32_t GetOpaqueFramebufferPixelFormat() const override;
uint64_t GetFormatModifier() const override;
uint32_t GetHandle() const override;
gfx::Size GetSize() const override;
const DrmDevice* GetDrmDevice() const override;
......
......@@ -91,10 +91,11 @@ void DrmWindow::SetCursor(const std::vector<SkBitmap>& bitmaps,
cursor_frame_delay_ms_ = frame_delay_ms;
cursor_timer_.Stop();
if (cursor_frame_delay_ms_)
if (cursor_frame_delay_ms_) {
cursor_timer_.Start(
FROM_HERE, base::TimeDelta::FromMilliseconds(cursor_frame_delay_ms_),
this, &DrmWindow::OnCursorAnimationTimeout);
}
ResetCursor(false);
}
......
......@@ -109,10 +109,6 @@ uint64_t GbmBuffer::GetFormatModifier() const {
return gbm_bo_.format_modifier();
}
uint32_t GbmBuffer::GetHandle() const {
return gbm_bo_.GetBoHandle();
}
gfx::Size GbmBuffer::GetSize() const {
return gbm_bo_.size();
}
......@@ -321,7 +317,7 @@ gfx::Size GbmPixmap::GetBufferSize() const {
}
uint32_t GbmPixmap::GetUniqueId() const {
return buffer_->GetHandle();
return buffer_->gbm_bo()->GetBoHandle();
}
bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
......
......@@ -48,7 +48,6 @@ class GbmBuffer : public ScanoutBuffer {
uint32_t GetFramebufferPixelFormat() const override;
uint32_t GetOpaqueFramebufferPixelFormat() const override;
uint64_t GetFormatModifier() const override;
uint32_t GetHandle() const override;
gfx::Size GetSize() const override;
const DrmDevice* GetDrmDevice() const override;
......
......@@ -202,7 +202,7 @@ HardwareDisplayController::GetFormatModifiersForModesetting(
}
bool HardwareDisplayController::SetCursor(
const scoped_refptr<ScanoutBuffer>& buffer) {
const scoped_refptr<DrmBuffer>& buffer) {
bool status = true;
if (is_disabled_)
......
......@@ -30,6 +30,7 @@ namespace ui {
class CrtcController;
class ScanoutBuffer;
class DrmBuffer;
class DrmDevice;
// The HDCOz will handle modesettings and scannout operations for hardware
......@@ -137,7 +138,7 @@ class HardwareDisplayController {
uint32_t fourcc_format);
// Set the hardware cursor to show the contents of |surface|.
bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer);
bool SetCursor(const scoped_refptr<DrmBuffer>& buffer);
bool UnsetCursor();
......
......@@ -34,10 +34,6 @@ uint32_t MockScanoutBuffer::GetOpaqueFramebufferId() const {
return opaque_id_;
}
uint32_t MockScanoutBuffer::GetHandle() const {
return 0;
}
gfx::Size MockScanoutBuffer::GetSize() const {
return size_;
}
......
......@@ -25,7 +25,6 @@ class MockScanoutBuffer : public ScanoutBuffer {
// ScanoutBuffer:
uint32_t GetFramebufferId() const override;
uint32_t GetOpaqueFramebufferId() const override;
uint32_t GetHandle() const override;
gfx::Size GetSize() const override;
uint32_t GetFramebufferPixelFormat() const override;
uint32_t GetOpaqueFramebufferPixelFormat() const override;
......
......@@ -37,9 +37,6 @@ class ScanoutBuffer : public base::RefCountedThreadSafe<ScanoutBuffer> {
// Returns format modifier for buffer.
virtual uint64_t GetFormatModifier() const = 0;
// Handle for the buffer. This is received when allocating the buffer.
virtual uint32_t GetHandle() const = 0;
// Size of the buffer.
virtual gfx::Size GetSize() const = 0;
......
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