Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp745185ybh; Sun, 12 Jul 2020 23:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy59DSlEmLSEXFEmsAqexVgcybJ1EGxXzpvPBkF3HeNaBesHgcCN7z+0AAgA6MHIoCcbld X-Received: by 2002:a17:906:2dd2:: with SMTP id h18mr49640008eji.504.1594620654832; Sun, 12 Jul 2020 23:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594620654; cv=none; d=google.com; s=arc-20160816; b=HBiAodjWTCr+cK+UKamjaxPqGGvvH8EttABARDJ9ShXlVuL9aNu3gvJ4J8i095keAf pOnIVDIApeXSnFX8PW3GDXVz6YhloldRb3MKXfFLl1zkqbnvltP7pd7/5FeYUX4dyqDx 5OTFGbJ9aC6gaFAFGVoVtKDlt1OBGPaX3sGv62B6Ks9vu9Ufo13tfC28FDKcFryKyMbp +Fsgw8wuwrjBv7W6+JisfRm8te7tjSpGRG1atvaNcrtFLO0lNK+f/9zjUEVsbFamLMnG KZya3aeWs2hGtY/LD5+DNYlqEXSs0JmwLsHU/WM/jYsFbkfCMFV0M+Eysl3ecfqDHoIN CjpA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bQh/36jCZcDByG+9nx4Kj3oZ/1DPecGh3s/vB7rmmZs=; b=BxFIovvbJ2px4w+Vnlzooo7fnQH4xSUDKPNuoq+EhOCHi9IiEKCl1lCyhJd0MQ/W02 u5YwZjA8RdWEDZ56yUiWFbwXDzzBh3fLxaEBXWa+T72gIwxaf+d46QBcu8y5Qg0xxfAv VPYPndhUHuywndqb/HRA8jV7nUKxAg0bO44XdG3805mSgU2RWNEo5jxRHLfYcMOX8+56 tHSPRfNZVJOePiQ2PM0IPax63jf+F9Jk7Dbn0MF83yx1VWp83Z9WW5N23k9mVwuHG+58 hVohyWPOzFKkjXb60P3/0EhQqfLGzwpF3ljwQE9GswQFzTIoW+ochOkWqkF5G83DHuRC QB2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DzaaXGKE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx2si8117961ejb.706.2020.07.12.23.10.32; Sun, 12 Jul 2020 23:10:54 -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=@chromium.org header.s=google header.b=DzaaXGKE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729405AbgGMGJ7 (ORCPT + 99 others); Mon, 13 Jul 2020 02:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729397AbgGMGJ5 (ORCPT ); Mon, 13 Jul 2020 02:09:57 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A67DC08C5DB for ; Sun, 12 Jul 2020 23:09:57 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id 72so5067397ple.0 for ; Sun, 12 Jul 2020 23:09:57 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=bQh/36jCZcDByG+9nx4Kj3oZ/1DPecGh3s/vB7rmmZs=; b=DzaaXGKEpgVhqKOYBrv2Ua3uko6Tg//W4TOh35bm6GY9/BkI0zqcEeLc6TZXpm7Sfm /XgTqZwkYtLSEtoNNHrfGrLK/G/na3RKiExc3Z/NTkrILxC1ZYUiffZ4XZ29QZ9QsAFB V9RuE+kPzERAWf/+jzRmBghIJRvi65l8g9G+Y= 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:mime-version:content-transfer-encoding; bh=bQh/36jCZcDByG+9nx4Kj3oZ/1DPecGh3s/vB7rmmZs=; b=dk2Qs5EZY+wyXqJbsK5kOlmHbxcswkuyawX5dXRra2OHAiDxP544OehDMmVmMKiDsU bwPxwWbKsZjDdJUTV0Ta/DZ4owU78lh+r61Ovaf/KFFudHkUa2WSLT3FNgQfzAz3yyJf pqiNlCNe69e5e5FLhdIaGrmYz07vYCuqnVZMmgYPd1n8WFLtAkq6j3hKL00eaJ5B4Kx2 Cs1sg+H3TfU4LFLabc6xIYu9m1wHbDSFRQlbifW/+NjrX8cqNJJQjxwBMAq2febLoZGT 24ftgQUH+u5ZZJm8os0tyQTyQQwsvowH2QyEeimgPRpxEY7ONm4Hr1ULvfpCaCtbPgq6 PbGQ== X-Gm-Message-State: AOAM5326LA2CbqRtM5Xe31HaVZEL0K6lWkSasENsWOfokdxcg6ilpZxC 4hfazV4d/eCQaJ5eInzEaaNKCw== X-Received: by 2002:a17:90a:71c1:: with SMTP id m1mr18559733pjs.22.1594620596992; Sun, 12 Jul 2020 23:09:56 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:eeb1:d7ff:fe57:b7e5]) by smtp.gmail.com with ESMTPSA id c134sm13134934pfc.115.2020.07.12.23.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:09:56 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Hans Verkuil , Yunfei Dong , Maoguang Meng Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH v3 15/16] media: mtk-vcodec: venc: set default time per frame Date: Mon, 13 Jul 2020 15:08:41 +0900 Message-Id: <20200713060842.471356-16-acourbot@chromium.org> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog In-Reply-To: <20200713060842.471356-1-acourbot@chromium.org> References: <20200713060842.471356-1-acourbot@chromium.org> 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 The time per frame was left initialized to 0/0, which make the driver fail v4l2-compliance, and also leaves it potentially exposed to doing a division by zero. Signed-off-by: Alexandre Courbot --- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 1b79185cf922..09baac2dbc36 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -24,6 +24,9 @@ #define DFT_CFG_HEIGHT MTK_VENC_MIN_H #define MTK_MAX_CTRLS_HINT 20 +#define MTK_DEFAULT_FRAMERATE_NUM 1001 +#define MTK_DEFAULT_FRAMERATE_DENOM 30000 + static void mtk_venc_worker(struct work_struct *work); static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = { @@ -1197,6 +1200,8 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx) DFT_CFG_WIDTH * DFT_CFG_HEIGHT; ctx->q_data[MTK_Q_DATA_DST].bytesperline[0] = 0; + ctx->enc_params.framerate_num = MTK_DEFAULT_FRAMERATE_NUM; + ctx->enc_params.framerate_denom = MTK_DEFAULT_FRAMERATE_DENOM; } int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) -- 2.27.0.383.g050319c2ae-goog