.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2016 MediaTek Inc. |
---|
3 | 4 | * Author: Daniel Hsiao <daniel.hsiao@mediatek.com> |
---|
4 | 5 | * PoChun Lin <pochun.lin@mediatek.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify |
---|
8 | | - * it under the terms of the GNU General Public License version 2 as |
---|
9 | | - * published by the Free Software Foundation. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | 6 | */ |
---|
16 | 7 | |
---|
17 | 8 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
26 | 17 | #include "../venc_drv_base.h" |
---|
27 | 18 | #include "../venc_ipi_msg.h" |
---|
28 | 19 | #include "../venc_vpu_if.h" |
---|
29 | | -#include "mtk_vpu.h" |
---|
30 | 20 | |
---|
31 | 21 | #define VENC_BITSTREAM_FRAME_SIZE 0x0098 |
---|
32 | 22 | #define VENC_BITSTREAM_HEADER_LEN 0x00e8 |
---|
.. | .. |
---|
199 | 189 | if (i == VENC_VP8_VPU_WORK_BUF_RC_CODE || |
---|
200 | 190 | i == VENC_VP8_VPU_WORK_BUF_RC_CODE2 || |
---|
201 | 191 | i == VENC_VP8_VPU_WORK_BUF_RC_CODE3) { |
---|
| 192 | + struct mtk_vcodec_fw *handler; |
---|
202 | 193 | void *tmp_va; |
---|
203 | 194 | |
---|
204 | | - tmp_va = vpu_mapping_dm_addr(inst->vpu_inst.dev, |
---|
205 | | - wb[i].vpua); |
---|
| 195 | + handler = inst->vpu_inst.ctx->dev->fw_handler; |
---|
| 196 | + tmp_va = mtk_vcodec_fw_map_dm_addr(handler, |
---|
| 197 | + wb[i].vpua); |
---|
206 | 198 | memcpy(inst->work_bufs[i].va, tmp_va, wb[i].size); |
---|
207 | 199 | } |
---|
208 | 200 | wb[i].iova = inst->work_bufs[i].dma_addr; |
---|
.. | .. |
---|
310 | 302 | |
---|
311 | 303 | mtk_vcodec_debug(inst, "->frm_cnt=%d", inst->frm_cnt); |
---|
312 | 304 | |
---|
313 | | - ret = vpu_enc_encode(&inst->vpu_inst, 0, frm_buf, bs_buf, bs_size); |
---|
| 305 | + ret = vpu_enc_encode(&inst->vpu_inst, 0, frm_buf, bs_buf, bs_size, |
---|
| 306 | + NULL); |
---|
314 | 307 | if (ret) |
---|
315 | 308 | return ret; |
---|
316 | 309 | |
---|
.. | .. |
---|
332 | 325 | return ret; |
---|
333 | 326 | } |
---|
334 | 327 | |
---|
335 | | -static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle) |
---|
| 328 | +static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) |
---|
336 | 329 | { |
---|
337 | 330 | int ret = 0; |
---|
338 | 331 | struct venc_vp8_inst *inst; |
---|
.. | .. |
---|
343 | 336 | |
---|
344 | 337 | inst->ctx = ctx; |
---|
345 | 338 | inst->vpu_inst.ctx = ctx; |
---|
346 | | - inst->vpu_inst.dev = ctx->dev->vpu_plat_dev; |
---|
347 | 339 | inst->vpu_inst.id = IPI_VENC_VP8; |
---|
348 | 340 | inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx, VENC_LT_SYS); |
---|
349 | 341 | |
---|
.. | .. |
---|
358 | 350 | if (ret) |
---|
359 | 351 | kfree(inst); |
---|
360 | 352 | else |
---|
361 | | - (*handle) = (unsigned long)inst; |
---|
| 353 | + ctx->drv_handle = inst; |
---|
362 | 354 | |
---|
363 | 355 | return ret; |
---|
364 | 356 | } |
---|
365 | 357 | |
---|
366 | | -static int vp8_enc_encode(unsigned long handle, |
---|
| 358 | +static int vp8_enc_encode(void *handle, |
---|
367 | 359 | enum venc_start_opt opt, |
---|
368 | 360 | struct venc_frm_buf *frm_buf, |
---|
369 | 361 | struct mtk_vcodec_mem *bs_buf, |
---|
.. | .. |
---|
400 | 392 | return ret; |
---|
401 | 393 | } |
---|
402 | 394 | |
---|
403 | | -static int vp8_enc_set_param(unsigned long handle, |
---|
| 395 | +static int vp8_enc_set_param(void *handle, |
---|
404 | 396 | enum venc_set_param_type type, |
---|
405 | 397 | struct venc_enc_param *enc_prm) |
---|
406 | 398 | { |
---|
.. | .. |
---|
451 | 443 | return ret; |
---|
452 | 444 | } |
---|
453 | 445 | |
---|
454 | | -static int vp8_enc_deinit(unsigned long handle) |
---|
| 446 | +static int vp8_enc_deinit(void *handle) |
---|
455 | 447 | { |
---|
456 | 448 | int ret = 0; |
---|
457 | 449 | struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; |
---|
.. | .. |
---|
469 | 461 | return ret; |
---|
470 | 462 | } |
---|
471 | 463 | |
---|
472 | | -static const struct venc_common_if venc_vp8_if = { |
---|
| 464 | +const struct venc_common_if venc_vp8_if = { |
---|
473 | 465 | .init = vp8_enc_init, |
---|
474 | 466 | .encode = vp8_enc_encode, |
---|
475 | 467 | .set_param = vp8_enc_set_param, |
---|
476 | 468 | .deinit = vp8_enc_deinit, |
---|
477 | 469 | }; |
---|
478 | | - |
---|
479 | | -const struct venc_common_if *get_vp8_enc_comm_if(void); |
---|
480 | | - |
---|
481 | | -const struct venc_common_if *get_vp8_enc_comm_if(void) |
---|
482 | | -{ |
---|
483 | | - return &venc_vp8_if; |
---|
484 | | -} |
---|