Received: by 10.223.176.46 with SMTP id f43csp283225wra; Thu, 25 Jan 2018 22:03:47 -0800 (PST) X-Google-Smtp-Source: AH8x227eMDEKThhiYGHz7U/XFyyqA2MYve5NxKfzBL4WDwXP99uFK6My3wksVWTO5VJTwRovu/qh X-Received: by 2002:a17:902:7797:: with SMTP id o23-v6mr4181792pll.287.1516946627582; Thu, 25 Jan 2018 22:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516946627; cv=none; d=google.com; s=arc-20160816; b=rhIpP9jRoqQHZuNKGQvalRGunM9XdaRNwdqXXXaM+sj7KJTpTHiUrtlFfUG2KCff7g 1PKdwAUNaG87D1Us2bYLPoAprDGt1zBYb1o8g8y9KGusqNhoP5+ZHRpG+NRTVRZbJHlz XuVbfOUIcIp0qOWG6raWI5c9J8YgZtkNWiKmDL/Qvh/lQrNk/dswMSNPOY42N/dKDlo0 GcVNFL7nTBGyBN7yMorzDfxrxBsPSsqEo71Lx52z1L+ua2hYyLpM4n4VQgPXwaVUH6Bz M8njkdXLEYYL3Ihg6aeDTtOPDMQcGPMyneRFlY6Kdmt+n+PEgUvUgU6Lw9iPKUeDd2mk lTHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ICc6njSz9DlCADgfYiqkd9Two9UHyaMVdDpGavmLKPQ=; b=rfOKfRbvUZZ+A/wxJ42p58LvGS6eUIMY1gq3Dlu7V3Iljmfovzyys5+IHklpK61wlO 3O6cvbE7JMUiMfKaXT0reanC1EbG5N7GScQGjJ3dKHwlu5ZX/9AYSDckHcLx7bubQy9Q 798aRudhY5BfINUBkmT28+FZxvYBqlj2b6crLN2qEBcUHeo8xT+BhDf8Gf38SEAeZPQI 671lRH3TMe7I/+BHZcCmK4ekmEsiBapyZTNaESXMiNl+9Jty38pcYL4EHWt/fJTWG5Bt Tf7ZYw/4V2ck14roX+f5Ip0U51uGgIwDHPvdGpl/y19OT3DME28p5YKl9niHBotjQu74 PLmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eN9HAEaC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si5813139pfa.223.2018.01.25.22.03.33; Thu, 25 Jan 2018 22:03:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eN9HAEaC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbeAZGDJ (ORCPT + 99 others); Fri, 26 Jan 2018 01:03:09 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34487 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbeAZGDE (ORCPT ); Fri, 26 Jan 2018 01:03:04 -0500 Received: by mail-pg0-f66.google.com with SMTP id r19so6625955pgn.1 for ; Thu, 25 Jan 2018 22:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ICc6njSz9DlCADgfYiqkd9Two9UHyaMVdDpGavmLKPQ=; b=eN9HAEaCFLqH8wJQXJ9tKr1foLmFawccnh7ndYB0hAeRMn1x7zdOxLHnA+QlC2RDRW U4NavUSmM5PdTsNfs3NK9FNiMC9hVIlXkWShhPuCUKHwMITBMwKJzLRvh4qLgLRDuP1K PoR6+dyQ/wuN5lKJBfgmTqUvV0RNtUwLcikXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ICc6njSz9DlCADgfYiqkd9Two9UHyaMVdDpGavmLKPQ=; b=F6uZS9wqnB25XWlOEfnRgH/oRTAt/rxPAEFXEBeRdGJc4qDkt+w3RG1/N90Uktn77K KBgC7tLM7BUhcI0BS04eoMJ7iXqpIDuNpxVoM9QCctVhVcNZedYe5HpFVLFoT3Up9mwJ PV/9xzMrcmQyGe/+mTDwZAWM/heji8Bf3MtUxhTuk0fo2e87uBtpfLHHJTrdwFCfxe+C IPAbPdhkGcI5T2YBm5ziN1ybEQ64DxsT17Z0E0+aSUTvZWLlBVmNX32cdledp7weGsNR 9bijnwtxEg9W17b9X+gN7QjOJfm2CetYeiNdwtXAzu1sPiLR5MuXbWQYpMiStSf//VnU jEUA== X-Gm-Message-State: AKwxytf0F3RNHa3zoaZDp17lJEzdLVXy/yfjuHCWTZtgftNUUTOg7PJW EOzJBtCpUlwB1mk0CX8NXj+sDpOYuJU= X-Received: by 10.99.97.137 with SMTP id v131mr14832733pgb.243.1516946584024; Thu, 25 Jan 2018 22:03:04 -0800 (PST) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:1002:a6cd:a898:e07b:a331]) by smtp.gmail.com with ESMTPSA id j3sm14543201pfh.39.2018.01.25.22.03.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 22:03:03 -0800 (PST) From: Alexandre Courbot To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus , Gustavo Padovan Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [RFC PATCH 8/8] media: vim2m: add request support Date: Fri, 26 Jan 2018 15:02:16 +0900 Message-Id: <20180126060216.147918-9-acourbot@chromium.org> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog In-Reply-To: <20180126060216.147918-1-acourbot@chromium.org> References: <20180126060216.147918-1-acourbot@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the necessary ops for supporting requests in vim2m. Signed-off-by: Alexandre Courbot --- drivers/media/platform/vim2m.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index a32e8a7950eb..1ddbad5eb569 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include MODULE_DESCRIPTION("Virtual device for mem2mem framework testing"); MODULE_AUTHOR("Pawel Osciak, "); @@ -370,6 +372,24 @@ static void job_abort(void *priv) ctx->aborting = 1; } +static void apply_request_params(struct media_request *req, + struct vim2m_ctx *ctx) +{ + struct media_request_entity_data *data; + + if (!req) + return; + + data = media_request_get_entity_data(req, &ctx->dev->vfd.entity, + &ctx->fh); + if (WARN_ON(!data)) + return; + + /* apply controls here */ + + data->applied = true; +} + /* device_run() - prepares and starts the device * * This simulates all the immediate preparations required before starting @@ -385,8 +405,15 @@ static void device_run(void *priv) src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); + /* Apply request if needed */ + apply_request_params(src_buf->vb2_buf.request, ctx); + WARN_ON(dst_buf->vb2_buf.request != NULL); + device_process(ctx, src_buf, dst_buf); + /* Inform user about which request produced the destination buffer */ + dst_buf->request_fd = src_buf->request_fd; + /* Run a timer, which simulates a hardware irq */ schedule_irq(dev, ctx->transtime); } @@ -841,6 +868,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds src_vq->mem_ops = &vb2_vmalloc_memops; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; src_vq->lock = &ctx->dev->dev_mutex; + src_vq->allow_requests = true; ret = vb2_queue_init(src_vq); if (ret) @@ -1006,6 +1034,9 @@ static int vim2m_probe(struct platform_device *pdev) #ifdef CONFIG_MEDIA_CONTROLLER dev->mdev.dev = &pdev->dev; + dev->mdev.req_mgr = media_request_mgr_alloc(&dev->mdev); + if (IS_ERR(dev->mdev.req_mgr)) + return PTR_ERR(dev->mdev.req_mgr); strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); media_device_init(&dev->mdev); dev->v4l2_dev.mdev = &dev->mdev; -- 2.16.0.rc1.238.g530d649a79-goog