170ccab60SHarry Wentland /* 270ccab60SHarry Wentland * Copyright 2017 Advanced Micro Devices, Inc. 370ccab60SHarry Wentland * 470ccab60SHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 570ccab60SHarry Wentland * copy of this software and associated documentation files (the "Software"), 670ccab60SHarry Wentland * to deal in the Software without restriction, including without limitation 770ccab60SHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 870ccab60SHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 970ccab60SHarry Wentland * Software is furnished to do so, subject to the following conditions: 1070ccab60SHarry Wentland * 1170ccab60SHarry Wentland * The above copyright notice and this permission notice shall be included in 1270ccab60SHarry Wentland * all copies or substantial portions of the Software. 1370ccab60SHarry Wentland * 1470ccab60SHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1570ccab60SHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1670ccab60SHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1770ccab60SHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1870ccab60SHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1970ccab60SHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2070ccab60SHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 2170ccab60SHarry Wentland * 2270ccab60SHarry Wentland * Authors: AMD 2370ccab60SHarry Wentland * 2470ccab60SHarry Wentland */ 2570ccab60SHarry Wentland 2670ccab60SHarry Wentland #ifndef _DCN10_IPP_H_ 2770ccab60SHarry Wentland #define _DCN10_IPP_H_ 2870ccab60SHarry Wentland 2970ccab60SHarry Wentland #include "ipp.h" 3070ccab60SHarry Wentland 3170ccab60SHarry Wentland #define TO_DCN10_IPP(ipp)\ 3270ccab60SHarry Wentland container_of(ipp, struct dcn10_ipp, base) 3370ccab60SHarry Wentland 3435ce37d6SDmytro Laktyushkin #define IPP_REG_LIST_DCN(id) \ 3535ce37d6SDmytro Laktyushkin SRI(FORMAT_CONTROL, CNVC_CFG, id), \ 3670ccab60SHarry Wentland SRI(CNVC_SURFACE_PIXEL_FORMAT, CNVC_CFG, id), \ 3770ccab60SHarry Wentland SRI(CURSOR0_CONTROL, CNVC_CUR, id), \ 3870ccab60SHarry Wentland SRI(CURSOR0_COLOR0, CNVC_CUR, id), \ 3935ce37d6SDmytro Laktyushkin SRI(CURSOR0_COLOR1, CNVC_CUR, id) 4035ce37d6SDmytro Laktyushkin 4135ce37d6SDmytro Laktyushkin #define IPP_REG_LIST_DCN10(id) \ 4235ce37d6SDmytro Laktyushkin IPP_REG_LIST_DCN(id), \ 439b1c9b4cSDmytro Laktyushkin SRI(CURSOR_SETTINS, HUBPREQ, id), \ 4470ccab60SHarry Wentland SRI(CURSOR_SURFACE_ADDRESS_HIGH, CURSOR, id), \ 4570ccab60SHarry Wentland SRI(CURSOR_SURFACE_ADDRESS, CURSOR, id), \ 4670ccab60SHarry Wentland SRI(CURSOR_SIZE, CURSOR, id), \ 4770ccab60SHarry Wentland SRI(CURSOR_CONTROL, CURSOR, id), \ 4870ccab60SHarry Wentland SRI(CURSOR_POSITION, CURSOR, id), \ 4970ccab60SHarry Wentland SRI(CURSOR_HOT_SPOT, CURSOR, id), \ 5070ccab60SHarry Wentland SRI(CURSOR_DST_OFFSET, CURSOR, id) 5170ccab60SHarry Wentland 5283421f32SHarry Wentland #define IPP_REG_LIST_DCN20(id) \ 5383421f32SHarry Wentland IPP_REG_LIST_DCN(id), \ 5483421f32SHarry Wentland SRI(CURSOR_SETTINGS, HUBPREQ, id), \ 5583421f32SHarry Wentland SRI(CURSOR_SURFACE_ADDRESS_HIGH, CURSOR0_, id), \ 5683421f32SHarry Wentland SRI(CURSOR_SURFACE_ADDRESS, CURSOR0_, id), \ 5783421f32SHarry Wentland SRI(CURSOR_SIZE, CURSOR0_, id), \ 5883421f32SHarry Wentland SRI(CURSOR_CONTROL, CURSOR0_, id), \ 5983421f32SHarry Wentland SRI(CURSOR_POSITION, CURSOR0_, id), \ 6083421f32SHarry Wentland SRI(CURSOR_HOT_SPOT, CURSOR0_, id), \ 6183421f32SHarry Wentland SRI(CURSOR_DST_OFFSET, CURSOR0_, id) 6283421f32SHarry Wentland 63*3f68c01bSZhan Liu #define IPP_REG_LIST_DCN201(id) \ 64*3f68c01bSZhan Liu IPP_REG_LIST_DCN(id), \ 65*3f68c01bSZhan Liu SRI(CURSOR_SURFACE_ADDRESS_HIGH, CURSOR0_, id), \ 66*3f68c01bSZhan Liu SRI(CURSOR_SURFACE_ADDRESS, CURSOR0_, id), \ 67*3f68c01bSZhan Liu SRI(CURSOR_SIZE, CURSOR0_, id), \ 68*3f68c01bSZhan Liu SRI(CURSOR_CONTROL, CURSOR0_, id), \ 69*3f68c01bSZhan Liu SRI(CURSOR_POSITION, CURSOR0_, id), \ 70*3f68c01bSZhan Liu SRI(CURSOR_HOT_SPOT, CURSOR0_, id), \ 71*3f68c01bSZhan Liu SRI(CURSOR_DST_OFFSET, CURSOR0_, id) 72*3f68c01bSZhan Liu 73e9475143Spana #define CURSOR0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY__SHIFT 0x4 74e9475143Spana #define CURSOR0_CURSOR_CONTROL__CURSOR_2X_MAGNIFY_MASK 0x00000010L 75e9475143Spana 7670ccab60SHarry Wentland #define IPP_SF(reg_name, field_name, post_fix)\ 7770ccab60SHarry Wentland .field_name = reg_name ## __ ## field_name ## post_fix 7870ccab60SHarry Wentland 7935ce37d6SDmytro Laktyushkin #define IPP_MASK_SH_LIST_DCN(mask_sh) \ 8035ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CFG0_CNVC_SURFACE_PIXEL_FORMAT, CNVC_SURFACE_PIXEL_FORMAT, mask_sh), \ 8135ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CFG0_FORMAT_CONTROL, CNVC_BYPASS, mask_sh), \ 8235ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CFG0_FORMAT_CONTROL, ALPHA_EN, mask_sh), \ 8335ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CFG0_FORMAT_CONTROL, FORMAT_EXPANSION_MODE, mask_sh), \ 8435ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_MODE, mask_sh), \ 8535ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CUR0_CURSOR0_COLOR0, CUR0_COLOR0, mask_sh), \ 8635ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CUR0_CURSOR0_COLOR1, CUR0_COLOR1, mask_sh), \ 8735ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_EXPANSION_MODE, mask_sh), \ 8835ce37d6SDmytro Laktyushkin IPP_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_ENABLE, mask_sh) 8935ce37d6SDmytro Laktyushkin 9035ce37d6SDmytro Laktyushkin #define IPP_MASK_SH_LIST_DCN10(mask_sh) \ 9135ce37d6SDmytro Laktyushkin IPP_MASK_SH_LIST_DCN(mask_sh),\ 929b1c9b4cSDmytro Laktyushkin IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_DST_Y_OFFSET, mask_sh), \ 939b1c9b4cSDmytro Laktyushkin IPP_SF(HUBPREQ0_CURSOR_SETTINS, CURSOR0_CHUNK_HDL_ADJUST, mask_sh), \ 9470ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \ 9570ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_SURFACE_ADDRESS, CURSOR_SURFACE_ADDRESS, mask_sh), \ 9670ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_SIZE, CURSOR_WIDTH, mask_sh), \ 9770ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_SIZE, CURSOR_HEIGHT, mask_sh), \ 9870ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_MODE, mask_sh), \ 99e9475143Spana IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_2X_MAGNIFY, mask_sh), \ 10070ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_PITCH, mask_sh), \ 10170ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_LINES_PER_CHUNK, mask_sh), \ 10270ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_CONTROL, CURSOR_ENABLE, mask_sh), \ 10370ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_POSITION, CURSOR_X_POSITION, mask_sh), \ 10470ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_POSITION, CURSOR_Y_POSITION, mask_sh), \ 10570ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_X, mask_sh), \ 10670ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_Y, mask_sh), \ 10770ccab60SHarry Wentland IPP_SF(CURSOR0_CURSOR_DST_OFFSET, CURSOR_DST_X_OFFSET, mask_sh), \ 10870ccab60SHarry Wentland IPP_SF(CNVC_CFG0_FORMAT_CONTROL, OUTPUT_FP, mask_sh) 10970ccab60SHarry Wentland 11083421f32SHarry Wentland #define IPP_MASK_SH_LIST_DCN20(mask_sh) \ 11183421f32SHarry Wentland IPP_MASK_SH_LIST_DCN(mask_sh), \ 11283421f32SHarry Wentland IPP_SF(HUBPREQ0_CURSOR_SETTINGS, CURSOR0_DST_Y_OFFSET, mask_sh), \ 11383421f32SHarry Wentland IPP_SF(HUBPREQ0_CURSOR_SETTINGS, CURSOR0_CHUNK_HDL_ADJUST, mask_sh), \ 11483421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \ 11583421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_SURFACE_ADDRESS, CURSOR_SURFACE_ADDRESS, mask_sh), \ 11683421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_SIZE, CURSOR_WIDTH, mask_sh), \ 11783421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_SIZE, CURSOR_HEIGHT, mask_sh), \ 11883421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_MODE, mask_sh), \ 11983421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_2X_MAGNIFY, mask_sh), \ 12083421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_PITCH, mask_sh), \ 12183421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_LINES_PER_CHUNK, mask_sh), \ 12283421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_ENABLE, mask_sh), \ 12383421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_POSITION, CURSOR_X_POSITION, mask_sh), \ 12483421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_POSITION, CURSOR_Y_POSITION, mask_sh), \ 12583421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_X, mask_sh), \ 12683421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_Y, mask_sh), \ 12783421f32SHarry Wentland IPP_SF(CURSOR0_0_CURSOR_DST_OFFSET, CURSOR_DST_X_OFFSET, mask_sh) 12883421f32SHarry Wentland 129*3f68c01bSZhan Liu #define IPP_MASK_SH_LIST_DCN201(mask_sh) \ 130*3f68c01bSZhan Liu IPP_MASK_SH_LIST_DCN(mask_sh), \ 131*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \ 132*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_SURFACE_ADDRESS, CURSOR_SURFACE_ADDRESS, mask_sh), \ 133*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_SIZE, CURSOR_WIDTH, mask_sh), \ 134*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_SIZE, CURSOR_HEIGHT, mask_sh), \ 135*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_MODE, mask_sh), \ 136*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_2X_MAGNIFY, mask_sh), \ 137*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_PITCH, mask_sh), \ 138*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_LINES_PER_CHUNK, mask_sh), \ 139*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_CONTROL, CURSOR_ENABLE, mask_sh), \ 140*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_POSITION, CURSOR_X_POSITION, mask_sh), \ 141*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_POSITION, CURSOR_Y_POSITION, mask_sh), \ 142*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_X, mask_sh), \ 143*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_HOT_SPOT, CURSOR_HOT_SPOT_Y, mask_sh), \ 144*3f68c01bSZhan Liu IPP_SF(CURSOR0_0_CURSOR_DST_OFFSET, CURSOR_DST_X_OFFSET, mask_sh) 145*3f68c01bSZhan Liu 14670ccab60SHarry Wentland #define IPP_DCN10_REG_FIELD_LIST(type) \ 14770ccab60SHarry Wentland type CNVC_SURFACE_PIXEL_FORMAT; \ 14870ccab60SHarry Wentland type CNVC_BYPASS; \ 14970ccab60SHarry Wentland type ALPHA_EN; \ 15070ccab60SHarry Wentland type FORMAT_EXPANSION_MODE; \ 15170ccab60SHarry Wentland type CURSOR0_DST_Y_OFFSET; \ 15270ccab60SHarry Wentland type CURSOR0_CHUNK_HDL_ADJUST; \ 15370ccab60SHarry Wentland type CUR0_MODE; \ 15470ccab60SHarry Wentland type CUR0_COLOR0; \ 15570ccab60SHarry Wentland type CUR0_COLOR1; \ 15670ccab60SHarry Wentland type CUR0_EXPANSION_MODE; \ 15770ccab60SHarry Wentland type CURSOR_SURFACE_ADDRESS_HIGH; \ 15870ccab60SHarry Wentland type CURSOR_SURFACE_ADDRESS; \ 15970ccab60SHarry Wentland type CURSOR_WIDTH; \ 16070ccab60SHarry Wentland type CURSOR_HEIGHT; \ 16170ccab60SHarry Wentland type CURSOR_MODE; \ 162e9475143Spana type CURSOR_2X_MAGNIFY; \ 16370ccab60SHarry Wentland type CURSOR_PITCH; \ 16470ccab60SHarry Wentland type CURSOR_LINES_PER_CHUNK; \ 16570ccab60SHarry Wentland type CURSOR_ENABLE; \ 16670ccab60SHarry Wentland type CUR0_ENABLE; \ 16770ccab60SHarry Wentland type CURSOR_X_POSITION; \ 16870ccab60SHarry Wentland type CURSOR_Y_POSITION; \ 16970ccab60SHarry Wentland type CURSOR_HOT_SPOT_X; \ 17070ccab60SHarry Wentland type CURSOR_HOT_SPOT_Y; \ 17170ccab60SHarry Wentland type CURSOR_DST_X_OFFSET; \ 17270ccab60SHarry Wentland type OUTPUT_FP 17370ccab60SHarry Wentland 17470ccab60SHarry Wentland struct dcn10_ipp_shift { 17570ccab60SHarry Wentland IPP_DCN10_REG_FIELD_LIST(uint8_t); 17670ccab60SHarry Wentland }; 17770ccab60SHarry Wentland 17870ccab60SHarry Wentland struct dcn10_ipp_mask { 17970ccab60SHarry Wentland IPP_DCN10_REG_FIELD_LIST(uint32_t); 18070ccab60SHarry Wentland }; 18170ccab60SHarry Wentland 18270ccab60SHarry Wentland struct dcn10_ipp_registers { 18370ccab60SHarry Wentland uint32_t CURSOR_SETTINS; 1849b1c9b4cSDmytro Laktyushkin uint32_t CURSOR_SETTINGS; 18570ccab60SHarry Wentland uint32_t CNVC_SURFACE_PIXEL_FORMAT; 18670ccab60SHarry Wentland uint32_t CURSOR0_CONTROL; 18770ccab60SHarry Wentland uint32_t CURSOR0_COLOR0; 18870ccab60SHarry Wentland uint32_t CURSOR0_COLOR1; 18970ccab60SHarry Wentland uint32_t FORMAT_CONTROL; 19070ccab60SHarry Wentland uint32_t CURSOR_SURFACE_ADDRESS_HIGH; 19170ccab60SHarry Wentland uint32_t CURSOR_SURFACE_ADDRESS; 19270ccab60SHarry Wentland uint32_t CURSOR_SIZE; 19370ccab60SHarry Wentland uint32_t CURSOR_CONTROL; 19470ccab60SHarry Wentland uint32_t CURSOR_POSITION; 19570ccab60SHarry Wentland uint32_t CURSOR_HOT_SPOT; 19670ccab60SHarry Wentland uint32_t CURSOR_DST_OFFSET; 19770ccab60SHarry Wentland }; 19870ccab60SHarry Wentland 19970ccab60SHarry Wentland struct dcn10_ipp { 20070ccab60SHarry Wentland struct input_pixel_processor base; 20170ccab60SHarry Wentland 20270ccab60SHarry Wentland const struct dcn10_ipp_registers *regs; 20370ccab60SHarry Wentland const struct dcn10_ipp_shift *ipp_shift; 20470ccab60SHarry Wentland const struct dcn10_ipp_mask *ipp_mask; 20570ccab60SHarry Wentland 20670ccab60SHarry Wentland struct dc_cursor_attributes curs_attr; 20770ccab60SHarry Wentland }; 20870ccab60SHarry Wentland 20970ccab60SHarry Wentland void dcn10_ipp_construct(struct dcn10_ipp *ippn10, 21070ccab60SHarry Wentland struct dc_context *ctx, 21170ccab60SHarry Wentland int inst, 21270ccab60SHarry Wentland const struct dcn10_ipp_registers *regs, 21370ccab60SHarry Wentland const struct dcn10_ipp_shift *ipp_shift, 21470ccab60SHarry Wentland const struct dcn10_ipp_mask *ipp_mask); 21570ccab60SHarry Wentland 21683421f32SHarry Wentland void dcn20_ipp_construct(struct dcn10_ipp *ippn10, 21783421f32SHarry Wentland struct dc_context *ctx, 21883421f32SHarry Wentland int inst, 21983421f32SHarry Wentland const struct dcn10_ipp_registers *regs, 22083421f32SHarry Wentland const struct dcn10_ipp_shift *ipp_shift, 22183421f32SHarry Wentland const struct dcn10_ipp_mask *ipp_mask); 22283421f32SHarry Wentland 22370ccab60SHarry Wentland #endif /* _DCN10_IPP_H_ */ 224