.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. |
---|
3 | 4 | * Copyright (C) 2017 Linaro Ltd. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 and |
---|
7 | | - * only version 2 as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | | - * |
---|
14 | 5 | */ |
---|
15 | 6 | #include <linux/slab.h> |
---|
16 | 7 | #include <linux/mutex.h> |
---|
.. | .. |
---|
113 | 104 | mutex_lock(&core->lock); |
---|
114 | 105 | } |
---|
115 | 106 | |
---|
| 107 | + if (!core->ops) |
---|
| 108 | + goto unlock; |
---|
| 109 | + |
---|
116 | 110 | ret = core->ops->core_deinit(core); |
---|
117 | 111 | |
---|
118 | 112 | if (!ret) |
---|
.. | .. |
---|
207 | 201 | const struct hfi_ops *ops = core->ops; |
---|
208 | 202 | int ret; |
---|
209 | 203 | |
---|
| 204 | + if (inst->state != INST_UNINIT) |
---|
| 205 | + return -EINVAL; |
---|
| 206 | + |
---|
210 | 207 | inst->hfi_codec = to_codec_type(pixfmt); |
---|
211 | 208 | reinit_completion(&inst->done); |
---|
212 | 209 | |
---|
.. | .. |
---|
285 | 282 | |
---|
286 | 283 | return 0; |
---|
287 | 284 | } |
---|
| 285 | +EXPORT_SYMBOL_GPL(hfi_session_start); |
---|
288 | 286 | |
---|
289 | 287 | int hfi_session_stop(struct venus_inst *inst) |
---|
290 | 288 | { |
---|
.. | .. |
---|
308 | 306 | |
---|
309 | 307 | return 0; |
---|
310 | 308 | } |
---|
| 309 | +EXPORT_SYMBOL_GPL(hfi_session_stop); |
---|
311 | 310 | |
---|
312 | 311 | int hfi_session_continue(struct venus_inst *inst) |
---|
313 | 312 | { |
---|
.. | .. |
---|
337 | 336 | |
---|
338 | 337 | return 0; |
---|
339 | 338 | } |
---|
| 339 | +EXPORT_SYMBOL_GPL(hfi_session_abort); |
---|
340 | 340 | |
---|
341 | 341 | int hfi_session_load_res(struct venus_inst *inst) |
---|
342 | 342 | { |
---|
.. | .. |
---|
383 | 383 | |
---|
384 | 384 | return 0; |
---|
385 | 385 | } |
---|
| 386 | +EXPORT_SYMBOL_GPL(hfi_session_unload_res); |
---|
386 | 387 | |
---|
387 | | -int hfi_session_flush(struct venus_inst *inst) |
---|
| 388 | +int hfi_session_flush(struct venus_inst *inst, u32 type, bool block) |
---|
388 | 389 | { |
---|
389 | 390 | const struct hfi_ops *ops = inst->core->ops; |
---|
390 | 391 | int ret; |
---|
391 | 392 | |
---|
392 | 393 | reinit_completion(&inst->done); |
---|
393 | 394 | |
---|
394 | | - ret = ops->session_flush(inst, HFI_FLUSH_ALL); |
---|
| 395 | + ret = ops->session_flush(inst, type); |
---|
395 | 396 | if (ret) |
---|
396 | 397 | return ret; |
---|
397 | 398 | |
---|
398 | | - ret = wait_session_msg(inst); |
---|
399 | | - if (ret) |
---|
400 | | - return ret; |
---|
| 399 | + if (block) { |
---|
| 400 | + ret = wait_session_msg(inst); |
---|
| 401 | + if (ret) |
---|
| 402 | + return ret; |
---|
| 403 | + } |
---|
401 | 404 | |
---|
402 | 405 | return 0; |
---|
403 | 406 | } |
---|
.. | .. |
---|
517 | 520 | { |
---|
518 | 521 | venus_hfi_destroy(core); |
---|
519 | 522 | } |
---|
| 523 | + |
---|
| 524 | +void hfi_reinit(struct venus_core *core) |
---|
| 525 | +{ |
---|
| 526 | + venus_hfi_queues_reinit(core); |
---|
| 527 | +} |
---|