| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2016 MediaTek Inc. |
|---|
| 3 | 4 | * Author: Jungchang Tsao <jungchang.tsao@mediatek.com> |
|---|
| 4 | 5 | * PC Chen <pc.chen@mediatek.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 120 | 112 | /** |
|---|
| 121 | 113 | * struct vdec_vp8_vpu_inst - VPU instance for VP8 decode |
|---|
| 122 | 114 | * @wq_hd : Wait queue to wait VPU message ack |
|---|
| 123 | | - * @signaled : 1 - Host has received ack message from VPU, 0 - not recevie |
|---|
| 115 | + * @signaled : 1 - Host has received ack message from VPU, 0 - not receive |
|---|
| 124 | 116 | * @failure : VPU execution result status 0 - success, others - fail |
|---|
| 125 | 117 | * @inst_addr : VPU decoder instance address |
|---|
| 126 | 118 | */ |
|---|
| .. | .. |
|---|
| 294 | 286 | |
|---|
| 295 | 287 | mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)", |
|---|
| 296 | 288 | pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); |
|---|
| 297 | | - mtk_vcodec_debug(inst, "Y(%d, %d), C(%d, %d)", pic->y_bs_sz, |
|---|
| 298 | | - pic->y_len_sz, pic->c_bs_sz, pic->c_len_sz); |
|---|
| 289 | + mtk_vcodec_debug(inst, "fb size: Y(%d), C(%d)", |
|---|
| 290 | + pic->fb_sz[0], pic->fb_sz[1]); |
|---|
| 299 | 291 | } |
|---|
| 300 | 292 | |
|---|
| 301 | 293 | static void vp8_dec_finish(struct vdec_vp8_inst *inst) |
|---|
| .. | .. |
|---|
| 396 | 388 | inst->vsi->dec.working_buf_dma = 0; |
|---|
| 397 | 389 | } |
|---|
| 398 | 390 | |
|---|
| 399 | | -static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec) |
|---|
| 391 | +static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx) |
|---|
| 400 | 392 | { |
|---|
| 401 | 393 | struct vdec_vp8_inst *inst; |
|---|
| 402 | 394 | int err; |
|---|
| .. | .. |
|---|
| 408 | 400 | inst->ctx = ctx; |
|---|
| 409 | 401 | |
|---|
| 410 | 402 | inst->vpu.id = IPI_VDEC_VP8; |
|---|
| 411 | | - inst->vpu.dev = ctx->dev->vpu_plat_dev; |
|---|
| 412 | 403 | inst->vpu.ctx = ctx; |
|---|
| 413 | | - inst->vpu.handler = vpu_dec_ipi_handler; |
|---|
| 414 | 404 | |
|---|
| 415 | 405 | err = vpu_dec_init(&inst->vpu); |
|---|
| 416 | 406 | if (err) { |
|---|
| .. | .. |
|---|
| 427 | 417 | get_hw_reg_base(inst); |
|---|
| 428 | 418 | mtk_vcodec_debug(inst, "VP8 Instance >> %p", inst); |
|---|
| 429 | 419 | |
|---|
| 430 | | - *h_vdec = (unsigned long)inst; |
|---|
| 420 | + ctx->drv_handle = inst; |
|---|
| 431 | 421 | return 0; |
|---|
| 432 | 422 | |
|---|
| 433 | 423 | error_deinit: |
|---|
| .. | .. |
|---|
| 437 | 427 | return err; |
|---|
| 438 | 428 | } |
|---|
| 439 | 429 | |
|---|
| 440 | | -static int vdec_vp8_decode(unsigned long h_vdec, struct mtk_vcodec_mem *bs, |
|---|
| 430 | +static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs, |
|---|
| 441 | 431 | struct vdec_fb *fb, bool *res_chg) |
|---|
| 442 | 432 | { |
|---|
| 443 | 433 | struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; |
|---|
| .. | .. |
|---|
| 573 | 563 | cr->left, cr->top, cr->width, cr->height); |
|---|
| 574 | 564 | } |
|---|
| 575 | 565 | |
|---|
| 576 | | -static int vdec_vp8_get_param(unsigned long h_vdec, |
|---|
| 577 | | - enum vdec_get_param_type type, void *out) |
|---|
| 566 | +static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type, |
|---|
| 567 | + void *out) |
|---|
| 578 | 568 | { |
|---|
| 579 | 569 | struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; |
|---|
| 580 | 570 | |
|---|
| .. | .. |
|---|
| 607 | 597 | return 0; |
|---|
| 608 | 598 | } |
|---|
| 609 | 599 | |
|---|
| 610 | | -static void vdec_vp8_deinit(unsigned long h_vdec) |
|---|
| 600 | +static void vdec_vp8_deinit(void *h_vdec) |
|---|
| 611 | 601 | { |
|---|
| 612 | 602 | struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; |
|---|
| 613 | 603 | |
|---|
| .. | .. |
|---|
| 618 | 608 | kfree(inst); |
|---|
| 619 | 609 | } |
|---|
| 620 | 610 | |
|---|
| 621 | | -static struct vdec_common_if vdec_vp8_if = { |
|---|
| 611 | +const struct vdec_common_if vdec_vp8_if = { |
|---|
| 622 | 612 | .init = vdec_vp8_init, |
|---|
| 623 | 613 | .decode = vdec_vp8_decode, |
|---|
| 624 | 614 | .get_param = vdec_vp8_get_param, |
|---|
| 625 | 615 | .deinit = vdec_vp8_deinit, |
|---|
| 626 | 616 | }; |
|---|
| 627 | | - |
|---|
| 628 | | -struct vdec_common_if *get_vp8_dec_comm_if(void); |
|---|
| 629 | | - |
|---|
| 630 | | -struct vdec_common_if *get_vp8_dec_comm_if(void) |
|---|
| 631 | | -{ |
|---|
| 632 | | - return &vdec_vp8_if; |
|---|
| 633 | | -} |
|---|