@@ -2171,13 +2171,12 @@ int vmw_kms_write_svga(struct vmw_private *vmw_priv,
2171
2171
return 0 ;
2172
2172
}
2173
2173
2174
+ static
2174
2175
bool vmw_kms_validate_mode_vram (struct vmw_private * dev_priv ,
2175
- uint32_t pitch ,
2176
- uint32_t height )
2176
+ u64 pitch ,
2177
+ u64 height )
2177
2178
{
2178
- return ((u64 ) pitch * (u64 ) height ) < (u64 )
2179
- ((dev_priv -> active_display_unit == vmw_du_screen_target ) ?
2180
- dev_priv -> max_primary_mem : dev_priv -> vram_size );
2179
+ return (pitch * height ) < (u64 )dev_priv -> vram_size ;
2181
2180
}
2182
2181
2183
2182
/**
@@ -2873,25 +2872,18 @@ int vmw_du_helper_plane_update(struct vmw_du_update_plane *update)
2873
2872
enum drm_mode_status vmw_connector_mode_valid (struct drm_connector * connector ,
2874
2873
struct drm_display_mode * mode )
2875
2874
{
2875
+ enum drm_mode_status ret ;
2876
2876
struct drm_device * dev = connector -> dev ;
2877
2877
struct vmw_private * dev_priv = vmw_priv (dev );
2878
- u32 max_width = dev_priv -> texture_max_width ;
2879
- u32 max_height = dev_priv -> texture_max_height ;
2880
2878
u32 assumed_cpp = 4 ;
2881
2879
2882
2880
if (dev_priv -> assume_16bpp )
2883
2881
assumed_cpp = 2 ;
2884
2882
2885
- if (dev_priv -> active_display_unit == vmw_du_screen_target ) {
2886
- max_width = min (dev_priv -> stdu_max_width , max_width );
2887
- max_height = min (dev_priv -> stdu_max_height , max_height );
2888
- }
2889
-
2890
- if (max_width < mode -> hdisplay )
2891
- return MODE_BAD_HVALUE ;
2892
-
2893
- if (max_height < mode -> vdisplay )
2894
- return MODE_BAD_VVALUE ;
2883
+ ret = drm_mode_validate_size (mode , dev_priv -> texture_max_width ,
2884
+ dev_priv -> texture_max_height );
2885
+ if (ret != MODE_OK )
2886
+ return ret ;
2895
2887
2896
2888
if (!vmw_kms_validate_mode_vram (dev_priv ,
2897
2889
mode -> hdisplay * assumed_cpp ,
0 commit comments