Maxime Ripard
0b1dbe82e0
drm/vc4: hdmi: Add support for BCM2712 HDMI controllers
...
The HDMI controllers found in the BCM2712 are largely the ones found in
the BCM2711 with a different PHY.
There's some difference with how timings are split between registers,
and HDMI1 is now able to run at 4k/60Hz.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-12-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:20 +00:00
Maxime Ripard
9a9ef0da86
drm/vc4: crtc: Add support for BCM2712 PixelValves
...
The PixelValves found on the BCM2712 are similar to the ones found in
the previous generation.
Compared to BCM2711:
- the pixelvalves only drive one HDMI controller each
- HDMI1 PixelValve has a FIFO long enough to support 4k at 60Hz
- support has been added for odd horizontal timings whilst at 2pixels/clock
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-11-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:20 +00:00
Maxime Ripard
7687a12153
drm/vc4: hvs: Add support for BCM2712 HVS
...
The HVS found in the BCM2712, while having a similar role, is very
different from the one found in the previous SoCs. Indeed, the register
layout is fairly different, and the DLIST format is new as well.
Let's introduce the needed functions to support the new HVS.
This commit adds the C-step register layout. The D-step will be
added later.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-10-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:19 +00:00
Maxime Ripard
626ffc5f87
drm/vc4: drv: Support BCM2712
...
The BCM2712 has an improved display pipeline, most notably with a
different HVS and only HDMI and writeback outputs.
Let's introduce it as a new VideoCore generation and compatible.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-9-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:19 +00:00
Dave Stevenson
8f2fc64773
drm/vc4: Fix reading of frame count on GEN5 / Pi4
...
The frame count values moved within registers DISPSTAT1 and
DISPSTAT2 with GEN5, so update the accessor function to
accommodate that.
Fixes: b51cd7ad14 ("drm/vc4: hvs: Fix frame count register readout")
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-2-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:19 +00:00
Dave Stevenson
56aa4c374d
drm/vc4: Use of_device_get_match_data to set generation
...
Use of_device_get_match_data to retrieve the generation value
as set in the struct of_device_id, rather than manually comparing
compatible strings.
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20241025-drm-vc4-2712-support-v2-1-35efa83c8fc0@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-11-27 14:37:19 +00:00
Thomas Zimmermann
b86711c6d6
drm/client: Move public client header to clients/ subdirectory
...
Move the public header file drm_client_setup.h to the clients/
subdirectory and update all drivers. No functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241108154600.126162-3-tzimmermann@suse.de
2024-11-15 09:42:13 +01:00
Dave Airlie
30169bb645
Backmerge v6.12-rc6 of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into drm-next
...
Backmerge Linus tree for some drm-fixes needed for msm and xe merges.
Signed-off-by: Dave Airlie <airlied@redhat.com >
2024-11-04 14:25:33 +10:00
Thomas Zimmermann
7e89e4365f
drm/vc4: Use video aperture helpers
...
DRM's aperture functions have long been implemented as helpers
under drivers/video/ for use with fbdev. Avoid the DRM wrappers by
calling the video functions directly.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Maxime Ripard <mripard@kernel.org >
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com >
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com >
Acked-by: Javier Martinez Canillas <javierm@redhat.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240930130921.689876-25-tzimmermann@suse.de
2024-10-14 15:28:48 +02:00
Dave Stevenson
42aa18d1c3
drm/vc4: Correct generation check in vc4_hvs_lut_load
...
Commit 24c5ed3ddf ("drm/vc4: Introduce generation number enum")
incorrectly swapped a check of hvs->vc4->is_vc5 to
hvs->vc4->gen == VC4_GEN_4 in vc4_hvs_lut_load, hence breaking
loading the gamma look up table on Pi0-3.
Correct that conditional.
Fixes: 24c5ed3ddf ("drm/vc4: Introduce generation number enum")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com >
Closes: https://lore.kernel.org/dri-devel/37051126-3921-4afe-a936-5f828bff5752@samsung.com/
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241008-drm-vc4-fixes-v1-3-9d0396ca9f42@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-10-09 12:11:03 +01:00
Dave Stevenson
6b0bd1b02e
drm/vc4: Match drm_dev_enter and exit calls in vc4_hvs_atomic_flush
...
Commit 92c17d1647 ("drm/vc4: hvs: Ignore atomic_flush if we're disabled")
added a path which returned early without having called drm_dev_exit.
Ensure all paths call drm_dev_exit.
Fixes: 92c17d1647 ("drm/vc4: hvs: Ignore atomic_flush if we're disabled")
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241008-drm-vc4-fixes-v1-2-9d0396ca9f42@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-10-09 12:10:19 +01:00
Dave Stevenson
cf1c87d978
drm/vc4: Match drm_dev_enter and exit calls in vc4_hvs_lut_load
...
Commit 52efe364d1 ("drm/vc4: hvs: Don't write gamma luts on 2711")
added a return path to vc4_hvs_lut_load that had called
drm_dev_enter, but not drm_dev_exit.
Ensure we call drm_dev_exit.
Fixes: 52efe364d1 ("drm/vc4: hvs: Don't write gamma luts on 2711")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com >
Closes: https://lore.kernel.org/dri-devel/37051126-3921-4afe-a936-5f828bff5752@samsung.com/
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241008-drm-vc4-fixes-v1-1-9d0396ca9f42@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-10-09 12:10:19 +01:00
Dave Stevenson
01c29dbf9d
drm/vc4: Run default client setup for all variants.
...
Commit 45903624e9 ("drm/vc4: Run DRM default client setup")
only added DRM_FBDEV_DMA_DRIVER_OPS for the vc4 (Pi0-3) driver
definition, which caused an issue on vc5 (Pi4) as there was no
fbdev_probe function defined.
Fixes: 45903624e9 ("drm/vc4: Run DRM default client setup")
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20241002-vc4_fbdev_fix-v1-1-8737bd11b147@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-10-09 12:04:43 +01:00
Maíra Canal
82fe69e63d
drm/vc4: Use vc4_perfmon_find()
...
Similar to commit f2a4bcb253 ("drm/v3d: Use v3d_perfmon_find()"),
replace the open-coded `vc4_perfmon_find()` with the real thing.
Cc: Christian Gmeiner <cgmeiner@igalia.com >
Signed-off-by: Maíra Canal <mcanal@igalia.com >
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com >
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241004123817.890016-1-mcanal@igalia.com
2024-10-07 10:04:46 -03:00
Maíra Canal
0b2ad4f6f2
drm/vc4: Stop the active perfmon before being destroyed
...
Upon closing the file descriptor, the active performance monitor is not
stopped. Although all perfmons are destroyed in `vc4_perfmon_close_file()`,
the active performance monitor's pointer (`vc4->active_perfmon`) is still
retained.
If we open a new file descriptor and submit a few jobs with performance
monitors, the driver will attempt to stop the active performance monitor
using the stale pointer in `vc4->active_perfmon`. However, this pointer
is no longer valid because the previous process has already terminated,
and all performance monitors associated with it have been destroyed and
freed.
To fix this, when the active performance monitor belongs to a given
process, explicitly stop it before destroying and freeing it.
Cc: stable@vger.kernel.org # v4.17+
Cc: Boris Brezillon <bbrezillon@kernel.org >
Cc: Juan A. Suarez Romero <jasuarez@igalia.com >
Fixes: 65101d8c91 ("drm/vc4: Expose performance counters to userspace")
Signed-off-by: Maíra Canal <mcanal@igalia.com >
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20241004123817.890016-2-mcanal@igalia.com
2024-10-07 09:06:46 -03:00
Thomas Zimmermann
45903624e9
drm/vc4: Run DRM default client setup
...
Call drm_client_setup_with_fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.
v5:
- select DRM_CLIENT_SELECTION
v2:
- use drm_client_setup_with_fourcc()
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Maxime Ripard <mripard@kernel.org >
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com >
Cc: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com >
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240924071734.98201-47-tzimmermann@suse.de
2024-09-26 09:31:27 +02:00
Dave Stevenson
7ab6512e79
drm/vc4: hvs: Correct logic on stopping an HVS channel
...
When factoring out __vc4_hvs_stop_channel, the logic got inverted from
if (condition)
// stop channel
to
if (condition)
goto out
//stop channel
out:
and also changed the exact register writes used to stop the channel.
Correct the logic so that the channel is actually stopped, and revert
to the original register writes.
Fixes: 6d01a106b4 ("drm/vc4: crtc: Move HVS init and close to a function")
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-32-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Tim Gover
886a79237e
drm/vc4: hvs: Enable SCALER_CONTROL early in HVS init
...
Always enable SCALER_CONTROL before attempting other HVS
operations. It's safe to write to some parts of the HVS but
in general it's dangerous to do this because it can cause bus
lockups.
Signed-off-by: Tim Gover <tim.gover@raspberrypi.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-31-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Dave Stevenson
8e7eb0c54a
drm/vc4: plane: Move the buffer offset out of the vc4_plane_state
...
The offset fields in vc4_plane_state are described as being
the offset for each buffer in the bo, however it is used to
store the complete DMA address that is then written into the
register.
The DMA address including the fb ofset can be retrieved
using drm_fb_dma_get_gem_addr, and the offset adjustment due to
clipping is local to vc4_plane_mode_set.
Drop the offset field from the state, and compute the complete
DMA address in vc4_plane_mode_set.
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-30-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Maxime Ripard
7621db4d40
drm/vc4: hvs: Change prototype of __vc4_hvs_alloc to pass registers
...
The BCM2712 HVS has registers to report the size of the various SRAM the
driver uses, and their size actually differ depending on the stepping.
The initialisation of the memory pools happen in the __vc4_hvs_alloc()
function that also allocates the main HVS structure, that will then hold
the pointer to the memory mapping of the registers.
This creates some kind of circular dependency that we can break by
passing the mapping pointer as an argument for __vc4_hvs_alloc() to use
to query to get the SRAM sizes and initialise the memory pools
accordingly.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-29-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Maxime Ripard
74c3b7c63b
drm/vc4: hvs: Rework LBM alignment
...
With the introduction of the support for BCM2712, the check of whether
we're running on vc5 or not to compute the LBM alignment requirement
doesn't work anymore.
Moreover, the LBM size will need to be computed in words for the
BCM2712, while we've had sizes in bytes so far.
Aligning on either 64 or 32 words is thus fairly harmful on BCM2712, so
let's just explicitly align the size when needed, and then call
drm_mm_insert_node_generic() with an alignment of 1.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-28-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Maxime Ripard
efbc7b9c21
drm/vc4: plane: Change ptr0_offset to an array
...
The BCM2712 will have a fairly different dlist, that will feature one
Pointer 0 word for each plane.
Let's prepare by changing the ptr0_offset variable that holds the offset
in a dlist of the pointer 0 word to an array.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-27-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:54 +01:00
Maxime Ripard
295fbb059f
drm/vc4: hvs: Rename hvs_regs list
...
The HVS register set has been heavily modified in the BCM2712, and we'll
thus need a separate debugfs_reg32 array for it.
The name hvs_regs is thus a bit too generic, so let's rename it to
something more specific.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-26-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
808f4055a1
drm/vc4: hvs: Create cob_init function
...
Just like the HVS itself, the COB parameters will be fairly different in
the BCM2712.
Let's move the COB parameters computation and its initialisation to a
separate function that will be easier to extend in the future.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-25-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
2fa4ef5fb9
drm/vc4: hvs: Create hw_init function
...
Since the BCM2712 will feature a significantly different HVS, let's move
the hardware initialisation part of our bind function into a separate
function.
That way, it will be easier to extend in the future.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-24-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
c157ff40a4
drm/vc4: hvs: Use switch statement to simplify vc4_hvs_get_fifo_from_output
...
Since we'll support BCM2712 soon, let's move the logic behind
vc4_hvs_get_fifo_from_output() to a switch to extend it more easily.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-23-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
dbe8ef676f
drm/vc4: Make v3d paths unavailable on any generation newer than vc4
...
The V3D IP has been separate since BCM2711, so let's make sure we issue
a WARN if we're running not only on BCM2711, but also anything newer.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-22-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
24c5ed3ddf
drm/vc4: Introduce generation number enum
...
With the introduction of the BCM2712 support, we will get yet another
generation of display engine to support.
The binary check of whether it's VC5 or not thus doesn't work anymore,
especially since some parts of the driver will have changed with BCM2711,
and some others with BCM2712.
Let's introduce an enum to store the generation the driver is running
on, which should provide more flexibility.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-21-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dom Cobley
1330d28d75
drm/vc4: hvs: Remove ABORT_ON_EMPTY flag
...
ABORT_ON_EMPTY chooses whether the HVS abandons the current frame
when it experiences an underflow, or attempts to continue.
In theory the frame should be black from the point of underflow,
compared to a shift of sebsequent pixels to the left.
Unfortunately it seems to put the HVS is a bad state where it is not
possible to recover simply. This typically requires a reboot
following the 'flip done timed out message'.
Discussion with Broadcom has suggested we don't use this flag.
All their testing is done with it disabled.
Additionally setting BLANK_INSERT_EN causes the HDMI to output
blank pixels on an underflow which avoids it losing sync.
After this change a 'flip done timed out' due to sdram bandwidth
starvation or too low a clock is recoverable once the situation improves.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-20-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dave Stevenson
d285bb622e
drm/vc4: hvs: Remove incorrect limit from hvs_dlist debugfs function
...
The debugfs function to dump dlists aborted at 256 bytes,
when actually the dlist memory is generally significantly
larger but varies based on SoC.
We already have the correct limit in __vc4_hvs_alloc, so
store it for use in the debugfs dlist function.
Fixes: c6dac00340 ("drm/vc4: hvs: Add debugfs node that dumps the current display lists")
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-19-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dave Stevenson
6d5f76e054
drm/vc4: hvs: Fix dlist debug not resetting the next entry pointer
...
The debug function to display the dlists didn't reset next_entry_start
when starting each display, so resulting in not stopping the
list at the correct place.
Fixes: c6dac00340 ("drm/vc4: hvs: Add debugfs node that dumps the current display lists")
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-18-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dom Cobley
223ee2567a
drm/vc4: hdmi: Avoid hang with debug registers when suspended
...
Trying to read /sys/kernel/debug/dri/1/hdmi1_regs
when the hdmi is disconnected results in a fatal system hang.
This is due to the pm suspend code disabling the dvp clock.
That is just a gate of the 108MHz clock in DVP_HT_RPI_MISC_CONFIG,
which results in accesses hanging AXI bus.
Protect against this.
Fixes: 25eb441d55 ("drm/vc4: hdmi: Add all the vc5 HDMI registers into the debugfs dumps")
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-17-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dave Stevenson
542962190e
drm/vc4: plane: YUV planes require vertical scaling to always be enabled
...
It has been observed that a YUV422 unity scaled plane isn't displayed.
Enabling vertical scaling on the UV planes solves this. There is
already a similar clause to always enable horizontal scaling on the
UV planes.
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-16-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Dave Stevenson
52efe364d1
drm/vc4: hvs: Don't write gamma luts on 2711
...
The gamma block has changed in 2711, therefore writing the lut
in vc4_hvs_lut_load is incorrect.
Whilst the gamma property isn't created for 2711, it is called
from vc4_hvs_init_channel, so abort if attempted.
Fixes: c54619b0bf ("drm/vc4: Add support for the BCM2711 HVS5")
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-15-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
dbe101b106
drm/vc4: crtc: Move assigned_channel to a variable
...
We access multiple times the vc4_crtc_state->assigned_channel variable
in the vc4_crtc_get_scanout_position() function, so let's store it in a
local variable.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-14-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
5171d86a62
drm/vc4: plane: Use return variable in atomic_check
...
The vc4_plane_atomic_check() directly returns the result of the final
function it calls.
Using the already defined ret variable to check its content on error,
and a separate return 0 on success, makes it easier to extend.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-13-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
f18029bdf2
drm/vc4: plane: Add more debugging for LBM allocation
...
LBM allocations need a different size depending on the line length,
format, etc.
This can get tricky, and fail. Let's add some more prints to ease the
debugging when it does.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-12-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
6184b9446d
drm/vc4: hvs: Print error if we fail an allocation
...
We need to allocate a few additional structures when checking our
atomic_state, especially related to hardware SRAM that will hold the
plane descriptors (DLIST) and the current line context (LBM) during
composition.
Since those allocation can fail, let's add some error message in that
case to help debug what goes wrong.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-11-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
b6d7a95396
drm/vc4: hvs: More logging for dlist generation
...
DLIST generation can get pretty tricky and there's not a lot of debug in
the driver to help. Let's add a few more to track the generated DLIST
size.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-10-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:53 +01:00
Maxime Ripard
6ecfe7c2f9
drm/vc4: hdmi: Warn if writing to an unknown HDMI register
...
The VC4 HDMI driver has a bunch of accessors to read from a register.
The read accessor was warning when accessing an unknown register, but
the write one was just returning silently.
Let's make sure we warn also when writing to an unknown register.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-9-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dom Cobley
59f8b2b7fb
drm/vc4: hdmi: Increase audio MAI fifo dreq threshold
...
Now we wait for write responses and have a burst
size of 4, we can set the fifo threshold much higher.
Set it to 28 (of the 32 entry size) to keep fifo
fuller and reduce chance of underflow.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-8-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dave Stevenson
014eccc9da
drm/vc4: hvs: Set AXI panic modes for the HVS
...
The HVS can change AXI request mode based on how full the COB
FIFOs are.
Until now the vc4 driver has been relying on the firmware to
have set these to sensible values.
With HVS channel 2 now being used for live video, change the
panic mode for all channels to be explicitly set by the driver,
and the same for all channels.
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-7-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dom Cobley
31c8a80b93
drm/vc4: plane: Add support for YUV444 formats
...
Support displaying DRM_FORMAT_YUV444 and DRM_FORMAT_YVU444 formats.
Tested with kmstest and kodi. e.g.
kmstest -r 1920x1080@60 -f 400x300-YU24
Note: without the shift of width, only half the chroma is fetched,
resulting in correct left half of image and corrupt colours on right half.
The increase in width shouldn't affect fetching of Y data,
as the hardware will clamp at dest width.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-6-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dom Cobley
b4e5646178
drm/vc4: hdmi: Avoid log spam for audio start failure
...
We regularly get dmesg error reports of:
[ 18.184066] hdmi-audio-codec hdmi-audio-codec.3.auto: ASoC: error at snd_soc_dai_startup on i2s-hifi: -19
[ 18.184098] MAI: soc_pcm_open() failed (-19)
These are generated for any disconnected hdmi interface when pulseaudio
attempts to open the associated ALSA device (numerous times). Each open
generates a kernel error message, generating general log spam.
The error messages all come from _soc_pcm_ret in sound/soc/soc-pcm.c#L39
which suggests returning ENOTSUPP, rather that ENODEV will be quiet.
And indeed it is.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-5-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dave Stevenson
9337d27d23
drm/vc4: crtc: Force trigger of dlist update on margins change
...
When the margins are changed, the dlist needs to be regenerated
with the changed updated dest regions for each of the planes.
Setting the zpos_changed flag is sufficient to trigger that
without doing a full modeset, therefore set it should the
margins be changed.
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-4-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dom Cobley
ac69c01fa8
drm/vc4: plane: Handle fractional coordinates using the phase field
...
Apply fractional source co-ordinates into the scaling filters.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-3-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Dom Cobley
6639d7d9af
drm/vc4: plane: Keep fractional source coords inside state
...
Fractional source co-ordinates can be used to setup the scaling
filters, so retain the information.
Signed-off-by: Dom Cobley <popcornmix@gmail.com >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20240621152055.4180873-2-dave.stevenson@raspberrypi.com
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com >
2024-09-09 13:02:52 +01:00
Stefan Wahren
f60ef67ff2
drm/vc4: v3d: simplify clock retrieval
...
Common pattern of handling deferred probe can be simplified with
dev_err_probe() and devm_clk_get_optional(). This results in much
less code.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Signed-off-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240821214052.6800-6-wahrenst@gmx.net
2024-08-22 07:57:44 -03:00
Stefan Wahren
59ac702a93
drm/vc4: Get the rid of DRM_ERROR()
...
DRM_ERROR() has been deprecated in favor of pr_err(). However, we
should prefer to use drm_err() whenever possible so we get device-
specific output with the error message. In error case of kcalloc,
we can simply drop DRM_ERROR(), because kcalloc already logs errors.
Suggested-by: Maíra Canal <mcanal@igalia.com >
Signed-off-by: Stefan Wahren <wahrenst@gmx.net >
Reviewed-by: Maxime Ripard <mripard@kernel.org >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Signed-off-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240821214052.6800-4-wahrenst@gmx.net
2024-08-22 07:57:44 -03:00
Stefan Wahren
f1a54e860b
drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get
...
The commit 0f5251339e ("drm/vc4: hdmi: Make sure the controller is
powered in detect") introduced the necessary power management handling
to avoid register access while controller is powered down.
Unfortunately it just print a warning if pm_runtime_resume_and_get()
fails and proceed anyway.
This could happen during suspend to idle. So we must assume it is unsafe
to access the HDMI register. So bail out properly.
Fixes: 0f5251339e ("drm/vc4: hdmi: Make sure the controller is powered in detect")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net >
Reviewed-by: Maíra Canal <mcanal@igalia.com >
Acked-by: Maxime Ripard <mripard@kernel.org >
Signed-off-by: Maíra Canal <mcanal@igalia.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20240821214052.6800-3-wahrenst@gmx.net
2024-08-22 07:57:44 -03:00