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 #include "hw_shared.h" 29 #include "color.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 struct cdc_fe; 36 struct cdc_be; 37 struct vpe_priv; 38 39 /** note: all program_* functions shall return number of config packet created */ 40 struct cdc_fe_funcs { 41 bool (*check_input_format)(struct cdc_fe *cdc_fe, enum vpe_surface_pixel_format format); 42 43 /** non segment specific */ 44 void (*program_surface_config)(struct cdc_fe *cdc_fe, enum vpe_surface_pixel_format format, 45 enum vpe_rotation_angle rotation, bool horizontal_mirror, 46 enum vpe_swizzle_mode_values swizzle); 47 48 void (*program_crossbar_config)(struct cdc_fe *cdc_fe, enum vpe_surface_pixel_format format); 49 50 void (*program_global_sync)(struct cdc_fe *cdc_fe, uint32_t vupdate_offset, 51 uint32_t vupdate_width, uint32_t vready_offset); 52 53 void (*program_p2b_config)(struct cdc_fe *cdc_fe, enum vpe_surface_pixel_format format, 54 enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport, 55 const struct vpe_rect *viewport_c); 56 57 /** segment specific */ 58 void (*program_viewport)( 59 struct cdc_fe *cdc_fe, const struct vpe_rect *viewport, const struct vpe_rect *viewport_c); 60 }; 61 62 struct cdc_be_funcs { 63 bool (*check_output_format)(struct cdc_be *cdc_be, enum vpe_surface_pixel_format format); 64 65 void (*program_global_sync)(struct cdc_be *cdc_be, uint32_t vupdate_offset, 66 uint32_t vupdate_width, uint32_t vready_offset); 67 68 void (*program_p2b_config)(struct cdc_be *cdc_be, enum vpe_surface_pixel_format format, 69 enum vpe_swizzle_mode_values swizzle, const struct vpe_rect *viewport, 70 const struct vpe_rect *viewport_c); 71 }; 72 73 struct cdc_fe { 74 struct vpe_priv *vpe_priv; 75 struct cdc_fe_funcs *funcs; 76 unsigned int inst; 77 }; 78 79 struct cdc_be { 80 struct vpe_priv *vpe_priv; 81 struct cdc_be_funcs *funcs; 82 unsigned int inst; 83 }; 84 85 #ifdef __cplusplus 86 } 87 #endif 88