From patchwork Fri Jun 28 12:59:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 168080 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3669986ilk; Fri, 28 Jun 2019 06:00:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyksVEIfZfmcezN+cvQCo6kyVrXoHRz/kVpgI9q80Py8cjqCfCSbJwzBI9IWX8bbjWyS9Cv X-Received: by 2002:a63:d24f:: with SMTP id t15mr8294596pgi.301.1561726831507; Fri, 28 Jun 2019 06:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561726831; cv=none; d=google.com; s=arc-20160816; b=O/7TIgJxlKDIRTGnxyTc2Xf9WNrOkbjIVj6485MouXElPH9/+W6km3/XNPtnNcIzAf B+79mCHFGq6g7SiblnYCE56waJQCRrzYVLFVrFwBMtCKa4KID0Z6hcwDC2DXEU4nlLEM 6XH8J84Y1Tpm7jXQBCf6AlEsqXfj7ieGbU0SQKxjt4Z5G9Py8lrx9hi2Gx3QVKz/fysy Nl5xZaEH8S2bITG5mcAoF641d4CHmT5CYLnVkHFeBzUtjkzs0fwo+Z66Z3uTf25POXcX fZBnffI/kReG3RE1Q7O8SMGc05s81Hltj/wPY8hAZ6Uz9i7+I0XO5gDpO57iavhjQKEY PzfQ== 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; bh=fBtq7kaIVPRsvKUzCzl5KDAdxqoIYBr/rU+qALMTKSc=; b=gfnD/WNk5GidN8OUa8DVAWXP3TijRBQ13DNSOF+fTx9ygMyIbQkQHsK7wRHyy0CT59 4LtrNFg2hFV1Twqzz0QG+RADTeYGpAc+lr4mJxLmaApLIOPceIgaWosUKWJueZOQLApo PfDkTxUoD9H97SXfQz13i+/u+3NG7h5fKyrsgkt000uCw3COALgY1kJJjin0+X2e954J ort2CaxvJyrG/y5D9AQDu/qBlo4VcBj0CpTSkDt4UNa/HTfjUEMaQjZTzxF+Opkj2/WE OKEb5TUDRyUj+IqnxtXvMZ3TokrPowTyTbgb6pxJ/21Mv9KubfktjyqiGs+uqJ7dOh95 vRww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qnObovf0; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k72si2093202pge.95.2019.06.28.06.00.31; Fri, 28 Jun 2019 06:00:31 -0700 (PDT) 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=@linaro.org header.s=google header.b=qnObovf0; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbfF1NA3 (ORCPT + 30 others); Fri, 28 Jun 2019 09:00:29 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39853 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbfF1NA1 (ORCPT ); Fri, 28 Jun 2019 09:00:27 -0400 Received: by mail-wm1-f65.google.com with SMTP id z23so8904122wma.4 for ; Fri, 28 Jun 2019 06:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fBtq7kaIVPRsvKUzCzl5KDAdxqoIYBr/rU+qALMTKSc=; b=qnObovf0dgdVThBXHp4TM9zp+07NpQtylNFNkZwDDsvwArg7j42IQapGVbuUonaf9Z S0Y8DajsY0tEHZc30D7gM0RuxbzuBPA3rj0zTGinC5guvIKjToiyngXvw1D/DIjmGU4W cVHl60Zc1e8LMu9IypcFUxr0DqjlMCwZ5d1gFb4sgm5DqcsRjMnJnWkoFntoIMF/Y8Be PYZRjSa6Sn8NxSSGz26L7lBiCiZGD7C9WHTdenAf8pUSAiAdAbyIg/W4V5ycoPqxHC6K MKcmBOcOwkjawRJCCA30UVfNHWq4o+NE0Lpv8U2tkUFIrPSuZVSw+C6i3WewD3++CRaJ ZSOA== 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=fBtq7kaIVPRsvKUzCzl5KDAdxqoIYBr/rU+qALMTKSc=; b=IXWQoVxkJ09K8MhGVfkmXgW3hBYd1EImoVj5wFC7cx4gdYJ0h+LbwZlF44Ylwl7+EB FqPHWd/MxobblnhGjKHNQqg2hctzRWRAYVm0h5OgTRuVmJq9xuQDQ2ZJ0rp7gG/gTdtf H5C5N7y2p7oI2r9xBoF3qk2VekYJS1PtTITcXvg0udRk5+aBmBc/ctGSclZTbSEdO6kH X0uFzFRI7o1THOBtVD8W2ZJDHjL5knkCmgt3TgqlvHpmDuwQ+TABSiEDQh74HDL/YXwZ XrlG8MHIsNVturAVVisO5F3ggKQp7rJ+0ldL4aLV3+sVkm0OGzBj11AiV3vCquCjJJOx k9xQ== X-Gm-Message-State: APjAAAU6INLTK7vY8eDf4afNeL0pjxxGPz7Bi42XZq+iuQ34iYR4/9p1 N46BriCxFFiVzw4sz3vmZoygbw== X-Received: by 2002:a1c:2907:: with SMTP id p7mr7095504wmp.100.1561726825393; Fri, 28 Jun 2019 06:00:25 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id w20sm3717174wra.96.2019.06.28.06.00.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 06:00:24 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH v2 01/11] venus: venc: amend buffer size for bitstream plane Date: Fri, 28 Jun 2019 15:59:52 +0300 Message-Id: <20190628130002.24293-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628130002.24293-1-stanimir.varbanov@linaro.org> References: <20190628130002.24293-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Malathi Gottam Accept the buffer size requested by client and compare it against driver calculated size and set the maximum to bitstream plane. Signed-off-by: Malathi Gottam Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/venc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index a5f3d2c46bea..1b7fb2d5887c 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -294,6 +294,7 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; + u32 sizeimage; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -325,9 +326,10 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, - pixmp->width, - pixmp->height); + sizeimage = venus_helper_get_framesz(pixmp->pixelformat, + pixmp->width, + pixmp->height); + pfmt[0].sizeimage = max(ALIGN(pfmt[0].sizeimage, SZ_4K), sizeimage); if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) pfmt[0].bytesperline = ALIGN(pixmp->width, 128); @@ -399,8 +401,10 @@ static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f) if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) inst->fmt_out = fmt; - else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { inst->fmt_cap = fmt; + inst->output_buf_size = pixmp->plane_fmt[0].sizeimage; + } return 0; } @@ -918,6 +922,7 @@ static int venc_queue_setup(struct vb2_queue *q, sizes[0] = venus_helper_get_framesz(inst->fmt_cap->pixfmt, inst->width, inst->height); + sizes[0] = max(sizes[0], inst->output_buf_size); inst->output_buf_size = sizes[0]; break; default: From patchwork Fri Jun 28 12:59:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 168085 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3670226ilk; Fri, 28 Jun 2019 06:00:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJw7ECyHqPwlLEebuNid/JZVTgtZSTInVBx0bAysjLpKasqf73+8sgsOKSM0B98gWk9MOm X-Received: by 2002:a63:4d4a:: with SMTP id n10mr8984644pgl.396.1561726841010; Fri, 28 Jun 2019 06:00:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561726841; cv=none; d=google.com; s=arc-20160816; b=SJnaScNyCsazAk6e7vaBkaj8kRLX+j1R6EMBxxKttZhskySQ2r0PW7ZqZvELLyH/gf geMaWcQ+so7LS2NUTVtFGjBOi82PZTN8O9Ns8A5EEqF43Xk7PxqTi9roCwf0n9CVYVMH fDyykJxN40k5fs7+ah1nmJt08p63NdZ0lRuNo3VAjOWXx9sVl/CZV016pVz0UapBEHel FiKoOhDeAs0gcKy6iSoD1Y0/m5G1tKbFrk77NscSA6g0mXHjx/zPrA8NxZzYu25cMuQO 2YSjJrX8SUcL3s7TsWldNIlC6r6jBg38/6n3NAxKvtZuiBn8C12lUJgW6a0XhbaYvv24 wWBA== 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; bh=VYK6CuTcwUpXBzrv+57CELDw4v8ANQ9M8j2TEI8QevU=; b=jg7y5NfKHjdqosSlWo3wDkvgk3WzCCd99ihhH7ISV29Qqy2pGQO8lb7rW6BDUN3C6h maU1qmDqnxub8JjMCMo3p7QZzEVkyQk9OKfRGHjg10532eR8RPApbtauU6ImM+ikT4K4 BZNVij7IVj09LPyt6G4XCBxHd0SvMFWm9d9aQtdq9OfZ9tCSAAXZxw3/Bf41RQuhu0qF L0sYXFjrJdTh/TRJeT6JB8R50k/SDBFKt05cZHGpr6nuwInjfrohFkZBgoms13mSfYx0 nmzvL3cT6ZjVPXJZqeGYQ5TSK6R/S+dCLh+MrMw3xjpUVFzRjkRHrfJb6S5hTd+VdnDG iMeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIaKx5bz; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t22si1963534pgk.507.2019.06.28.06.00.40; Fri, 28 Jun 2019 06:00:40 -0700 (PDT) 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=@linaro.org header.s=google header.b=OIaKx5bz; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbfF1NAj (ORCPT + 30 others); Fri, 28 Jun 2019 09:00:39 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40655 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfF1NAd (ORCPT ); Fri, 28 Jun 2019 09:00:33 -0400 Received: by mail-wr1-f67.google.com with SMTP id p11so6203270wre.7 for ; Fri, 28 Jun 2019 06:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VYK6CuTcwUpXBzrv+57CELDw4v8ANQ9M8j2TEI8QevU=; b=OIaKx5bzcFJ9iQHFSo+vkoZWC/Js1VgIC5YdEtJwkq7wImjmgHDI3Uzb744irl1vpQ lSddEYDCwDSh34+o4ro84ykmsc9xLCAayQqTNUgOTO6rqSUotym41jym5H/msjWYLD3l kJHcPqhpcmB23hEAcomtgsmv89peFjdasBXG9H3Ajmt1aENoGFFc/V1RnUzHCoNTR9fD zBO62HZL75a3W5rtJ785/KdQG9CPnx03rCAAk525/vZK4LHr+b/HBGU+7E4EQS6GZ8R9 LjE0IN3KSd4yjsSa1QhUIwN74CjyczAOVlT/xu/Pih7CgJTXqMyMKTQkZw5htQgLQLLY QuWQ== 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=VYK6CuTcwUpXBzrv+57CELDw4v8ANQ9M8j2TEI8QevU=; b=kJMko/7ljclTFjrgkM4uo6sT0gw4bDgNEOGQJ9AWYsUzFjIqLuvwX7fpXMocDnTTRm 0x2ukEI3313WB0sTffV0Vzdvn3ex6VtRhBqBDGTulSEaboyki6McV5/BMgfmmi8r1TLF y0L3qk8FlFlWw6VfmQStHfPy13u1QYPMlLXgE8dbEf1k6LdMIEzg15O4+O3SOYdWzVVH oz564UUON4aXIlZnjWCUSBNhaChz6dRW9ODkC3XmLH7m/N1DG+loGhTsRuH8Co825Fg4 yF35FO06qdvod6QVCXov+ahu6NlsB1MOWCCawG2oeDX0dAx2hkrz2STOFkTRBgehe9x8 YGyQ== X-Gm-Message-State: APjAAAUStooefUkXvFaq3CvD0IImGOSWSHOebDPieLWmUqTLj4OChi1t fR8K12e5/aJE/iU8RDug8XrF1Q== X-Received: by 2002:adf:ee03:: with SMTP id y3mr3958702wrn.128.1561726831149; Fri, 28 Jun 2019 06:00:31 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id w20sm3717174wra.96.2019.06.28.06.00.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 06:00:30 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v2 04/11] venus: hfi: export few HFI functions Date: Fri, 28 Jun 2019 15:59:55 +0300 Message-Id: <20190628130002.24293-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628130002.24293-1-stanimir.varbanov@linaro.org> References: <20190628130002.24293-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export few HFI functions to use them from decoder to implement more granular control needed for stateful Codec API compliance. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 7c5bf5cb32de..82eb889ab541 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -276,6 +276,7 @@ int hfi_session_start(struct venus_inst *inst) return 0; } +EXPORT_SYMBOL_GPL(hfi_session_start); int hfi_session_stop(struct venus_inst *inst) { @@ -299,6 +300,7 @@ int hfi_session_stop(struct venus_inst *inst) return 0; } +EXPORT_SYMBOL_GPL(hfi_session_stop); int hfi_session_continue(struct venus_inst *inst) { @@ -328,6 +330,7 @@ int hfi_session_abort(struct venus_inst *inst) return 0; } +EXPORT_SYMBOL_GPL(hfi_session_abort); int hfi_session_load_res(struct venus_inst *inst) { @@ -374,6 +377,7 @@ int hfi_session_unload_res(struct venus_inst *inst) return 0; } +EXPORT_SYMBOL_GPL(hfi_session_unload_res); int hfi_session_flush(struct venus_inst *inst, u32 type) { From patchwork Fri Jun 28 12:59:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 168083 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3670156ilk; Fri, 28 Jun 2019 06:00:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+1STLmhPVrpMVFWpqjAGlhyOC1cbVO5UjjeXXimqXfNIdCBneO3s/qp2Bw10tf+WN9pxV X-Received: by 2002:a65:4342:: with SMTP id k2mr9231414pgq.218.1561726838793; Fri, 28 Jun 2019 06:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561726838; cv=none; d=google.com; s=arc-20160816; b=GnNM47W2Lb/fkD+4NBA8RfE7eLbhFKtmQvVr5NzisyKRhekicQ6q57yaoOGGKLtFSb H2x5gL0QWqddq5FU36ey3VcvemNNzPfzTyHScy8nmHTYUEgUe4b4oFp+7U6v0bdF2/C7 bB7KMLSGG1rg0WonidU7Hzf17aWp+ogpYSTeIC4iDmGiR+wKLP7jzrjH+g7zu1huZWud zzl09XxO85z+3+bp4xGKRZdWMir1XRJxj/Pkx0bP6WOYxtQ4iNSXJDUztN0H2xhPgQBz l0nZe9vS0yBbVZ6REf0ir7Yan80Hr3Hw769gdNFM5zm5wh2JEuI2NQnwsSfSjYB7E5g8 d2UQ== 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; bh=GDdYN5kQt5oodJg9h0fQ+PGqnlQ6057Y5ThAbiMCFHE=; b=kGbvqMoLkkF1bZokJqFpkPGjhMQE1yLpcLXZLV9EavejHQCinZ70lglGPrwZ3n2zES vPHkvoN/D0Aermfyy9IaOxYSem2hNId48XwUzR1L5ZHIEgIVmNUi37UVvPbliQSLMOht vnCtiUYeshFhE/flJCC95EYtjd+AYo5DdJtviwpspuRhxwD2N1O0X1BFnFmUJx1SfNfV yHJk0rMkKxn/vIxMIZmYcjgybOdGFlY5Tlr7iRMNGs24Vz2Z0JUm8T63Y3JfOOAVA7nS 3N95X2vFaeeWgwK7troh+wsEPyU0VoI5p6u8IUyOsITlci26wJeLSuqDsCn35qluB2b/ 4xGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aStCg4Hr; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si2042833pgi.556.2019.06.28.06.00.38; Fri, 28 Jun 2019 06:00:38 -0700 (PDT) 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=@linaro.org header.s=google header.b=aStCg4Hr; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727219AbfF1NAh (ORCPT + 30 others); Fri, 28 Jun 2019 09:00:37 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46016 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfF1NAe (ORCPT ); Fri, 28 Jun 2019 09:00:34 -0400 Received: by mail-wr1-f66.google.com with SMTP id f9so6174709wre.12 for ; Fri, 28 Jun 2019 06:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GDdYN5kQt5oodJg9h0fQ+PGqnlQ6057Y5ThAbiMCFHE=; b=aStCg4HrF6BmAN5ZprxLweMHT3TIAHKj9unAhcfV7uHqCXxK/8cTWppGWhbH6ZIp28 X1QPv8tS/qz0Nlfbj4S7cWYVVp7LxyG+w+c6yBHwIHX3raV4D1AfsFzmFUuBghwvbcFv b+W4geq0zgQs+TlGDuYDGhYHSWbOaXWX1d35Ijn1iH7mZcWV8bjjBoQo3AFPPkWcg1eW 24QBV7tmPeX4wF/K953B6FL5UGulav6XLBmO+/XtUGvPCh42HQObW993Q35MrOM2mhxa 7fHSc/28OoOlsMRatKMoqX1LuISEQ6/3YoixCLbhReBc7C4wC8aX16RVtlAOmpCJEZha 30IQ== 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=GDdYN5kQt5oodJg9h0fQ+PGqnlQ6057Y5ThAbiMCFHE=; b=fnt7VYx0I+waOMOlyI+Fz/3eKKgxBM2ZNgfEWBPwLdzP0kRacme+JIQtFyOGAlTwcg XQ18inWA1yuS8tNaWMh9+3pubtA9QR+IqLcw00iAmmSeBewxXPwcfRgkd+uGyj6CZOgA 5UhH+3g5g2RWTXBbgryDdf6mGoFgBXlNgZmvRWCc41/TcVtd+aJ7tSROsc+QzxVwQxSB lfVf0xesJ9dVy+HBpmG9YWgAU9VXLZ6TSossbrorxgVhsEWJ16GEtRBc1fRaazg7745v QpdF+r0hi3xW3ZH6xq+l0Q5TTeYeBdCZY/3BLBG5jvIzQQurR3MOUWDTm3gYOeLcs1lU yyHg== X-Gm-Message-State: APjAAAUiZc/gMMLSoVmQKeoxTO5CdnyB4cHFnxUMTBFSN8UUk+KCLEa5 TV+GlVILNAEgT7eskbvhr16hsQ== X-Received: by 2002:adf:e2c7:: with SMTP id d7mr7602029wrj.272.1561726832700; Fri, 28 Jun 2019 06:00:32 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id w20sm3717174wra.96.2019.06.28.06.00.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 06:00:32 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v2 05/11] venus: hfi: return an error if session_init is already called Date: Fri, 28 Jun 2019 15:59:56 +0300 Message-Id: <20190628130002.24293-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628130002.24293-1-stanimir.varbanov@linaro.org> References: <20190628130002.24293-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes hfi_session_init to return an error when it is already called without a call to hfi_session_deinit. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 82eb889ab541..3d8b1284d1f3 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -198,6 +198,9 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt) const struct hfi_ops *ops = core->ops; int ret; + if (inst->state != INST_UNINIT) + return -EINVAL; + inst->hfi_codec = to_codec_type(pixfmt); reinit_completion(&inst->done); From patchwork Fri Jun 28 12:59:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 168089 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3670899ilk; Fri, 28 Jun 2019 06:01:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2u7Bau4hr5onVbJltmq3uHNo+d5YIYTu9RIlK5klh0SKoSaN0lFEypTS8inTsVM/dkYf/ X-Received: by 2002:a17:902:a411:: with SMTP id p17mr11626125plq.104.1561726869934; Fri, 28 Jun 2019 06:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561726869; cv=none; d=google.com; s=arc-20160816; b=I+UDenpYmN0BqGNy90bqdyv2+1x3ikDZ+DHi8uaQu97fb16AOt5BLsBJZUpbgCnH+8 kBQ9iJqQW9xKH/kuLCu1d0h09iKcOouCcINbin9hgYWa+SQZSZ3BZBHH60DEig98xmxG wucR1RINp2nFygtQiWnFxZqfUBVrxnKZD+3Q78NJ2ACqwJ8JfcwiWwD+h1IaalOBOfmN BBjGXvE9oqs2q67WghaWI8R5HYm5ncvUYhkSeT7nvc7ctaYVb1txnWo7PtJvSBSFAJYz EtIr+DglflFNQSWB6gv1O/KeVSHKiIx0Qch8GFBXaB++hK8z6Vm2/d0+1DSmCkX6VcHN a4Pg== 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; bh=FBLKO27dHaQrao2r2KD0kPHzW+2HdrGXpaJBaZnrR7A=; b=JEYDjtU2v7Yd/Zx+vgjndC4eSNO7hvGAadmHpgz9Xyg1H0rd0g6QtiwfW4iTBwbz29 wYeWkEUou9SdQOTPQOxyB5PgTEHFwTYtrKBL7Y35kjeu6uijxb/TuoWDc1vX/vSH7IOS DA58Zdirg/mMBlJJsFntK9I5TfCbORbfKIPoAy3oqBH7Oy6W/ipVlWxn2WeEOjxLfGLl 4/2Ztyr126O3ylkerWNitnbwdvQzCUxsbvFr0jnBGVbgiubMgVEvOof25w0v+1WI43au c4XnpLEorAV43Iht3lRw3jVtl/pj3X8sI95CdTPD5KLnZpbYlIdW3UDPJffQ7GouHcZ/ k5OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZAzZ4lAo; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si2097651plg.71.2019.06.28.06.01.05; Fri, 28 Jun 2019 06:01:09 -0700 (PDT) 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=@linaro.org header.s=google header.b=ZAzZ4lAo; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbfF1NBC (ORCPT + 30 others); Fri, 28 Jun 2019 09:01:02 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:32979 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbfF1NAj (ORCPT ); Fri, 28 Jun 2019 09:00:39 -0400 Received: by mail-wm1-f67.google.com with SMTP id h19so9322320wme.0 for ; Fri, 28 Jun 2019 06:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FBLKO27dHaQrao2r2KD0kPHzW+2HdrGXpaJBaZnrR7A=; b=ZAzZ4lAoYkAvxfaNWBiUuUnyQCQbbNKsMpfDtAC8redcT2OJnWdYZ5zLYRV7OxhU0M cTvnN9rKm0edBhzNW9YvVCIQfxKH1oCMLpqOI9D0kamX1Q+OxtfE/rRgXdoOfqDORyb2 vo271veLtKQtd02Alrb9H2WZE3BF+ts+V99Qc9+pjEAoC5QzJqRgx5ykA6hd81UQ75dB BQF+FFDizh+8du1kybPRkxbff3Znk4xJz/0hhnoODYbwrd9hvmfJ/A1ommLfNWXLsbtA cEV4z2oRMm33vpwCmMFwuicwduGxtF7d03NUcgpzs+7xA/eeTwYATtYAaZI8gbHrVCrO Y9yA== 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=FBLKO27dHaQrao2r2KD0kPHzW+2HdrGXpaJBaZnrR7A=; b=CKfp7uF63y5gHyRg0juHpMUUHm8CGcRWtUCFhy6p00gH7jGNuKoc/5EqcPN8tg/kRc inQpPahiSgr53FzNzxjM/PqjaQ5AorYhbHqIwqPNpZy2np2TCCAb+fArAImwo2NFsG3m jqMEYIWGsuhIgEcJL1zvT6ZCEvGaWv1vFaLMR4+WuTQ8HOUZu+jwoOXvCIACkhOZa7YZ 7iPWqDZ4UjfXjbp82UpF0RqwU1tK7U0/ASci543Z/G/2hDFj8+LpszZnCohgutmjr1f9 9q2gh9cMalQKUC1/5g8P9tO56zQ4Jf7p1XyDLXwQNELgeWU70YUgp+vlw+Of0mDmy8Da FR9w== X-Gm-Message-State: APjAAAXQAteLJExZA24W2EnLO238Pm0/W8sWa9x376yLbng1Ozwit2EP J1S5b9BoV1EtY0nWlccIYZJiQg== X-Received: by 2002:a1c:9a03:: with SMTP id c3mr7324818wme.101.1561726837254; Fri, 28 Jun 2019 06:00:37 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id w20sm3717174wra.96.2019.06.28.06.00.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 06:00:36 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v2 08/11] venus: vdec: allow bigger sizeimage set by clients Date: Fri, 28 Jun 2019 15:59:59 +0300 Message-Id: <20190628130002.24293-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628130002.24293-1-stanimir.varbanov@linaro.org> References: <20190628130002.24293-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In most of the cases the client will know better what could be the maximum size for compressed data buffers. Change the driver to permit the user to set bigger size for the compressed buffer but make reasonable sanitation. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index e1f998656c07..fb9afee76793 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -133,6 +133,7 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; struct v4l2_plane_pix_format *pfmt = pixmp->plane_fmt; const struct venus_format *fmt; + u32 szimage; memset(pfmt[0].reserved, 0, sizeof(pfmt[0].reserved)); memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); @@ -161,14 +162,17 @@ vdec_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) pixmp->num_planes = fmt->num_planes; pixmp->flags = 0; - pfmt[0].sizeimage = venus_helper_get_framesz(pixmp->pixelformat, - pixmp->width, - pixmp->height); + szimage = venus_helper_get_framesz(pixmp->pixelformat, pixmp->width, + pixmp->height); - if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + pfmt[0].sizeimage = szimage; pfmt[0].bytesperline = ALIGN(pixmp->width, 128); - else + } else { + pfmt[0].sizeimage = clamp_t(u32, pfmt[0].sizeimage, 0, SZ_8M); + pfmt[0].sizeimage = max(pfmt[0].sizeimage, szimage); pfmt[0].bytesperline = 0; + } return fmt; } @@ -266,6 +270,7 @@ static int vdec_s_fmt(struct file *file, void *fh, struct v4l2_format *f) inst->ycbcr_enc = pixmp->ycbcr_enc; inst->quantization = pixmp->quantization; inst->xfer_func = pixmp->xfer_func; + inst->input_buf_size = pixmp->plane_fmt[0].sizeimage; } memset(&format, 0, sizeof(format)); @@ -728,6 +733,7 @@ static int vdec_queue_setup(struct vb2_queue *q, sizes[0] = venus_helper_get_framesz(inst->fmt_out->pixfmt, inst->out_width, inst->out_height); + sizes[0] = max(sizes[0], inst->input_buf_size); inst->input_buf_size = sizes[0]; *num_buffers = max(*num_buffers, in_num); inst->num_input_bufs = *num_buffers;