Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphics/MultiplexingDisplay: Add HW cursor support. #3206

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented Jan 29, 2024

Create a HW cursor on each Display; if any Display cannot support a HW cursor, bail.

Our existing HW cursor implementations already handle setting the position outside of their display area, so we can just directly delegate to all multiplexed Cursor implementations without needing to track which platform(s) should actually be handling the event.

Fixes: #3198

Create a HW cursor on each `Display`; if `Display` cannot support a HW cursor, bail.

Our existing HW cursor implementations already handle setting the position outside of
their display area, so we can just directly delegate to all multiplexed `Cursor` implementations
without needing to track which platform(s) should actually be handling the event.
Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (42acb15) 77.81% compared to head (5952efd) 77.87%.

Files Patch % Lines
src/server/graphics/multiplexing_hw_cursor.cpp 82.60% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3206      +/-   ##
==========================================
+ Coverage   77.81%   77.87%   +0.05%     
==========================================
  Files        1072     1063       -9     
  Lines       75097    74680     -417     
==========================================
- Hits        58436    58155     -281     
+ Misses      16661    16525     -136     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +31 to +35
cursors.push_back(display->create_hardware_cursor());
if (cursors.back() == nullptr)
{
BOOST_THROW_EXCEPTION((std::runtime_error{"Platform failed to create hardware cursor"}));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a problem here, but thinking forward: this means that when adding a virtual display we offer different behaviour. (Obviously, fixing that would need something more complex than "hardware cursor" xor "software cursor")

Copy link
Collaborator

@AlanGriffiths AlanGriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of thoughts on style, but I haven't come up with an argument for change.

Approving, but won't queue yet (in case someone wants to chime in)

mir::logging::Severity::informational,
"display",
"Failed to create hardware cursor");
return nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why, but I prefer default constructing a shared_ptr<...> (original code) to implicitly constructing it with nullptr.

for (auto display : platform_displays)
{
cursors.push_back(display->create_hardware_cursor());
if (cursors.back() == nullptr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operator!() seems more idiomatic operator==(T*)

@Saviq
Copy link
Collaborator

Saviq commented Jan 29, 2024

Something's not right here:

#3205 (comment)

@AlanGriffiths
Copy link
Collaborator

Something's not right here:

#3205 (comment)

@RAOF if I understand your theory in that issue correctly, then PR is "merely" exposing an underlying bug, not itself causing problems?

@RAOF
Copy link
Contributor Author

RAOF commented Jan 31, 2024

Something's not right here:
#3205 (comment)

@RAOF if I understand your theory in that issue correctly, then PR is "merely" exposing an underlying bug, not itself causing problems?

My theory is that the HW cursor (specifically, drmMode*Cursor) is broken on that device/driver, and this PR causes Mir to use the HW cursor API, so the cursor is broken.

I think the last time we tried to use this API was in 2.13, so testing a 2.13-based frame and checking in the logs that it enables the hardware cursor would be a way to verify this.

@AlanGriffiths
Copy link
Collaborator

My theory is that the HW cursor (specifically, drmMode*Cursor) is broken on that device/driver

That brings back memories...

  # Workaround for https://github.com/MirServer/mir-kiosk/issues/23
  # "Mouse offset from image on Raspberry Pi 3 with Ubuntu Core 18"
  if grep -q snap_core=core18 /proc/cmdline && grep -q snap_kernel=pi-kernel /proc/cmdline
  then cursor=software
  fi

(I know it's a different bug and doesn't help here)

@AlanGriffiths
Copy link
Collaborator

Something's not right here:

@Saviq that seems to have been resolved. We should land unless you have thoughts on my "nits"?

@Saviq
Copy link
Collaborator

Saviq commented Feb 13, 2024

@Saviq that seems to have been resolved. We should land unless you have thoughts on my "nits"?

I think we need confirmation on what goes on with the hw cursor on a Pi - did it ever work? I'll have a look with 2.13 as Chris suggests.

@Saviq
Copy link
Collaborator

Saviq commented Feb 13, 2024

My theory is that the HW cursor (specifically, drmMode*Cursor) is broken on that device/driver, and this PR causes Mir to use the HW cursor API, so the cursor is broken.

I think the last time we tried to use this API was in 2.13, so testing a 2.13-based frame and checking in the logs that it enables the hardware cursor would be a way to verify this.

Like this?

<information> mirserver: Using hardware cursor
# …
<information> mirserver: Mir version 2.13.1
# …
<information> GLRenderer: GL vendor: Broadcom
<information> GLRenderer: GL renderer: V3D 4.2

So yeah, should work? This is with ubuntu-frame/20/stable.

Copy link
Collaborator

@Saviq Saviq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but with 22/edge I get:

<information> mirserver: Using software cursor

And on this PR:

<information> mirserver: Using hardware cursor

Still, we should give @RAOF the chance to reply to your nits. ACK otherwise.

@AlanGriffiths
Copy link
Collaborator

Still, we should give @RAOF the chance to reply to your nits. ACK otherwise.

Three days is enough chance

@AlanGriffiths AlanGriffiths added this pull request to the merge queue Feb 16, 2024
Merged via the queue into main with commit be02b69 Feb 16, 2024
36 of 37 checks passed
@AlanGriffiths AlanGriffiths deleted the fix-hw-cursor branch February 16, 2024 11:10
mattkae pushed a commit that referenced this pull request Mar 27, 2024
graphics/MultiplexingDisplay: Add HW cursor support.
mattkae pushed a commit that referenced this pull request Mar 27, 2024
graphics/MultiplexingDisplay: Add HW cursor support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cursor from GDM Login remains on screen after logging into Miriway
3 participants