Commit c020f660 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/udl: Test pixel limit in mode-config's mode-valid function

The sku_pixel_limit is a per-device property, similar to the amount
of available video memory. Move the respective mode-valid test from
the connector to the mode-config structure.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221006095355.23579-3-tzimmermann@suse.de
parent 59a811fa
...@@ -54,19 +54,6 @@ static int udl_get_modes(struct drm_connector *connector) ...@@ -54,19 +54,6 @@ static int udl_get_modes(struct drm_connector *connector)
return 0; return 0;
} }
static enum drm_mode_status udl_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct udl_device *udl = to_udl(connector->dev);
if (!udl->sku_pixel_limit)
return 0;
if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit)
return MODE_VIRTUAL_Y;
return 0;
}
static enum drm_connector_status static enum drm_connector_status
udl_detect(struct drm_connector *connector, bool force) udl_detect(struct drm_connector *connector, bool force)
{ {
...@@ -97,7 +84,6 @@ static void udl_connector_destroy(struct drm_connector *connector) ...@@ -97,7 +84,6 @@ static void udl_connector_destroy(struct drm_connector *connector)
static const struct drm_connector_helper_funcs udl_connector_helper_funcs = { static const struct drm_connector_helper_funcs udl_connector_helper_funcs = {
.get_modes = udl_get_modes, .get_modes = udl_get_modes,
.mode_valid = udl_mode_valid,
}; };
static const struct drm_connector_funcs udl_connector_funcs = { static const struct drm_connector_funcs udl_connector_funcs = {
......
...@@ -407,8 +407,22 @@ static const struct drm_simple_display_pipe_funcs udl_simple_display_pipe_funcs ...@@ -407,8 +407,22 @@ static const struct drm_simple_display_pipe_funcs udl_simple_display_pipe_funcs
* Modesetting * Modesetting
*/ */
static enum drm_mode_status udl_mode_config_mode_valid(struct drm_device *dev,
const struct drm_display_mode *mode)
{
struct udl_device *udl = to_udl(dev);
if (udl->sku_pixel_limit) {
if (mode->vdisplay * mode->hdisplay > udl->sku_pixel_limit)
return MODE_MEM;
}
return MODE_OK;
}
static const struct drm_mode_config_funcs udl_mode_funcs = { static const struct drm_mode_config_funcs udl_mode_funcs = {
.fb_create = drm_gem_fb_create_with_dirty, .fb_create = drm_gem_fb_create_with_dirty,
.mode_valid = udl_mode_config_mode_valid,
.atomic_check = drm_atomic_helper_check, .atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment