Skip to content

Commit

Permalink
ozone: dri: Fix excessive cursor uploads
Browse files Browse the repository at this point in the history
We have a check to skip updates if the cursor is reset to the same value,
but this stopped working in a prior refactor. Fix it by using ShowCursor()
from DriCursor::SetCursor() instead of DriWindow::SetCursor().

BUG=436433
TEST=chrome on link_freon with an extra LOG() in before sending
     OzoneGpuMsg_CursorSet

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

Cr-Commit-Position: refs/heads/master@{#305762}
  • Loading branch information
mspang authored and Commit bot committed Nov 26, 2014
1 parent 3c02e4d commit 58d7a81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions ui/ozone/platform/dri/dri_cursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ void DriCursor::SetCursor(gfx::AcceleratedWidget widget,
return;

cursor_ = cursor;

ShowCursor();
}

void DriCursor::ShowCursor() {
DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget);
if (!sender_->IsConnected())
return;
if (cursor_.get())
sender_->SetHardwareCursor(cursor_window_, cursor_->bitmaps(),
bitmap_location(), cursor_->frame_delay_ms());
Expand All @@ -49,6 +53,8 @@ void DriCursor::ShowCursor() {
}

void DriCursor::HideCursor() {
if (!sender_->IsConnected())
return;
DCHECK_NE(cursor_window_, gfx::kNullAcceleratedWidget);
sender_->SetHardwareCursor(cursor_window_, std::vector<SkBitmap>(),
gfx::Point(), 0);
Expand Down
5 changes: 0 additions & 5 deletions ui/ozone/platform/dri/dri_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ void DriWindow::Restore() {}
void DriWindow::SetCursor(PlatformCursor cursor) {
DriCursor* dri_cursor = window_manager_->cursor();
dri_cursor->SetCursor(widget_, cursor);
// ShowCursor results in a IPC call to GPU. So, we make sure the channel
// is connected. OnChannelEstablished guarantees that ShowCursor is called
// eventually.
if (sender_->IsConnected() && dri_cursor->GetCursorWindow() == widget_)
dri_cursor->ShowCursor();
}

void DriWindow::MoveCursorTo(const gfx::Point& location) {
Expand Down

0 comments on commit 58d7a81

Please sign in to comment.