Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5416922imu; Tue, 29 Jan 2019 19:28:45 -0800 (PST) X-Google-Smtp-Source: ALg8bN7S7ZuKFOn9U7XFkoitSVCNagQFM1b3Vp8QlSwsqXnQNbhQA+x/wfDztbrJgOT0/Ay07gft X-Received: by 2002:a65:51ca:: with SMTP id i10mr25241932pgq.371.1548818925491; Tue, 29 Jan 2019 19:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548818925; cv=none; d=google.com; s=arc-20160816; b=XPESwGBHYNA2D+YnZnw2UEuZcSnXpJxyF5gOwY+qC2LHpQR5bL+/DmCn2tF8x9MWBF tHRhCCjIcJ1PfhRy0Or513cZ94i8kKEQ+4YYGibHEk+/1vBYHKOiCmPecEvJ2kLgle7w HZX7xgbNJSSiFu88Q3v0krl4w8q5CMZ4PSzxTICZwDEv9rdSv8i9NGNWuSNUtC12X/aR LJTODpYmrMZl/ezQhCS67mOJcAOxIxBHxOS7JFSM/omRdGUaIUB2fDFT1XAxEg9kLtph tKVEW6WTndj8W3paA420EaJHzs9I856+z75kSUWTEI8Vn4vBDV4cL4RBfbY43P8p9iMT Dbsg== 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:date:cc:to:from:subject :message-id:dkim-signature; bh=fIPU2IKg2fXrm0JSCPOV2UQ20i/t4e7FNw+eyeIX/kE=; b=s0STcAuQks7wW2+659Sv2TQPshkviNO/afS+jCN5NBTRX8mVQBMLXgc02VB8c3clKj JkfYDcOGGxEcSa9EaI65OGWfmFCIwK3PCraXI66CPW+CgvppOzXvjyTOYHGpTDy8UART Yx9vI7FF3WgsgsjtBI45aOXdAcI6SZENfXuLOjK7/k5IVpZMdosawcT5kWQ/Sh66gsfy IcVzRoDr6Lduz60Hur15rZQQ1YHGfkpz4dDnHhb5b/S0uIfdQN1r2tco+/6yWZIaRtyR W8H0Yepp5rDKAO8inw2MhIBa4RwIfFJN+lvEW7KwrN9DonEwSDWEfmeW9utdvGBke9H5 F/Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=aYg5cO5U; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si316729pgk.405.2019.01.29.19.28.30; Tue, 29 Jan 2019 19:28:45 -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=@ndufresne-ca.20150623.gappssmtp.com header.s=20150623 header.b=aYg5cO5U; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730045AbfA3D2T (ORCPT + 99 others); Tue, 29 Jan 2019 22:28:19 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:40514 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727681AbfA3D2T (ORCPT ); Tue, 29 Jan 2019 22:28:19 -0500 Received: by mail-qt1-f194.google.com with SMTP id k12so24775964qtf.7 for ; Tue, 29 Jan 2019 19:28:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=fIPU2IKg2fXrm0JSCPOV2UQ20i/t4e7FNw+eyeIX/kE=; b=aYg5cO5UtjYMhsjRNGSbrvLxjw8VhaaJgRRVLiUKPS8mYyPFtE1/cgGWezIya0oSTr Ailr4kt0Qgnt6XCmTGstaWIzw4pPYh5MtCflF7FTLAnjsmOu6U1L/D4+Tc81WnxNdjNX S1jKSIa7HsaYNCjbieUXWQhc5kxBXxn8eMQSFD21Dl8i8s5cTbhgWrzIroTac+3Qk3he 5NoANCJlJcjZuD0+zqY/AaII9M4EsvbuDVch4Vkd4AdmR985gguQsHEIg3moGhBD2F31 Zc+KGvs+ESWqrN6ZaL91CxAbOa8OBY3HvEBM99atYv5Oj4baXV2GzVSo0KxPlg+LL1BW Y1Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=fIPU2IKg2fXrm0JSCPOV2UQ20i/t4e7FNw+eyeIX/kE=; b=pH+nhfkQhComuE0L9BkQOatzeVsivTNBOCVHCUdSg5iS0lMmUR+5NuF/IU37RedarW MM3cVOqklY6dTB9/B4LjMZFgylsMvZ+qiPZ2gcR0ZYnwXedm45Fj+xXRdF236ZDCijp4 C04SG1xMjPNVLf0js4MCb3OIA5smdKlG/wvzIyW8lj6BbrjHF0WhXhs3Cum8/WBwuqXE IXfWSaVIglwzT7dWdBhtk1bxLieK7ks2NhX5imNeGtex3MKdmz6P+EIPACBj/Hkzi/ZR RzFMEckQi3ZavLAwTzXJOB1HOdAqCFqeZn43hyfXk2YweC8v0yoHA0lN+amAAo2oqmt/ +ojA== X-Gm-Message-State: AJcUukf4FI5mNECRTKDlorK/0Hy/fjC9qiaH+4m42QU4skOYH/E5Lhhj Yn+Z484QBxIpPAZOSryQacMHsw== X-Received: by 2002:a0c:d0d7:: with SMTP id b23mr26557412qvh.67.1548818897708; Tue, 29 Jan 2019 19:28:17 -0800 (PST) Received: from skullcanyon ([192.222.193.21]) by smtp.gmail.com with ESMTPSA id e29sm175298qtc.74.2019.01.29.19.28.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 19:28:16 -0800 (PST) Message-ID: <9651c01bf3f2adcc405963bfab48b7e7a5656494.camel@ndufresne.ca> Subject: Re: [PATCH v2] venus: enc: fix enum_frameintervals From: Nicolas Dufresne To: Stanimir Varbanov , linux-media@vger.kernel.org Cc: Hans Verkuil , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 29 Jan 2019 22:28:15 -0500 In-Reply-To: <20190122105322.22096-1-stanimir.varbanov@linaro.org> References: <20190122105322.22096-1-stanimir.varbanov@linaro.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.4 (3.30.4-1.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le mardi 22 janvier 2019 à 12:53 +0200, Stanimir Varbanov a écrit : > This ixes an issue when setting the encoder framerate because of ixes -> fixes > missing precision. Now the frameinterval type is changed to > TYPE_CONTINUOUS and step = 1. Also the math is changed when > framerate property is called - the firmware side expects that > the framerate one is 1 << 16 units. Note sure, maybe you didn't mean to add 'one' here ? Why not just say that that firmware expect values in Q16 ? > > Signed-off-by: Stanimir Varbanov Looking toward testing it, but I had the bad luck of using an USB storage rootfs, and apparently USB no longer works on 5.0rc+, if you have a baseline tree to suggest, I'll take it. Thanks for this patch. > --- > v2: replace DIV_ROUND_UP with do_div and make roundup manually > > drivers/media/platform/qcom/venus/venc.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c > index 32cff294582f..99c94b155b46 100644 > --- a/drivers/media/platform/qcom/venus/venc.c > +++ b/drivers/media/platform/qcom/venus/venc.c > @@ -31,6 +31,7 @@ > #include "venc.h" > > #define NUM_B_FRAMES_MAX 4 > +#define FRAMERATE_FACTOR (1 << 16) > > /* > * Three resons to keep MPLANE formats (despite that the number of planes > @@ -581,7 +582,7 @@ static int venc_enum_frameintervals(struct file *file, void *fh, > struct venus_inst *inst = to_inst(file); > const struct venus_format *fmt; > > - fival->type = V4L2_FRMIVAL_TYPE_STEPWISE; > + fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; > > fmt = find_format(inst, fival->pixel_format, > V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); > @@ -604,12 +605,12 @@ static int venc_enum_frameintervals(struct file *file, void *fh, > fival->height < frame_height_min(inst)) > return -EINVAL; > > - fival->stepwise.min.numerator = 1; > + fival->stepwise.min.numerator = FRAMERATE_FACTOR; > fival->stepwise.min.denominator = frate_max(inst); > - fival->stepwise.max.numerator = 1; > + fival->stepwise.max.numerator = FRAMERATE_FACTOR; > fival->stepwise.max.denominator = frate_min(inst); > fival->stepwise.step.numerator = 1; > - fival->stepwise.step.denominator = frate_max(inst); > + fival->stepwise.step.denominator = 1; > > return 0; > } > @@ -654,6 +655,7 @@ static int venc_set_properties(struct venus_inst *inst) > struct hfi_quantization quant; > struct hfi_quantization_range quant_range; > u32 ptype, rate_control, bitrate, profile = 0, level = 0; > + u64 framerate; > int ret; > > ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2); > @@ -664,9 +666,16 @@ static int venc_set_properties(struct venus_inst *inst) > if (ret) > return ret; > > + framerate = inst->timeperframe.denominator * FRAMERATE_FACTOR; > + /* next line is to round up */ > + framerate += inst->timeperframe.numerator - 1; > + do_div(framerate, inst->timeperframe.numerator); > + > ptype = HFI_PROPERTY_CONFIG_FRAME_RATE; > frate.buffer_type = HFI_BUFFER_OUTPUT; > - frate.framerate = inst->fps * (1 << 16); > + frate.framerate = framerate; > + if (frate.framerate > frate_max(inst)) > + frate.framerate = frate_max(inst); > > ret = hfi_session_set_property(inst, ptype, &frate); > if (ret)