1*b843c749SSergey Zigachev /* 2*b843c749SSergey Zigachev * Copyright 2017 Advanced Micro Devices, Inc. 3*b843c749SSergey Zigachev * 4*b843c749SSergey Zigachev * Permission is hereby granted, free of charge, to any person obtaining a 5*b843c749SSergey Zigachev * copy of this software and associated documentation files (the "Software"), 6*b843c749SSergey Zigachev * to deal in the Software without restriction, including without limitation 7*b843c749SSergey Zigachev * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*b843c749SSergey Zigachev * and/or sell copies of the Software, and to permit persons to whom the 9*b843c749SSergey Zigachev * Software is furnished to do so, subject to the following conditions: 10*b843c749SSergey Zigachev * 11*b843c749SSergey Zigachev * The above copyright notice and this permission notice shall be included in 12*b843c749SSergey Zigachev * all copies or substantial portions of the Software. 13*b843c749SSergey Zigachev * 14*b843c749SSergey Zigachev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*b843c749SSergey Zigachev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*b843c749SSergey Zigachev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*b843c749SSergey Zigachev * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*b843c749SSergey Zigachev * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*b843c749SSergey Zigachev * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*b843c749SSergey Zigachev * OTHER DEALINGS IN THE SOFTWARE. 21*b843c749SSergey Zigachev * 22*b843c749SSergey Zigachev * Authors: AMD 23*b843c749SSergey Zigachev * 24*b843c749SSergey Zigachev */ 25*b843c749SSergey Zigachev 26*b843c749SSergey Zigachev #ifndef _DCN10_IPP_H_ 27*b843c749SSergey Zigachev #define _DCN10_IPP_H_ 28*b843c749SSergey Zigachev 29*b843c749SSergey Zigachev #include "ipp.h" 30*b843c749SSergey Zigachev 31*b843c749SSergey Zigachev #define TO_DCN10_IPP(ipp)\ 32*b843c749SSergey Zigachev container_of(ipp, struct dcn10_ipp, base) 33*b843c749SSergey Zigachev 34*b843c749SSergey Zigachev #define IPP_REG_LIST_DCN(id) \ 35*b843c749SSergey Zigachev SRI(FORMAT_CONTROL, CNVC_CFG, id), \ 36*b843c749SSergey Zigachev SRI(CNVC_SURFACE_PIXEL_FORMAT, CNVC_CFG, id), \ 37*b843c749SSergey Zigachev SRI(CURSOR0_CONTROL, CNVC_CUR, id), \ 38*b843c749SSergey Zigachev SRI(CURSOR0_COLOR0, CNVC_CUR, id), \ 39*b843c749SSergey Zigachev SRI(CURSOR0_COLOR1, CNVC_CUR, id) 40*b843c749SSergey Zigachev 41*b843c749SSergey Zigachev #define IPP_REG_LIST_DCN10(id) \ 42*b843c749SSergey Zigachev IPP_REG_LIST_DCN(id), \ 43*b843c749SSergey Zigachev SRI(CURSOR_SETTINS, HUBPREQ, id), \ 44*b843c749SSergey Zigachev SRI(CURSOR_SURFACE_ADDRESS_HIGH, CURSOR, id), \ 45*b843c749SSergey Zigachev SRI(CURSOR_SURFACE_ADDRESS, CURSOR, id), \ 46*b843c749SSergey Zigachev SRI(CURSOR_SIZE, CURSOR, id), \ 47*b843c749SSergey Zigachev SRI(CURSOR_CONTROL, CURSOR, id), \ 48*b843c749SSergey Zigachev SRI(CURSOR_POSITION, CURSOR, id), \ 49*b843c749SSergey Zigachev SRI(CURSOR_HOT_SPOT, CURSOR, id), \ 50*b843c749SSergey Zigachev SRI(CURSOR_DST_OFFSET, CURSOR, id) 51*b843c749SSergey Zigachev 52*b843c749SSergey Zigachev #define CURSOR0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY__SHIFT 0x4 53*b843c749SSergey Zigachev #define CURSOR0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY_MASK 0x00000010L 54*b843c749SSergey Zigachev #define CURSOR1_CURSOR_CONTROL__CURSOR_2X_MAGNIFY__SHIFT 0x4 55*b843c749SSergey Zigachev #define CURSOR1_CURSOR_CONTROL__CURSOR_2X_MAGNIFY_MASK 0x00000010L 56*b843c749SSergey Zigachev #define CURSOR2_CURSOR_CONTROL__CURSOR_2X_MAGNIFY__SHIFT 0x4 57*b843c749SSergey Zigachev #define CURSOR2_CURSOR_CONTROL__CURSOR_2X_MAGNIFY_MASK 0x00000010L 58*b843c749SSergey Zigachev #define CURSOR3_CURSOR_CONTROL__CURSOR_2X_MAGNIFY__SHIFT 0x4 59*b843c749SSergey Zigachev #define CURSOR3_CURSOR_CONTROL__CURSOR_2X_MAGNIFY_MASK 0x00000010L 60*b843c749SSergey Zigachev 61*b843c749SSergey Zigachev #define IPP_SF(reg_name, field_name, post_fix)\ 62*b843c749SSergey Zigachev .field_name = reg_name ## __ ## field_name ## post_fix 63*b843c749SSergey Zigachev 64*b843c749SSergey Zigachev #define IPP_MASK_SH_LIST_DCN(mask_sh) \ 65*b843c749SSergey Zigachev IPP_SF(CNVC_CFG0_CNVC_SURFACE_PIXEL_FORMAT, CNVC_SURFACE_PIXEL_FORMAT, mask_sh), \ 66*b843c749SSergey Zigachev IPP_SF(CNVC_CFG0_FORMAT_CONTROL, CNVC_BYPASS, mask_sh), \ 67*b843c749SSergey Zigachev IPP_SF(CNVC_CFG0_FORMAT_CONTROL, ALPHA_EN, mask_sh), \ 68*b843c749SSergey Zigachev IPP_SF(CNVC_CFG0_FORMAT_CONTROL, FORMAT_EXPANSION_MODE, mask_sh), \ 69*b843c749SSergey Zigachev IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_MODE, mask_sh), \ 70*b843c749SSergey Zigachev IPP_SF(CNVC_CUR0_CURSOR0_COLOR0, CUR0_COLOR0, mask_sh), \ 71*b843c749SSergey Zigachev IPP_SF(CNVC_CUR0_CURSOR0_COLOR1, CUR0_COLOR1, mask_sh), \ 72*b843c749SSergey Zigachev IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_EXPANSION_MODE, mask_sh), \ 73*b843c749SSergey Zigachev IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_ENABLE, mask_sh) 74*b843c749SSergey Zigachev 75*b843c749SSergey Zigachev #define IPP_MASK_SH_LIST_DCN10(mask_sh) \ 76*b843c749SSergey Zigachev IPP_MASK_SH_LIST_DCN(mask_sh),\ 77*b843c749SSergey Zigachev IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_DST_Y_OFFSET, mask_sh), \ 78*b843c749SSergey Zigachev IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_CHUNK_HDL_ADJUST, mask_sh), \ 79*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \ 80*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_SURFACE_ADDRESS, CURSOR_SURFACE_ADDRESS, mask_sh), \ 81*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_SIZE, CURSOR_WIDTH, mask_sh), \ 82*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_SIZE, CURSOR_HEIGHT, mask_sh), \ 83*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_MODE, mask_sh), \ 84*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_2X_MAGNIFY, mask_sh), \ 85*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_PITCH, mask_sh), \ 86*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_LINES_PER_CHUNK, mask_sh), \ 87*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_ENABLE, mask_sh), \ 88*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_POSITION, CURSOR_X_POSITION, mask_sh), \ 89*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_POSITION, CURSOR_Y_POSITION, mask_sh), \ 90*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_X, mask_sh), \ 91*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_Y, mask_sh), \ 92*b843c749SSergey Zigachev IPP_SF(CURSOR0_CURSOR_DST_OFFSET, CURSOR_DST_X_OFFSET, mask_sh), \ 93*b843c749SSergey Zigachev IPP_SF(CNVC_CFG0_FORMAT_CONTROL, OUTPUT_FP, mask_sh) 94*b843c749SSergey Zigachev 95*b843c749SSergey Zigachev #define IPP_DCN10_REG_FIELD_LIST(type) \ 96*b843c749SSergey Zigachev type CNVC_SURFACE_PIXEL_FORMAT; \ 97*b843c749SSergey Zigachev type CNVC_BYPASS; \ 98*b843c749SSergey Zigachev type ALPHA_EN; \ 99*b843c749SSergey Zigachev type FORMAT_EXPANSION_MODE; \ 100*b843c749SSergey Zigachev type CURSOR0_DST_Y_OFFSET; \ 101*b843c749SSergey Zigachev type CURSOR0_CHUNK_HDL_ADJUST; \ 102*b843c749SSergey Zigachev type CUR0_MODE; \ 103*b843c749SSergey Zigachev type CUR0_COLOR0; \ 104*b843c749SSergey Zigachev type CUR0_COLOR1; \ 105*b843c749SSergey Zigachev type CUR0_EXPANSION_MODE; \ 106*b843c749SSergey Zigachev type CURSOR_SURFACE_ADDRESS_HIGH; \ 107*b843c749SSergey Zigachev type CURSOR_SURFACE_ADDRESS; \ 108*b843c749SSergey Zigachev type CURSOR_WIDTH; \ 109*b843c749SSergey Zigachev type CURSOR_HEIGHT; \ 110*b843c749SSergey Zigachev type CURSOR_MODE; \ 111*b843c749SSergey Zigachev type CURSOR_2X_MAGNIFY; \ 112*b843c749SSergey Zigachev type CURSOR_PITCH; \ 113*b843c749SSergey Zigachev type CURSOR_LINES_PER_CHUNK; \ 114*b843c749SSergey Zigachev type CURSOR_ENABLE; \ 115*b843c749SSergey Zigachev type CUR0_ENABLE; \ 116*b843c749SSergey Zigachev type CURSOR_X_POSITION; \ 117*b843c749SSergey Zigachev type CURSOR_Y_POSITION; \ 118*b843c749SSergey Zigachev type CURSOR_HOT_SPOT_X; \ 119*b843c749SSergey Zigachev type CURSOR_HOT_SPOT_Y; \ 120*b843c749SSergey Zigachev type CURSOR_DST_X_OFFSET; \ 121*b843c749SSergey Zigachev type OUTPUT_FP 122*b843c749SSergey Zigachev 123*b843c749SSergey Zigachev struct dcn10_ipp_shift { 124*b843c749SSergey Zigachev IPP_DCN10_REG_FIELD_LIST(uint8_t); 125*b843c749SSergey Zigachev }; 126*b843c749SSergey Zigachev 127*b843c749SSergey Zigachev struct dcn10_ipp_mask { 128*b843c749SSergey Zigachev IPP_DCN10_REG_FIELD_LIST(uint32_t); 129*b843c749SSergey Zigachev }; 130*b843c749SSergey Zigachev 131*b843c749SSergey Zigachev struct dcn10_ipp_registers { 132*b843c749SSergey Zigachev uint32_t CURSOR_SETTINS; 133*b843c749SSergey Zigachev uint32_t CURSOR_SETTINGS; 134*b843c749SSergey Zigachev uint32_t CNVC_SURFACE_PIXEL_FORMAT; 135*b843c749SSergey Zigachev uint32_t CURSOR0_CONTROL; 136*b843c749SSergey Zigachev uint32_t CURSOR0_COLOR0; 137*b843c749SSergey Zigachev uint32_t CURSOR0_COLOR1; 138*b843c749SSergey Zigachev uint32_t FORMAT_CONTROL; 139*b843c749SSergey Zigachev uint32_t CURSOR_SURFACE_ADDRESS_HIGH; 140*b843c749SSergey Zigachev uint32_t CURSOR_SURFACE_ADDRESS; 141*b843c749SSergey Zigachev uint32_t CURSOR_SIZE; 142*b843c749SSergey Zigachev uint32_t CURSOR_CONTROL; 143*b843c749SSergey Zigachev uint32_t CURSOR_POSITION; 144*b843c749SSergey Zigachev uint32_t CURSOR_HOT_SPOT; 145*b843c749SSergey Zigachev uint32_t CURSOR_DST_OFFSET; 146*b843c749SSergey Zigachev }; 147*b843c749SSergey Zigachev 148*b843c749SSergey Zigachev struct dcn10_ipp { 149*b843c749SSergey Zigachev struct input_pixel_processor base; 150*b843c749SSergey Zigachev 151*b843c749SSergey Zigachev const struct dcn10_ipp_registers *regs; 152*b843c749SSergey Zigachev const struct dcn10_ipp_shift *ipp_shift; 153*b843c749SSergey Zigachev const struct dcn10_ipp_mask *ipp_mask; 154*b843c749SSergey Zigachev 155*b843c749SSergey Zigachev struct dc_cursor_attributes curs_attr; 156*b843c749SSergey Zigachev }; 157*b843c749SSergey Zigachev 158*b843c749SSergey Zigachev void dcn10_ipp_construct(struct dcn10_ipp *ippn10, 159*b843c749SSergey Zigachev struct dc_context *ctx, 160*b843c749SSergey Zigachev int inst, 161*b843c749SSergey Zigachev const struct dcn10_ipp_registers *regs, 162*b843c749SSergey Zigachev const struct dcn10_ipp_shift *ipp_shift, 163*b843c749SSergey Zigachev const struct dcn10_ipp_mask *ipp_mask); 164*b843c749SSergey Zigachev 165*b843c749SSergey Zigachev #endif /* _DCN10_IPP_H_ */ 166