Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions drivers/media/platform/apple/avd/avd-vp9.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ struct avd_vp9_bank {
struct avd_buf lf_left_info;
struct avd_buf lf_left;
struct avd_buf color;
struct avd_buf seg;
struct avd_buf pipe_state;
struct avd_buf counts;
struct avd_buf probs;
Expand All @@ -205,6 +204,13 @@ struct avd_vp9_ctx {
unsigned int nbanks;
struct avd_vp9_bank bank[AVD_VP9_BANKS];
struct avd_vp9_bank *b;
/*
* The segmentation map, one per stream. A frame reads the map the frame
* before it left (temporal prediction, or a frame without a map update),
* so the two banks of the queued transport must share it: with one
* buffer per bank, a frame read the map of the frame before last.
*/
struct avd_buf seg;
};

static bool avd_vp9_needs_counts(u32 flags)
Expand Down Expand Up @@ -422,8 +428,8 @@ static void set_header(struct avd_ctx *ctx, struct avd_vp9_run *run)
pusha(vp9_ctx->b->bufs.counts.addr, "counts", 0);
pusha(vp9_ctx->b->bufs.probs.addr, "probs", 0);
pusha(vp9_ctx->b->bufs.above_info.addr, "above_info", 0);
pusha(vp9_ctx->b->bufs.seg.addr, "seg", 1);
pusha(vp9_ctx->b->bufs.seg.addr, "seg", 2);
pusha(vp9_ctx->seg.addr, "seg", 1);
pusha(vp9_ctx->seg.addr, "seg", 2);
pusha(vp9_ctx->b->bufs.color.addr, "color", 3);
pusha(avd_vp9_uses_prev_mv(frame->flags, &vp9_ctx->last) ?
vp9_ctx->last.color : vp9_ctx->b->bufs.color.addr,
Expand Down Expand Up @@ -738,10 +744,6 @@ static int avd_vp9_alloc_bufs(struct avd_ctx *ctx, struct avd_vp9_bank *bank)
if (ret)
return ret;

ret = avd_buf_alloc(avd, &bank->bufs.seg, DIV_ROUND_UP(w, 8) * 24);
if (ret)
return ret;

ret = avd_buf_alloc(avd, &bank->bufs.lf_left,
DIV_ROUND_UP(h, 8) * 16 * bit_depth);
if (ret)
Expand Down Expand Up @@ -1119,14 +1121,14 @@ static void avd_vp9_free(struct avd_ctx *ctx, struct avd_vp9_ctx *vp9_ctx)
struct avd_dev *avd = ctx->dev;

ctx->max_frames = 1;
avd_buf_free(avd, &vp9_ctx->seg);
for (unsigned int i = 0; i < vp9_ctx->nbanks; i++) {
struct avd_vp9_bank *bank = &vp9_ctx->bank[i];

avd_buf_free(avd, &bank->bufs.pipe_state);
avd_buf_free(avd, &bank->bufs.inst);
avd_buf_free(avd, &bank->bufs.probs);
avd_buf_free(avd, &bank->bufs.counts);
avd_buf_free(avd, &bank->bufs.seg);
avd_buf_free(avd, &bank->bufs.color);
avd_buf_free(avd, &bank->bufs.ip_above);
avd_buf_free(avd, &bank->bufs.lf_above);
Expand Down Expand Up @@ -1157,6 +1159,9 @@ static int avd_vp9_start(struct avd_ctx *ctx)

vp9_ctx->nbanks = avd_qfw_has_vp_done(ctx->dev) ? AVD_VP9_BANKS : 1;
vp9_ctx->b = &vp9_ctx->bank[0];
ret = avd_buf_alloc(ctx->dev, &vp9_ctx->seg, DIV_ROUND_UP(fmt_width(ctx), 8) * 24);
if (ret)
goto err_free_ctx;
for (unsigned int i = 0; i < vp9_ctx->nbanks; i++) {
ret = avd_vp9_alloc_bufs(ctx, &vp9_ctx->bank[i]);
if (ret)
Expand Down
Loading