diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2021-04-01 18:03:47 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2021-04-01 19:42:33 +0900 |
commit | 460f05c41bd20bad37c91a18aef984594c2d5c39 (patch) | |
tree | 8ed1f5174297c3724e61ceff0406fe4179923e83 | |
parent | 91e1afbab5bc106bbe62d75ef810fe4f5f6fe896 (diff) | |
download | libtdm-vc4-460f05c41bd20bad37c91a18aef984594c2d5c39.tar.gz libtdm-vc4-460f05c41bd20bad37c91a18aef984594c2d5c39.tar.bz2 libtdm-vc4-460f05c41bd20bad37c91a18aef984594c2d5c39.zip |
remove unnecessary check hwc restriction
Change-Id: I95ea5eaaaa4e89dd7839fd89c2416b1a135af199
-rw-r--r-- | src/libhal-backend-tdm-vc4/tdm_vc4_display.c | 121 | ||||
-rw-r--r-- | src/libtdm-vc4/tdm_vc4_display.c | 121 |
2 files changed, 12 insertions, 230 deletions
diff --git a/src/libhal-backend-tdm-vc4/tdm_vc4_display.c b/src/libhal-backend-tdm-vc4/tdm_vc4_display.c index 6a9c5a5..7539937 100644 --- a/src/libhal-backend-tdm-vc4/tdm_vc4_display.c +++ b/src/libhal-backend-tdm-vc4/tdm_vc4_display.c @@ -34,78 +34,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdm_backend_vc4.h" -#define MIN_WIDTH 2 - #define LIST_INSERT_AFTER(__after, __item) \ (__item)->prev = (__after); \ (__item)->next = (__after)->next; \ (__after)->next->prev = (__item); \ (__after)->next = (__item); -static hal_tdm_error -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) -{ - int start, end; - int virtual_screen; - - *new_src_x = src_x; - *new_src_w = src_w; - *new_dst_x = dst_x; - *new_dst_w = dst_w; - - if (buf_w < MIN_WIDTH || buf_w % 2) { - TDM_BACKEND_ERR("buf_w(%u) not 2's multiple or less than %u", buf_w, MIN_WIDTH); - return HAL_TDM_ERROR_BAD_REQUEST; - } - - if (dst_x > crtc_w || dst_y > crtc_h) { - TDM_BACKEND_ERR("dst_pos(%u,%u) is out of crtc(%ux%u)", dst_x, dst_y, crtc_w, crtc_h); - return HAL_TDM_ERROR_BAD_REQUEST; - } - - if (src_x > dst_x || ((dst_x - src_x) + buf_w) > crtc_w) - virtual_screen = 1; - else - virtual_screen = 0; - - start = dst_x; - end = ((dst_x + dst_w) > crtc_w) ? crtc_w : (dst_x + dst_w); - - /* check window minimun width */ - if ((end - start) < MIN_WIDTH) { - TDM_BACKEND_ERR("visible_w(%d) less than %u", end - start, MIN_WIDTH); - return HAL_TDM_ERROR_BAD_REQUEST; - } - - if (!virtual_screen) { - /* Pagewidth of window (= 8 byte align / bytes-per-pixel ) */ - if ((end - start) % 2) - end--; - } else { - /* You should align the sum of PAGEWIDTH_F and OFFSIZE_F double-word (8 byte) boundary. */ - if (end % 2) - end--; - } - - *new_dst_x = start; - *new_dst_w = end - start; - - TDM_BACKEND_RETURN_VAL_IF_FAIL(*new_src_w > 0, HAL_TDM_ERROR_BAD_REQUEST); - TDM_BACKEND_RETURN_VAL_IF_FAIL(*new_dst_w > 0, HAL_TDM_ERROR_BAD_REQUEST); - - if (src_x != *new_src_x || src_w != *new_src_w || dst_x != *new_dst_x || - dst_w != *new_dst_w) - TDM_BACKEND_INFO("=> buf_w(%d) src(%d,%d) dst(%d,%d), virt(%d) start(%d) end(%d)", - buf_w, *new_src_x, *new_src_w, *new_dst_x, *new_dst_w, virtual_screen, start, - end); - - return HAL_TDM_ERROR_NONE; -} - static drmModeModeInfoPtr _tdm_vc4_display_get_mode(tdm_vc4_output *output_data) { @@ -1502,35 +1436,13 @@ _vc4_layer_make_atomic_request(tdm_vc4_layer *layer_data, drmModeAtomicReqPtr re { tdm_vc4_display *display_data = layer_data->display_data; tdm_vc4_output *output_data = layer_data->output_data; - unsigned int new_src_x, new_src_w; - unsigned int new_dst_x, new_dst_w; uint32_t fx, fy, fw, fh; - int crtc_w, crtc_h; tdm_vc4_layer_info layer_info = layer_data->info; hal_tdm_error ret = HAL_TDM_ERROR_NONE; if (!layer_data->display_buffer_changed && !layer_data->info_changed) return HAL_TDM_ERROR_NONE; - if (output_data->current_mode) { - crtc_w = output_data->current_mode->hdisplay; - crtc_h = output_data->current_mode->vdisplay; - } else { - drmModeCrtcPtr crtc = drmModeGetCrtc(display_data->drm_fd, output_data->crtc_id); - if (!crtc) { - TDM_BACKEND_ERR("getting crtc failed"); - return HAL_TDM_ERROR_OPERATION_FAILED; - } - crtc_w = crtc->width; - crtc_h = crtc->height; - if (crtc_w == 0) { - TDM_BACKEND_ERR("getting crtc width failed"); - drmModeFreeCrtc(crtc); - return HAL_TDM_ERROR_OPERATION_FAILED; - } - drmModeFreeCrtc(crtc); - } - layer_data->display_buffer_changed = 0; layer_data->info_changed = 0; @@ -1547,46 +1459,25 @@ _vc4_layer_make_atomic_request(tdm_vc4_layer *layer_data, drmModeAtomicReqPtr re return HAL_TDM_ERROR_NONE; } - /* check hw restriction*/ - 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) != HAL_TDM_ERROR_NONE) { - TDM_BACKEND_WRN("not going to set plane(%u)", layer_data->plane_id); - return HAL_TDM_ERROR_NONE; - } - - if (layer_info.src_config.pos.x != new_src_x) - TDM_BACKEND_DBG("src_x changed: %u => %u", layer_info.src_config.pos.x, new_src_x); - if (layer_info.src_config.pos.w != new_src_w) - TDM_BACKEND_DBG("src_w changed: %u => %u", layer_info.src_config.pos.w, new_src_w); - if (layer_info.dst_pos.x != new_dst_x) - TDM_BACKEND_DBG("dst_x changed: %u => %u", layer_info.dst_pos.x, new_dst_x); - if (layer_info.dst_pos.w != new_dst_w) - TDM_BACKEND_DBG("dst_w changed: %u => %u", layer_info.dst_pos.w, new_dst_w); - /* Source values are 16.16 fixed point */ - fx = ((unsigned int)new_src_x) << 16; + fx = ((unsigned int)layer_info.src_config.pos.x) << 16; fy = ((unsigned int)layer_info.src_config.pos.y) << 16; - fw = ((unsigned int)new_src_w) << 16; + fw = ((unsigned int)layer_info.src_config.pos.w) << 16; fh = ((unsigned int)layer_info.src_config.pos.h) << 16; TDM_BACKEND_DBG("MakeAtomicRequest: drm_fd(%d) plane_id(%u) zpos(%d) crtc_id(%u) fb_id(%u) src(%u,%u %ux%u) dst(%u,%u %ux%u)", display_data->drm_fd, layer_data->plane_id, layer_data->zpos, 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.src_config.pos.x, layer_info.src_config.pos.y, + layer_info.src_config.pos.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); ret = _vc4_layer_add_atomic_properties(layer_data, request, layer_data->display_buffer->fb_id, output_data->crtc_id, fx, fy, fw, fh, - new_dst_x, layer_info.dst_pos.y, - new_dst_w, layer_info.dst_pos.h, layer_data->acquire_fence); + layer_info.dst_pos.x, layer_info.dst_pos.y, + layer_info.dst_pos.w, layer_info.dst_pos.h, layer_data->acquire_fence); if (ret != HAL_TDM_ERROR_NONE) { TDM_BACKEND_ERR("MakeAtomicRequest failed"); return ret; diff --git a/src/libtdm-vc4/tdm_vc4_display.c b/src/libtdm-vc4/tdm_vc4_display.c index a76f3c0..432c1bf 100644 --- a/src/libtdm-vc4/tdm_vc4_display.c +++ b/src/libtdm-vc4/tdm_vc4_display.c @@ -34,78 +34,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tdm_vc4.h" -#define MIN_WIDTH 2 - #define LIST_INSERT_AFTER(__after, __item) \ (__item)->prev = (__after); \ (__item)->next = (__after)->next; \ (__after)->next->prev = (__item); \ (__after)->next = (__item); -static tdm_error -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) -{ - int start, end; - int virtual_screen; - - *new_src_x = src_x; - *new_src_w = src_w; - *new_dst_x = dst_x; - *new_dst_w = dst_w; - - if (buf_w < MIN_WIDTH || buf_w % 2) { - TDM_ERR("buf_w(%u) not 2's multiple or less than %u", buf_w, MIN_WIDTH); - 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 - virtual_screen = 0; - - start = dst_x; - end = ((dst_x + dst_w) > crtc_w) ? crtc_w : (dst_x + dst_w); - - /* check window minimun width */ - if ((end - start) < MIN_WIDTH) { - TDM_ERR("visible_w(%d) less than %u", end - start, MIN_WIDTH); - return TDM_ERROR_BAD_REQUEST; - } - - if (!virtual_screen) { - /* Pagewidth of window (= 8 byte align / bytes-per-pixel ) */ - if ((end - start) % 2) - end--; - } else { - /* You should align the sum of PAGEWIDTH_F and OFFSIZE_F double-word (8 byte) boundary. */ - if (end % 2) - end--; - } - - *new_dst_x = start; - *new_dst_w = end - start; - - RETURN_VAL_IF_FAIL(*new_src_w > 0, TDM_ERROR_BAD_REQUEST); - RETURN_VAL_IF_FAIL(*new_dst_w > 0, TDM_ERROR_BAD_REQUEST); - - if (src_x != *new_src_x || src_w != *new_src_w || dst_x != *new_dst_x || - dst_w != *new_dst_w) - TDM_INFO("=> buf_w(%d) src(%d,%d) dst(%d,%d), virt(%d) start(%d) end(%d)", - buf_w, *new_src_x, *new_src_w, *new_dst_x, *new_dst_w, virtual_screen, start, - end); - - return TDM_ERROR_NONE; -} - static drmModeModeInfoPtr _tdm_vc4_display_get_mode(tdm_vc4_output_data *output_data) { @@ -1563,35 +1497,13 @@ _vc4_layer_make_atomic_request(tdm_vc4_layer_data *layer_data, drmModeAtomicReqP { tdm_vc4_data *vc4_data = layer_data->vc4_data; tdm_vc4_output_data *output_data = layer_data->output_data; - unsigned int new_src_x, new_src_w; - unsigned int new_dst_x, new_dst_w; uint32_t fx, fy, fw, fh; - int crtc_w, crtc_h; tdm_info_layer layer_info = layer_data->info; tdm_error ret = TDM_ERROR_NONE; if (!layer_data->display_buffer_changed && !layer_data->info_changed) return TDM_ERROR_NONE; - if (output_data->current_mode) { - crtc_w = output_data->current_mode->hdisplay; - crtc_h = output_data->current_mode->vdisplay; - } else { - drmModeCrtcPtr crtc = drmModeGetCrtc(vc4_data->drm_fd, output_data->crtc_id); - if (!crtc) { - TDM_ERR("getting crtc failed"); - return TDM_ERROR_OPERATION_FAILED; - } - crtc_w = crtc->width; - crtc_h = crtc->height; - if (crtc_w == 0) { - TDM_ERR("getting crtc width failed"); - drmModeFreeCrtc(crtc); - return TDM_ERROR_OPERATION_FAILED; - } - drmModeFreeCrtc(crtc); - } - layer_data->display_buffer_changed = 0; layer_data->info_changed = 0; @@ -1608,46 +1520,25 @@ _vc4_layer_make_atomic_request(tdm_vc4_layer_data *layer_data, drmModeAtomicReqP return TDM_ERROR_NONE; } - /* check hw restriction*/ - 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); - return TDM_ERROR_NONE; - } - - if (layer_info.src_config.pos.x != new_src_x) - TDM_DBG("src_x changed: %u => %u", layer_info.src_config.pos.x, new_src_x); - if (layer_info.src_config.pos.w != new_src_w) - TDM_DBG("src_w changed: %u => %u", layer_info.src_config.pos.w, new_src_w); - if (layer_info.dst_pos.x != new_dst_x) - TDM_DBG("dst_x changed: %u => %u", layer_info.dst_pos.x, new_dst_x); - if (layer_info.dst_pos.w != new_dst_w) - TDM_DBG("dst_w changed: %u => %u", layer_info.dst_pos.w, new_dst_w); - /* Source values are 16.16 fixed point */ - fx = ((unsigned int)new_src_x) << 16; + fx = ((unsigned int)layer_info.src_config.pos.x) << 16; fy = ((unsigned int)layer_info.src_config.pos.y) << 16; - fw = ((unsigned int)new_src_w) << 16; + fw = ((unsigned int)layer_info.src_config.pos.w) << 16; fh = ((unsigned int)layer_info.src_config.pos.h) << 16; TDM_DBG("MakeAtomicRequest: drm_fd(%d) plane_id(%u) zpos(%d) crtc_id(%u) fb_id(%u) src(%u,%u %ux%u) dst(%u,%u %ux%u)", vc4_data->drm_fd, layer_data->plane_id, layer_data->zpos, 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.src_config.pos.x, layer_info.src_config.pos.y, + layer_info.src_config.pos.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); ret = _vc4_layer_add_atomic_properties(layer_data, request, layer_data->display_buffer->fb_id, output_data->crtc_id, fx, fy, fw, fh, - new_dst_x, layer_info.dst_pos.y, - new_dst_w, layer_info.dst_pos.h, layer_data->acquire_fence); + layer_info.dst_pos.x, layer_info.dst_pos.y, + layer_info.dst_pos.w, layer_info.dst_pos.h, layer_data->acquire_fence); if (ret != TDM_ERROR_NONE) { TDM_ERR("MakeAtomicRequest failed"); return ret; |