From ac2682411d03cf2951abf2856aeaf10206e700fc Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 13 May 2021 11:56:21 +0100 Subject: [PATCH] staging/bcm2835-codec: Change the default codec res to 32x32 In order to effectively guarantee that a V4L2_EVENT_SOURCE_CHANGE event occurs, adopt a default resolution of 32x32 so that it is incredibly unlikely to be decoding a stream of that resolution and therefore failing to note a "change" requiring the event. Signed-off-by: Dave Stevenson --- .../bcm2835-codec/bcm2835-v4l2-codec.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c @@ -97,8 +97,19 @@ static const char * const components[] = #define MAX_W 1920 #define MAX_H 1920 #define BPL_ALIGN 32 -#define DEFAULT_WIDTH 640 -#define DEFAULT_HEIGHT 480 +/* + * The decoder spec supports the V4L2_EVENT_SOURCE_CHANGE event, but the docs + * seem to want it to always be generated on startup, which prevents the client + * from configuring the CAPTURE queue based on any parsing it has already done + * which may save time and allow allocation of CAPTURE buffers early. Surely + * SOURCE_CHANGE means something has changed, not just "always notify". + * + * For those clients that don't set the CAPTURE resolution, adopt a default + * resolution that is seriously unlikely to be correct, therefore almost + * guaranteed to get the SOURCE_CHANGE event. + */ +#define DEFAULT_WIDTH 32 +#define DEFAULT_HEIGHT 32 /* * The unanswered question - what is the maximum size of a compressed frame? * V4L2 mandates that the encoded frame must fit in a single buffer. Sizing