19f31d106STina Zhang /* 29f31d106STina Zhang * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 39f31d106STina Zhang * 49f31d106STina Zhang * Permission is hereby granted, free of charge, to any person obtaining a 59f31d106STina Zhang * copy of this software and associated documentation files (the "Software"), 69f31d106STina Zhang * to deal in the Software without restriction, including without limitation 79f31d106STina Zhang * the rights to use, copy, modify, merge, publish, distribute, sublicense, 89f31d106STina Zhang * and/or sell copies of the Software, and to permit persons to whom the 99f31d106STina Zhang * Software is furnished to do so, subject to the following conditions: 109f31d106STina Zhang * 119f31d106STina Zhang * The above copyright notice and this permission notice (including the next 129f31d106STina Zhang * paragraph) shall be included in all copies or substantial portions of the 139f31d106STina Zhang * Software. 149f31d106STina Zhang * 159f31d106STina Zhang * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 169f31d106STina Zhang * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 179f31d106STina Zhang * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 189f31d106STina Zhang * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 199f31d106STina Zhang * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 209f31d106STina Zhang * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 219f31d106STina Zhang * SOFTWARE. 229f31d106STina Zhang * 239f31d106STina Zhang * Authors: 249f31d106STina Zhang * Kevin Tian <kevin.tian@intel.com> 259f31d106STina Zhang * 269f31d106STina Zhang * Contributors: 279f31d106STina Zhang * Bing Niu <bing.niu@intel.com> 289f31d106STina Zhang * Xu Han <xu.han@intel.com> 299f31d106STina Zhang * Ping Gao <ping.a.gao@intel.com> 309f31d106STina Zhang * Xiaoguang Chen <xiaoguang.chen@intel.com> 319f31d106STina Zhang * Yang Liu <yang2.liu@intel.com> 329f31d106STina Zhang * Tina Zhang <tina.zhang@intel.com> 339f31d106STina Zhang * 349f31d106STina Zhang */ 359f31d106STina Zhang 369f31d106STina Zhang #ifndef _GVT_FB_DECODER_H_ 379f31d106STina Zhang #define _GVT_FB_DECODER_H_ 389f31d106STina Zhang 39ab11a927SMasahiro Yamada #include <linux/types.h> 40ab11a927SMasahiro Yamada 41*acc855d3SJani Nikula #include "display/intel_display_limits.h" 42265f6c0fSJani Nikula 43265f6c0fSJani Nikula struct intel_vgpu; 44265f6c0fSJani Nikula 459f31d106STina Zhang #define _PLANE_CTL_FORMAT_SHIFT 24 469f31d106STina Zhang #define _PLANE_CTL_TILED_SHIFT 10 479f31d106STina Zhang #define _PIPE_V_SRCSZ_SHIFT 0 489f31d106STina Zhang #define _PIPE_V_SRCSZ_MASK (0xfff << _PIPE_V_SRCSZ_SHIFT) 499f31d106STina Zhang #define _PIPE_H_SRCSZ_SHIFT 16 509f31d106STina Zhang #define _PIPE_H_SRCSZ_MASK (0x1fff << _PIPE_H_SRCSZ_SHIFT) 519f31d106STina Zhang 529f31d106STina Zhang #define _PRI_PLANE_FMT_SHIFT 26 539f31d106STina Zhang #define _PRI_PLANE_STRIDE_MASK (0x3ff << 6) 549f31d106STina Zhang #define _PRI_PLANE_X_OFF_SHIFT 0 559f31d106STina Zhang #define _PRI_PLANE_X_OFF_MASK (0x1fff << _PRI_PLANE_X_OFF_SHIFT) 569f31d106STina Zhang #define _PRI_PLANE_Y_OFF_SHIFT 16 579f31d106STina Zhang #define _PRI_PLANE_Y_OFF_MASK (0xfff << _PRI_PLANE_Y_OFF_SHIFT) 589f31d106STina Zhang 599f31d106STina Zhang #define _CURSOR_MODE 0x3f 609f31d106STina Zhang #define _CURSOR_ALPHA_FORCE_SHIFT 8 619f31d106STina Zhang #define _CURSOR_ALPHA_FORCE_MASK (0x3 << _CURSOR_ALPHA_FORCE_SHIFT) 629f31d106STina Zhang #define _CURSOR_ALPHA_PLANE_SHIFT 10 639f31d106STina Zhang #define _CURSOR_ALPHA_PLANE_MASK (0x3 << _CURSOR_ALPHA_PLANE_SHIFT) 649f31d106STina Zhang #define _CURSOR_POS_X_SHIFT 0 659f31d106STina Zhang #define _CURSOR_POS_X_MASK (0x1fff << _CURSOR_POS_X_SHIFT) 669f31d106STina Zhang #define _CURSOR_SIGN_X_SHIFT 15 679f31d106STina Zhang #define _CURSOR_SIGN_X_MASK (1 << _CURSOR_SIGN_X_SHIFT) 689f31d106STina Zhang #define _CURSOR_POS_Y_SHIFT 16 699f31d106STina Zhang #define _CURSOR_POS_Y_MASK (0xfff << _CURSOR_POS_Y_SHIFT) 709f31d106STina Zhang #define _CURSOR_SIGN_Y_SHIFT 31 719f31d106STina Zhang #define _CURSOR_SIGN_Y_MASK (1 << _CURSOR_SIGN_Y_SHIFT) 729f31d106STina Zhang 739f31d106STina Zhang #define _SPRITE_FMT_SHIFT 25 749f31d106STina Zhang #define _SPRITE_COLOR_ORDER_SHIFT 20 759f31d106STina Zhang #define _SPRITE_YUV_ORDER_SHIFT 16 769f31d106STina Zhang #define _SPRITE_STRIDE_SHIFT 6 779f31d106STina Zhang #define _SPRITE_STRIDE_MASK (0x1ff << _SPRITE_STRIDE_SHIFT) 789f31d106STina Zhang #define _SPRITE_SIZE_WIDTH_SHIFT 0 799f31d106STina Zhang #define _SPRITE_SIZE_HEIGHT_SHIFT 16 809f31d106STina Zhang #define _SPRITE_SIZE_WIDTH_MASK (0x1fff << _SPRITE_SIZE_WIDTH_SHIFT) 819f31d106STina Zhang #define _SPRITE_SIZE_HEIGHT_MASK (0xfff << _SPRITE_SIZE_HEIGHT_SHIFT) 829f31d106STina Zhang #define _SPRITE_POS_X_SHIFT 0 839f31d106STina Zhang #define _SPRITE_POS_Y_SHIFT 16 849f31d106STina Zhang #define _SPRITE_POS_X_MASK (0x1fff << _SPRITE_POS_X_SHIFT) 859f31d106STina Zhang #define _SPRITE_POS_Y_MASK (0xfff << _SPRITE_POS_Y_SHIFT) 869f31d106STina Zhang #define _SPRITE_OFFSET_START_X_SHIFT 0 879f31d106STina Zhang #define _SPRITE_OFFSET_START_Y_SHIFT 16 889f31d106STina Zhang #define _SPRITE_OFFSET_START_X_MASK (0x1fff << _SPRITE_OFFSET_START_X_SHIFT) 899f31d106STina Zhang #define _SPRITE_OFFSET_START_Y_MASK (0xfff << _SPRITE_OFFSET_START_Y_SHIFT) 909f31d106STina Zhang 919f31d106STina Zhang enum GVT_FB_EVENT { 929f31d106STina Zhang FB_MODE_SET_START = 1, 939f31d106STina Zhang FB_MODE_SET_END, 949f31d106STina Zhang FB_DISPLAY_FLIP, 959f31d106STina Zhang }; 969f31d106STina Zhang 979f31d106STina Zhang enum DDI_PORT { 989f31d106STina Zhang DDI_PORT_NONE = 0, 999f31d106STina Zhang DDI_PORT_B = 1, 1009f31d106STina Zhang DDI_PORT_C = 2, 1019f31d106STina Zhang DDI_PORT_D = 3, 1029f31d106STina Zhang DDI_PORT_E = 4 1039f31d106STina Zhang }; 1049f31d106STina Zhang 1059f31d106STina Zhang /* color space conversion and gamma correction are not included */ 1069f31d106STina Zhang struct intel_vgpu_primary_plane_format { 1079f31d106STina Zhang u8 enabled; /* plane is enabled */ 108b244ffa1SZhenyu Wang u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */ 1099f31d106STina Zhang u8 bpp; /* bits per pixel */ 1109f31d106STina Zhang u32 hw_format; /* format field in the PRI_CTL register */ 1119f31d106STina Zhang u32 drm_format; /* format in DRM definition */ 1129f31d106STina Zhang u32 base; /* framebuffer base in graphics memory */ 1139f31d106STina Zhang u64 base_gpa; 1149f31d106STina Zhang u32 x_offset; /* in pixels */ 1159f31d106STina Zhang u32 y_offset; /* in lines */ 1169f31d106STina Zhang u32 width; /* in pixels */ 1179f31d106STina Zhang u32 height; /* in lines */ 1189f31d106STina Zhang u32 stride; /* in bytes */ 1199f31d106STina Zhang }; 1209f31d106STina Zhang 1219f31d106STina Zhang struct intel_vgpu_sprite_plane_format { 1229f31d106STina Zhang u8 enabled; /* plane is enabled */ 1239f31d106STina Zhang u8 tiled; /* X-tiled */ 1249f31d106STina Zhang u8 bpp; /* bits per pixel */ 1259f31d106STina Zhang u32 hw_format; /* format field in the SPR_CTL register */ 1269f31d106STina Zhang u32 drm_format; /* format in DRM definition */ 1279f31d106STina Zhang u32 base; /* sprite base in graphics memory */ 1289f31d106STina Zhang u64 base_gpa; 1299f31d106STina Zhang u32 x_pos; /* in pixels */ 1309f31d106STina Zhang u32 y_pos; /* in lines */ 1319f31d106STina Zhang u32 x_offset; /* in pixels */ 1329f31d106STina Zhang u32 y_offset; /* in lines */ 1339f31d106STina Zhang u32 width; /* in pixels */ 1349f31d106STina Zhang u32 height; /* in lines */ 1359f31d106STina Zhang u32 stride; /* in bytes */ 1369f31d106STina Zhang }; 1379f31d106STina Zhang 1389f31d106STina Zhang struct intel_vgpu_cursor_plane_format { 1399f31d106STina Zhang u8 enabled; 1409f31d106STina Zhang u8 mode; /* cursor mode select */ 1419f31d106STina Zhang u8 bpp; /* bits per pixel */ 1429f31d106STina Zhang u32 drm_format; /* format in DRM definition */ 1439f31d106STina Zhang u32 base; /* cursor base in graphics memory */ 1449f31d106STina Zhang u64 base_gpa; 1459f31d106STina Zhang u32 x_pos; /* in pixels */ 1469f31d106STina Zhang u32 y_pos; /* in lines */ 1479f31d106STina Zhang u8 x_sign; /* X Position Sign */ 1489f31d106STina Zhang u8 y_sign; /* Y Position Sign */ 1499f31d106STina Zhang u32 width; /* in pixels */ 1509f31d106STina Zhang u32 height; /* in lines */ 1519f31d106STina Zhang u32 x_hot; /* in pixels */ 1529f31d106STina Zhang u32 y_hot; /* in pixels */ 1539f31d106STina Zhang }; 1549f31d106STina Zhang 1559f31d106STina Zhang int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, 1569f31d106STina Zhang struct intel_vgpu_primary_plane_format *plane); 1579f31d106STina Zhang int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu, 1589f31d106STina Zhang struct intel_vgpu_cursor_plane_format *plane); 1599f31d106STina Zhang int intel_vgpu_decode_sprite_plane(struct intel_vgpu *vgpu, 1609f31d106STina Zhang struct intel_vgpu_sprite_plane_format *plane); 1619f31d106STina Zhang 1629f31d106STina Zhang #endif 163