[PATCH v3 04/11] media: videobuf2: Stop define VB2_MAX_FRAME as global

Benjamin Gaignard benjamin.gaignard at collabora.com
Mon Jul 3 01:09:13 PDT 2023


Le 30/06/2023 à 11:51, Hsia-Jun Li a écrit :
>
> On 6/22/23 21:13, Benjamin Gaignard wrote:
>> CAUTION: Email originated externally, do not click links or open 
>> attachments unless you recognize the sender and know the content is 
>> safe.
>>
>>
>> After changing bufs arrays to a dynamic allocated array
>> VB2_MAX_FRAME doesn't mean anything for videobuf2 core.
>
> I think make it 64 which is the VB2_MAX_FRAME in Android GKI kernel is 
> more reasonable.
>
> It would be hard to iterate the whole array, it would go worse with a 
> filter. Such iterate may need to go twice because you mix 
> post-processing buffer and decoding buffer(with MV) in the same array.

Here I don't want to change drivers behavior so I keep the same value.
If it happens that they need more buffers, like for dynamic resolution change
feature for Verisilicon VP9 decoder, case by case patches will be needed.


>
>> Remove it from the core definitions but keep it for drivers internal
>> needs.
>>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>
>> ---
>>   drivers/media/common/videobuf2/videobuf2-core.c | 2 ++
>>   drivers/media/platform/amphion/vdec.c | 1 +
>>   .../media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 2 ++
>>   drivers/media/platform/qcom/venus/hfi.h | 2 ++
>>   drivers/media/platform/verisilicon/hantro_hw.h | 2 ++
>>   drivers/staging/media/ipu3/ipu3-v4l2.c | 2 ++
>>   include/media/videobuf2-core.h | 1 -
>>   include/media/videobuf2-v4l2.h | 4 ----
>>   8 files changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c 
>> b/drivers/media/common/videobuf2/videobuf2-core.c
>> index 86e1e926fa45..899783f67580 100644
>> --- a/drivers/media/common/videobuf2/videobuf2-core.c
>> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
>> @@ -31,6 +31,8 @@
>>
>>   #include <trace/events/vb2.h>
>>
>> +#define VB2_MAX_FRAME  32
>> +
>>   static int debug;
>>   module_param(debug, int, 0644);
>>
>> diff --git a/drivers/media/platform/amphion/vdec.c 
>> b/drivers/media/platform/amphion/vdec.c
>> index 3fa1a74a2e20..b3219f6d17fa 100644
>> --- a/drivers/media/platform/amphion/vdec.c
>> +++ b/drivers/media/platform/amphion/vdec.c
>> @@ -28,6 +28,7 @@
>>
>>   #define VDEC_MIN_BUFFER_CAP            8
>>   #define VDEC_MIN_BUFFER_OUT            8
>> +#define VB2_MAX_FRAME                  32
>>
>>   struct vdec_fs_info {
>>          char name[8];
>> diff --git 
>> a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c 
>> b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c
>> index 6532a69f1fa8..a1e0f24bb91c 100644
>> --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c
>> +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c
>> @@ -16,6 +16,8 @@
>>   #include "../vdec_drv_if.h"
>>   #include "../vdec_vpu_if.h"
>>
>> +#define VB2_MAX_FRAME  32
>> +
>>   /* reset_frame_context defined in VP9 spec */
>>   #define VP9_RESET_FRAME_CONTEXT_NONE0 0
>>   #define VP9_RESET_FRAME_CONTEXT_NONE1 1
>> diff --git a/drivers/media/platform/qcom/venus/hfi.h 
>> b/drivers/media/platform/qcom/venus/hfi.h
>> index f25d412d6553..bd5ca5a8b945 100644
>> --- a/drivers/media/platform/qcom/venus/hfi.h
>> +++ b/drivers/media/platform/qcom/venus/hfi.h
>> @@ -10,6 +10,8 @@
>>
>>   #include "hfi_helper.h"
>>
>> +#define VB2_MAX_FRAME                          32
>> +
>>   #define VIDC_SESSION_TYPE_VPE                  0
>>   #define VIDC_SESSION_TYPE_ENC                  1
>>   #define VIDC_SESSION_TYPE_DEC                  2
>> diff --git a/drivers/media/platform/verisilicon/hantro_hw.h 
>> b/drivers/media/platform/verisilicon/hantro_hw.h
>> index e83f0c523a30..9e8faf7ba6fb 100644
>> --- a/drivers/media/platform/verisilicon/hantro_hw.h
>> +++ b/drivers/media/platform/verisilicon/hantro_hw.h
>> @@ -15,6 +15,8 @@
>>   #include <media/v4l2-vp9.h>
>>   #include <media/videobuf2-core.h>
>>
>> +#define VB2_MAX_FRAME  32
>> +
>>   #define DEC_8190_ALIGN_MASK    0x07U
>>
>>   #define MB_DIM                 16
>> diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c 
>> b/drivers/staging/media/ipu3/ipu3-v4l2.c
>> index e530767e80a5..6627b5c2d4d6 100644
>> --- a/drivers/staging/media/ipu3/ipu3-v4l2.c
>> +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
>> @@ -10,6 +10,8 @@
>>   #include "ipu3.h"
>>   #include "ipu3-dmamap.h"
>>
>> +#define VB2_MAX_FRAME  32
>> +
>>   /******************** v4l2_subdev_ops ********************/
>>
>>   #define IPU3_RUNNING_MODE_VIDEO                0
>> diff --git a/include/media/videobuf2-core.h 
>> b/include/media/videobuf2-core.h
>> index 77921cf894ef..080b783d608d 100644
>> --- a/include/media/videobuf2-core.h
>> +++ b/include/media/videobuf2-core.h
>> @@ -20,7 +20,6 @@
>>   #include <media/media-request.h>
>>   #include <media/frame_vector.h>
>>
>> -#define VB2_MAX_FRAME  (32)
>>   #define VB2_MAX_PLANES (8)
>>
>>   /**
>> diff --git a/include/media/videobuf2-v4l2.h 
>> b/include/media/videobuf2-v4l2.h
>> index 5a845887850b..88a7a565170e 100644
>> --- a/include/media/videobuf2-v4l2.h
>> +++ b/include/media/videobuf2-v4l2.h
>> @@ -15,10 +15,6 @@
>>   #include <linux/videodev2.h>
>>   #include <media/videobuf2-core.h>
>>
>> -#if VB2_MAX_FRAME != VIDEO_MAX_FRAME
>> -#error VB2_MAX_FRAME != VIDEO_MAX_FRAME
>> -#endif
>> -
>>   #if VB2_MAX_PLANES != VIDEO_MAX_PLANES
>>   #error VB2_MAX_PLANES != VIDEO_MAX_PLANES
>>   #endif
>> -- 
>> 2.39.2
>>



More information about the Linux-mediatek mailing list