Skip to content

Commit

Permalink
drm: xlnx: mixer: Return error if requested dimensions not scaleable
Browse files Browse the repository at this point in the history
In case the mixer is not able to scale to application requested dimensions
then return error during check.

Signed-off-by: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
  • Loading branch information
Devarsh Thakkar authored and Michal Simek committed Jul 26, 2021
1 parent 4dcb891 commit 3fc4c7a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/gpu/drm/xlnx/xlnx_mixer.c
Expand Up @@ -2026,14 +2026,27 @@ static int xlnx_mix_plane_atomic_check(struct drm_plane *plane,
struct xlnx_mix_plane *mix_plane = to_xlnx_plane(plane);
struct xlnx_mix_hw *mixer_hw = to_mixer_hw(mix_plane);
struct xlnx_mix *mix;
int scale_factor[3] = {1, 2, 4};
int fb_width = 0, fb_height = 0;

if (state->fb) {
fb_width = state->fb->width;
fb_height = state->fb->height;
}
/* No check required for the drm_primary_plane */
mix = container_of(mixer_hw, struct xlnx_mix, mixer_hw);
if (mix->drm_primary_layer == mix_plane)
return 0;

scale = xlnx_mix_get_layer_scaling(mixer_hw,
mix_plane->mixer_layer->id);

if (state->fb && ((fb_width * scale_factor[scale] != state->crtc_w) ||
(fb_height * scale_factor[scale] != state->crtc_h))) {
DRM_DEBUG_KMS("Not possible to scale to desired dimensions\n");
return -EINVAL;
}

if (is_window_valid(mixer_hw, state->crtc_x, state->crtc_y,
state->src_w >> 16, state->src_h >> 16, scale))
return 0;
Expand Down

0 comments on commit 3fc4c7a

Please sign in to comment.