| cb71de09 | 18-Sep-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/sysfb: Lookup blit function during atomic check
Some configurations of sysfb outputs require format conversion from framebuffer to scanout buffer. It is a driver bug if the conversion helper is
drm/sysfb: Lookup blit function during atomic check
Some configurations of sysfb outputs require format conversion from framebuffer to scanout buffer. It is a driver bug if the conversion helper is missing, yet it might happen on odd scanout formats. The old code, based on drm_fb_blit(), only detects this situation during the commit's hardware update, which is too late to abort the update.
Lookup the correct blit helper as part of the check phase. Then store it in the sysfb plane state. Allows for detection of a missing helper before the commit has started. Also avoids drm_fb_blit()'s large switch statement on each updated scanline. Only a single lookup has to be done.
The lookup is in drm_sysfb_get_blit_func(), which only tracks formats supported by sysfb drivers.
The lookup happens in sysfb's begin_fb_access helper instead of its atomic_check helper. This allows vesadrm, and possibly other drivers, to implement their own atomic_check without interfering with blit lookups. Vesadrm implements XRGB8888 on top of R8 formats with the help of the atomic_check. Doing the blit lookup in begin_fb_access then always uses the correct CRTC format on all drivers.
v2: - vesadrm: use drm_sysfb_plane_helper_begin_fb_access() - fix type in commit description (Javier)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250918154207.84714-3-tzimmermann@suse.de
show more ...
|
| 27a7e8b6 | 26-Aug-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/sysfb: Do not deref unexisting CRTC state in atomic_disable
Do not access CRTC state in drm_sysfb_plane_helper_atomic_disable(). Use format from sysfb device for clearing scanout buffer. This is
drm/sysfb: Do not deref unexisting CRTC state in atomic_disable
Do not access CRTC state in drm_sysfb_plane_helper_atomic_disable(). Use format from sysfb device for clearing scanout buffer. This is the behavior from before commit 061963cd9e5b ("drm/sysfb: Blit to CRTC destination format").
When being disabled, the plane has no associated CRTC. Trying to deref the format pointer results in a segmentation fault. An example stack track is shown below.
[ 58.948915] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000023: 0000 [#1] SMP KASAN PTI [ 58.959971] KASAN: null-ptr-deref in range [0x0000000000000118-0x000000000000011f] [...] [ 58.979308] RIP: 0010:drm_sysfb_plane_helper_atomic_disable+0x1af/0x520 [...] [ 59.084227] Call Trace: [ 59.086682] <TASK> [ 59.088793] ? __pfx_drm_sysfb_plane_helper_atomic_disable+0x10/0x10 [ 59.095155] ? crtc_disable+0xf2/0x5a0 [ 59.098920] drm_atomic_helper_commit_planes+0x848/0x1030 [ 59.104336] drm_atomic_helper_commit_tail+0x41/0xb0 [ 59.109316] commit_tail+0x204/0x330 [ 59.112903] drm_atomic_helper_commit+0x242/0x2e0 [ 59.117618] ? __pfx_drm_atomic_helper_commit+0x10/0x10 [ 59.122851] drm_atomic_commit+0x1e1/0x290 [ 59.126957] ? drm_atomic_add_affected_connectors+0x266/0x330 [ 59.132714] ? __pfx_drm_atomic_commit+0x10/0x10 [ 59.137343] ? __pfx___drm_printfn_info+0x10/0x10 [ 59.142058] ? drm_atomic_set_crtc_for_connector+0x436/0x630 [ 59.147729] atomic_remove_fb+0x631/0x920 [ 59.151751] ? save_trace+0xcf/0x180 [ 59.155343] ? __pfx_atomic_remove_fb+0x10/0x10 [ 59.159890] ? __pfx___drm_dev_dbg+0x10/0x10 [ 59.164173] drm_framebuffer_remove+0x19a/0x710
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 061963cd9e5b ("drm/sysfb: Blit to CRTC destination format") Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14874 Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Javier Martinez Canillas <javierm@redhat.com> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://lore.kernel.org/r/20250826145044.954396-1-tzimmermann@suse.de
show more ...
|
| 7399c13f | 14-Jul-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/vesadrm: Support DRM_FORMAT_C8
Add support for DRM_FORMAT_C8 to vesadrm. The new pixel-format description PIXEL_FORMAT_C8 describes the layout. Vesadrm's helpers vesadrm_fill_palette_lut() and v
drm/vesadrm: Support DRM_FORMAT_C8
Add support for DRM_FORMAT_C8 to vesadrm. The new pixel-format description PIXEL_FORMAT_C8 describes the layout. Vesadrm's helpers vesadrm_fill_palette_lut() and vesadrm_load_palette_lut() set the hardware palette according to the CRTC's output format.
The driver emulates XRGB8888 by converting the source buffer to RGB332 and using the resulting 256 colors as index into the hardware palette. The hardware palette converts back to RGB during scanout. This has no overhead compared to other format conversion, but allows common userspace, such as Wayland compositors, to operate on the display.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250714151513.309475-10-tzimmermann@suse.de
show more ...
|
| 1adb35c2 | 14-Jul-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/vesadrm: Prepare color management for palette-based framebuffers
Distiguish between component-based formats and 'the rest' in vesadrm's color management. Scanout buffers with component-based for
drm/vesadrm: Prepare color management for palette-based framebuffers
Distiguish between component-based formats and 'the rest' in vesadrm's color management. Scanout buffers with component-based format allow for gamma correction. Palette-based formats (i.e., 'the rest') require palette setup.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250714151513.309475-9-tzimmermann@suse.de
show more ...
|
| cbc383ce | 14-Jul-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/vesadrm: Rename vesadrm_set_gamma_lut() to vesadrm_set_color_lut()
Rename vesadrm's gamma helpers in preparation of the upcoming support for color palettes. Gamma correction and color palettes s
drm/vesadrm: Rename vesadrm_set_gamma_lut() to vesadrm_set_color_lut()
Rename vesadrm's gamma helpers in preparation of the upcoming support for color palettes. Gamma correction and color palettes share the same hardware features, but the driver's old naming only indicated support for gamma LUTs.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250714151513.309475-8-tzimmermann@suse.de
show more ...
|
| 061963cd | 14-Jul-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/sysfb: Blit to CRTC destination format
Use the color format stored in struct drm_sysfb_crtc_state for color-format conversion instead of the scanout-buffer format announced by firmware. Currentl
drm/sysfb: Blit to CRTC destination format
Use the color format stored in struct drm_sysfb_crtc_state for color-format conversion instead of the scanout-buffer format announced by firmware. Currently, both values are identical.
This will allow drivers to modify the CRTC's input format to a certain extend. Specifically, vesadrm will be able to display RGB framebuffers when the scanout buffer is of C8 format. With color- format conversion to RGB332 and correct setup of the C8 palette, displaying XRGB8888-based buffers under C8 can be achieved.
v2: - refer to RGB332 as CRTC input format
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250714151513.309475-5-tzimmermann@suse.de
show more ...
|
| c06cb85a | 20-May-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/vesadrm: Use helpers for programming gamma ramps
Replace vesadrm's code for programming the hardware gamma LUT with DRM helpers. Either load a provided gamma ramp or program a default. Set the i
drm/vesadrm: Use helpers for programming gamma ramps
Replace vesadrm's code for programming the hardware gamma LUT with DRM helpers. Either load a provided gamma ramp or program a default. Set the individual entries with a callback.
Each gamma value is given as 3 individual 16-bit values for red, green and blue. The driver reduces them to 8 bit to make them fit into hardware registers.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250520094203.30545-6-tzimmermann@suse.de
show more ...
|
| e8c08688 | 10-Apr-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/sysfb: Share helpers for screen_info validation
Share efidrm's and vesadrm's validation of struct screen_info in shared helpers. Update the drivers.
Most validation helpers test individual valu
drm/sysfb: Share helpers for screen_info validation
Share efidrm's and vesadrm's validation of struct screen_info in shared helpers. Update the drivers.
Most validation helpers test individual values against limits and can be shared as they are. For color formats, a common helper looks up the correct DRM format info from a driver-provided list of color formats.
These screen_info helpers are only available if CONFIG_SCREEN_INFO has been selected, as done by efidrm and vesadrm.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250410083834.10810-4-tzimmermann@suse.de
show more ...
|
| 6046b49b | 10-Apr-2025 |
Thomas Zimmermann <tzimmermann@suse.de> |
drm/sysfb: Share helpers for integer validation
Provide sysfb helpers for validating framebuffer integer values against limits. Update drivers. If a driver did not specify a limit for a certain valu
drm/sysfb: Share helpers for integer validation
Provide sysfb helpers for validating framebuffer integer values against limits. Update drivers. If a driver did not specify a limit for a certain value, use INT_MAX.
v2: - declare module information near EOF (Javier)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20250410083834.10810-3-tzimmermann@suse.de
show more ...
|