On Thu, May 21, 2026 at 6:35 PM Maaz Mombasawala <[email protected]> wrote: > > Add the mode_valid() callback in drm_mode_config_funcs to check for valid > mode during drm_mode_setcrtc. > Both the mode_valid() callbacks also check if the vrefresh value is > correct. > This fixes igt test kms_invalid_mode@overflow-vrefresh. > > Signed-off-by: Maaz Mombasawala <[email protected]> > --- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 28 ++++++++++++++++++++++++++++ > drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 9 +++++++++ > drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 12 +++--------- > 3 files changed, 40 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > index 1b407b61f683..4db29b645a38 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > @@ -1063,8 +1063,36 @@ vmw_kms_atomic_check_modeset(struct drm_device *dev, > return ret; > } > > +static enum drm_mode_status > +vmw_kms_config_mode_valid(struct drm_device *dev, > + const struct drm_display_mode *mode) > +{ > + enum drm_mode_status ret; > + struct vmw_private *dev_priv = vmw_priv(dev); > + u64 assumed_cpp = dev_priv->assume_16bpp ? 2 : 4; > + /* Align width and height to account for GPU tile over-alignment */ > + u64 required_mem = ALIGN(mode->hdisplay, GPU_TILE_SIZE) * > + ALIGN(mode->vdisplay, GPU_TILE_SIZE) * > + assumed_cpp;
Could you move this below drm_mode_validate_size and ensure one of the ALIGN's is casted to u64, just to prevent future wrapping around u32? z
smime.p7s
Description: S/MIME Cryptographic Signature
