Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp583196ybt; Fri, 19 Jun 2020 08:41:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpVapCdr+IdQ379l44tUYzt8SrhBNNu5bZbS640mwU8nI5+AhOvc+TqnRFRAvIVi6IT21u X-Received: by 2002:a50:9b13:: with SMTP id o19mr3876787edi.143.1592581265914; Fri, 19 Jun 2020 08:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592581265; cv=none; d=google.com; s=arc-20160816; b=oGHncW7FxvLOX0w2BpkiwolSXmMkeXdyNlZ0YCmgUz61CTZtkcwEp2vvQEbXresVoC uebG8Xcv8UNCT1r7Jb6zll+y1m77vDMhfvgrCxxnrVvI9Y4Txrg6+pvIrB3zusRA8jAq OKXFT4KlkSKNbbksHQhRChgaXM0AF7BbZD90xJf8+WwfOrKPbYrSLKfV3Pw6YrTSbqRl LOiBkYYkroQxebL8dBYjw/I2iTS3FnhDwZpX3edT9RglQm4LaIpCdbAGy4DLT6ij0ZWT g0oA/jI6RtR5IL9hg+thEvJjX5k8SqponSzDacZU3881nW2n3zBC0QyIqaR/5LrFrkWN MsSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QNu6BK+AKMiZYnP8s2cn9hMBZgrI85KrpzKmQc+V0zU=; b=u+D0oEPj/OShrCxA9PY6+RRlTwXG0LGJbzsMjgWMP1V5Zel2xyXR/C3j9kN6bnMrcQ Czi8OgKkseBM/I5dcVrUF2bXtKmlzs/hI2yKOIzgF9tyccjLGFdUdYA7qtO8kM8SkfgV kwLiO5ZC9eYdGqPNMW4PRnIuj5bpnHL94YgyvMYtxfRMh76ekg34WGXFc+m1LpNlaHfa a0P6JZlPIQm+8+9M/KoGNrCvgovAraG7D23YKkwSWN8QHhcDVcAUrpXRmGJG+NRFovxD K1OQ8mL94ysxkE9yQ5bvdHr089TYMa5aJ/X4F4HuyQy5T9QGXCTWcIvQVduGO90VaJNR COag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zg5YZ+ia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si3902043ejr.66.2020.06.19.08.40.43; Fri, 19 Jun 2020 08:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zg5YZ+ia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404703AbgFSP3m (ORCPT + 99 others); Fri, 19 Jun 2020 11:29:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:33150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404667AbgFSP3c (ORCPT ); Fri, 19 Jun 2020 11:29:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D682A21BE5; Fri, 19 Jun 2020 15:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580571; bh=tH3Xht3LJp4Pj+XEDbZoLHPhR/pCQ8NSKBwMakmsDvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zg5YZ+iaItUKng1WxdGtjZD5b7+Y6PRqbiWlzfJff/g7ayNYP7g7nveqpp9O2Fm8m 3JsO/a/94CfA3nQFiO3PtrJ7KZp/UIMnW4IDzpa0mjNY4URJ7U6Pvkxu9/eGjM7nT6 UV9V/IMmRy6zjfGvMr0Y7RJqQELX1uiaRgZphJHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Paul Kocialkowski , Samuel Holland , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.7 300/376] media: cedrus: Program output format during each run Date: Fri, 19 Jun 2020 16:33:38 +0200 Message-Id: <20200619141724.541035605@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Samuel Holland commit a8876c22eab9a871834f85de83e98bbf7e6e264d upstream. Previously, the output format was programmed as part of the ioctl() handler. However, this has two problems: 1) If there are multiple active streams with different output formats, the hardware will use whichever format was set last for both streams. Similarly, an ioctl() done in an inactive context will wrongly affect other active contexts. 2) The registers are written while the device is not actively streaming. To enable runtime PM tied to the streaming state, all hardware access needs to be moved inside cedrus_device_run(). The call to cedrus_dst_format_set() is now placed just before the codec-specific callback that programs the hardware. Cc: Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver") Suggested-by: Jernej Skrabec Suggested-by: Paul Kocialkowski Signed-off-by: Samuel Holland Tested-by: Jernej Skrabec Reviewed-by: Jernej Skrabec Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 2 ++ drivers/staging/media/sunxi/cedrus/cedrus_video.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -74,6 +74,8 @@ void cedrus_device_run(void *priv) v4l2_m2m_buf_copy_metadata(run.src, run.dst, true); + cedrus_dst_format_set(dev, &ctx->dst_fmt); + dev->dec_ops[ctx->current_codec]->setup(ctx, &run); /* Complete request(s) controls if needed. */ --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c @@ -273,7 +273,6 @@ static int cedrus_s_fmt_vid_cap(struct f struct v4l2_format *f) { struct cedrus_ctx *ctx = cedrus_file2ctx(file); - struct cedrus_dev *dev = ctx->dev; struct vb2_queue *vq; int ret; @@ -287,8 +286,6 @@ static int cedrus_s_fmt_vid_cap(struct f ctx->dst_fmt = f->fmt.pix; - cedrus_dst_format_set(dev, &ctx->dst_fmt); - return 0; }