Skip to content

media/hevc_d: Improve checking and cleanup of decoder - #7583

Open
jc-kynesim wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_dec_valid_3
Open

media/hevc_d: Improve checking and cleanup of decoder#7583
jc-kynesim wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_dec_valid_3

Conversation

@jc-kynesim

Copy link
Copy Markdown
Contributor

A number of fixes and cleanup - many Claude inspired.

Optimise guessing of new PU/Coeff buffers is we have already had to reallocate in this context.

Fix buffer size roundup code so it rounds up as intended rather than to twice that amount.

Reset slot tracking on streamoff so it doesn't become fatally confused if a second run is started before closing the context.

Fix accounting for size of scaling factor list when alloocating command buffers. Previously would over allocate a bit.

A number of fixes to decoder cleanup on release or probe error where structures could be leaked or were freed in the wrong order.

Fix typo and pointless && clause in Kconfig

Collocated ref index was bounds checked against the wrong value, potentially ending up with feeding random addresses to the h/w.

Many more slice header and PPS parameters checked that could potentially misprogram the hardware.

Generaly tidy and remove dead code and structures.

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two very minor nits as I know they'd get flagged upstream.

Comment thread drivers/media/platform/raspberrypi/hevc_dec/hevc_d.c
Comment thread drivers/media/platform/raspberrypi/hevc_dec/hevc_d.c
A number of fixes and cleanup - many Claude inspired.

Optimise guessing of new PU/Coeff buffers is we have already had to
reallocate in this context.

Fix buffer size roundup code so it rounds up as intended rather
than to twice that amount.

Reset slot tracking on streamoff so it doesn't become fatally confused
if a second run is started before closing the context.

Fix accounting for size of scaling factor list when alloocating command
buffers. Previously would over allocate a bit.

A number of fixes to decoder cleanup on release or probe error where
structures could be leaked or were freed in the wrong order.

Fix typo and pointless && clause in Kconfig

Collocated ref index was bounds checked against the wrong value,
potentially ending up with feeding random addresses to the h/w.

Many more slice header and PPS parameters checked that could potentially
misprogram the hardware.

Generaly tidy and remove dead code and structures.

Signed-off-by: John Cox <jc@kynesim.co.uk>
@jc-kynesim
jc-kynesim force-pushed the dev/6.18/hevc_dec_valid_3 branch from 5fb97cb to ad2f32c Compare September 1, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants