Repository navigation
vc4 updates for 4.4 - #1419
vc4 updates for 4.4#1419
Conversation
Make bcm2835_clock_choose_div to optionally round up the chosen MASH divisor so that the resulting average rate will not be higher than the requested one. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Michael Turquette <mturquette@baylibre.com> (cherry picked from commit 9c95b32)
Some bcm2835 clocks used by hardware (like "PWM" or "H264") can have multiple parent clocks. These clocks divide the rate of a parent which can be selected by setting the proper bits in the clock control register. Previously all these parents where handled by a mux clock. But a mux clock cannot be used because updating clock control register to select parent needs a password to be xor'd with the parent index. This patch get rid of mux clock and make these clocks handle their own parent, allowing them to select the one to use. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Michael Turquette <mturquette@baylibre.com> (cherry picked from commit 6d18b8a)
Register the pwm clock for bcm2835. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Michael Turquette <mturquette@baylibre.com> (cherry picked from commit cfbab8f)
Added missing CTRL and DIV clock register definitions for: PCM, SLIM, TCNT, TEC, TD0, TD1 Register information taken from: https://rawgit.com/msperl/rpi-registers/master/rpi-registers.html#CM which extracted the information from the header files shared by Broadcom/rpi foundation in this file: http://www.broadcom.com/docs/support/videocore/Brcm_Android_ICS_Graphics_Stack.tar.gz Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit 2103a21)
bcm2835_pll_off is currently assigning CM_PLL_ANARST to the control register, which may lose the other bits that are currently set by the clock dividers. It also now locks during the read/modify/write cycle of both registers. Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 6727f08)
Add missing locking to: * bcm2835_pll_divider_on * bcm2835_pll_divider_off to protect the read modify write cycle for the register access protecting both cm_reg and a2w_reg registers. Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit ec36a5c)
Current clamping of a normal divider allows a value < 1 to be valid. A divider of < 1 would actually only be possible if we had a PLL... So this patch clamps the divider to 1. Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 997f16b)
The current driver calculates the clock divider with fractional support enabled. But it does not enable fractional support in the control register itself resulting in an integer only divider, but in clk_set_rate responds back the fractionally divided clock frequency. This patch enables fractional support in the control register whenever there is a fractional bit set in the requested clock divider. Mash clock limits are are also handled for the PWM clock applying the correct divider limits (2 and max_int) applicable to basic fractional divider support (mash order of 1). It also adds locking to protect the read/modify/write cycle of the register modification. Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 959ca92)
Fix all the checkpatch complaints for clk-bcm2835.c Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 6e1e60d)
For debugging purposes under some circumstance it helps to be able to see the actual clock registers. E.g: when looking at the clock divider it is helpful to see what the actual clock divider is. This patch exposes all the clock registers specific to each clock/pll/pll-divider via debugfs. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 96bf9c6)
As the use of BCM2835_CLOCK_COUNT in include/dt-bindings/clock/bcm2835.h is frowned upon as it needs to get modified every time a new clock gets introduced this patch changes the clk-bcm2835 driver to use a different scheme for registration of clocks and pll, so that there is no more need for BCM2835_CLOCK_COUNT to be defined. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 56eb3a2)
Reorganize bcm2835_clock_array so that there is no more need for separate bcm2835_*_data structures to be defined. Instead the required structures are generated inline via helper macros. To allow this to also work for pll alone it was required that the parent_pll was changed from a pointer to bcm2835_pll_data to the name of the pll instead. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 3b15afe)
Enable the PCM clock in the SOC, which is used by the bcm2835-i2s driver. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 33b6896)
Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 7284369)
Add AVE0, DFT, GP0, GP1, GP2, SLIM, SMI, TEC, DPI, CAM0, CAM1, DSI0E, and DSI1E. PULSE is not added because it has an extra divider. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit d3d6f15)
In poweroff, we set the reset bit and the power down bit, but only managed to unset the reset bit for poweron. This meant that if HDMI did -EPROBE_DEFER after it had grabbed its clocks, we'd power down the PLLH (that had been on at boot time) and never recover. Signed-off-by: Eric Anholt <eric@anholt.net> Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Cc: stable@vger.kernel.org Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> (cherry picked from commit d794a7b18350b7538e64248adf639f2cb8da5fb7)
These packets give us direct access to the firmware's power management code, as opposed to GET/SET_POWER_STATE packets that only had a couple of domains implemented. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kevin Hilman <khilman@linaro.org> (cherry picked from commit 60d5633)
This patch adds support for several power domains on Raspberry Pi, including USB (so it can be enabled even if the bootloader didn't do it), and graphics. This patch is the combined work of Eric Anholt (who wrote USB support inside of the Raspberry Pi firmware driver, and wrote the non-USB domain support) and Alexander Aring (who separated the original USB work out from the firmware driver). Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Kevin Hilman <khilman@linaro.org> (cherry picked from commit a09cd35)
The firmware driver can be a loadable module, but the power domain can only be built-in, so we get a build error in an allmodconfig kernel: :(.text+0x17e59c): undefined reference to `rpi_firmware_property' :(.text+0x17e51c): undefined reference to `rpi_firmware_get' :(.text+0x17e244): undefined reference to `rpi_firmware_property' This changes the dependency to only allow the power domain code to be enabled when the firmware driver is built-in. Other users of the firmware driver may still be loadable modules and not everyone needs the power domains, so we don't change the firmware code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> (cherry picked from commit 22a5b1d)
Signed-off-by: Eric Anholt <eric@anholt.net>
This will be used by the GPU driver for powering on HDMI at boot time and for 3D hang reset. Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
The copy_to/from_user() functions return the number of bytes remaining to be copied. We want to return error codes here. Also it's a bad idea to print an error message if a copy from user fails because users can use that to spam /var/log/messages which is annoying so I removed those. Fixes: 2146136 ('drm/vc4: Add an interface for capturing the GPU state after a hang.') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 65c4777)
This just fixes a warning on 64-bit builds:
drivers/gpu/drm/vc4/vc4_validate.c: In function ‘validate_gl_shader_rec’:
drivers/gpu/drm/vc4/vc4_validate.c:864:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c671e1e)
Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit f427fb1)
This is the pointer to the HVS device's memory where we stored the contents of *dlist. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 17eac75)
As we add actual scaling, this is going to get way more complicated. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 5c67999)
Previously, on every modeset we would allocate new display list memory, recompute changed planes, write all of them to the new memory, and pointed scanout at the new list (which will latch approximately at the next line of scanout). We let drm_atomic_helper_wait_for_vblanks() decide whether we needed to wait for a vblank after a modeset before cleaning up the old state and letting the next modeset proceed, and on legacy cursor updates we wouldn't wait. If you moved the cursor fast enough, we could potentially wrap around the display list memory area and overwrite the existing display list while it was still being scanned out, resulting in the HVS scanning out garbage or just halting. Instead of making cursor updates wait for scanout to move to the new display list area (which introduces significant cursor lag in X), we just rewrite our current display list. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 6674a90)
This implements a simple policy for choosing scaling modes (trapezoidal for decimation, PPF for magnification), and a single PPF filter (Mitchell/Netravali's recommendation). Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 21af94c)
This supports 420 and 422 subsampling with 2 or 3 planes, tested with modetest. It doesn't set up chroma subsampling position (which it appears KMS doesn't deal with yet). The LBM memory is overallocated in many cases, but apparently the docs aren't quite correct and I'll probably need to look at the hardware source to really figure it out. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit fc04023)
We were tracking the "where are the head pointers pointing" globally, so if another job reused the same BOs and execution was at the same point as last time we checked, we'd stop and trigger a reset even though the GPU had made progress. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit c4ce60d)
We'd need X to queue up an async pageflip while another is outstanding, and then take a SIGIO. I think X actually avoids sending out the next pageflip while one's already queued, but I'm not sure. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 48627eb)
If the firmware hadn't brought up HDMI for us, we need to do its power-on reset sequence (reset HD and and clear its STANDBY bits, reset HDMI, and leave the PHY disabled). Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 851479a)
This is also involved in the HDMI setup sequence so it's nice to see it. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 936f1a5)
It's used for delaying vsync in interlaced mode. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit c31806f)
It looks like when I went to add the interlaced bits, I just took the existing PV_VERT* block and indented it, instead of copy and pasting it first. Without this, changing resolution never worked. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit a7c5047)
We weren't updating the interlaced bit, so we'd scan out incorrectly if the firmware had brought up the TV encoder and we were switching to HDMI. Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 6a60920)
The hardware provides us with separate threads for binning and rendering, and the existing model waits for them both to complete before submitting the next job. Splitting the binning and rendering submissions reduces idle time and gives us approx 20-30% speedup with some x11perf tests such as -line10 and -tilerect1. Improves openarena performance by 1.01897% +/- 0.247857% (n=16). Thanks to anholt for suggesting this. v2: Rebase on the spurious resets fix (change by anholt). Signed-off-by: Varad Gautam <varadgautam@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit ca26d28)
Fixes an error thrown every few seconds when we poll HPD when it's on a I2C to GPIO expander. Signed-off-by: Eric Anholt <eric@anholt.net> Tested-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 0e60eab)
The original Raspberry Pi had the GPIO active high, but the later models are active low. The DT GPIO bindings allow specifying the active flag, except that it doesn't get propagated to the gpiodesc, so you have to handle it yourself. Signed-off-by: Eric Anholt <eric@anholt.net> Tested-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 0b06e0a)
The copy_from_user() function returns the number of bytes not copied but we want to return a negative error code. Fixes: 463873d ('drm/vc4: Add an API for creating GPU shaders in GEM BOs.') Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Eric Anholt <eric@anholt.net> (cherry picked from commit 585cb13)
The Raspberry Pi Foundation's firmware updates are shipping device trees using the old string, so we'll keep recognizing that as this rev of V3D. Still, we should use a more specific name in the upstream DT to clarify which board is being supported, in case we do other revs of V3D in the future. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Stephen Warren <swarren@wwwdotorg.org> (cherry picked from commit 90d7116)
The previous area no longer works, for reasons I haven't investigated. Just move it somewhere that works. Signed-off-by: Eric Anholt <eric@anholt.net>
|
I get a WARN on boot. |
|
We suspect the cma issue is because device tree by default loads at top of non highmem memory (e.g. ends at 768M). |
|
I don't see any reason not to include the CMA commit -- the size is the only thing we care about, and the base just has to be whatever works from among 0, 256, 512, or 768. |
|
The vblank warning has been around for a while, not special to this merge. I think it's that we don't have a frame count/current scanline register from HVS, so I need to go test and fix this path that nobody else uses. |
|
Is there any disadvantage to allocating more to CMA? |
|
The V3D hardware, to a rough approximation, can't have its addresses cross a 256MB boundary due to a HW bug. Thus we choose 256MB for size and align it to a 256MB boundary somewhere, to get the maximum size possible. |
|
I'm not getting a console framebuffer with overlay enabled. Any thoughts? Booting to desktop does work. |
|
It would be better for DRM & DRM_VC4 to be built-in to the kernel, rather than as modules. |
|
@popcornmix I'm assuming you have an HDMI monitor plugged in? Is the firmware configuring HDMI at boot? Anything in config.txt other than the overlay and avoid_warnings? Asking this to see if I can replicate your environment. The divide in set_rate is of the rate being passed in, which would suggest that the mode->clock is 0? Next step would be to put a drm_mode_debug_printmodeline(mode) near the top of vc4_hdmi_encoder_mode_set(). Also, setting drm.debug=0x14 on kernel command line should help with modeset debugging. |
|
Yes, monitor is plugged into HDMI. Firmware chooses: |
See: raspberrypi/linux#1419 kernel: clk-bcm2835-aux fix - backported from kernel 4.6 See: raspberrypi/linux#1423 kernel: bcm2835-i2s: Reduce the TX DREQ threshold See: raspberrypi/linux#1417 kernel: config: Add DRM_UDL module See: raspberrypi/linux#1422 kernel: vchiq_arm: Add completion records under the mutex See: https://discourse.osmc.tv/t/crashing-when-seeking/15716 firmware: pwm_sdm: Fix release build bug regression See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445 firmware: raspistill: Use camera_info component to set the sensor name and output resolution firmware: dtoverlay: Require sudo for destructive operations firmware: dtoverlay: command line tweaks See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=139732 firmware: platform: Move initial freq settings to platform firmeare: platform: Move initial volt settings to platform
See: raspberrypi/linux#1419 kernel: clk-bcm2835-aux fix - backported from kernel 4.6 See: raspberrypi/linux#1423 kernel: bcm2835-i2s: Reduce the TX DREQ threshold See: raspberrypi/linux#1417 kernel: config: Add DRM_UDL module See: raspberrypi/linux#1422 kernel: vchiq_arm: Add completion records under the mutex See: https://discourse.osmc.tv/t/crashing-when-seeking/15716 firmware: pwm_sdm: Fix release build bug regression See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445 firmware: raspistill: Use camera_info component to set the sensor name and output resolution firmware: dtoverlay: Require sudo for destructive operations firmware: dtoverlay: command line tweaks See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=139732 firmware: platform: Move initial freq settings to platform firmeare: platform: Move initial volt settings to platform
See: raspberrypi/linux#1419 kernel: clk-bcm2835-aux fix - backported from kernel 4.6 See: raspberrypi/linux#1423 kernel: bcm2835-i2s: Reduce the TX DREQ threshold See: raspberrypi/linux#1417 kernel: config: Add DRM_UDL module See: raspberrypi/linux#1422 kernel: vchiq_arm: Add completion records under the mutex See: https://discourse.osmc.tv/t/crashing-when-seeking/15716 firmware: pwm_sdm: Fix release build bug regression See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445 firmware: raspistill: Use camera_info component to set the sensor name and output resolution firmware: dtoverlay: Require sudo for destructive operations firmware: dtoverlay: command line tweaks See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=139732 firmware: platform: Move initial freq settings to platform firmeare: platform: Move initial volt settings to platform
See: raspberrypi/linux#1419 kernel: clk-bcm2835-aux fix - backported from kernel 4.6 See: raspberrypi/linux#1423 kernel: bcm2835-i2s: Reduce the TX DREQ threshold See: raspberrypi/linux#1417 kernel: config: Add DRM_UDL module See: raspberrypi/linux#1422 kernel: vchiq_arm: Add completion records under the mutex See: https://discourse.osmc.tv/t/crashing-when-seeking/15716 firmware: pwm_sdm: Fix release build bug regression See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=136445 firmware: raspistill: Use camera_info component to set the sensor name and output resolution firmware: dtoverlay: Require sudo for destructive operations firmware: dtoverlay: command line tweaks See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=139732 firmware: platform: Move initial freq settings to platform firmeare: platform: Move initial volt settings to platform
Here's a giant merge of post-4.4 development for vc4. Just touch-tested with a pi2 so far (X, glxgears). Note that I'm using the overlay for downstream merge testing now, which I wasn't before.
The only commit I'm not really pleased with is the CMA move in the overlay. Also, it would be really nice to be able to customize the CMA area based on the board in use so that we could enable pi1 with a smaller CMA area, but I don't know how we would do that with a single overlay file.