From patchwork Fri Aug 18 14:16:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 110392 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp889642obb; Fri, 18 Aug 2017 07:17:03 -0700 (PDT) X-Received: by 10.98.3.3 with SMTP id 3mr8927571pfd.31.1503065822903; Fri, 18 Aug 2017 07:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503065822; cv=none; d=google.com; s=arc-20160816; b=rVSB5V4JZcF4xjAUh1ALcUvPbmyIwXsAmHV5WzlsrLd1POtnftuSBD4pVGsUukeOXq xAUv9ecFhMCeHwQuEDINeYKqCQBzDaSLsQbRofsZcvtajI3lA5rbkzB2N02VmummCYaz WeK3CDxQnfJokDiXMZxlKZ1nCFJNmxEpaRYlY7yRYYlJgCkA9n5Dyc6h6I/vXZJvdxFO Weqeie9fAJLR28FlUFxEQQi3pc9hUZPJGQ5auc2RnX5qQijvrJkmXVJD7tw2LanwFbx6 O8mcF12emvB2HVwDB/mempH3kBTdI9wtAyUFC8YNC455/m4L6ON3/m3HFa2Kf2JyFt+u c9lw== 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=6LzLQlwqYUmbanL6ynw/oWBDQUrO9sUKe8UbegFTTqM=; b=M9NnbqKiit5Fd2npwS3rmsfyI0QHMdQ0U6thRxKpwGVExYJkuPpXRT5ystLKfl0NxH RipjotqDvoTG9e9jfdTFcysgd6fpvhMOoAMcpOqjkElKSwqTDB1AChPN+2HrxBToBbNE KXUyNf2t6Y0wypI+4U5dR5ffEv1miLAjt+AwLOAV6Jpe+6LMrD1PrYfD/jHVrByDHP0l y2zkHAaFfv4qT3Vqy1DNoheBnweHyUr+FsUJlE1mR6TYsNsE3JddXqfdssUAz+5R3FNK i+z3vkljacOFR4iBSYE1GqAfIp1caVE0nz8NU2L1ycQOhXNb9Di49CsC3q/nhw26aOIR lh3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OOQ+d51S; 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 b1si3971379plc.28.2017.08.18.07.17.02; Fri, 18 Aug 2017 07:17:02 -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=OOQ+d51S; 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 S1753565AbdHROQ7 (ORCPT + 26 others); Fri, 18 Aug 2017 10:16:59 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:38057 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753532AbdHROQy (ORCPT ); Fri, 18 Aug 2017 10:16:54 -0400 Received: by mail-wr0-f177.google.com with SMTP id 5so47465938wrz.5 for ; Fri, 18 Aug 2017 07:16:54 -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=6LzLQlwqYUmbanL6ynw/oWBDQUrO9sUKe8UbegFTTqM=; b=OOQ+d51SR2uhRROXzBfet2esxSAeBZNotIfNdX+8undK17l8nM96/PLkGq1oXsfIYX 6TqJUeOHqcO8qDL7v5oqrrVYphao7tslmWfo8seqJjmUrm7t1BLRKqLSqMHmd0FQZxea G9WTUKP/vOVm2E+DYFS5+DhI2i8WCBJmds7AY= 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=6LzLQlwqYUmbanL6ynw/oWBDQUrO9sUKe8UbegFTTqM=; b=L0Jk4lEMHYZmQ0DFuQaGqKFP6fB+ioRPbcH4HDDIzKAdahxFzDIyRBQHkJwTW8/UnG TtybZNECebZLFGKLSUOHlbGEg8gqovr8sKrekrsWf8HJ76lFrrSJZdjVMVdXdrjDfu+G Birvd32neIdxCGD1kjYCi0qF1d20ocwIVTnn0203/45A2dQn0JHgq97X0Kd1elANjNuC 1Z4MW5NUMkbOmWtaJogT8+zByWB1k3EbZXafqqrkWvc6j8wHeh2Ul19gleUbOnicXrBr xapxOnU4P4FGaTXbWS7pZ6JRldGHig6WdMG0zcG6cXDb4KboooloCm3pTKKjitRCXy7Y Ju2w== X-Gm-Message-State: AHYfb5gHD97zoX6Q0JK4gfD1G2rYInJnSXJYBFjaNa/DFPEfWhLi0tOg 9Tg54LunLGLXTR2o X-Received: by 10.223.129.135 with SMTP id 7mr5333525wra.11.1503065813726; Fri, 18 Aug 2017 07:16:53 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 55sm1387383wrv.32.2017.08.18.07.16.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 07:16:53 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: Pawel Osciak , Marek Szyprowski , Kyungmin Park , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH 5/7] media: venus: add helper to check supported codecs Date: Fri, 18 Aug 2017 17:16:04 +0300 Message-Id: <20170818141606.4835-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818141606.4835-1-stanimir.varbanov@linaro.org> References: <20170818141606.4835-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adds a helper function to runtime check supported encoder and decoder codecs depending on venus version and platform. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 49 +++++++++++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 2 files changed, 50 insertions(+) -- 2.11.0 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 5f4434c0a8f1..b52410deeb4c 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -34,6 +34,55 @@ struct intbuf { unsigned long attrs; }; +bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) +{ + struct venus_core *core = inst->core; + u32 session_type = inst->session_type; + u32 codec; + + switch (v4l2_pixfmt) { + case V4L2_PIX_FMT_H264: + codec = HFI_VIDEO_CODEC_H264; + break; + case V4L2_PIX_FMT_H263: + codec = HFI_VIDEO_CODEC_H263; + break; + case V4L2_PIX_FMT_MPEG1: + codec = HFI_VIDEO_CODEC_MPEG1; + break; + case V4L2_PIX_FMT_MPEG2: + codec = HFI_VIDEO_CODEC_MPEG2; + break; + case V4L2_PIX_FMT_MPEG4: + codec = HFI_VIDEO_CODEC_MPEG4; + break; + case V4L2_PIX_FMT_VC1_ANNEX_G: + case V4L2_PIX_FMT_VC1_ANNEX_L: + codec = HFI_VIDEO_CODEC_VC1; + break; + case V4L2_PIX_FMT_VP8: + codec = HFI_VIDEO_CODEC_VP8; + break; + case V4L2_PIX_FMT_VP9: + codec = HFI_VIDEO_CODEC_VP9; + break; + case V4L2_PIX_FMT_XVID: + codec = HFI_VIDEO_CODEC_DIVX; + break; + default: + return false; + } + + if (session_type == VIDC_SESSION_TYPE_ENC && core->enc_codecs & codec) + return true; + + if (session_type == VIDC_SESSION_TYPE_DEC && core->dec_codecs & codec) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(venus_helper_check_codec); + static int intbufs_set_buffer(struct venus_inst *inst, u32 type) { struct venus_core *core = inst->core; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 6a061b417a93..971392be5df5 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -19,6 +19,7 @@ struct venus_inst; +bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt); struct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst, unsigned int type, u32 idx); void venus_helper_buffers_done(struct venus_inst *inst,