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/PlatformProbe: Implement a more principled GraphicBufferAllocator selector #3402

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

RAOF
Copy link
Contributor

@RAOF RAOF commented May 28, 2024

This implements an actual selection process for the GraphicBufferAllocator:

  • First, find the RenderingPlatform(s) with fewest displays they can't drive, then
  • Select the RenderingPlatform with the highest number of displays probed 'best' for

In the case of ties, the algorithm picks the first RenderingPlatform in the list;
due to the selections elsewhere, that will be the first platform in alphabetical order

Fixes: #3400

RAOF added 2 commits May 28, 2024 12:42
This implements an actual selection process for the GraphicBufferAllocator:
* First, find the `RenderingPlatform`(s) with *fewest* displays they *can't* drive, then
* Select the `RenderingPlatform` with the highest number of displays probed 'best' for

In the case of ties, the algorithm picks the first `RenderingPlatform` in the list;
due to the selections elsewhere, that will be the first platform in alphabetical order.
@RAOF RAOF requested a review from a team as a code owner May 28, 2024 08:04
@RAOF
Copy link
Contributor Author

RAOF commented May 28, 2024

This needs further testing on hardware I have (laptop, RPi4) before merging.

Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 98.93617% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.31%. Comparing base (a5f3143) to head (48cfdca).
Report is 480 commits behind head on main.

Files with missing lines Patch % Lines
tests/unit-tests/graphics/test_platform_prober.cpp 98.48% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3402      +/-   ##
==========================================
- Coverage   77.52%   77.31%   -0.22%     
==========================================
  Files        1065     1075      +10     
  Lines       67901    68494     +593     
==========================================
+ Hits        52639    52953     +314     
- Misses      15262    15541     +279     

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

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.

This looks sensible, and obviously does what is described.

But could there be tests?

@RAOF
Copy link
Contributor Author

RAOF commented May 30, 2024

Yes, there could (and should!) be tests!

@RAOF
Copy link
Contributor Author

RAOF commented May 31, 2024

Ok! glmark on the Pi is noisy, but this does not appear to have a significant performance effect there (and it still renders correctly 😉).

It works on my laptop - rendering is correct, both from i915 and amdgpu, and performance is better when rendering on i915. Performance seems to be a lot worse on amdgpu. Here we run into “how useful a benchmark is glmark?”. I'm not sure, and I'm still investigating exactly where the difference is.

@RAOF
Copy link
Contributor Author

RAOF commented Jun 3, 2024

OK. So, the difference between trunk and this:

  • On trunk, amdgpu uses linux_dmabuf. The client driver selects a format/modifier pair that's (apparently) much faster for amdgpu to render to, but is incompatible with i915.
  • On this (and, it turns out, 2.16.2) the client driver uses wl_drm and create_prime_buffer; this will (presumably, there's no easy way to introspect this) allocate a linear buffer that is slower to render to.

So this is not a performance regression vs 2.16.2 on AMD on my Intel/AMD hybrid laptop, and renders correctly.

It might be interesting in future to see how rendering to the optimal buffer layout, and then going through the bounce-buffer to be sampleable from the Intel GPU, but that's definitely future work.

This should be good to go.

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.

Yeah, that looks better

@AlanGriffiths AlanGriffiths enabled auto-merge June 6, 2024 09:35
@AlanGriffiths AlanGriffiths added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 5f4bd84 Jun 6, 2024
35 of 36 checks passed
@AlanGriffiths AlanGriffiths deleted the MIRENG-541-select-buffer-allocator branch June 6, 2024 10:41
@AlanGriffiths AlanGriffiths mentioned this pull request Sep 9, 2024
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.

The DMABufEGLProvider on the non-scanout device is used for buffer imports
2 participants