summaryrefslogtreecommitdiff
path: root/drivers/gpu
AgeCommit message (Collapse)Author
2026-06-09drm/bridge: Document bridge chain format selectionNicolas Frattaroli
The bridge chain format selection behaviour was, until now, undocumented. With the addition of the "color format" DRM property, it's not sufficiently complex enough that documentation is warranted, especially for driver authors trying to do the right thing. Add a high-level overview of how the process is supposed to work, and mention what the display driver is supposed to do if it wants to make use of this functionality. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-23-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/tests: bridge: Add test for HDMI output bus formats helperNicolas Frattaroli
The common atomic_get_output_bus_fmts helper for HDMI bridge connectors, called drm_atomic_helper_bridge_get_hdmi_output_bus_fmts, should return an array of output bus formats depending on the supported formats of the connector, and the current output BPC. Add a test to exercise some of this helper. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-22-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/tests: bridge: Add KUnit tests for bridge chain format selectionNicolas Frattaroli
With the "color format" property, the bridge chain format selection has gained increased complexity. Instead of simply finding any sequence of bus formats that works, the bridge chain format selection needs to pick a sequence that results in the requested color format. Add KUnit tests for this new logic. These take the form of some pleasant preprocessor macros to make it less cumbersome to define test bridges with a set of possible input and output formats. The input and output formats are defined for bridges in the form of tuples, where the first member defines the input format, and the second member defines the output format that can be produced from this input format. This means the tests can construct scenarios in which not all inputs can be converted to all outputs. Some tests are added to test interesting scenarios to exercise the bus format selection in the presence of a specific color format request. Furthermore, tests are added to verify that bridge chains that end in an HDMI connector will always prefer RGB when the color format is DRM_CONNECTOR_COLOR_FORMAT_AUTO, as is the behaviour in the HDMI state helpers. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-21-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/tests: hdmi: Add tests for HDMI helper's mode_validNicolas Frattaroli
Add some KUnit tests to verify that the HDMI state helper's mode_valid implementation does not improperly reject chroma subsampled modes on the basis of their clock rate not being satisfiable in RGB. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-20-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/tests: hdmi: Add tests for the color_format propertyNicolas Frattaroli
Add some KUnit tests to check the color_format property is working as expected with the HDMI state helper. Existing tests are extended to also test the DRM_CONNECTOR_COLOR_FORMAT_AUTO case, in order to avoid duplicating test cases. For the explicitly selected color format cases, parameterized tests are added. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-19-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/connector: Register color format property on HDMI connectorsNicolas Frattaroli
The drmm_connector_hdmi_init function can figure out what DRM color formats are supported by a particular connector based on the supported HDMI format bitmask that's passed in. Use it to register the drm color format property. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-18-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: dw_hdmi_qp: Set supported_formats platdataNicolas Frattaroli
With the introduction of the supported_formats member in the dw-hdmi-qp platform data struct, drivers that have access to this information should now set it. Set it in the rockchip dw_hdmi_qp glue driver. This allows this information to be passed down to the dw-hdmi-qp core, which sets it in the bridge it creates, and consequently will allow the common HDMI bridge code to act on it. Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-17-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: dw_hdmi_qp: Implement "color format" DRM propertyNicolas Frattaroli
Switch between requested color formats by setting the right bus formats, configuring the VO GRF registers, and setting the right output mode. To do this, the encoder's atomic_check queries the bus format of the first bridge, which was determined by the bridge chain recursive format selection. Pick the input format if it's !FIXED, otherwise, pick the output format. The previously unused GRF register color format defines are redone as well. Both RK3588 and RK3576 use the same defines; it didn't look like this as there was a typo in the previously (unused) definition. Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-16-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/bridge: dw-hdmi-qp: Use common HDMI output bus fmts helperNicolas Frattaroli
Make use of the common drm_bridge_funcs.atomic_get_output_bus_fmts helper for HDMI bridge connectors. This allows dw-hdmi-qp HDMI bridges to participate in recursive bus format selection in a meaningful way. Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-15-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: vop2: Set correct output format for RK3576 YUV422Nicolas Frattaroli
For RK3576 to be able to output YUV422 signals, it first needs to be able to pick the right output mode in the display controller to do so. The RK3576 hardware specifies different output formats depending on the used display protocol. Adjust the written register value based on the SoC and connector, so other users of vcstate->output_mode don't have to care about this. Reviewed-by: Andy Yan <andyshrk@163.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-14-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: vop2: Recognise 10-bit YUV422 as YUV formatNicolas Frattaroli
The Rockchip VOP2 video output driver has a "is_yuv_output" function, which returns true when a given bus format is a YUV format, and false otherwise. This switch statement is lacking the bus format used for YUV422 10-bit. Add the two component orderings of the YUV422 10-bit bus formats to the switch statement. Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-13-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: vop2: Add RK3576 to the RG swap special caseNicolas Frattaroli
Much like RK3588, RK3576 requires an RG swap to be performed for YUV444 8-bit and YUV444 10-bit bus formats. Add its version to the already existing check for RK3588, so that YUV444 output is correct on this platform. Fixes: 944757a4cba6 ("drm/rockchip: vop2: Add support for rk3576") Reviewed-by: Andy Yan <andyshrk@163.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-12-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/rockchip: Add YUV422 output mode constants for VOP2Nicolas Frattaroli
The Rockchip display controller has a general YUV422 output mode, and some SoC-specific connector-specific output modes for RK3576. Add them, based on the values in downstream and the TRM (dsp_out_mode in RK3576 TRM Part 2, register POST*_CTRL_POST_DSP_CTRL). Reviewed-by: Andy Yan <andyshrk@163.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-11-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/amdgpu: Implement "color format" DRM propertyNicolas Frattaroli
The "color format" DRM property allows userspace to explicitly pick a color format to use. If an unsupported color format is requested, userspace will be given an error instead of silently having its request disobeyed. The default case, which is AUTO, picks YCbCr 4:2:0 if it's a 4:2:0-only mode, and RGB in all other cases. Co-developed-by: Werner Sembach <wse@tuxedocomputers.com> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com> Co-developed-by: Andri Yngvason <andri@yngvason.is> Signed-off-by: Andri Yngvason <andri@yngvason.is> Co-developed-by: Marius Vlad <marius.vlad@collabora.com> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-10-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/display: hdmi-state-helper: Try subsampling in mode_validNicolas Frattaroli
drm_hdmi_connector_mode_valid assumes modes are only valid if they work with RGB. The reality is more complex however: YCbCr 4:2:0 chroma-subsampled modes only require half the pixel clock that the same mode would require in RGB. This leads to drm_hdmi_connector_mode_valid rejecting perfectly valid 420-only or 420-also modes. Fix this by checking whether the mode is 420-capable first. If so, then proceed by checking it with DRM_OUTPUT_COLOR_FORMAT_YCBCR420 so long as the connector has legalized 420, otherwise error out. If the mode is not 420-capable, check with RGB as was previously always the case. Fixes: 47368ab437fd ("drm/display: hdmi: add generic mode_valid helper") Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-9-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/display: hdmi-state-helper: Act on color format DRM propertyNicolas Frattaroli
With the introduction of the "color format" DRM property, which allows userspace to request a specific color format, the HDMI state helper should implement this. Implement it by translating the requested drm_connector_color_format to a drm_output_color_format enum value as per the logic HDMI should use for this: Auto is translated to RGB, and a fallback to YUV420 is only performed if the original color format was auto. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-8-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/atomic-helper: Add HDMI bridge output bus formats helperNicolas Frattaroli
The drm_bridge_funcs atomic_get_output_bus_fmts operation should be the same for likely every HDMI connector bridge, unless such an HDMI connector bridge has some special hardware restrictions that I cannot envision yet. To avoid code duplication and standardize on a set of media bus formats that the HDMI output color formats translate to, add a common helper function that implements this operation to the drm bridge helpers. The function returns a list of output bus formats based on the HDMI bridge's current output bits-per-component, and its bitmask of supported color formats. To guard against future expansion of DRM_OUTPUT_COLOR_FORMAT outgrowing the hweight8 call, add a BUILD_BUG_ON statement where it's used that checks for DRM_OUTPUT_COLOR_FORMAT_COUNT. The justification for not using hweight32 in all cases is that not all ISAs have a popcount instruction, and will benefit from a smaller/faster software implementation that doesn't have to operate across all bits. The justification for not defining an hweight_color depending on the value of DRM_OUTPUT_COLOR_FORMAT_COUNT is that this count enum value is only known at compile time, not at preprocessor time. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-7-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/bridge: Act on the DRM color format propertyNicolas Frattaroli
The new DRM color format property allows userspace to request a specific color format on a connector. In turn, this fills the connector state's color_format member to switch color formats. Make drm_bridges consider the color_format set in the connector state during the atomic bridge check. Call into the connector function to get the connector state's connector color format. For bridge connectors including an HDMI bridge, this will make use of whatever the HDMI implementation set as output formats, and AUTO will never be part of the rejection logic. Reject any output bus formats that do not correspond to the requested color format. DRM_CONNECTOR_COLOR_FORMAT_AUTO is always accepted as a matching color format for a bus format, meaning that non-HDMI bridge chains will end up picking the first bus format choice that works, as has already been the case previously. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-6-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/display: bridge_connector: Use HDMI color format for HDMI connsNicolas Frattaroli
For bridge connectors which contain an HDMI bridge at some stage, the HDMI state helpers' format selection logic should be involved. Add an implementation for the drm_bridge_funcs color_format function, which translates from the HDMI state's output format to a connector format for bridge connectors involving an HDMI bridge, but return the connector state's color_format member unchanged otherwise. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-5-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/connector: Let connectors have a say in their color formatNicolas Frattaroli
Add a function to get the connector color format from a connector state, and a new function pointer in drm_connector_funcs to allow connectors to override what connector color format it returns. This is useful for the bridge chain recursive bus format selection code, which does not wish to implement connector implementation specific checks like whether it involves HDMI. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-4-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm: Add new general DRM property "color format"Nicolas Frattaroli
Add a new general DRM property named "color format" which can be used by userspace to request the display driver to output a particular color format. Possible string values for the new enum property are: - "AUTO" (setup by default, driver internally picks the color format) - "RGB" - "YUV 4:4:4" - "YUV 4:2:2" - "YUV 4:2:0" Drivers should advertise from this list the formats they support in an optimistic best-case scenario. EDID data from the sink can then be used in the kernel's atomic check phase to restrict this set of formats, as well as by userspace to make a correct choice in the first place. Co-developed-by: Werner Sembach <wse@tuxedocomputers.com> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com> Co-developed-by: Andri Yngvason <andri@yngvason.is> Signed-off-by: Andri Yngvason <andri@yngvason.is> Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-3-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/display: hdmi-state-helper: Use default case for unsupported formatsNicolas Frattaroli
Switch statements that do not handle all possible values of an enumeration will generate a warning during compilation. In preparation for adding a COUNT value to the end of the enum, this needs to be dealt with. Add a default case to sink_supports_format_bpc's DRM_OUTPUT_COLOR_FORMAT switch statement, and move the log-and-return unknown pixel format handling into it. No functional change. Reviewed-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-2-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/amd/display: Remove unnecessary SIGNAL_TYPE_HDMI_TYPE_A checkWerner Sembach
Remove unnecessary SIGNAL_TYPE_HDMI_TYPE_A check that was performed in the drm_mode_is_420_only() case, but not in the drm_mode_is_420_also() && force_yuv420_output case. Without further knowledge if YCbCr 4:2:0 is supported outside of HDMI, there is no reason to use RGB when the display reports drm_mode_is_420_only() even on a non HDMI connection. This patch also moves both checks in the same if-case. This eliminates an extra else-if-case. Signed-off-by: Werner Sembach <wse@tuxedocomputers.com> Signed-off-by: Andri Yngvason <andri@yngvason.is> Tested-by: Andri Yngvason <andri@yngvason.is> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Link: https://patch.msgid.link/20260609-color-format-v17-1-35739b5782cc@collabora.com Signed-off-by: Daniel Stone <daniels@collabora.com>
2026-06-09drm/vc4: fix krealloc() memory leakAlexander A. Klimov
Don't just overwrite the original pointer passed to krealloc() with its return value without checking latter: MEM = krealloc(MEM, SZ, GFP); If krealloc() returns NULL, that erases the pointer to the still allocated memory, hence leaks this memory. Instead, use a temporary variable, check it's not NULL and only then assign it to the original pointer: TMP = krealloc(MEM, SZ, GFP); if (!TMP) return; MEM = TMP; While on it, use krealloc_array(). Fixes: 6d45c81d229d ("drm/vc4: Add support for branching in shader validation.") Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Maíra Canal <mcanal@igalia.com> Link: https://patch.msgid.link/20260606123817.37222-1-grandmaster@al2klimov.de
2026-06-09drm/xe: drop unused xe_exec_queue_ops::active callbackTangudu Tilak Tirumalesh
send_tlb_inval_ctx_ppgtt() was the only caller of q->ops->active(q). The per-VM exec_queue list is now walked unfiltered. With no remaining callers, drop the .active op from struct xe_exec_queue_ops along with the GuC and execlist backend implementations (guc_exec_queue_active() and execlist_exec_queue_active()). Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://patch.msgid.link/20260608162745.338725-3-tilak.tirumalesh.tangudu@intel.com Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
2026-06-09drm/xe: include all registered queues in TLB invalidationTangudu Tilak Tirumalesh
Context-based TLB invalidation currently selects only scheduling-active exec queues via q->ops->active(). During rebind flows, queues may be suspended (or transitioning through resume) while still owning valid translations, causing them to be skipped from invalidation and leading to missed TLB invalidations on LR rebinds. The underlying issue is a TOCTOU: q->guc->state bits are flipped lock-free from enable_scheduling(), disable_scheduling{,_deregister}(), the suspend/resume sched-msg handlers, handle_sched_done(), and guc_exec_queue_stop(); nothing in send_tlb_inval_ctx_ppgtt() serializes against them, so any state-based predicate can race. Include all the registered queues so that TLB invalidations are not missed. This is race-free because list membership on vm->exec_queues.list is stable under vm->exec_queues.lock held by the caller. The performance impact is expected to be minimal and harmless. If it does turn out to be a concern, we can come back with a race-safe solution to ignore certain queues. Fixes: 6cdaa5346d6f ("drm/xe: Add context-based invalidation to GuC TLB invalidation backend") Assisted-by: Claude:claude-opus-4.6 Suggested-by: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Signed-off-by: Tangudu Tilak Tirumalesh <tilak.tirumalesh.tangudu@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260608162745.338725-2-tilak.tirumalesh.tangudu@intel.com Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
2026-06-09drm/v3d: Deprecate V3D 3.3 and 4.1 supportMaíra Canal
V3D 3.3 (Broadcom BCM7268) and V3D 4.1 (Broadcom BCM7278) has had no in-tree userspace since Mesa dropped support in 2024, on the grounds that those generations were no longer being tested. The situation in the kernel is similar: the maintainers don't have this hardware, the hardware is not available for purchase, and there is no known user of these GPUs. With no userspace left to drive it and no known users, maintaining the ver <= 41 code paths is a cost without a benefit, considering that these paths are not being exercised on real hardware. As a first step toward removal, emit a deprecation warning at probe for V3D versions earlier than or equal to 4.1. The hardware remains functional for now; this only warns. If any real user appears and explain its use-case, support can be retained. Schedule the removal of V3D 3.3 and 4.1 support to the next kernel release. Link: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25851 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20260606185616.694188-2-mcanal@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/i915/bw: Simplify the best max_data_rate searchVille Syrjälä
For some reason we're tracking the best max_data_rate as the difference between the required data_rate and max_data_rate. That's pointlessly complicated as we're just looking for the minimum max_data_rate that is greater or equal to data_rate. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-12-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Use icl_qgv_bw()Ville Syrjälä
Replace a hand rolled copy of icl_qgv_bw() with the real thing. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-11-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Print derated bandwidth numbers for DG2Ville Syrjälä
While DG2 is using hardcoded numbers for the memory bandwidth stuff, let's still print them to aid in debugging as there are two different SKUs to consider with different bandwidth numbers. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-10-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Move peakbw[] out from the plane groupVille Syrjälä
The peak bandwidth doesn't depend on the number of planes, so there is no need to repeat the same information for each plane group. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-9-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Move psf_bw[] out from the plane groupVille Syrjälä
The PSF bandwidth doesn't depend on the number of planes, so there is no need to repeat the same information for each plane group. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-8-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Move num_{qgv,psf}_points out from the plane groupVille Syrjälä
We only have a single num_{qgv,psf}_points value, there is no need to replicate it in each plane group. And drop the somewhat misplaced comments about pcode behaviour from {icl,tgl}_max_bw_index() while at it. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-7-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drn/i915/bw: s/num_points/num_qgv_points/Ville Syrjälä
Rename 'num_points' to 'num_qgv_points' to make it a bit more specific. We already have the 'num_psf_points' counterpart. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-6-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Move 'bi_next' to tighter scopeVille Syrjälä
Move 'bi_next' into the scope where it's actually used. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-5-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapilai@intel.com>
2026-06-09drm/i915/bw: Initialize num_planes sensibly for the first plane group in TGL+Ville Syrjälä
The way the TGL+ bw algorithm works is that 'num_planes' is really a maximum number of allowed planes (whereas in the ICL version it was more of a minimum), and the assumption is that the first plane group (max[0]) can be used with any number of planes (tgl_max_bw_index() always returns 0 at the end). To make things a bit less weird let's just set the first plane group's num_planes to some big number to indicate it has no real limit on the number of planes. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-4-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Streamline dg2_get_bw_info()Ville Syrjälä
Make dg2_get_bw_info() look a bit more like xe2_hpd_get_bw_info() so that we don't have so many different ways of writing the same stuff (namely the "set all plane groups to the same value" part). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-3-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/i915/bw: Don't memcpy() pointlesslyVille Syrjälä
Structs can be copied with a simple assingment. Eliminate the pointless memcpy(). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260528103458.18069-2-ville.syrjala@linux.intel.com Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
2026-06-09drm/v3d: Ensure atomic submissions in v3d_submit_jobs()Maíra Canal
Currently, v3d_submit_jobs() arms and pushes each job one at a time, wiring dependencies between consecutive jobs after each push. If drm_sched_job_add_dependency() fails midway, the already-pushed jobs are scheduler-owned and will be submitted to the GPU for execution, even though the subsequent jobs won't be submitted. This breaks the atomicity of the submissions, as only some of the jobs from a submission would be submitted to the hardware, while the other part fails. Restructure v3d_submit_jobs() into three phases: (1) arm all jobs belonging to a given submission, (2) wire inter-job dependencies, and (3) push all jobs to the scheduler unconditionally. Phase (2) can fail; on failure, it marks every armed job finished fence with an error, so that run_job() callbacks skip hardware execution. This guarantees that every armed job is always pushed, either to run or to be skipped, and it also ensures the atomicity of a submission. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-12-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Reject invalid out_sync handles in submit ioctlsMaíra Canal
v3d_submit_process_post_deps() looks up the out_sync syncobj via drm_syncobj_find(), and if userspace passes a non-zero handle that doesn't refer to a valid syncobj, the lookup silently returns NULL and the post-deps step skips publishing the submission's last fence to it. The ioctl still returns success, leaving userspace to wait on a invalid syncobj. Instead of silently ignoring an invalid non-zero out_sync, move the syncobj lookup to the submission and make it fail with -ENOENT up front, mirroring the syncobj validation already done for in_sync. Now, v3d_submit_process_post_deps() only does the fence replacement. Note that the lookup is skipped when the multi-sync extension is in use, since args->out_sync is unused in that case. To keep cleanup symmetric on error paths, convert the function v3d_put_multisync_post_deps() into a single function that releases the references that were acquired but never published for both single-sync and multi-sync. Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-11-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Split BO fence attach from syncobj output handlingMaíra Canal
v3d_attach_fences_and_unlock_reservation() does three different things: (1) attaches the submission's last fence to every BO, (2) releases drm_exec, and (3) replaces the userspace out_sync syncobjs. Decouple these three behaviors into different functions, so that each function has a more self-contained behavior. v3d_submit_jobs() now invokes the three steps explicitly, which makes the submission sequence self-documenting and keeps each helper self-contained. No functional change; just code consolidation. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-10-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Refactor CPU ioctl into unified submission chainMaíra Canal
Restructure the CPU ioctl so that all job types, including indirect CSD, use a single struct v3d_submit chain and a single DRM exec context. Now that v3d_get_cpu_indirect_csd_params() is a pure parser and the submit helpers operate on struct v3d_submit, fold the indirect CSD path into the standard flow by appending the CSD and CLEAN_CACHE jobs to the same struct v3d_submit as the CPU job and locking the union of all jobs' BOs under one drm_exec. This eliminates the second drm_exec, the nested submission, and the conditional two-pass fence attachment that the CPU ioctl previously required for the indirect CSD path. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-9-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Convert submit helpers to operate on struct v3d_submitMaíra Canal
Generalize the submission helpers so they act on a whole struct v3d_submit (the entire job chain) rather than on individual jobs and a drm_exec. This lets a submission of several chained jobs be locked, fenced, and finalized as a single unit, and is the groundwork for collapsing the indirect CSD path into one chain. The following helpers were generalized: - v3d_lookup_bos() - v3d_lock_bo_reservations() (renamed to v3d_submit_lock_reservations()): - v3d_attach_fences_and_unlock_reservation() - v3d_setup_csd_jobs_and_bos() Now, the locking helper now iterates over all jobs and locks the union of their BOs under one DRM exec, using DRM_EXEC_IGNORE_DUPLICATES to tolerate shared BO references. The fence-attach helper similarly walks every job and attaches the chain's last fence to all touched BOs. Also, v3d_submit_jobs() becomes the single submit-and-finalize entry point and callers no longer need to open-code fence attachment, reservation unlocking, etc. Update CL/TFU/CSD/CPU ioctls to use the new helper signatures. The CPU ioctl still uses two struct v3d_submit instances (one for the CPU job, one for the indirect CSD jobs) and keeps its manual two-pass fence-attach flow. Converting the indirect CSD path into the unified chain is done in the next commit. No functional change. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-8-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Make v3d_get_cpu_indirect_csd_params() a pure parserMaíra Canal
v3d_get_cpu_indirect_csd_params() currently does double duty: it parses the indirect CSD extension and, while still inside the extension parser, also creates the CSD/clean jobs and locks their BOs through a separate DRM exec context. This nested submission deviates from the standard flow and makes it hard to fold the indirect CSD path into the unified submit chain. Stash the parsed drm_v3d_submit_csd args in struct v3d_indirect_csd_info and have the parser only fill in the parameters. Then, move job creation (v3d_setup_csd_jobs_and_bos()) into v3d_submit_cpu_ioctl(), where is the proper place to create jobs. No functional change, but prepares to move the CPU ioctl into the unified submission chain. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-7-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Introduce struct v3d_submit and convert CL/TFU/CSD ioctlsMaíra Canal
As the V3D driver grew with time, different types of submission were added and the submission code grew more complex, but the driver stuck with the same abstractions. Nowadays, the submission ioctls don't submit a single job, but a chain of jobs: 1. v3d_submit_cl_ioctl() submits a BIN job (optional), RENDER job (mandatory), and a CLEAN_CACHE job (optional). 2. v3d_submit_csd_ioctl() submits a CSD, and a CLEAN_CACHE job. 3. v3d_submit_tfu_ioctl() submits a TFU job. Therefore, each ioctl submits a chain of jobs in which each job depends on the previous one. However, this concept is not well represented in software at the moment. To address this, introduce a new concept: the struct v3d_submit, which groups the submission state and represents the submission chain formed by an ordered array of jobs. Add new helpers to allocate, add jobs to the chain and submit jobs to the scheduler, all based on the new struct. Convert v3d_submit_cl_ioctl(), v3d_submit_tfu_ioctl() and v3d_submit_csd_ioctl() to the new pattern. Each ioctl now follows the same flow: add jobs -> attach perfmon -> lookup BOs -> lock reservations -> submit chain -> attach fences -> put jobs. The CPU ioctl is left on the old helpers for now; its indirect CSD path requires some restructuring that will be addressed in the next few commits. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-6-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Migrate BO reservation locking to DRM execMaíra Canal
Replace the drm_gem_(un)lock_reservations() + ww_acquire_ctx pattern with DRM exec across all submit ioctls. Just a straightforward conversion; no functional change. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-5-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Reject invalid syncobj handles in submit ioctlsMaíra Canal
drm_sched_job_add_syncobj_dependency() returns -ENOENT both when the handle is zero and when the handle is non-zero but does not find a corresponding existing syncobj (userspace bug). The driver previously ignored -ENOENT in both cases, silently accepting broken handles. Distinguish the two: skip the call entirely when the handle is zero, as there is no dependency, and let -ENOENT propagate for non-zero handles that don't resolve, turning the error into a proper return to userspace. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-4-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Extract v3d_job_add_syncobjs() helperMaíra Canal
Move the syncobj dependency setup out of v3d_job_init() into its own v3d_job_add_syncobjs() helper and make the queue that the job was submitted a variable in struct v3d_job, so that v3d_job_add_syncobjs() can use it. No functional change. This prepares for the next commit which changes the error handling, and for a later consolidation that separates job allocation from syncobj attachment. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-3-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Clear queue->active_job when v3d_fence_create() failsMaíra Canal
The run_job() callbacks for BIN, RENDER, TFU and CSD assign the incoming job to queue->active_job before calling v3d_fence_create(). If v3d_fence_create() fails, the callback returns NULL without clearing active_job, leaving a dangling pointer. Create a failure path in all run_job() callbacks that clears the active job before returning NULL. The BIN path takes queue->queue_lock around the clear as it races against v3d_overflow_mem_work(); RENDER, TFU and CSD paths have no concurrent reader, so the clear is lock-free. Fixes: a783a09ee76d ("drm/v3d: Refactor job management.") Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-2-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
2026-06-09drm/v3d: Drop unused drm_encoder.h include from v3d_drv.hMaíra Canal
The V3D driver has no display pipeline, so nothing in the driver requires drm_encoder.h. Remove the stale include. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20260604-v3d-sched-misc-fixes-v4-1-c068f5bf5ccf@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>