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

drm/vc4: Notify firmware when use of simple framebuffer is complete #4421

Merged
merged 6 commits into from
Jul 2, 2021

Conversation

popcornmix
Copy link
Collaborator

With latest firmware and this call, the firmware is able to free the memory allocation for the simple framebuffer that was used in initial booting. This can be up to 16MB of gpu memory when running with hdmi_enable_4kp60=1.

It also allows the firmware to release the boost to the core clock that was necessary when driving that hdmi mode, and may no longer be required if kms choosing a lower resolution hdmi mode.

mripard added 2 commits June 29, 2021 17:51
The raspberrypi,firmware property has been documented as required in the
binding but was never actually used in the final version of the binding.
Remove it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The vc4 driver will need to tell the firmware that it takes over the
display for the firmware to free its resources (lower the clock, free
some memory, etc.)

Let's add an optional phandle to our firmware node.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@popcornmix
Copy link
Collaborator Author

@mripard this tested okay for me with LibreELEC on Pi3 and Pi4 with "ARM FB" allocation removed from vcdbg reloc.

Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

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

A few minor niggles...

@HiassofT
Copy link
Contributor

Testing on LibreELEC / RPi4 was fine here as well, core clock boost and framebuffer allocations were removed as expected

mripard added 2 commits June 30, 2021 14:41
The RPI_FIRMWARE_NOTIFY_DISPLAY_DONE firmware call allows to tell the
firmware the kernel is in charge of the display now and the firmware can
free whatever resources it was using.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The bind hooks will modify their controller registers, so simplefb is
going to be unusable anyway. Let's avoid any transient state where it
could still be in the system but no longer functionnal.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@popcornmix popcornmix force-pushed the firmware-notify-done branch from 04d5f7f to 0805ea9 Compare June 30, 2021 13:42
@popcornmix
Copy link
Collaborator Author

@pelwell does this update match what you wanted?
@mripard are you happy with the two changes @pelwell requested?

Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

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

Yes, that looks better. If you can remove that extra blank line I'll merge.

mripard added 2 commits June 30, 2021 15:29
Once the call to drm_fb_helper_remove_conflicting_framebuffers() has
been made, simplefb has been unregistered and the KMS driver is entirely
in charge of the display.

Thus, we can notify the firmware it can free whatever resource it was
using to maintain simplefb functional.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Add the firmware phandle to the vc4 node so that we can send it the
message that we're done with the firmware display.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@popcornmix popcornmix force-pushed the firmware-notify-done branch from 0805ea9 to 6ce13aa Compare July 2, 2021 11:46
@popcornmix
Copy link
Collaborator Author

@mripard are you happy with this PR? There have been trivial edits to your commits based on @pelwell's suggestions.

@mripard
Copy link
Contributor

mripard commented Jul 2, 2021

Yep, it looks great, thanks!

@pelwell pelwell merged commit a1c0966 into raspberrypi:rpi-5.10.y Jul 2, 2021
@popcornmix popcornmix deleted the firmware-notify-done branch July 2, 2021 12:22
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 2, 2021
…mplete

See: raspberrypi/linux#4421

kernel: Fix CPU hang when using CEC while HDMI output is disabled
See: raspberrypi/linux#4418

kernel: drm/vc4: hdmi: Add missing clk_disable_unprepare on error path
See: raspberrypi/linux#4426

kernel: staging: vc04_services: isp: Set the YUV420/YVU420 format stride to 64 bytes
See: raspberrypi/linux#4419

kernel: media: i2c: imx477: Add support for imx378 as a compatible sensor
See: raspberrypi/linux#4420
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 2, 2021
…mplete

See: raspberrypi/linux#4421

kernel: Fix CPU hang when using CEC while HDMI output is disabled
See: raspberrypi/linux#4418

kernel: drm/vc4: hdmi: Add missing clk_disable_unprepare on error path
See: raspberrypi/linux#4426

kernel: staging: vc04_services: isp: Set the YUV420/YVU420 format stride to 64 bytes
See: raspberrypi/linux#4419

kernel: media: i2c: imx477: Add support for imx378 as a compatible sensor
See: raspberrypi/linux#4420
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.

4 participants