1 /* Copyright 2022 Advanced Micro Devices, Inc. 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a 4 * copy of this software and associated documentation files (the "Software"), 5 * to deal in the Software without restriction, including without limitation 6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 * and/or sell copies of the Software, and to permit persons to whom the 8 * Software is furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included in 11 * all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 * OTHER DEALINGS IN THE SOFTWARE. 20 * 21 * Authors: AMD 22 * 23 */ 24 25 #pragma once 26 27 #include "vpe_types.h" 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 struct plane_desc_header { 32 int32_t nps0; 33 int32_t npd0; 34 int32_t nps1; 35 int32_t npd1; 36 int32_t subop; 37 }; 38 39 struct plane_desc_src { 40 uint8_t tmz; 41 enum vpe_swizzle_mode_values swizzle; 42 enum vpe_rotation_angle rotation; 43 uint32_t base_addr_lo; 44 uint32_t base_addr_hi; 45 uint16_t pitch; 46 uint16_t viewport_x; 47 uint16_t viewport_y; 48 uint16_t viewport_w; 49 uint16_t viewport_h; 50 uint8_t elem_size; 51 }; 52 53 struct plane_desc_dst { 54 uint8_t tmz; 55 enum vpe_swizzle_mode_values swizzle; 56 enum vpe_mirror mirror; 57 uint32_t base_addr_lo; 58 uint32_t base_addr_hi; 59 uint16_t pitch; 60 uint16_t viewport_x; 61 uint16_t viewport_y; 62 uint16_t viewport_w; 63 uint16_t viewport_h; 64 uint8_t elem_size; 65 }; 66 67 68 struct plane_desc_writer { 69 struct vpe_buf *buf; /**< store the current buf pointer */ 70 71 /* store the base addr of the currnet config 72 * i.e. config header 73 * it is always constructed in emb_buf 74 */ 75 uint64_t base_gpu_va; 76 uint64_t base_cpu_va; 77 78 int32_t num_src; 79 int32_t num_dst; 80 enum vpe_status status; 81 82 void (*init)( 83 struct plane_desc_writer *writer, struct vpe_buf *buf, struct plane_desc_header *header); 84 void (*add_source)( 85 struct plane_desc_writer *writer, struct plane_desc_src *source, bool is_plane0); 86 void (*add_destination)( 87 struct plane_desc_writer *writer, struct plane_desc_dst *destination, bool is_plane0); 88 void (*add_meta)(struct plane_desc_writer *writer, struct plane_desc_src *src); 89 }; 90 91 #ifdef __cplusplus 92 } 93 #endif 94