On Mon, Sep 8, 2025 at 9:12 AM Ryosuke Yasuoka <ryasu...@redhat.com> wrote:
> +static int > +vmw_stdu_primary_plane_get_scanout_buffer(struct drm_plane *plane, > + struct drm_scanout_buffer *sb) > +{ > + struct drm_plane_state *state = plane->state; > + struct drm_crtc *crtc = state->crtc; > + struct vmw_private *dev_priv = vmw_priv(crtc->dev); > + > + if (!plane->state || !plane->state->fb || !plane->state->visible) > + return -ENODEV; > + > + sb->format = plane->state->fb->format; > + sb->width = plane->state->fb->width; > + sb->height = plane->state->fb->height; > + sb->pitch[0] = plane->state->fb->pitches[0]; > + > + u64 size = sb->height * sb->pitch[0]; > + > + sb->map[0].vaddr = memremap(dev_priv->vram_start, size, MEMREMAP_WT); > + > + if (!sb->map[0].vaddr) > + return -ENOMEM; > + > + return 0; > +} > + > +static void vmw_stdu_primary_plane_panic_flush(struct drm_plane *plane) > +{ > + vmw_ldu_primary_plane_panic_flush(plane); > +} > + > static void > vmw_stdu_crtc_atomic_flush(struct drm_crtc *crtc, > struct drm_atomic_state *state) > @@ -1506,6 +1538,8 @@ drm_plane_helper_funcs > vmw_stdu_primary_plane_helper_funcs = { > .atomic_update = vmw_stdu_primary_plane_atomic_update, > .prepare_fb = vmw_stdu_primary_plane_prepare_fb, > .cleanup_fb = vmw_stdu_primary_plane_cleanup_fb, > + .get_scanout_buffer = vmw_stdu_primary_plane_get_scanout_buffer, > + .panic_flush = vmw_stdu_primary_plane_panic_flush, > }; > > static const struct drm_crtc_helper_funcs vmw_stdu_crtc_helper_funcs = { > -- > 2.51.0 > You only need the code I've highlighted in this reply with some minor changes. 1. You can call `vmw_kms_write_svga` directly in `panic_flush`. There is no need to mark the buffer as dirty or send any commands. 2. The format should be hardcoded to RGB565 to minimize the risk of overrunning VRAM. Adjust the pitch accordingly to 2x width. 3. The sizes should be vmw_priv->initial_width, and vmw_priv->initial_height. These are the safe sizes for VRAM in early boot and will work in panic as well. 4. You want to ensure `get_scanout_buffer` only succeeds once when using display unit 0 since all calls to this function will return the same VRAM. 5. memremap flags should be `MEMREMAP_WB | MEMREMAP_DEC` 6. Move the panic related functions to the vmwgfx_kms.c files since they work in all DU modes.
smime.p7s
Description: S/MIME Cryptographic Signature