Commit 92378355 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Ozone/DRM: Add trace events to DrmThread

Add trace events to all non-trivial methods of DrmThread and all
methods in DrmThreadProxy that block.

Bug: 1034559
Change-Id: I4f77dc84f0e35f2f405d2a9f4658c865800cf44e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013812Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Saman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734133}
parent c00b062e
...@@ -104,6 +104,7 @@ void DrmThread::RunTaskAfterWindowReady(gfx::AcceleratedWidget window, ...@@ -104,6 +104,7 @@ void DrmThread::RunTaskAfterWindowReady(gfx::AcceleratedWidget window,
} }
void DrmThread::Init() { void DrmThread::Init() {
TRACE_EVENT0("drm", "DrmThread::Init");
device_manager_ = device_manager_ =
std::make_unique<DrmDeviceManager>(std::move(device_generator_)); std::make_unique<DrmDeviceManager>(std::move(device_generator_));
screen_manager_ = std::make_unique<ScreenManager>(); screen_manager_ = std::make_unique<ScreenManager>();
...@@ -125,6 +126,7 @@ void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget, ...@@ -125,6 +126,7 @@ void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget,
uint32_t client_flags, uint32_t client_flags,
std::unique_ptr<GbmBuffer>* buffer, std::unique_ptr<GbmBuffer>* buffer,
scoped_refptr<DrmFramebuffer>* framebuffer) { scoped_refptr<DrmFramebuffer>* framebuffer) {
TRACE_EVENT0("drm", "DrmThread::CreateBuffer");
scoped_refptr<ui::DrmDevice> drm = device_manager_->GetDrmDevice(widget); scoped_refptr<ui::DrmDevice> drm = device_manager_->GetDrmDevice(widget);
CHECK(drm) << "No devices available for buffer allocation."; CHECK(drm) << "No devices available for buffer allocation.";
...@@ -160,6 +162,7 @@ void DrmThread::CreateBufferAsync(gfx::AcceleratedWidget widget, ...@@ -160,6 +162,7 @@ void DrmThread::CreateBufferAsync(gfx::AcceleratedWidget widget,
gfx::BufferUsage usage, gfx::BufferUsage usage,
uint32_t client_flags, uint32_t client_flags,
CreateBufferAsyncCallback callback) { CreateBufferAsyncCallback callback) {
TRACE_EVENT0("drm", "DrmThread::CreateBufferAsync");
std::unique_ptr<GbmBuffer> buffer; std::unique_ptr<GbmBuffer> buffer;
scoped_refptr<DrmFramebuffer> framebuffer; scoped_refptr<DrmFramebuffer> framebuffer;
CreateBuffer(widget, size, format, usage, client_flags, &buffer, CreateBuffer(widget, size, format, usage, client_flags, &buffer,
...@@ -174,6 +177,7 @@ void DrmThread::CreateBufferFromHandle( ...@@ -174,6 +177,7 @@ void DrmThread::CreateBufferFromHandle(
gfx::NativePixmapHandle handle, gfx::NativePixmapHandle handle,
std::unique_ptr<GbmBuffer>* out_buffer, std::unique_ptr<GbmBuffer>* out_buffer,
scoped_refptr<DrmFramebuffer>* out_framebuffer) { scoped_refptr<DrmFramebuffer>* out_framebuffer) {
TRACE_EVENT0("drm", "DrmThread::CreateBufferFromHandle");
scoped_refptr<ui::DrmDevice> drm = device_manager_->GetDrmDevice(widget); scoped_refptr<ui::DrmDevice> drm = device_manager_->GetDrmDevice(widget);
DCHECK(drm); DCHECK(drm);
...@@ -202,6 +206,7 @@ void DrmThread::SchedulePageFlip( ...@@ -202,6 +206,7 @@ void DrmThread::SchedulePageFlip(
std::vector<DrmOverlayPlane> planes, std::vector<DrmOverlayPlane> planes,
SwapCompletionOnceCallback submission_callback, SwapCompletionOnceCallback submission_callback,
PresentationOnceCallback presentation_callback) { PresentationOnceCallback presentation_callback) {
TRACE_EVENT0("drm", "DrmThread::SchedulePageFlip");
scoped_refptr<ui::DrmDevice> drm_device = scoped_refptr<ui::DrmDevice> drm_device =
device_manager_->GetDrmDevice(widget); device_manager_->GetDrmDevice(widget);
...@@ -217,6 +222,7 @@ void DrmThread::OnPlanesReadyForPageFlip( ...@@ -217,6 +222,7 @@ void DrmThread::OnPlanesReadyForPageFlip(
SwapCompletionOnceCallback submission_callback, SwapCompletionOnceCallback submission_callback,
PresentationOnceCallback presentation_callback, PresentationOnceCallback presentation_callback,
std::vector<DrmOverlayPlane> planes) { std::vector<DrmOverlayPlane> planes) {
TRACE_EVENT0("drm", "DrmThread::OnPlanesReadyForPageFlip");
DrmWindow* window = screen_manager_->GetWindow(widget); DrmWindow* window = screen_manager_->GetWindow(widget);
if (window) { if (window) {
window->SchedulePageFlip(std::move(planes), std::move(submission_callback), window->SchedulePageFlip(std::move(planes), std::move(submission_callback),
...@@ -228,6 +234,7 @@ void DrmThread::OnPlanesReadyForPageFlip( ...@@ -228,6 +234,7 @@ void DrmThread::OnPlanesReadyForPageFlip(
} }
void DrmThread::IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic) { void DrmThread::IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic) {
TRACE_EVENT0("drm", "DrmThread::IsDeviceAtomic");
scoped_refptr<ui::DrmDevice> drm_device = scoped_refptr<ui::DrmDevice> drm_device =
device_manager_->GetDrmDevice(widget); device_manager_->GetDrmDevice(widget);
...@@ -236,6 +243,7 @@ void DrmThread::IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic) { ...@@ -236,6 +243,7 @@ void DrmThread::IsDeviceAtomic(gfx::AcceleratedWidget widget, bool* is_atomic) {
void DrmThread::CreateWindow(gfx::AcceleratedWidget widget, void DrmThread::CreateWindow(gfx::AcceleratedWidget widget,
const gfx::Rect& initial_bounds) { const gfx::Rect& initial_bounds) {
TRACE_EVENT0("drm", "DrmThread::CreateWindow");
DCHECK_GT(widget, last_created_window_); DCHECK_GT(widget, last_created_window_);
last_created_window_ = widget; last_created_window_ = widget;
...@@ -250,12 +258,14 @@ void DrmThread::CreateWindow(gfx::AcceleratedWidget widget, ...@@ -250,12 +258,14 @@ void DrmThread::CreateWindow(gfx::AcceleratedWidget widget,
} }
void DrmThread::DestroyWindow(gfx::AcceleratedWidget widget) { void DrmThread::DestroyWindow(gfx::AcceleratedWidget widget) {
TRACE_EVENT0("drm", "DrmThread::DestroyWindow");
std::unique_ptr<DrmWindow> window = screen_manager_->RemoveWindow(widget); std::unique_ptr<DrmWindow> window = screen_manager_->RemoveWindow(widget);
window->Shutdown(); window->Shutdown();
} }
void DrmThread::SetWindowBounds(gfx::AcceleratedWidget widget, void DrmThread::SetWindowBounds(gfx::AcceleratedWidget widget,
const gfx::Rect& bounds) { const gfx::Rect& bounds) {
TRACE_EVENT0("drm", "DrmThread::SetWindowBounds");
screen_manager_->GetWindow(widget)->SetBounds(bounds); screen_manager_->GetWindow(widget)->SetBounds(bounds);
} }
...@@ -263,12 +273,14 @@ void DrmThread::SetCursor(gfx::AcceleratedWidget widget, ...@@ -263,12 +273,14 @@ void DrmThread::SetCursor(gfx::AcceleratedWidget widget,
const std::vector<SkBitmap>& bitmaps, const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location, const gfx::Point& location,
int32_t frame_delay_ms) { int32_t frame_delay_ms) {
TRACE_EVENT0("drm", "DrmThread::SetCursor");
screen_manager_->GetWindow(widget) screen_manager_->GetWindow(widget)
->SetCursor(bitmaps, location, frame_delay_ms); ->SetCursor(bitmaps, location, frame_delay_ms);
} }
void DrmThread::MoveCursor(gfx::AcceleratedWidget widget, void DrmThread::MoveCursor(gfx::AcceleratedWidget widget,
const gfx::Point& location) { const gfx::Point& location) {
TRACE_EVENT0("drm", "DrmThread::MoveCursor");
screen_manager_->GetWindow(widget)->MoveCursor(location); screen_manager_->GetWindow(widget)->MoveCursor(location);
} }
...@@ -290,6 +302,7 @@ void DrmThread::GetDeviceCursor( ...@@ -290,6 +302,7 @@ void DrmThread::GetDeviceCursor(
void DrmThread::RefreshNativeDisplays( void DrmThread::RefreshNativeDisplays(
base::OnceCallback<void(MovableDisplaySnapshots)> callback) { base::OnceCallback<void(MovableDisplaySnapshots)> callback) {
TRACE_EVENT0("drm", "DrmThread::RefreshNativeDisplays");
std::move(callback).Run(display_manager_->GetDisplays()); std::move(callback).Run(display_manager_->GetDisplays());
} }
...@@ -298,6 +311,7 @@ void DrmThread::ConfigureNativeDisplay( ...@@ -298,6 +311,7 @@ void DrmThread::ConfigureNativeDisplay(
std::unique_ptr<display::DisplayMode> mode, std::unique_ptr<display::DisplayMode> mode,
const gfx::Point& origin, const gfx::Point& origin,
base::OnceCallback<void(int64_t, bool)> callback) { base::OnceCallback<void(int64_t, bool)> callback) {
TRACE_EVENT0("drm", "DrmThread::ConfigureNativeDisplay");
std::move(callback).Run( std::move(callback).Run(
id, display_manager_->ConfigureDisplay(id, *mode, origin)); id, display_manager_->ConfigureDisplay(id, *mode, origin));
} }
...@@ -305,20 +319,24 @@ void DrmThread::ConfigureNativeDisplay( ...@@ -305,20 +319,24 @@ void DrmThread::ConfigureNativeDisplay(
void DrmThread::DisableNativeDisplay( void DrmThread::DisableNativeDisplay(
int64_t id, int64_t id,
base::OnceCallback<void(int64_t, bool)> callback) { base::OnceCallback<void(int64_t, bool)> callback) {
TRACE_EVENT0("drm", "DrmThread::DisableNativeDisplay");
std::move(callback).Run(id, display_manager_->DisableDisplay(id)); std::move(callback).Run(id, display_manager_->DisableDisplay(id));
} }
void DrmThread::TakeDisplayControl(base::OnceCallback<void(bool)> callback) { void DrmThread::TakeDisplayControl(base::OnceCallback<void(bool)> callback) {
TRACE_EVENT0("drm", "DrmThread::TakeDisplayControl");
std::move(callback).Run(display_manager_->TakeDisplayControl()); std::move(callback).Run(display_manager_->TakeDisplayControl());
} }
void DrmThread::RelinquishDisplayControl( void DrmThread::RelinquishDisplayControl(
base::OnceCallback<void(bool)> callback) { base::OnceCallback<void(bool)> callback) {
TRACE_EVENT0("drm", "DrmThread::RelinquishDisplayControl");
display_manager_->RelinquishDisplayControl(); display_manager_->RelinquishDisplayControl();
std::move(callback).Run(true); std::move(callback).Run(true);
} }
void DrmThread::AddGraphicsDevice(const base::FilePath& path, base::File file) { void DrmThread::AddGraphicsDevice(const base::FilePath& path, base::File file) {
TRACE_EVENT0("drm", "DrmThread::AddGraphicsDevice");
device_manager_->AddDrmDevice(path, std::move(file)); device_manager_->AddDrmDevice(path, std::move(file));
// There might be tasks that were blocked on a DrmDevice becoming available. // There might be tasks that were blocked on a DrmDevice becoming available.
...@@ -326,12 +344,14 @@ void DrmThread::AddGraphicsDevice(const base::FilePath& path, base::File file) { ...@@ -326,12 +344,14 @@ void DrmThread::AddGraphicsDevice(const base::FilePath& path, base::File file) {
} }
void DrmThread::RemoveGraphicsDevice(const base::FilePath& path) { void DrmThread::RemoveGraphicsDevice(const base::FilePath& path) {
TRACE_EVENT0("drm", "DrmThread::RemoveGraphicsDevice");
device_manager_->RemoveDrmDevice(path); device_manager_->RemoveDrmDevice(path);
} }
void DrmThread::GetHDCPState( void DrmThread::GetHDCPState(
int64_t display_id, int64_t display_id,
base::OnceCallback<void(int64_t, bool, display::HDCPState)> callback) { base::OnceCallback<void(int64_t, bool, display::HDCPState)> callback) {
TRACE_EVENT0("drm", "DrmThread::GetHDCPState");
display::HDCPState state = display::HDCP_STATE_UNDESIRED; display::HDCPState state = display::HDCP_STATE_UNDESIRED;
bool success = display_manager_->GetHDCPState(display_id, &state); bool success = display_manager_->GetHDCPState(display_id, &state);
std::move(callback).Run(display_id, success, state); std::move(callback).Run(display_id, success, state);
...@@ -340,12 +360,14 @@ void DrmThread::GetHDCPState( ...@@ -340,12 +360,14 @@ void DrmThread::GetHDCPState(
void DrmThread::SetHDCPState(int64_t display_id, void DrmThread::SetHDCPState(int64_t display_id,
display::HDCPState state, display::HDCPState state,
base::OnceCallback<void(int64_t, bool)> callback) { base::OnceCallback<void(int64_t, bool)> callback) {
TRACE_EVENT0("drm", "DrmThread::SetHDCPState");
std::move(callback).Run(display_id, std::move(callback).Run(display_id,
display_manager_->SetHDCPState(display_id, state)); display_manager_->SetHDCPState(display_id, state));
} }
void DrmThread::SetColorMatrix(int64_t display_id, void DrmThread::SetColorMatrix(int64_t display_id,
const std::vector<float>& color_matrix) { const std::vector<float>& color_matrix) {
TRACE_EVENT0("drm", "DrmThread::SetColorMatrix");
display_manager_->SetColorMatrix(display_id, color_matrix); display_manager_->SetColorMatrix(display_id, color_matrix);
} }
...@@ -353,6 +375,7 @@ void DrmThread::SetGammaCorrection( ...@@ -353,6 +375,7 @@ void DrmThread::SetGammaCorrection(
int64_t display_id, int64_t display_id,
const std::vector<display::GammaRampRGBEntry>& degamma_lut, const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut) { const std::vector<display::GammaRampRGBEntry>& gamma_lut) {
TRACE_EVENT0("drm", "DrmThread::SetGammaCorrection");
display_manager_->SetGammaCorrection(display_id, degamma_lut, gamma_lut); display_manager_->SetGammaCorrection(display_id, degamma_lut, gamma_lut);
} }
......
...@@ -85,6 +85,7 @@ void DrmThreadProxy::CreateBuffer(gfx::AcceleratedWidget widget, ...@@ -85,6 +85,7 @@ void DrmThreadProxy::CreateBuffer(gfx::AcceleratedWidget widget,
uint32_t flags, uint32_t flags,
std::unique_ptr<GbmBuffer>* buffer, std::unique_ptr<GbmBuffer>* buffer,
scoped_refptr<DrmFramebuffer>* framebuffer) { scoped_refptr<DrmFramebuffer>* framebuffer) {
TRACE_EVENT0("drm", "DrmThreadProxy::CreateBuffer");
DCHECK(drm_thread_.task_runner()) DCHECK(drm_thread_.task_runner())
<< "no task runner! in DrmThreadProxy::CreateBuffer"; << "no task runner! in DrmThreadProxy::CreateBuffer";
base::OnceClosure task = base::OnceClosure task =
...@@ -127,6 +128,7 @@ void DrmThreadProxy::CreateBufferFromHandle( ...@@ -127,6 +128,7 @@ void DrmThreadProxy::CreateBufferFromHandle(
gfx::NativePixmapHandle handle, gfx::NativePixmapHandle handle,
std::unique_ptr<GbmBuffer>* buffer, std::unique_ptr<GbmBuffer>* buffer,
scoped_refptr<DrmFramebuffer>* framebuffer) { scoped_refptr<DrmFramebuffer>* framebuffer) {
TRACE_EVENT0("drm", "DrmThreadProxy::CreateBufferFromHandle");
base::OnceClosure task = base::BindOnce( base::OnceClosure task = base::BindOnce(
&DrmThread::CreateBufferFromHandle, base::Unretained(&drm_thread_), &DrmThread::CreateBufferFromHandle, base::Unretained(&drm_thread_),
widget, size, format, std::move(handle), buffer, framebuffer); widget, size, format, std::move(handle), buffer, framebuffer);
......
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