From patchwork Wed Jun 13 15:07:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138480 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp847319lji; Wed, 13 Jun 2018 08:09:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLYF7agR3UvOa92e2QoTJoCh2gIqcdmSMDRAIv38j8w8KnoCauZIFDgZBq09YHjI8FYPGeb X-Received: by 2002:a65:4642:: with SMTP id k2-v6mr4491194pgr.423.1528902551017; Wed, 13 Jun 2018 08:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902551; cv=none; d=google.com; s=arc-20160816; b=dsMDx2x8jWo2/1meQ2s53zwRWTW8bVvZEOQVbVS1bGbUZt+sZjR0/iJ0J+AABsxfpP Lof23XisG7cUhf4okk2uLMu30p6AlsdQq1wCbjEs0e6Gp+w4pPtU0MXi89Ay4L9xIcQW W0fk7tO0i38iXjx53MxPMCdL4Pe20ai+jCuj1AosmtkPmQ0dQ5aVYKj/GrWrfSIO/KXJ sK5KUd4v70FfH3Icy7hexKnD2yYRczyDbfgaZGt6rITJz7PVyEcUAdF0swhexO02vQSS uOsycaZXyWbTCj81WCsDkfrdk95lTKlf6dcnT3uqX2TDhqySNfBjqg5Vej3i4wmR3gBv q2SA== 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=Oxz3/nq/V8kK+KJ9ImRD+ogWBqMrH5XUPEuzacshQrw=; b=Y54IMLfMrCawzk7I2zyrFFE5gOwhCAZcF2M5+PRDv58K6QlIlBz959MkNhLiRaWrrk BPiIEmSDq6wMyOimMdPbEoPPhfmwlTTgiqwSbdr5Si7lxE+u0qq34LbsEbIV0IQE1EyI SIWY/rjmMVSA62v0CRdzv+XelOrJXxU+D+tDUYxxx1CDvgxLTmQKdE5x7GZHVyvBhEQO m7ffGQZ2WtVju2vDy6Sui8/z3+98iG9cn3SMqFva1XVWDE4lI5LbBuE139M4Sim2OiFz JhDYN1bftnp2o/RX/j+j06Zqsh8AGtya4veih/8sDV5yeYU5gogdnSDCP0g2isQIvv3d TGzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e1MKSSHU; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 z3-v6si3041981plb.228.2018.06.13.08.09.10; Wed, 13 Jun 2018 08:09:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e1MKSSHU; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935944AbeFMPJI (ORCPT + 13 others); Wed, 13 Jun 2018 11:09:08 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45069 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935916AbeFMPJH (ORCPT ); Wed, 13 Jun 2018 11:09:07 -0400 Received: by mail-wr0-f193.google.com with SMTP id o12-v6so3128159wrm.12 for ; Wed, 13 Jun 2018 08:09:06 -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=cFlFkNWCB/XAbvhXkdSY2vZ27efFVAFnjAV1bSmg1kQ=; b=e1MKSSHUm4Y/03qHbFGFfZHmF7TEUJtlrkhg0gmua+o8mhqqiBnqaxCQ7ZHEi30+A+ qnzLal8AWbLYuavec0gybCXdisxf53kf33DSH0Ic/ZZrAXtANGBHEQmdpnH10X3dqR1X VwiTlrHJK46piCftNECxG08AnxTQfXsaA6few= 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=cFlFkNWCB/XAbvhXkdSY2vZ27efFVAFnjAV1bSmg1kQ=; b=A58kj7bhf6JlLotdDM810yHo5XmXTvF6eEHowWLynOPt1cJRs18okfmz7YsYqTt058 VWjfLShga+/KkVALlHT0KMVKu15aJMwBJazsI72UFWSM5RcMp4JccVRIOaVDt5s12lWr yls3C5t/1oN4u8z18wHVwdHTbVaDzQCPczfgMQQroYAGtU+iPehtjOocaHbIdDV2jsu2 jO5+NvJDc0+6Ju2Uzu4kwUqxaEv0k96PduqmTOnorr7QTDYEJ8XirSKF6H7gollKWJ89 F8rPxuUo9dzS84eCrYExg7/yAfdoCPtHWI9ff2Q2GK3enAPs5v4LY1DflHwhD5B7bYOP 8k7w== X-Gm-Message-State: APt69E3vTcCFZRbod6kN5dqskpceqH3HGhfMDN7kTS/Hc2aPGqRfNyZw iT2eiR260ybL+pZvN3gxGi49QA== X-Received: by 2002:adf:91e5:: with SMTP id 92-v6mr4547401wri.124.1528902545969; Wed, 13 Jun 2018 08:09:05 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:05 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 02/27] venus: hfi: preparation to support venus 4xx Date: Wed, 13 Jun 2018 18:07:36 +0300 Message-Id: <20180613150801.11702-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This covers the differences between 1xx,3xx and 4xx. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 4 ++ drivers/media/platform/qcom/venus/helpers.c | 37 +++++++---- drivers/media/platform/qcom/venus/hfi_helper.h | 84 ++++++++++++++++++++++-- drivers/media/platform/qcom/venus/hfi_venus_io.h | 7 ++ drivers/media/platform/qcom/venus/vdec.c | 5 +- drivers/media/platform/qcom/venus/venc.c | 5 +- 6 files changed, 120 insertions(+), 22 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 0360d295f4c8..8d3e150800c9 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -305,6 +305,10 @@ struct venus_inst { struct hfi_buffer_requirements bufreq[HFI_BUFFER_TYPE_MAX]; }; +#define IS_V1(core) ((core)->res->hfi_version == HFI_VERSION_1XX) +#define IS_V3(core) ((core)->res->hfi_version == HFI_VERSION_3XX) +#define IS_V4(core) ((core)->res->hfi_version == HFI_VERSION_4XX) + #define ctrl_to_inst(ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 0ce9559a2924..d9065cc8a7d3 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -166,21 +166,37 @@ static int intbufs_unset_buffers(struct venus_inst *inst) return ret; } -static const unsigned int intbuf_types[] = { - HFI_BUFFER_INTERNAL_SCRATCH, - HFI_BUFFER_INTERNAL_SCRATCH_1, - HFI_BUFFER_INTERNAL_SCRATCH_2, +static const unsigned int intbuf_types_1xx[] = { + HFI_BUFFER_INTERNAL_SCRATCH(HFI_VERSION_1XX), + HFI_BUFFER_INTERNAL_SCRATCH_1(HFI_VERSION_1XX), + HFI_BUFFER_INTERNAL_SCRATCH_2(HFI_VERSION_1XX), + HFI_BUFFER_INTERNAL_PERSIST, + HFI_BUFFER_INTERNAL_PERSIST_1, +}; + +static const unsigned int intbuf_types_4xx[] = { + HFI_BUFFER_INTERNAL_SCRATCH(HFI_VERSION_4XX), + HFI_BUFFER_INTERNAL_SCRATCH_1(HFI_VERSION_4XX), + HFI_BUFFER_INTERNAL_SCRATCH_2(HFI_VERSION_4XX), HFI_BUFFER_INTERNAL_PERSIST, HFI_BUFFER_INTERNAL_PERSIST_1, }; static int intbufs_alloc(struct venus_inst *inst) { - unsigned int i; + size_t arr_sz; + size_t i; int ret; - for (i = 0; i < ARRAY_SIZE(intbuf_types); i++) { - ret = intbufs_set_buffer(inst, intbuf_types[i]); + if (IS_V4(inst->core)) + arr_sz = ARRAY_SIZE(intbuf_types_4xx); + else + arr_sz = ARRAY_SIZE(intbuf_types_1xx); + + for (i = 0; i < arr_sz; i++) { + ret = intbufs_set_buffer(inst, + IS_V4(inst->core) ? intbuf_types_4xx[i] : + intbuf_types_1xx[i]); if (ret) goto error; } @@ -257,12 +273,11 @@ static int load_scale_clocks(struct venus_core *core) set_freq: - if (core->res->hfi_version == HFI_VERSION_3XX) { - ret = clk_set_rate(clk, freq); + ret = clk_set_rate(clk, freq); + + if (IS_V3(core) || IS_V4(core)) { ret |= clk_set_rate(core->core0_clk, freq); ret |= clk_set_rate(core->core1_clk, freq); - } else { - ret = clk_set_rate(clk, freq); } if (ret) { diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 55d8eb21403a..1bc5aab1ce6b 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -121,6 +121,7 @@ #define HFI_EXTRADATA_METADATA_FILLER 0x7fe00002 #define HFI_INDEX_EXTRADATA_INPUT_CROP 0x0700000e +#define HFI_INDEX_EXTRADATA_OUTPUT_CROP 0x0700000f #define HFI_INDEX_EXTRADATA_DIGITAL_ZOOM 0x07000010 #define HFI_INDEX_EXTRADATA_ASPECT_RATIO 0x7f100003 @@ -376,13 +377,18 @@ #define HFI_BUFFER_OUTPUT2 0x3 #define HFI_BUFFER_INTERNAL_PERSIST 0x4 #define HFI_BUFFER_INTERNAL_PERSIST_1 0x5 -#define HFI_BUFFER_INTERNAL_SCRATCH 0x1000001 -#define HFI_BUFFER_EXTRADATA_INPUT 0x1000002 -#define HFI_BUFFER_EXTRADATA_OUTPUT 0x1000003 -#define HFI_BUFFER_EXTRADATA_OUTPUT2 0x1000004 -#define HFI_BUFFER_INTERNAL_SCRATCH_1 0x1000005 -#define HFI_BUFFER_INTERNAL_SCRATCH_2 0x1000006 - +#define HFI_BUFFER_INTERNAL_SCRATCH(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0x6 : 0x1000001) +#define HFI_BUFFER_INTERNAL_SCRATCH_1(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0x7 : 0x1000005) +#define HFI_BUFFER_INTERNAL_SCRATCH_2(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0x8 : 0x1000006) +#define HFI_BUFFER_EXTRADATA_INPUT(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002) +#define HFI_BUFFER_EXTRADATA_OUTPUT(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0xa : 0x1000003) +#define HFI_BUFFER_EXTRADATA_OUTPUT2(ver) \ + (((ver) == HFI_VERSION_4XX) ? 0xb : 0x1000004) #define HFI_BUFFER_TYPE_MAX 11 #define HFI_BUFFER_MODE_STATIC 0x1000001 @@ -424,12 +430,14 @@ #define HFI_PROPERTY_PARAM_CODEC_MASK_SUPPORTED 0x100e #define HFI_PROPERTY_PARAM_MVC_BUFFER_LAYOUT 0x100f #define HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED 0x1010 +#define HFI_PROPERTY_PARAM_WORK_MODE 0x1015 /* * HFI_PROPERTY_CONFIG_COMMON_START * HFI_DOMAIN_BASE_COMMON + HFI_ARCH_COMMON_OFFSET + 0x2000 */ #define HFI_PROPERTY_CONFIG_FRAME_RATE 0x2001 +#define HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE 0x2002 /* * HFI_PROPERTY_PARAM_VDEC_COMMON_START @@ -438,6 +446,9 @@ #define HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM 0x1003001 #define HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR 0x1003002 #define HFI_PROPERTY_PARAM_VDEC_NONCP_OUTPUT2 0x1003003 +#define HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH 0x1003007 +#define HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT 0x1003009 +#define HFI_PROPERTY_PARAM_VDEC_COLOUR_SPACE 0x100300a /* * HFI_PROPERTY_CONFIG_VDEC_COMMON_START @@ -518,6 +529,7 @@ enum hfi_version { HFI_VERSION_1XX, HFI_VERSION_3XX, + HFI_VERSION_4XX }; struct hfi_buffer_info { @@ -767,12 +779,56 @@ struct hfi_framesize { u32 height; }; +#define VIDC_CORE_ID_DEFAULT 0 +#define VIDC_CORE_ID_1 1 +#define VIDC_CORE_ID_2 2 +#define VIDC_CORE_ID_3 3 + +struct hfi_videocores_usage_type { + u32 video_core_enable_mask; +}; + +#define VIDC_WORK_MODE_1 1 +#define VIDC_WORK_MODE_2 2 + +struct hfi_video_work_mode { + u32 video_work_mode; +}; + struct hfi_h264_vui_timing_info { u32 enable; u32 fixed_framerate; u32 time_scale; }; +struct hfi_bit_depth { + u32 buffer_type; + u32 bit_depth; +}; + +struct hfi_picture_type { + u32 is_sync_frame; + u32 picture_type; +}; + +struct hfi_pic_struct { + u32 progressive_only; +}; + +struct hfi_colour_space { + u32 colour_space; +}; + +struct hfi_extradata_input_crop { + u32 size; + u32 version; + u32 port_index; + u32 left; + u32 top; + u32 width; + u32 height; +}; + #define HFI_COLOR_FORMAT_MONOCHROME 0x01 #define HFI_COLOR_FORMAT_NV12 0x02 #define HFI_COLOR_FORMAT_NV21 0x03 @@ -961,6 +1017,12 @@ struct hfi_buffer_count_actual { u32 count_actual; }; +struct hfi_buffer_count_actual_4xx { + u32 type; + u32 count_actual; + u32 count_min_host; +}; + struct hfi_buffer_size_actual { u32 type; u32 size; @@ -971,6 +1033,14 @@ struct hfi_buffer_display_hold_count_actual { u32 hold_count; }; +/* HFI 4XX reorder the fields, use these macros */ +#define HFI_BUFREQ_HOLD_COUNT(bufreq, ver) \ + ((ver) == HFI_VERSION_4XX ? 0 : (bufreq)->hold_count) +#define HFI_BUFREQ_COUNT_MIN(bufreq, ver) \ + ((ver) == HFI_VERSION_4XX ? (bufreq)->hold_count : (bufreq)->count_min) +#define HFI_BUFREQ_COUNT_MIN_HOST(bufreq, ver) \ + ((ver) == HFI_VERSION_4XX ? (bufreq)->count_min : 0) + struct hfi_buffer_requirements { u32 type; u32 size; diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index 98cc350113ab..d327b5cea334 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -110,4 +110,11 @@ #define WRAPPER_CPU_STATUS (WRAPPER_BASE + 0x2014) #define WRAPPER_SW_RESET (WRAPPER_BASE + 0x3000) +/* Venus 4xx */ +#define WRAPPER_VCODEC0_MMCC_POWER_STATUS (WRAPPER_BASE + 0x90) +#define WRAPPER_VCODEC0_MMCC_POWER_CONTROL (WRAPPER_BASE + 0x94) + +#define WRAPPER_VCODEC1_MMCC_POWER_STATUS (WRAPPER_BASE + 0x110) +#define WRAPPER_VCODEC1_MMCC_POWER_CONTROL (WRAPPER_BASE + 0x114) + #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 49bbd1861d3a..261a51adeef2 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -689,6 +689,7 @@ static int vdec_queue_setup(struct vb2_queue *q, static int vdec_verify_conf(struct venus_inst *inst) { + enum hfi_version ver = inst->core->res->hfi_version; struct hfi_buffer_requirements bufreq; int ret; @@ -700,14 +701,14 @@ static int vdec_verify_conf(struct venus_inst *inst) return ret; if (inst->num_output_bufs < bufreq.count_actual || - inst->num_output_bufs < bufreq.count_min) + inst->num_output_bufs < HFI_BUFREQ_COUNT_MIN(&bufreq, ver)) return -EINVAL; ret = venus_helper_get_bufreq(inst, HFI_BUFFER_INPUT, &bufreq); if (ret) return ret; - if (inst->num_input_bufs < bufreq.count_min) + if (inst->num_input_bufs < HFI_BUFREQ_COUNT_MIN(&bufreq, ver)) return -EINVAL; return 0; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 6b2ce479584e..947001170a77 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -892,6 +892,7 @@ static int venc_queue_setup(struct vb2_queue *q, static int venc_verify_conf(struct venus_inst *inst) { + enum hfi_version ver = inst->core->res->hfi_version; struct hfi_buffer_requirements bufreq; int ret; @@ -903,7 +904,7 @@ static int venc_verify_conf(struct venus_inst *inst) return ret; if (inst->num_output_bufs < bufreq.count_actual || - inst->num_output_bufs < bufreq.count_min) + inst->num_output_bufs < HFI_BUFREQ_COUNT_MIN(&bufreq, ver)) return -EINVAL; ret = venus_helper_get_bufreq(inst, HFI_BUFFER_INPUT, &bufreq); @@ -911,7 +912,7 @@ static int venc_verify_conf(struct venus_inst *inst) return ret; if (inst->num_input_bufs < bufreq.count_actual || - inst->num_input_bufs < bufreq.count_min) + inst->num_input_bufs < HFI_BUFREQ_COUNT_MIN(&bufreq, ver)) return -EINVAL; return 0; From patchwork Wed Jun 13 15:07:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138504 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp856445lji; Wed, 13 Jun 2018 08:15:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKRcABwJJ3Lu/v9XaiA5WeGvegqZL/PLVeKoUAIm4M5e1edmWdgM2v0gKLLYo6m2JUsHK3n X-Received: by 2002:a17:902:b110:: with SMTP id q16-v6mr5648595plr.286.1528902954812; Wed, 13 Jun 2018 08:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902954; cv=none; d=google.com; s=arc-20160816; b=Hfy74xPJZk8NWO9KiDLYIR0kj0q0/wMU/+aMdu/RN0wmhvTgKkm97ETAOrF6wibYnA 6OjsKJC+kCU85wm25z1/sLkuXW0GHiJHeIChCQlSyNDEMJU8CZltDQ+p/Qx5sQoEZ/Y9 JAQGynfRlzK4Q6YYyTlV9ni03NxFD4Lk8xZ+r0WoWCI8K1A99D8ICMLVMxTzO+xt9Hos KfXTFfk73SksVyAQ6cFV996RnY6m238q2zpXa7hJ63RCg1JwRSfpBMS4nPSCdg4od2Nt m3m7LCBTDVnROSDTgPaAG5ZcNdJrwMFDHm0iQbbXwFEj5Wkujn5g8mybjo9LdrVFVzrm bHlQ== 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=Ju5gja5TjYN9FMENeuvrIATH3fWmnH2TlWmJ0qnfAcY=; b=r7n3gW6XZbflbsD6/AS6sclCR1JvvZ/+9qppwo+Rmr7J6sj7CwigQY6bd0nF3GpuuZ c3y8wt45jd2hT5DXBxA3vQznEsyx8BnpuzxGP8baaE3BakAOzZ7R9vAcs9aOKJ91yFBg 5MOJioH+u+it6t8DCgaBE7GWzumeCdZpcWVctcyosRinhIGYQry2fmEjlunuPskf1aEG zP2t/+CYxAX3hy6A9XUXhYaPeBvgD+suyfSVJ3W4t+sQD5UO+YYGUzT/+9qALXuyM8b1 BfskaqoxhiarfLmOYZ06a5S0c2k32urT962RfcCT7rN0H6VREq0zJR2uPi36mkSqZePP y6Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NIwuOhb7; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 u2-v6si2509329pgv.335.2018.06.13.08.15.54; Wed, 13 Jun 2018 08:15:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NIwuOhb7; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935477AbeFMPPx (ORCPT + 13 others); Wed, 13 Jun 2018 11:15:53 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33577 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935985AbeFMPJS (ORCPT ); Wed, 13 Jun 2018 11:09:18 -0400 Received: by mail-wr0-f195.google.com with SMTP id k16-v6so3157180wro.0 for ; Wed, 13 Jun 2018 08:09:17 -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=g23pTkthDir6WiafxRO9C54UE8+PUxr4OXpPgPQrngc=; b=NIwuOhb7g/SEQ5QyvP56c8xntKRy/PAgqmEu4b6hePbEeg0WCFf0rpXGtaono1T/3p tNXWs3DWLyctca/VFvrmZoZZbelqid6ab2qSN2a7mCTUNtm+TUT579+yYEeWMaS84FyT aySGzX+0nn/nY8xv65LGAX04h9qp3sTOisoQg= 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=g23pTkthDir6WiafxRO9C54UE8+PUxr4OXpPgPQrngc=; b=jjj2vGaa4fK2khOFjsbiXKaub7YlAPQJva6x81ztD/5UJvBdu93cs+FbzIxBI5d+AC mWqmAfOIgoxuzeMWd3y2Yr7wLaesUtQk7uxpAJm4UbJyCyhhqdLOB3Fy0U0w1Obp8vGu aRsTxFGpQwvqhDKWSfcSPtmDkpw6GWBSs6TTwt2Wp0crklE1RiVOWdc4EDrVRQE3P+cx KTdWPY+VJnchXAC8Vw8euXX7Ky4i1ok9ES2R3IR827J+qhXhi4Vw5iiac4eELICrgOOI IYMEAgaT+Rh+kCXgLmVPfZMlhliHjoYNQb1eDgW2EocAT2ssf0D8pJu3zNDAiRam6Ncy xo1g== X-Gm-Message-State: APt69E3Ruz9/lUWbtQm/XnetrelQMlVYGPXVb5gBdgb+A2cjbhFFK++4 KEba1yOO8UZvJ0GFpkinq8MJmg== X-Received: by 2002:adf:a54a:: with SMTP id j10-v6mr4903792wrb.155.1528902556833; Wed, 13 Jun 2018 08:09:16 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:16 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 08/27] venus: hfi_venus: fix suspend function for venus 3xx versions Date: Wed, 13 Jun 2018 18:07:42 +0300 Message-Id: <20180613150801.11702-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This fixes the suspend function for Venus 3xx versions by add a check for WFI (wait for interrupt) bit. This bit is on when the ARM9 is idle and entered in low power mode. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_venus.c | 72 ++++++++++++++++-------- drivers/media/platform/qcom/venus/hfi_venus_io.h | 1 + 2 files changed, 51 insertions(+), 22 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 784b3ad1a9f6..72a8547eab39 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1444,13 +1444,40 @@ static int venus_suspend_1xx(struct venus_core *core) return 0; } +static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev) +{ + u32 ctrl_status, cpu_status; + + cpu_status = venus_readl(hdev, WRAPPER_CPU_STATUS); + ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); + + if (cpu_status & WRAPPER_CPU_STATUS_WFI && + ctrl_status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK) + return true; + + return false; +} + +static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev) +{ + u32 ctrl_status, cpu_status; + + cpu_status = venus_readl(hdev, WRAPPER_CPU_STATUS); + ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); + + if (cpu_status & WRAPPER_CPU_STATUS_WFI && + ctrl_status & CPU_CS_SCIACMDARG0_PC_READY) + return true; + + return false; +} + static int venus_suspend_3xx(struct venus_core *core) { struct venus_hfi_device *hdev = to_hfi_priv(core); struct device *dev = core->dev; - u32 ctrl_status, wfi_status; + bool val; int ret; - int cnt = 100; if (!hdev->power_enabled || hdev->suspended) return 0; @@ -1464,29 +1491,30 @@ static int venus_suspend_3xx(struct venus_core *core) return -EINVAL; } - ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); - if (!(ctrl_status & CPU_CS_SCIACMDARG0_PC_READY)) { - wfi_status = venus_readl(hdev, WRAPPER_CPU_STATUS); - ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); - - ret = venus_prepare_power_collapse(hdev, false); - if (ret) { - dev_err(dev, "prepare for power collapse fail (%d)\n", - ret); - return ret; - } + /* + * Power collapse sequence for Venus 3xx and 4xx versions: + * 1. Check for ARM9 and video core to be idle by checking WFI bit + * (bit 0) in CPU status register and by checking Idle (bit 30) in + * Control status register for video core. + * 2. Send a command to prepare for power collapse. + * 3. Check for WFI and PC_READY bits. + */ + ret = readx_poll_timeout(venus_cpu_and_video_core_idle, hdev, val, val, + 1500, 100 * 1500); + if (ret) + return ret; - cnt = 100; - while (cnt--) { - wfi_status = venus_readl(hdev, WRAPPER_CPU_STATUS); - ctrl_status = venus_readl(hdev, CPU_CS_SCIACMDARG0); - if (ctrl_status & CPU_CS_SCIACMDARG0_PC_READY && - wfi_status & BIT(0)) - break; - usleep_range(1000, 1500); - } + ret = venus_prepare_power_collapse(hdev, false); + if (ret) { + dev_err(dev, "prepare for power collapse fail (%d)\n", ret); + return ret; } + ret = readx_poll_timeout(venus_cpu_idle_and_pc_ready, hdev, val, val, + 1500, 100 * 1500); + if (ret) + return ret; + mutex_lock(&hdev->lock); ret = venus_power_off(hdev); diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index c0b18de1e396..def0926a6dee 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -110,6 +110,7 @@ #define WRAPPER_CPU_CGC_DIS (WRAPPER_BASE + 0x2010) #define WRAPPER_CPU_STATUS (WRAPPER_BASE + 0x2014) +#define WRAPPER_CPU_STATUS_WFI BIT(0) #define WRAPPER_SW_RESET (WRAPPER_BASE + 0x3000) /* Venus 4xx */ From patchwork Wed Jun 13 15:07:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138502 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp855344lji; Wed, 13 Jun 2018 08:15:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIZThpw/UQ3oqOtsgWAiXf3vNAf+ztZeEVOGImcnXtvykK70dN+W2J0BJesowtbx+JR52I0 X-Received: by 2002:a62:a6dd:: with SMTP id r90-v6mr5358301pfl.60.1528902909018; Wed, 13 Jun 2018 08:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902909; cv=none; d=google.com; s=arc-20160816; b=yG6nelTwZH1sM7fTLthNs9SDSSXatYMPDV9k4+j3rDqko96pOPAeKXsIqRihOtIOBj QdWKHY3pIMY2xzVjIA9/vtgL05Cuav9xfh/ajKQRz+UTigboVVytfUy2MEKnoqVUjBKJ 6KpBhKgbAcyYZvoZqORoO1kR//yz9b0eVFC0rtvsKCw/8hEaeQq64/UlcE/p05unM+ev sGFY1Fj8QmDEMTKJTgs/P01AihUUh1ld15i77OVtecPpa60Qj157eAqxJFS1Bgf2FC9g w3yy+cRdTNvQX7kSFDklo8Hlk1vt/fnvHlU6eDfEp9MWm0q6ko+OGMnAc+OmEXRCJpuR c7Rg== 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=I6Vt4AsmyfraPFdDRKtDK18+2744WinUyJ1pW+GlWlo=; b=D6H6nPmob1YRBeu368BKKtW0gp20Jacyh852KV9JqRy6muOg6Z6yVfM6bQitOki9s5 a3CRDmE3yOR6XTe1qPdkUR074lTV/hGdOLUarKHDm4IUgyBOUXkvgvEzUSsoAmTmGr1c l/DSSSBo0TUzndlLhRumtNsoIOo0B2gV13bnKjvKa0vPXgfc89kdwmiSKROZXE0Fo5uj iFUZAezLZWEDRtxzyBvBetT4pv5qP2KCgsoV0L9ihiNH+6Fa+4BOTi/emfpmJW5R73+r DSnGRUrLZUD57SDsCkjGbkArEq3URr2Im2CmkCYwFNdBHU6BVT7bfwv3obqQObEMfCUC xerg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IZSQqhk5; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 l190-v6si2654716pgl.198.2018.06.13.08.15.08; Wed, 13 Jun 2018 08:15:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IZSQqhk5; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935956AbeFMPJV (ORCPT + 13 others); Wed, 13 Jun 2018 11:09:21 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54940 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935998AbeFMPJU (ORCPT ); Wed, 13 Jun 2018 11:09:20 -0400 Received: by mail-wm0-f68.google.com with SMTP id o13-v6so5320502wmf.4 for ; Wed, 13 Jun 2018 08:09:19 -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=iP3OBq3KmmkdIHc4ClU6RmJI5t+xyWo9eNZ9y9WZFKg=; b=IZSQqhk5croRiez/q3h2TX1sKS+RYjVRd8n/uuYbuYWdX44k/XyiddD+uigw30icW3 rpD5FW+0IKVZJvgygJQKkM3x314H6elaik0Yb3v6v24eDC/kfZ8AnnxKcvdWc616E8qr mbmLf6NraRqLm/Lk9O7hGJvsKQawAFgJfmyhk= 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=iP3OBq3KmmkdIHc4ClU6RmJI5t+xyWo9eNZ9y9WZFKg=; b=ERBHbjKGbqeTFzdavFTvCrzdPIY7Pgqu9Bcj9T28d0TJR/73AzqeRl9S6oSSCvFKUd cVBoxzhrHcajKr2crF6vJ6mc1hwO3US5ulU/qs9+luemS6mmYqhotA0UwShk5CvD7Jbb EGHqQo+KJvnhdyntR+LnWL3SzJBJkvtlQH2gWDrZcOdzJBR4CIaQ6q1Zqd8bU4W9j4iD H1A9XPlaQuexioXp5HQQ3Q08iK8j8Xxzsk06M+KrkLElBc/BzTmuzlhbTw/tsH4BLHIF 6GnUTwNdnunPW+wZ8Rc6Jz/WuxY2BGnx0374KbjHSREpakacAe2Mce71E6hdt5sWEPxg uEXg== X-Gm-Message-State: APt69E2N4sZXjl7SZJCbMGkdRGTORM+ebPLRrsIxMtWDLgB6p0k0aOJO AnhZep7yfi6MFJRnU8sCmsI9Bg== X-Received: by 2002:a1c:9e95:: with SMTP id h143-v6mr3542325wme.105.1528902558857; Wed, 13 Jun 2018 08:09:18 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:18 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 09/27] venus: hfi_venus: move set of default properties to core init Date: Wed, 13 Jun 2018 18:07:43 +0300 Message-Id: <20180613150801.11702-10-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This moves setting of default properties (firmware debug, idle indicator and low power mode) from session init to core init. All of those properties are need to be enabled/disabled early so that they could be used before the clients are even initialized. The other reason is to set idle indicator property early before we enter into venus_suspend function where we need to check for ARM9 WFI. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/hfi_venus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 72a8547eab39..7a83e967a8ea 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1091,6 +1091,10 @@ static int venus_core_init(struct venus_core *core) if (ret) dev_warn(dev, "failed to send image version pkt to fw\n"); + ret = venus_sys_set_default_properties(hdev); + if (ret) + return ret; + return 0; } @@ -1135,10 +1139,6 @@ static int venus_session_init(struct venus_inst *inst, u32 session_type, struct hfi_session_init_pkt pkt; int ret; - ret = venus_sys_set_default_properties(hdev); - if (ret) - return ret; - ret = pkt_session_init(&pkt, inst, session_type, codec); if (ret) goto err; From patchwork Wed Jun 13 15:07:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138498 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp852991lji; Wed, 13 Jun 2018 08:13:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJPsKOIRX9tloK8A55nIs4gLC3vAgULVDBltCCmW0Jy2qG5GRIRKDnV9jJzDD/ISK4qVBnB X-Received: by 2002:a62:32c6:: with SMTP id y189-v6mr5295255pfy.241.1528902796700; Wed, 13 Jun 2018 08:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902796; cv=none; d=google.com; s=arc-20160816; b=NCunO4KdFC/uSQyrTAm0F+RUIEtiwgksRL0Xr0cA4hRt8peCxnb3aVJcTCea+u7PVI bUobHfNlPi92SKGfImn6IP0oo0lWW0He35mGIjd81L9f8aTXPI81RZp8Igve2duFp4s5 bKMcGbllqSMiifRd6wXCMMWKeHtPvpJd95/g1YRm8WdH+Hk2BHY5WB15LGAl0r++kKYi D6bzHE6JtelQyub8Zcn7fp+vrjKqtEWqTMgNM3egptLe6nC8a8DWSInl7FGYNZzYxQoO TL4tE8vqAhfJvqPc6BJZNHFujSostwxdPYL1TcvoFJYWRc6H7PHxG7sl0JkXmF6Wvi4A XKZA== 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=XbzB3gGWIOUwlkfB8fNvxycDKdUWLnR530TQDEBCv04=; b=BkWilyoF3ceUiUST568sXlhj2kl2sdmjYMLYACK0W81+D9HsitdUYgegotEu/Z5lj8 MyUuQ/GnYlZ+8vMzWhMaZqJYDWt8QljHIpfAsmM8RyVZhuJH97ydLIZL8Z7WY96ZpI82 KigdNZA1JammTmb8deybiu3wxlVSSeyE40yIyo1B/PJ8KmWSX6ozaOPtZgz9Mpqk219+ 9Lehg48JKMqYdw7U3oW+QtJV3/xAhd8u+6H+zNpp0MYjC0szZflEBqkNlKBa+eh9wB03 xuBcmb9qZYBmAz9Cta5P8+irU1qBZGGMYPVdq83/wqGbbdYzH7D+HjOpxrKkNLzsnySN NrGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OPGRaIpf; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 h2-v6si2429030pgf.334.2018.06.13.08.13.16; Wed, 13 Jun 2018 08:13:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OPGRaIpf; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964904AbeFMPNO (ORCPT + 13 others); Wed, 13 Jun 2018 11:13:14 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42210 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936049AbeFMPJd (ORCPT ); Wed, 13 Jun 2018 11:09:33 -0400 Received: by mail-wr0-f196.google.com with SMTP id w10-v6so3139517wrk.9 for ; Wed, 13 Jun 2018 08:09:32 -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=87ORcY69pnhjHzwy3ZGqBtyUOPwoa/Ckei7U+5Elc6I=; b=OPGRaIpf+/sYt2380waJ5LQ41bf3I1BZm5nsCVakxqQZJjQE4xFvTTTIa0DLdp+Wwa jZcsXJYP4ym6QvbiO5xqeXiJSV/zYMPAIfrNvSzavIORxbl4VIxCcQgsBfVRS0Mcu0O5 vhgMVbtB0DrIF9b8uafC748X+ZZmBHvi1x13E= 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=87ORcY69pnhjHzwy3ZGqBtyUOPwoa/Ckei7U+5Elc6I=; b=NIMnBFkgXmDtihKMBQPQpVxOdoW1oGjBEMvYmyCwCD1QPewyPZ25rRvGEwoMBH/+/W R8aqxuUzSsw1EmMcORVUfYfb3bIIOI+AABLbc2wvFGPco1nCI7/WmLCEFdYFWx7IxlEy FC1gfKMWug4BObftaI0r+PuTN5w24V5R9NPNzPfwTqSVv7kKypP7JShf2axRiMzNISWE nRCLeqLWvXTjIB+BVlQz9YTC3rc/JgkofO0aLXxTykN4lhYkfPRTClWWbNJj7N1hKuGZ Kc9u8zLd3qE/MhgP0BhCFRiQYRqjSbF/rzCkpjpE9tSPhaUa4i/VTgGD5mFScRxjKt4Z hTMA== X-Gm-Message-State: APt69E0RprymwfdbgZsFwqFrRly2lANfqrpPIEcb02ZxAllrrajNeVlc QME0OxZYE8urmyoyrmC4yYMTBQ== X-Received: by 2002:adf:a645:: with SMTP id k63-v6mr4762953wrc.231.1528902572269; Wed, 13 Jun 2018 08:09:32 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:31 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 17/27] venus: helpers: add buffer type argument to a helper Date: Wed, 13 Jun 2018 18:07:51 +0300 Message-Id: <20180613150801.11702-18-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This adds one more function argument to pass buffer type to set_output_resolution() helper function. That is a preparation to support secondary decoder output. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/helpers.c | 5 +++-- drivers/media/platform/qcom/venus/helpers.h | 3 ++- drivers/media/platform/qcom/venus/venc.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 0cce664f093d..2eeb243e4dbe 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -453,12 +453,13 @@ int venus_helper_set_input_resolution(struct venus_inst *inst, EXPORT_SYMBOL_GPL(venus_helper_set_input_resolution); int venus_helper_set_output_resolution(struct venus_inst *inst, - unsigned int width, unsigned int height) + unsigned int width, unsigned int height, + u32 buftype) { u32 ptype = HFI_PROPERTY_PARAM_FRAME_SIZE; struct hfi_framesize fs; - fs.buffer_type = HFI_BUFFER_OUTPUT; + fs.buffer_type = buftype; fs.width = width; fs.height = height; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index cd306bd8978f..0de9989adcdb 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -36,7 +36,8 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, int venus_helper_set_input_resolution(struct venus_inst *inst, unsigned int width, unsigned int height); int venus_helper_set_output_resolution(struct venus_inst *inst, - unsigned int width, unsigned int height); + unsigned int width, unsigned int height, + u32 buftype); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index aa6b0026d79d..1d7f87e0f5b3 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -795,7 +795,8 @@ static int venc_init_session(struct venus_inst *inst) goto deinit; ret = venus_helper_set_output_resolution(inst, inst->width, - inst->height); + inst->height, + HFI_BUFFER_OUTPUT); if (ret) goto deinit; From patchwork Wed Jun 13 15:07:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138493 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp850969lji; Wed, 13 Jun 2018 08:11:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLOYMxw1BThHPjKOVg4S3yQ++0WJ5JrTrYIrQYC1WwCXP7Ah/C5wsf7CzHQ5Om1LfQRO2jn X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr5661425plr.270.1528902698152; Wed, 13 Jun 2018 08:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902698; cv=none; d=google.com; s=arc-20160816; b=y5Cf5Rpi0fYURZbVdapa/6ytKWurKC3TzvrCnmSUlznr3PfzgAiDt3wcJ+WxlmD3xZ rrCYmeexDvtPkHkN6WPWi0xWlKq3+FZxOHKr7zurCUoErmJu40+eDUKmqFWNV34M9jGV KSdTYBdGeeXS3YJxM7MM55A55QPT1qz4r7dYxAyGaA1gzAZG6mPwrsp9BRE9BkSZhNFx QJPOIb6sR0QVpW10chSwi5H1sR7v7pn5aNGM9Di8EwrPPI346tbyOJDsj++xsNdav7BQ nL5n+hKgbxy8rKBImVywHv/gbG/dlhvUHpybwEpn2guC7pMfg3ga25Qr9feWZv3OKtHk Nl4g== 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=p0G8Yudy2bn9cBtUbsHsFM3x/BJRUPhrcvGiJndn3GM=; b=hhSvjIZ7Q/A4eBZrp3KYX20vsbNdS+kixHVIaQBfZbYNf9UATK+VpN58PXMQDU8iSv dWXL3XxWaQzwEH04HR7lc5/BMrNUSMP/5LAjL5GXsIQK3t/LknPnoWftByvJkNJvok7q WKk5GbSmkRrRCI3ReRK4Zrcf5imroB8ed4ouVXI4u3m3h8uC1pwETrFNnyq/tbtKRJQv 2Un1WcD7u8vp3R6iFNoMOI8ZlhfYt8y0XI2fVaV3vgbuQj3gNja+IyrmMtMbvB7ktEvn dbvS8aw6TOb3x5kKHadiRqwvUo3WoqSOgWOaD/jFXxqAhYTT3wibKTMaljjaBaYDx1jC UJZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VLaWf1fY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 x6-v6si3018090plv.315.2018.06.13.08.11.37; Wed, 13 Jun 2018 08:11:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VLaWf1fY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935869AbeFMPLc (ORCPT + 13 others); Wed, 13 Jun 2018 11:11:32 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37345 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935714AbeFMPJj (ORCPT ); Wed, 13 Jun 2018 11:09:39 -0400 Received: by mail-wm0-f65.google.com with SMTP id r125-v6so6101282wmg.2 for ; Wed, 13 Jun 2018 08:09:38 -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=KGtopIdccvCWqxzw2Y/ssJlKU0JmcRx1SeA6otkSH9k=; b=VLaWf1fY9HIjzDFPTtNjqGiIPhWbh5+bvSYbDHF9zFah94z277RF6En+CBGFOmG7Ug WattPOxTOpRnYixcIgz+cYlxehw0InIYlAEjavYTMl/ofmyTqFEsZ7bJKx1YrzK1iVOr nuqqCCBn5aCWGOmVpBczGq2Ct+TLf5NSY9msw= 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=KGtopIdccvCWqxzw2Y/ssJlKU0JmcRx1SeA6otkSH9k=; b=mCwd96at/Q9tArc9lEBt/BFFEuKsXmIx4xVZizd6qtrOMsZAgMNo1xSe9eNbqar/On tmR9jFQh6eW3rXAFHjqnyFpT9F/GbEOiBHPOL/cU9cv2RAs1nDoUAEb03idRxEnlKhlK EzB7BMRrq/GbocTeyaZeNpRQlWOfdNINTjBQnhNQkLsGMpTk60yG0AgVvBcb0FsEb9dE A+UfeTvvoW1hg+fEWQxsSUQurnqlr6tIGov8zFJGDzf9Iiha2HLQLfEZ9hNzM6MFbZgj +4gxfOucaoYkjy5sjXn89GXJVS6ZWtwM/bjjgy3dd9yqYHeswfno1mFRN7gc9Ly6PmnH JkUA== X-Gm-Message-State: APt69E3l7SBOXYKCgBKHhvktJ0B9vKdpzUnLRNtiKuXi859u2QRBjm9f 3Z9xYhKyBQWtDWMvJm6jL0knuw== X-Received: by 2002:a1c:6d85:: with SMTP id b5-v6mr3558349wmi.135.1528902578264; Wed, 13 Jun 2018 08:09:38 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:37 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 22/27] venus: vdec: get required input buffers as well Date: Wed, 13 Jun 2018 18:07:56 +0300 Message-Id: <20180613150801.11702-23-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rework and rename vdec_cap_num_buffers() to get the number of input buffers too. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/vdec.c | 41 +++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 5d8bf288bd2a..55213a8d55a3 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -603,19 +603,32 @@ static int vdec_init_session(struct venus_inst *inst) return ret; } -static int vdec_cap_num_buffers(struct venus_inst *inst, unsigned int *num) +static int vdec_num_buffers(struct venus_inst *inst, unsigned int *in_num, + unsigned int *out_num) { + enum hfi_version ver = inst->core->res->hfi_version; struct hfi_buffer_requirements bufreq; int ret; + *in_num = *out_num = 0; + ret = vdec_init_session(inst); if (ret) return ret; + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_INPUT, &bufreq); + if (ret) + goto deinit; + + *in_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq); + if (ret) + goto deinit; - *num = bufreq.count_actual; + *out_num = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); +deinit: hfi_session_deinit(inst); return ret; @@ -626,7 +639,7 @@ static int vdec_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct venus_inst *inst = vb2_get_drv_priv(q); - unsigned int p, num; + unsigned int p, in_num, out_num; int ret = 0; if (*num_planes) { @@ -649,35 +662,29 @@ static int vdec_queue_setup(struct vb2_queue *q, return 0; } + ret = vdec_num_buffers(inst, &in_num, &out_num); + if (ret) + return ret; + switch (q->type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: *num_planes = inst->fmt_out->num_planes; sizes[0] = get_framesize_compressed(inst->out_width, inst->out_height); inst->input_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, in_num); inst->num_input_bufs = *num_buffers; - - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - inst->num_output_bufs = num; + inst->num_output_bufs = out_num; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; - ret = vdec_cap_num_buffers(inst, &num); - if (ret) - break; - - *num_buffers = max(*num_buffers, num); - for (p = 0; p < *num_planes; p++) sizes[p] = get_framesize_uncompressed(p, inst->width, inst->height); - - inst->num_output_bufs = *num_buffers; inst->output_buf_size = sizes[0]; + *num_buffers = max(*num_buffers, out_num); + inst->num_output_bufs = *num_buffers; break; default: ret = -EINVAL; From patchwork Wed Jun 13 15:07:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138488 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp848208lji; Wed, 13 Jun 2018 08:09:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKId1eFvq/nH8csdOqahOiJ0gWD8tNggAutUecOiKopehjroEtiPNT+XkT45ksWco7Embma0 X-Received: by 2002:aa7:8004:: with SMTP id j4-v6mr5295959pfi.174.1528902589758; Wed, 13 Jun 2018 08:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902589; cv=none; d=google.com; s=arc-20160816; b=ZEZDPCdMSF0y4riL85zclbivl1BHCpnKAuFCXN9d8xt2t//PnLF3iPSDp25xNzCzaq fWXDv4qZ+MK9e1SzBSRpcKpT4txTzJGbfCM2r7YyoSZimI0X/ApGt9otQ4MWLxHIbpuN QARqb1UJMGcHlMjSu4GKgK1YmopgQy7AarIvmE1AFgXvv8ZpLKT3jTzXNGImAOvsjQZn fsOXlCdSsZoF707n9OjzeXwTfG2FjHBBYljK63KfCAhClsTPZVKkATzfZbRqp9bvf8pq FJ7IwhD1rmfN6SiZqVUFqr5uvLeAcyJx9VyKcYe6/GHNGjaNan/PnCtjmXcoDrru5HFI mP+g== 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=8X7oOYPzuHbTbcyilkf/vTQ39Sy/2Ju4mSVmpJ1zUcU=; b=yHMiUrHYWbK47JXg0/udyZYnR5o7orqEeenk9axETJ2//7ZXLXMln3OrBxxNc3mgxp pA/bhJA8rmi20eu3R63oX4tp2oSvQPX5/VD2tkhduGrrYdoefj0BCet18wZvMRE+nVqP OfjK5f1Kw4vrJomd2Lc7blBzVwW6ofHc6EqiBqlohTnAiUsYxRCuIoTtszMO1hlR0aZB 6yArPVtzf2bX1D+HUUXKFT7ugW1cZu2BKiOBG2g/5BEzdm0xkrny0EP7ZsMR6QAmsTiS RlGuL1c210t+EULk7sRLRsM0H5ezQp04UZualv+szWJ08emWXPPy6n5tPWhu5F7usxG0 DHKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iG4hzw5A; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 j6-v6si2584160pgs.615.2018.06.13.08.09.49; Wed, 13 Jun 2018 08:09:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iG4hzw5A; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936071AbeFMPJr (ORCPT + 13 others); Wed, 13 Jun 2018 11:09:47 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43127 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936070AbeFMPJn (ORCPT ); Wed, 13 Jun 2018 11:09:43 -0400 Received: by mail-wr0-f194.google.com with SMTP id d2-v6so3129297wrm.10 for ; Wed, 13 Jun 2018 08:09:42 -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=H7FwRrjPllm1lOYkYm0XODjFyJ1YXP3BQrRFNWmfzO4=; b=iG4hzw5AetF8+eMWV/ql8oPIRT+GGLiwmKZ6Aeh9KL0YqC6Eln2dGjB7hbjEAiZAop aKpDHJvk1JVZ1WGzY5xRpqD7/O9X+nU6pNwAfWHW4J0Ga+N1ZF5OZgjWOpFKs6wJdY42 +Nas1nSRajjM/ciFlIpX5BGfnLs/TAUAanW8o= 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=H7FwRrjPllm1lOYkYm0XODjFyJ1YXP3BQrRFNWmfzO4=; b=As37r8w3oFzA59nkagq/Cclrjq7sX+nJSGNHgfLvKPEeLd/xJIIsLTj/TNspUYwkOw vuEkPiVfMPOqp4++p8aenBbxbX9ReRwjbf1f6YQu5n7coLU4NTZxunvlD5Gn5MdfprQn SKT8eeM1nRUiS3pQYCtvb6hF/pgIq5hkps/vllMEcex5IjGMyVv/zuJnGMY9X3VOoDHb SaN21X1q2m6wh9i+lxRLCZaFurkGcYsMkC9DHGc646yeGZwdCqhjY8Utmi6h8vP/1Dpk Lo45Y3XF5rfAtARR0Ne1hrZFBqbOcCu5tnl5YdABJD2fzt8MmGk5G+c1MH8rWu+WHzip g++A== X-Gm-Message-State: APt69E02s9KaBhFwR6RMY2ZhPSiGAcMjqx7ZByid/j3l1CrjiUJ35deL dn0U/JFTcVKjXyMISi48IyFF5Q== X-Received: by 2002:adf:ac69:: with SMTP id v96-v6mr4372018wrc.5.1528902581932; Wed, 13 Jun 2018 08:09:41 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:41 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 25/27] venus: implementing multi-stream support Date: Wed, 13 Jun 2018 18:07:59 +0300 Message-Id: <20180613150801.11702-26-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This is implementing multi-stream decoder support. The multi-stream will be used to enable/disable the primary/secondary decoder outputs. Depending on formats on both decoder outputs we could implement downscale, dithering and supporting UBWC (universal bandwidth compression) formats. The UBWC compressed raw format is used to optimize interconnect bandwidth for bigger resolutions like 4K and hence we will get some power-saving benefits as well. Both decoder outputs are distinguished by buffer_type field in the HFI packets. For example HFI_BUFFER_OUTPUT is the buffer type for primary decoder output and HFI_BUFFER_OUTPUT2 is for secondary decoder output. Starting from Venus 4xx the DPB buffers format must be UBWC, so the multi-stream becomes mandatory for this Venus version. That means that we need to allocate internally in the driver a set of DPB buffers (with UBWC NV12 format) and give them to the firmware. The other decoder output (we called it OPB) format will be NV12 linear format and with the same resolution (or smaller in case the user wants to downscale). The DPB buffers are used for decoder reference frames and those have to be in a specific format (UBWC). So one decoder output is used to fill those reference buffers while the other output is used to fill the userspace buffers with the user requested format. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 6 + drivers/media/platform/qcom/venus/helpers.c | 204 +++++++++++++++++++++++++++- drivers/media/platform/qcom/venus/helpers.h | 6 + drivers/media/platform/qcom/venus/vdec.c | 93 ++++++++++++- drivers/media/platform/qcom/venus/venc.c | 1 + 5 files changed, 306 insertions(+), 4 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index f8e4d92ff0e1..8cc49f30a363 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -215,6 +215,7 @@ struct venus_buffer { * @list: used for attach an instance to the core * @lock: instance lock * @core: a reference to the core struct + * @dpbbufs: a list of decoded picture buffers * @internalbufs: a list of internal bufferes * @registeredbufs: a list of registered capture bufferes * @delayed_process a list of delayed buffers @@ -240,6 +241,8 @@ struct venus_buffer { * @input_buf_size holds input buffer size * @output_buf_size: holds output buffer size * @output2_buf_size: holds secondary decoder output buffer size + * @dpb_buftype: decoded picture buffer type + * @dpb_fmt: decoded picture buffer raw format * @opb_buftype: output picture buffer type * @opb_fmt: output picture buffer raw format * @reconfig: a flag raised by decoder when the stream resolution changed @@ -263,6 +266,7 @@ struct venus_inst { struct list_head list; struct mutex lock; struct venus_core *core; + struct list_head dpbbufs; struct list_head internalbufs; struct list_head registeredbufs; struct list_head delayed_process; @@ -292,6 +296,8 @@ struct venus_inst { unsigned int input_buf_size; unsigned int output_buf_size; unsigned int output2_buf_size; + u32 dpb_buftype; + u32 dpb_fmt; u32 opb_buftype; u32 opb_fmt; bool reconfig; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index a342472ae2f0..a0c7ef5f9125 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -85,6 +85,112 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_check_codec); +static int venus_helper_queue_dpb_bufs(struct venus_inst *inst) +{ + struct intbuf *buf; + int ret = 0; + + if (list_empty(&inst->dpbbufs)) + return 0; + + list_for_each_entry(buf, &inst->dpbbufs, list) { + struct hfi_frame_data fdata; + + memset(&fdata, 0, sizeof(fdata)); + fdata.alloc_len = buf->size; + fdata.device_addr = buf->da; + fdata.buffer_type = buf->type; + + ret = hfi_session_process_buf(inst, &fdata); + if (ret) + goto fail; + } + +fail: + return ret; +} + +int venus_helper_free_dpb_bufs(struct venus_inst *inst) +{ + struct intbuf *buf, *n; + + if (list_empty(&inst->dpbbufs)) + return 0; + + list_for_each_entry_safe(buf, n, &inst->dpbbufs, list) { + list_del_init(&buf->list); + dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); + kfree(buf); + } + + INIT_LIST_HEAD(&inst->dpbbufs); + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_free_dpb_bufs); + +int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) +{ + struct venus_core *core = inst->core; + struct device *dev = core->dev; + enum hfi_version ver = core->res->hfi_version; + struct hfi_buffer_requirements bufreq; + u32 buftype = inst->dpb_buftype; + unsigned int dpb_size = 0; + struct intbuf *buf; + unsigned int i; + u32 count; + int ret; + + /* no need to allocate dpb buffers */ + if (!inst->dpb_fmt) + return 0; + + if (inst->dpb_buftype == HFI_BUFFER_OUTPUT) + dpb_size = inst->output_buf_size; + else if (inst->dpb_buftype == HFI_BUFFER_OUTPUT2) + dpb_size = inst->output2_buf_size; + + if (!dpb_size) + return 0; + + ret = venus_helper_get_bufreq(inst, buftype, &bufreq); + if (ret) + return ret; + + count = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); + + for (i = 0; i < count; i++) { + buf = kzalloc(sizeof(*buf), GFP_KERNEL); + if (!buf) { + ret = -ENOMEM; + goto fail; + } + + buf->type = buftype; + buf->size = dpb_size; + buf->attrs = DMA_ATTR_WRITE_COMBINE | + DMA_ATTR_NO_KERNEL_MAPPING; + buf->va = dma_alloc_attrs(dev, buf->size, &buf->da, GFP_KERNEL, + buf->attrs); + if (!buf->va) { + kfree(buf); + ret = -ENOMEM; + goto fail; + } + + list_add_tail(&buf->list, &inst->dpbbufs); + } + + return 0; + +fail: + venus_helper_free_dpb_bufs(inst); + return ret; +} +EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs); + static int intbufs_set_buffer(struct venus_inst *inst, u32 type) { struct venus_core *core = inst->core; @@ -342,7 +448,10 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf) if (vbuf->flags & V4L2_BUF_FLAG_LAST || !fdata.filled_len) fdata.flags |= HFI_BUFFERFLAG_EOS; } else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { - fdata.buffer_type = HFI_BUFFER_OUTPUT; + if (inst->session_type == VIDC_SESSION_TYPE_ENC) + fdata.buffer_type = HFI_BUFFER_OUTPUT; + else + fdata.buffer_type = inst->opb_buftype; fdata.filled_len = 0; fdata.offset = 0; } @@ -672,6 +781,27 @@ int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); +int venus_helper_set_multistream(struct venus_inst *inst, bool out_en, + bool out2_en) +{ + struct hfi_multi_stream multi = {0}; + u32 ptype = HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM; + int ret; + + multi.buffer_type = HFI_BUFFER_OUTPUT; + multi.enable = out_en; + + ret = hfi_session_set_property(inst, ptype, &multi); + if (ret) + return ret; + + multi.buffer_type = HFI_BUFFER_OUTPUT2; + multi.enable = out2_en; + + return hfi_session_set_property(inst, ptype, &multi); +} +EXPORT_SYMBOL_GPL(venus_helper_set_multistream); + int venus_helper_set_dyn_bufmode(struct venus_inst *inst) { u32 ptype = HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE; @@ -819,9 +949,10 @@ EXPORT_SYMBOL_GPL(venus_helper_vb2_buf_init); int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb) { struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + unsigned int out_buf_size = venus_helper_get_opb_size(inst); if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && - vb2_plane_size(vb, 0) < inst->output_buf_size) + vb2_plane_size(vb, 0) < out_buf_size) return -EINVAL; if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && vb2_plane_size(vb, 0) < inst->input_buf_size) @@ -891,6 +1022,8 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) if (ret) hfi_session_abort(inst); + venus_helper_free_dpb_bufs(inst); + load_scale_clocks(core); INIT_LIST_HEAD(&inst->registeredbufs); } @@ -929,8 +1062,14 @@ int venus_helper_vb2_start_streaming(struct venus_inst *inst) if (ret) goto err_unload_res; + ret = venus_helper_queue_dpb_bufs(inst); + if (ret) + goto err_session_stop; + return 0; +err_session_stop: + hfi_session_stop(inst); err_unload_res: hfi_session_unload_res(inst); err_unreg_bufs: @@ -984,6 +1123,67 @@ void venus_helper_init_instance(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_init_instance); +static bool find_fmt_from_caps(struct venus_caps *caps, u32 buftype, u32 fmt) +{ + unsigned int i; + + for (i = 0; i < caps->num_fmts; i++) { + if (caps->fmts[i].buftype == buftype && + caps->fmts[i].fmt == fmt) + return true; + } + + return false; +} + +int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt, + u32 *out_fmt, u32 *out2_fmt, bool ubwc) +{ + struct venus_core *core = inst->core; + struct venus_caps *caps; + u32 ubwc_fmt, fmt = to_hfi_raw_fmt(v4l2_fmt); + bool found, found_ubwc; + + *out_fmt = *out2_fmt = 0; + + if (!fmt) + return -EINVAL; + + caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type); + if (!caps) + return -EINVAL; + + if (ubwc) { + ubwc_fmt = fmt | HFI_COLOR_FORMAT_UBWC_BASE; + found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, + ubwc_fmt); + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt); + + if (found_ubwc && found) { + *out_fmt = ubwc_fmt; + *out2_fmt = fmt; + return 0; + } + } + + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, fmt); + if (found) { + *out_fmt = fmt; + *out2_fmt = 0; + return 0; + } + + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt); + if (found) { + *out_fmt = 0; + *out2_fmt = fmt; + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(venus_helper_get_out_fmts); + int venus_helper_power_enable(struct venus_core *core, u32 session_type, bool enable) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 92b167a47166..2475f284f396 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -50,10 +50,16 @@ int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); int venus_helper_set_dyn_bufmode(struct venus_inst *inst); int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype); +int venus_helper_set_multistream(struct venus_inst *inst, bool out_en, + bool out2_en); unsigned int venus_helper_get_opb_size(struct venus_inst *inst); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); +int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt, + u32 *out2_fmt, bool ubwc); +int venus_helper_alloc_dpb_bufs(struct venus_inst *inst); +int venus_helper_free_dpb_bufs(struct venus_inst *inst); int venus_helper_power_enable(struct venus_core *core, u32 session_type, bool enable); #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 4e8a4086e6fa..9d509b3c1c7a 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -531,10 +531,16 @@ static int vdec_set_properties(struct venus_inst *inst) return 0; } +#define is_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_UBWC_BASE)) + static int vdec_output_conf(struct venus_inst *inst) { struct venus_core *core = inst->core; struct hfi_enable en = { .enable = 1 }; + u32 width = inst->out_width; + u32 height = inst->out_height; + u32 out_fmt, out2_fmt; + bool ubwc = false; u32 ptype; int ret; @@ -553,6 +559,80 @@ static int vdec_output_conf(struct venus_inst *inst) return ret; } + /* Force searching UBWC formats for bigger then HD resolutions */ + if (width > 1920 && height > ALIGN(1080, 32)) + ubwc = true; + + /* For Venus v4 UBWC format is mandatory */ + if (IS_V4(core)) + ubwc = true; + + ret = venus_helper_get_out_fmts(inst, inst->fmt_cap->pixfmt, &out_fmt, + &out2_fmt, ubwc); + if (ret) + return ret; + + inst->output_buf_size = + venus_helper_get_framesz_raw(out_fmt, width, height); + inst->output2_buf_size = + venus_helper_get_framesz_raw(out2_fmt, width, height); + + if (is_ubwc_fmt(out_fmt)) { + inst->opb_buftype = HFI_BUFFER_OUTPUT2; + inst->opb_fmt = out2_fmt; + inst->dpb_buftype = HFI_BUFFER_OUTPUT; + inst->dpb_fmt = out_fmt; + } else if (is_ubwc_fmt(out2_fmt)) { + inst->opb_buftype = HFI_BUFFER_OUTPUT; + inst->opb_fmt = out_fmt; + inst->dpb_buftype = HFI_BUFFER_OUTPUT2; + inst->dpb_fmt = out2_fmt; + } else { + inst->opb_buftype = HFI_BUFFER_OUTPUT; + inst->opb_fmt = out_fmt; + inst->dpb_buftype = 0; + inst->dpb_fmt = 0; + } + + ret = venus_helper_set_raw_format(inst, inst->opb_fmt, + inst->opb_buftype); + if (ret) + return ret; + + if (inst->dpb_fmt) { + ret = venus_helper_set_multistream(inst, false, true); + if (ret) + return ret; + + ret = venus_helper_set_raw_format(inst, inst->dpb_fmt, + inst->dpb_buftype); + if (ret) + return ret; + + ret = venus_helper_set_output_resolution(inst, width, height, + HFI_BUFFER_OUTPUT2); + if (ret) + return ret; + } + + if (IS_V3(core) || IS_V4(core)) { + if (inst->output2_buf_size) { + ret = venus_helper_set_bufsize(inst, + inst->output2_buf_size, + HFI_BUFFER_OUTPUT2); + if (ret) + return ret; + } + + if (inst->output_buf_size) { + ret = venus_helper_set_bufsize(inst, + inst->output_buf_size, + HFI_BUFFER_OUTPUT); + if (ret) + return ret; + } + } + ret = venus_helper_set_dyn_bufmode(inst); if (ret) return ret; @@ -623,6 +703,8 @@ static int vdec_queue_setup(struct vb2_queue *q, int ret = 0; if (*num_planes) { + unsigned int output_buf_size = venus_helper_get_opb_size(inst); + if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && *num_planes != inst->fmt_out->num_planes) return -EINVAL; @@ -636,7 +718,7 @@ static int vdec_queue_setup(struct vb2_queue *q, return -EINVAL; if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && - sizes[0] < inst->output_buf_size) + sizes[0] < output_buf_size) return -EINVAL; return 0; @@ -745,6 +827,10 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) if (ret) goto deinit_sess; + ret = venus_helper_alloc_dpb_bufs(inst); + if (ret) + goto deinit_sess; + ret = venus_helper_vb2_start_streaming(inst); if (ret) goto deinit_sess; @@ -796,9 +882,11 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, vbuf->field = V4L2_FIELD_NONE; if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + unsigned int opb_sz = venus_helper_get_opb_size(inst); + vb = &vbuf->vb2_buf; vb->planes[0].bytesused = - max_t(unsigned int, inst->output_buf_size, bytesused); + max_t(unsigned int, opb_sz, bytesused); vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++; @@ -936,6 +1024,7 @@ static int vdec_open(struct file *file) if (!inst) return -ENOMEM; + INIT_LIST_HEAD(&inst->dpbbufs); INIT_LIST_HEAD(&inst->registeredbufs); INIT_LIST_HEAD(&inst->internalbufs); INIT_LIST_HEAD(&inst->list); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 31aafe487fa1..be5dc3a2eb28 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1084,6 +1084,7 @@ static int venc_open(struct file *file) if (!inst) return -ENOMEM; + INIT_LIST_HEAD(&inst->dpbbufs); INIT_LIST_HEAD(&inst->registeredbufs); INIT_LIST_HEAD(&inst->internalbufs); INIT_LIST_HEAD(&inst->list); From patchwork Wed Jun 13 15:08:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 138489 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp848228lji; Wed, 13 Jun 2018 08:09:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK7H3VibQK+D/bILuX5HyDAcIz/JTMjP/pmyPoxpiBRX/NIbIY9f7yhTFoXGtOt4b2/lEYl X-Received: by 2002:a17:902:b706:: with SMTP id d6-v6mr5604978pls.105.1528902590516; Wed, 13 Jun 2018 08:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528902590; cv=none; d=google.com; s=arc-20160816; b=U8qdhumJpi7iTUY0jY1wQIwfSwL4YvjN2D+R8Lg5KUpr3EzfhuJyUuwCRUDMV+zPmk WdOZmH5Tn6siufvFX7toTd+jbh6TMnt13r/KAwQgUI2TiFSBO1q1RHzLVkiknGJOfOKp TQ5eMzcdOM5zcaMrM4ZjtCBh4cfDsiNwNT5q7eQMa1VneOBfHVakpy5HuTPCkqQPOlRY W63lrdK97BJ9zgDAIxO8oobb/0/wuRtL36uKtVMobAUuYliXCeUUfaah1hjHAXw3BuNY ePulQ/iNvKbu16xYfTK4Kli4eO2XYGrIH75/7emnKX91zgmIiZjJxrTpRJFNihs7cOIY 3/qA== 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=OPshOkkgLb7YeOHqpqAi77D2WOma3eq3NP3qrEentec=; b=vZrE2lLIRXJ+dWAnbjFV7avwVke9U2/VvXjeSfCbZYE2oHztdAIe1h6GIeNHwLx3xG klxaq3mOeCcGP/eYlAluAVuZVs0vPRl5wIsj75dqGh0w3jgvtmbAU68hhrRjBsv5g2nK EfdemOwIX/nPJaTFMqL67LqvxOBAEvWJIunhQTTlOVdBPo5Wf0SGVF6iiBU4FVGXFJ+f 0JOk2NfLXr54U+f4j9Y6qLF8RurR/+QGb8P0s529qTyU9xxFU3wOOzK0z5SNMR9i8/Nj b63k5hpuOy5E4vhIkRZ8ItZI/GPzukDARZjtJ2Hfz8kZgZQ7gMSanOKS1tr1+Xi2LOld AQsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KRk1fgWs; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 j6-v6si2584160pgs.615.2018.06.13.08.09.50; Wed, 13 Jun 2018 08:09:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KRk1fgWs; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936088AbeFMPJs (ORCPT + 13 others); Wed, 13 Jun 2018 11:09:48 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51593 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936079AbeFMPJo (ORCPT ); Wed, 13 Jun 2018 11:09:44 -0400 Received: by mail-wm0-f68.google.com with SMTP id r15-v6so5362503wmc.1 for ; Wed, 13 Jun 2018 08:09:43 -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=/ThhxevIU3epv9lgxlCyqJq5OSMzAnmUAMY3rX7cEds=; b=KRk1fgWsfsTwYcRkAC+meZ+lUFWkF/zVwMeaRQvN8CXkDYhy2L3SzmbgnRVcHFCxri z82SZTblgeNothGLK+VEQvQL1fCwpQrTf0KqHKZJ+XjmYUypqk6zFI1AZog1YDAcSFp2 mRXp9QwyUsrfVYdTB2JUZRuDvJ6RAgOZrNGx4= 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=/ThhxevIU3epv9lgxlCyqJq5OSMzAnmUAMY3rX7cEds=; b=sXdfGSVDiO3JYUQ8B0Rd6e+ramcDkogBOZLt1M83/TWGYPb7g3qEGOXptGwfp/MRNX gRSslDwy7Zrp6vdTYP08GBNsGJTycQRKxTov5Gu8JStufQQV3q7Q/N4JrfJq+NL9sE8u cEqC4+Ivg6UnayNiH0kFnTPwM13t2xd4xs+FSrQASsEmTcqDZNGpgQiRgwOc9JNkAHop HiUNxbagn9NPFq7jHMATx4I10GMgkkX3k95bNYleK9+HfWAQpk7do1NSlo1OA2/fJRMh COpkWENHsHOtKckx9p34rw1ptjHspejj/4ab/U/vblo2ozEpaBlRkuOWntkDg67c+aqT qJxQ== X-Gm-Message-State: APt69E1gcvK1lrU5UPZeJoG8r+DI75/+Ck76uaKtkOUYEkBRwMhbnG09 DBr6blcjKzHiwy5l0RhfdKUWLw== X-Received: by 2002:a1c:4108:: with SMTP id o8-v6mr4091174wma.50.1528902583143; Wed, 13 Jun 2018 08:09:43 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id e13-v6sm2886548wrm.45.2018.06.13.08.09.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 08:09:42 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Stanimir Varbanov Subject: [PATCH v3 26/27] venus: core: add sdm845 DT compatible and resource data Date: Wed, 13 Jun 2018 18:08:00 +0300 Message-Id: <20180613150801.11702-27-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180613150801.11702-1-stanimir.varbanov@linaro.org> References: <20180613150801.11702-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This adds sdm845 DT compatible string with it's resource data table. Signed-off-by: Stanimir Varbanov Reviewed-by: Rob Herring --- .../devicetree/bindings/media/qcom,venus.txt | 1 + drivers/media/platform/qcom/venus/core.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt index 2693449daf73..00d0d1bf7647 100644 --- a/Documentation/devicetree/bindings/media/qcom,venus.txt +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt @@ -6,6 +6,7 @@ Definition: Value should contain one of: - "qcom,msm8916-venus" - "qcom,msm8996-venus" + - "qcom,sdm845-venus" - reg: Usage: required Value type: diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 381bfdd688db..bb6add9d340e 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -450,9 +450,31 @@ static const struct venus_resources msm8996_res = { .fwname = "qcom/venus-4.2/venus.mdt", }; +static const struct freq_tbl sdm845_freq_table[] = { + { 1944000, 380000000 }, /* 4k UHD @ 60 */ + { 972000, 320000000 }, /* 4k UHD @ 30 */ + { 489600, 200000000 }, /* 1080p @ 60 */ + { 244800, 100000000 }, /* 1080p @ 30 */ +}; + +static const struct venus_resources sdm845_res = { + .freq_tbl = sdm845_freq_table, + .freq_tbl_size = ARRAY_SIZE(sdm845_freq_table), + .clks = {"core", "iface", "bus" }, + .clks_num = 3, + .max_load = 2563200, + .hfi_version = HFI_VERSION_4XX, + .vmem_id = VIDC_RESOURCE_NONE, + .vmem_size = 0, + .vmem_addr = 0, + .dma_mask = 0xe0000000 - 1, + .fwname = "qcom/venus-5.2/venus.mdt", +}; + static const struct of_device_id venus_dt_match[] = { { .compatible = "qcom,msm8916-venus", .data = &msm8916_res, }, { .compatible = "qcom,msm8996-venus", .data = &msm8996_res, }, + { .compatible = "qcom,sdm845-venus", .data = &sdm845_res, }, { } }; MODULE_DEVICE_TABLE(of, venus_dt_match);