Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2019 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  */
0023 
0024 #ifndef __AMDGPU_JPEG_H__
0025 #define __AMDGPU_JPEG_H__
0026 
0027 #include "amdgpu_ras.h"
0028 
0029 #define AMDGPU_MAX_JPEG_INSTANCES   2
0030 
0031 #define AMDGPU_JPEG_HARVEST_JPEG0 (1 << 0)
0032 #define AMDGPU_JPEG_HARVEST_JPEG1 (1 << 1)
0033 
0034 struct amdgpu_jpeg_reg{
0035     unsigned jpeg_pitch;
0036 };
0037 
0038 struct amdgpu_jpeg_inst {
0039     struct amdgpu_ring ring_dec;
0040     struct amdgpu_irq_src irq;
0041     struct amdgpu_jpeg_reg external;
0042 };
0043 
0044 struct amdgpu_jpeg_ras {
0045     struct amdgpu_ras_block_object ras_block;
0046 };
0047 
0048 struct amdgpu_jpeg {
0049     uint8_t num_jpeg_inst;
0050     struct amdgpu_jpeg_inst inst[AMDGPU_MAX_JPEG_INSTANCES];
0051     struct amdgpu_jpeg_reg internal;
0052     unsigned harvest_config;
0053     struct delayed_work idle_work;
0054     enum amd_powergating_state cur_state;
0055     struct mutex jpeg_pg_lock;
0056     atomic_t total_submission_cnt;
0057     struct ras_common_if    *ras_if;
0058     struct amdgpu_jpeg_ras  *ras;
0059 };
0060 
0061 int amdgpu_jpeg_sw_init(struct amdgpu_device *adev);
0062 int amdgpu_jpeg_sw_fini(struct amdgpu_device *adev);
0063 int amdgpu_jpeg_suspend(struct amdgpu_device *adev);
0064 int amdgpu_jpeg_resume(struct amdgpu_device *adev);
0065 
0066 void amdgpu_jpeg_ring_begin_use(struct amdgpu_ring *ring);
0067 void amdgpu_jpeg_ring_end_use(struct amdgpu_ring *ring);
0068 
0069 int amdgpu_jpeg_dec_ring_test_ring(struct amdgpu_ring *ring);
0070 int amdgpu_jpeg_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout);
0071 
0072 int amdgpu_jpeg_process_poison_irq(struct amdgpu_device *adev,
0073                 struct amdgpu_irq_src *source,
0074                 struct amdgpu_iv_entry *entry);
0075 
0076 #endif /*__AMDGPU_JPEG_H__*/