]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: venus: helpers, hfi, vdec: Set actual plane constraints to FW
authorDikshita Agarwal <dikshita@codeaurora.org>
Fri, 2 Apr 2021 10:06:45 +0000 (12:06 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 6 Apr 2021 13:59:15 +0000 (15:59 +0200)
Set actual plane alignments to FW with
HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO to calculate
correct buffer size.

bod: Fixed fall-through error in pkt_session_set_property_6xx() switch
     Ensure setting format constraints on 6xx only

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/helpers.c
drivers/media/platform/qcom/venus/helpers.h
drivers/media/platform/qcom/venus/hfi_cmds.c
drivers/media/platform/qcom/venus/vdec.c

index 8b08632b0296d35aa4c4230263b4509f1c32ca76..77ffb8fbb47f38070f96d5110f31d40312440c56 100644 (file)
@@ -1103,6 +1103,30 @@ int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode)
 }
 EXPORT_SYMBOL_GPL(venus_helper_set_work_mode);
 
+int venus_helper_set_format_constraints(struct venus_inst *inst)
+{
+       const u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO;
+       struct hfi_uncompressed_plane_actual_constraints_info pconstraint;
+
+       if (!IS_V6(inst->core))
+               return 0;
+
+       pconstraint.buffer_type = HFI_BUFFER_OUTPUT2;
+       pconstraint.num_planes = 2;
+       pconstraint.plane_format[0].stride_multiples = 128;
+       pconstraint.plane_format[0].max_stride = 8192;
+       pconstraint.plane_format[0].min_plane_buffer_height_multiple = 32;
+       pconstraint.plane_format[0].buffer_alignment = 256;
+
+       pconstraint.plane_format[1].stride_multiples = 128;
+       pconstraint.plane_format[1].max_stride = 8192;
+       pconstraint.plane_format[1].min_plane_buffer_height_multiple = 16;
+       pconstraint.plane_format[1].buffer_alignment = 256;
+
+       return hfi_session_set_property(inst, ptype, &pconstraint);
+}
+EXPORT_SYMBOL_GPL(venus_helper_set_format_constraints);
+
 int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
                              unsigned int output_bufs,
                              unsigned int output2_bufs)
index 3510938454993c7b5138ccbde2b979001916b177..98106e6eee859176c0fb8d608489734e7af9b141 100644 (file)
@@ -33,6 +33,7 @@ int venus_helper_set_output_resolution(struct venus_inst *inst,
                                       unsigned int width, unsigned int height,
                                       u32 buftype);
 int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
+int venus_helper_set_format_constraints(struct venus_inst *inst);
 int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
                              unsigned int output_bufs,
                              unsigned int output2_bufs);
index cdc745be4c228082b22f142ae3e5132cd5701f4b..fc0a01ffb60e6511180f4e6818f10d1e5beb26dd 100644 (file)
@@ -1259,6 +1259,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt,
        pkt->data[0] = ptype;
 
        switch (ptype) {
+       case HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO: {
+               struct hfi_uncompressed_plane_actual_constraints_info *in = pdata;
+               struct hfi_uncompressed_plane_actual_constraints_info *info = prop_data;
+
+               info->buffer_type = in->buffer_type;
+               info->num_planes = in->num_planes;
+               info->plane_format[0] = in->plane_format[0];
+               if (in->num_planes > 1)
+                       info->plane_format[1] = in->plane_format[1];
+
+               pkt->shdr.hdr.size += sizeof(u32) + sizeof(*info);
+               break;
+       }
        case HFI_PROPERTY_CONFIG_HEIC_FRAME_QUALITY: {
                struct hfi_heic_frame_quality *in = pdata, *cq = prop_data;
 
index f9f7f5b87f797a081dabfdd47aa50004b9ab0c63..8d58a7e4ebc16240db2183db839a3002352d812e 100644 (file)
@@ -715,6 +715,10 @@ static int vdec_output_conf(struct venus_inst *inst)
        if (ret)
                return ret;
 
+       ret = venus_helper_set_format_constraints(inst);
+       if (ret)
+               return ret;
+
        if (inst->dpb_fmt) {
                ret = venus_helper_set_multistream(inst, false, true);
                if (ret)