From patchwork Wed May 5 08:06:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Kuo X-Patchwork-Id: 12239295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 175EEC43461 for ; Wed, 5 May 2021 08:06:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D479E613D6 for ; Wed, 5 May 2021 08:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231866AbhEEIHb (ORCPT ); Wed, 5 May 2021 04:07:31 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:37452 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S231671AbhEEIHa (ORCPT ); Wed, 5 May 2021 04:07:30 -0400 X-UUID: e3176c72c0d64f268c2e6d0a75354e85-20210505 X-UUID: e3176c72c0d64f268c2e6d0a75354e85-20210505 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 943048906; Wed, 05 May 2021 16:06:30 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 16:06:28 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 5 May 2021 16:06:29 +0800 From: Louis Kuo To: , , , , , , , , , , CC: , , , , Subject: [RFC PATCH V0 0/4] media: some framework interface extension for new feature of Mediatek Camsys driver Date: Wed, 5 May 2021 16:06:22 +0800 Message-ID: <20210505080626.15432-1-louis.kuo@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hello, This is the first version of the RFC patch series extending V4L2 and media framework to support some advanced camera function, for example, to change the sensor when ISP is still streaming. A typical scenario is the wide-angle sensor and telephoto sensor switching in camera application. When the user is using the zooming UI, the application needs to switch the sensor from wide-angle sensor to telephoto sensor smoothly. To finish the function, we may need to modify the links of a pipeline and the format of pad and video device per request. Currently, the link, pad and video device format and selection settings are not involved in media request's design. Therefore, we try to extend the related interface to support the request-based operations. In the early version, we added request fd to the parameters of MEDIA_IOC_SETUP_LINK, VIDIOC_S_FMT, VIDIOC_SUBDEV_S_SELECTION, VIDIOC_SUBDEV_S_FMT. The driver uses media_request_get_by_fd() to retrieve the media request and save the pending change in it, so that we can apply the pending change in req_queue() callback then. Here is an example: int mtk_cam_vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { struct mtk_cam_device *cam = video_drvdata(file); struct mtk_cam_video_device *node = file_to_mtk_cam_node(file); struct mtk_cam_request_stream_data *stream_data; struct mtk_cam_request *cam_req; struct media_request *req; s32 fd; fd = s->request_fd; if (fd < 0) return -EINVAL; req = media_request_get_by_fd(&cam->media_dev, fd); /* .... */ cam_req = to_mtk_cam_req(req); stream_data = &cam_req->stream_data[node->uid.pipe_id]; stream_data->vdev_selection_update |= (1 << node->desc.id); stream_data->vdev_selection[node->desc.id] = *s; /* .... */ media_request_put(req); return 0; } I posted interface change as RFC to discuss first and would like some review comments. Thank you very much. media: v4l2-core: extend the v4l2 format to support request media: subdev: support which in v4l2_subdev_frame_interval media: v4l2-ctrl: Add ISP Camsys user control media: pixfmt: Add ISP Camsys formats drivers/media/mc/mc-device.c | 7 +- drivers/media/v4l2-core/v4l2-ioctl.c | 153 ++++++++++++++++++++++++++- include/media/media-entity.h | 3 + include/uapi/linux/media.h | 3 +- include/uapi/linux/v4l2-controls.h | 4 + include/uapi/linux/v4l2-subdev.h | 8 +- include/uapi/linux/videodev2.h | 109 ++++++++++++++++++- 7 files changed, 275 insertions(+), 12 deletions(-)