not allow setting the negative position to a layer. 12/166412/3
authorBoram Park <boram1288.park@samsung.com>
Wed, 10 Jan 2018 05:41:13 +0000 (14:41 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 10 Jan 2018 07:36:43 +0000 (07:36 +0000)
Change-Id: I3dc92c2ddaa190589e8c7984a66a0bbb9e32e65e

src/tdm_exynos_output.c

index 0d09ca1dfeea5bb55ec2686679cdfe20c6d41380..b2636f85bad3c29fee3538d8fb482082b5d4cec2 100644 (file)
@@ -62,8 +62,9 @@ check_hw_restriction_crtc(unsigned int crtc_w,
 }
 
 static tdm_error
-check_hw_restriction(unsigned int crtc_w, unsigned int buf_w,
-                                               unsigned int src_x, unsigned int src_w, unsigned int dst_x, unsigned int dst_w,
+check_hw_restriction(unsigned int crtc_w, unsigned int crtc_h, unsigned int buf_w,
+                                               unsigned int src_x, unsigned int src_w,
+                                               unsigned int dst_x, unsigned int dst_y, unsigned int dst_w,
                                                unsigned int *new_src_x, unsigned int *new_src_w,
                                                unsigned int *new_dst_x, unsigned int *new_dst_w)
 {
@@ -80,6 +81,11 @@ check_hw_restriction(unsigned int crtc_w, unsigned int buf_w,
                return TDM_ERROR_BAD_REQUEST;
        }
 
+       if (dst_x > crtc_w || dst_y > crtc_h) {
+               TDM_ERR("dst_pos(%u,%u) is out of crtc(%ux%u)", dst_x, dst_y, crtc_w, crtc_h);
+               return TDM_ERROR_BAD_REQUEST;
+       }
+
        if (src_x > dst_x || ((dst_x - src_x) + buf_w) > crtc_w)
                virtual_screen = 1;
        else
@@ -419,10 +425,11 @@ _tdm_exynos_output_commit_layer(tdm_exynos_layer_data *layer_data)
                _tdm_exynos_output_transform_layer_info(crtc_w, crtc_h, &layer_info);
 
        /* check hw restriction*/
-       if (check_hw_restriction(crtc_w, layer_data->display_buffer->width,
+       if (check_hw_restriction(crtc_w, crtc_h, layer_data->display_buffer->width,
                                                         layer_info.src_config.pos.x,
                                                         layer_info.src_config.pos.w,
                                                         layer_info.dst_pos.x,
+                                                        layer_info.dst_pos.y,
                                                         layer_info.dst_pos.w,
                                                         &new_src_x, &new_src_w, &new_dst_x, &new_dst_w) != TDM_ERROR_NONE) {
                TDM_WRN("not going to set plane(%u)", layer_data->plane_id);
@@ -457,7 +464,13 @@ _tdm_exynos_output_commit_layer(tdm_exynos_layer_data *layer_data)
                                                new_dst_x, layer_info.dst_pos.y,
                                                new_dst_w, layer_info.dst_pos.h,
                                                fx, fy, fw, fh) < 0) {
-               TDM_ERR("set plane(%d) failed: %m", layer_data->plane_id);
+               TDM_ERR("SetPlane: drm_fd(%d) plane_id(%u) crtc_id(%u) fb_id(%u) src(%u,%u %ux%u) dst(%u,%u %ux%u) failed: %m",
+                               exynos_data->drm_fd, layer_data->plane_id,
+                               output_data->crtc_id, layer_data->display_buffer->fb_id,
+                               new_src_x, layer_info.src_config.pos.y,
+                               new_src_w, layer_info.src_config.pos.h,
+                               layer_info.dst_pos.x, layer_info.dst_pos.y,
+                               layer_info.dst_pos.w, layer_info.dst_pos.h);
                return TDM_ERROR_OPERATION_FAILED;
        }