From a5f2ecac5ca3c5621bc093289d13c6f8d22e01ec Mon Sep 17 00:00:00 2001 From: Sunyoung Kang Date: Fri, 27 Apr 2018 15:01:18 +0900 Subject: [PATCH] media: mfc: support the s5p_mfc_poll() ioctl To use poll() ioctl, wait POLLOUT event for source and POLLIN event for destination. Change-Id: I35f8f31dd47408ee2d8b720a020fc4a66754986a Signed-off-by: Sunyoung Kang --- drivers/media/platform/exynos/mfc/s5p_mfc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc.c b/drivers/media/platform/exynos/mfc/s5p_mfc.c index 705ac511f272..c8449388720a 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "s5p_mfc_common.h" @@ -811,16 +812,20 @@ static unsigned int s5p_mfc_poll(struct file *file, struct poll_table_struct *wait) { struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data); + unsigned long req_events = poll_requested_events(wait); unsigned int ret = 0; - enum s5p_mfc_node_type node_type; - node_type = s5p_mfc_get_node_type(file); + mfc_debug_enter(); - if (s5p_mfc_is_decoder_node(node_type)) + if (req_events & (POLLOUT | POLLWRNORM)) { + mfc_debug(2, "wait source buffer\n"); ret = vb2_poll(&ctx->vq_src, file, wait); - else + } else if (req_events & (POLLIN | POLLRDNORM)) { + mfc_debug(2, "wait destination buffer\n"); ret = vb2_poll(&ctx->vq_dst, file, wait); + } + mfc_debug_leave(); return ret; } -- 2.20.1