18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 128c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 138c2ecf20Sopenharmony_ci * Software. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 168c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 178c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 188c2ecf20Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 198c2ecf20Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 208c2ecf20Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 218c2ecf20Sopenharmony_ci * SOFTWARE. 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * Authors: 248c2ecf20Sopenharmony_ci * Kevin Tian <kevin.tian@intel.com> 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * Contributors: 278c2ecf20Sopenharmony_ci * Bing Niu <bing.niu@intel.com> 288c2ecf20Sopenharmony_ci * Xu Han <xu.han@intel.com> 298c2ecf20Sopenharmony_ci * Ping Gao <ping.a.gao@intel.com> 308c2ecf20Sopenharmony_ci * Xiaoguang Chen <xiaoguang.chen@intel.com> 318c2ecf20Sopenharmony_ci * Yang Liu <yang2.liu@intel.com> 328c2ecf20Sopenharmony_ci * Tina Zhang <tina.zhang@intel.com> 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#ifndef _GVT_FB_DECODER_H_ 378c2ecf20Sopenharmony_ci#define _GVT_FB_DECODER_H_ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#include <linux/types.h> 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define _PLANE_CTL_FORMAT_SHIFT 24 428c2ecf20Sopenharmony_ci#define _PLANE_CTL_TILED_SHIFT 10 438c2ecf20Sopenharmony_ci#define _PIPE_V_SRCSZ_SHIFT 0 448c2ecf20Sopenharmony_ci#define _PIPE_V_SRCSZ_MASK (0xfff << _PIPE_V_SRCSZ_SHIFT) 458c2ecf20Sopenharmony_ci#define _PIPE_H_SRCSZ_SHIFT 16 468c2ecf20Sopenharmony_ci#define _PIPE_H_SRCSZ_MASK (0x1fff << _PIPE_H_SRCSZ_SHIFT) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define _PRI_PLANE_FMT_SHIFT 26 498c2ecf20Sopenharmony_ci#define _PRI_PLANE_STRIDE_MASK (0x3ff << 6) 508c2ecf20Sopenharmony_ci#define _PRI_PLANE_X_OFF_SHIFT 0 518c2ecf20Sopenharmony_ci#define _PRI_PLANE_X_OFF_MASK (0x1fff << _PRI_PLANE_X_OFF_SHIFT) 528c2ecf20Sopenharmony_ci#define _PRI_PLANE_Y_OFF_SHIFT 16 538c2ecf20Sopenharmony_ci#define _PRI_PLANE_Y_OFF_MASK (0xfff << _PRI_PLANE_Y_OFF_SHIFT) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define _CURSOR_MODE 0x3f 568c2ecf20Sopenharmony_ci#define _CURSOR_ALPHA_FORCE_SHIFT 8 578c2ecf20Sopenharmony_ci#define _CURSOR_ALPHA_FORCE_MASK (0x3 << _CURSOR_ALPHA_FORCE_SHIFT) 588c2ecf20Sopenharmony_ci#define _CURSOR_ALPHA_PLANE_SHIFT 10 598c2ecf20Sopenharmony_ci#define _CURSOR_ALPHA_PLANE_MASK (0x3 << _CURSOR_ALPHA_PLANE_SHIFT) 608c2ecf20Sopenharmony_ci#define _CURSOR_POS_X_SHIFT 0 618c2ecf20Sopenharmony_ci#define _CURSOR_POS_X_MASK (0x1fff << _CURSOR_POS_X_SHIFT) 628c2ecf20Sopenharmony_ci#define _CURSOR_SIGN_X_SHIFT 15 638c2ecf20Sopenharmony_ci#define _CURSOR_SIGN_X_MASK (1 << _CURSOR_SIGN_X_SHIFT) 648c2ecf20Sopenharmony_ci#define _CURSOR_POS_Y_SHIFT 16 658c2ecf20Sopenharmony_ci#define _CURSOR_POS_Y_MASK (0xfff << _CURSOR_POS_Y_SHIFT) 668c2ecf20Sopenharmony_ci#define _CURSOR_SIGN_Y_SHIFT 31 678c2ecf20Sopenharmony_ci#define _CURSOR_SIGN_Y_MASK (1 << _CURSOR_SIGN_Y_SHIFT) 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define _SPRITE_FMT_SHIFT 25 708c2ecf20Sopenharmony_ci#define _SPRITE_COLOR_ORDER_SHIFT 20 718c2ecf20Sopenharmony_ci#define _SPRITE_YUV_ORDER_SHIFT 16 728c2ecf20Sopenharmony_ci#define _SPRITE_STRIDE_SHIFT 6 738c2ecf20Sopenharmony_ci#define _SPRITE_STRIDE_MASK (0x1ff << _SPRITE_STRIDE_SHIFT) 748c2ecf20Sopenharmony_ci#define _SPRITE_SIZE_WIDTH_SHIFT 0 758c2ecf20Sopenharmony_ci#define _SPRITE_SIZE_HEIGHT_SHIFT 16 768c2ecf20Sopenharmony_ci#define _SPRITE_SIZE_WIDTH_MASK (0x1fff << _SPRITE_SIZE_WIDTH_SHIFT) 778c2ecf20Sopenharmony_ci#define _SPRITE_SIZE_HEIGHT_MASK (0xfff << _SPRITE_SIZE_HEIGHT_SHIFT) 788c2ecf20Sopenharmony_ci#define _SPRITE_POS_X_SHIFT 0 798c2ecf20Sopenharmony_ci#define _SPRITE_POS_Y_SHIFT 16 808c2ecf20Sopenharmony_ci#define _SPRITE_POS_X_MASK (0x1fff << _SPRITE_POS_X_SHIFT) 818c2ecf20Sopenharmony_ci#define _SPRITE_POS_Y_MASK (0xfff << _SPRITE_POS_Y_SHIFT) 828c2ecf20Sopenharmony_ci#define _SPRITE_OFFSET_START_X_SHIFT 0 838c2ecf20Sopenharmony_ci#define _SPRITE_OFFSET_START_Y_SHIFT 16 848c2ecf20Sopenharmony_ci#define _SPRITE_OFFSET_START_X_MASK (0x1fff << _SPRITE_OFFSET_START_X_SHIFT) 858c2ecf20Sopenharmony_ci#define _SPRITE_OFFSET_START_Y_MASK (0xfff << _SPRITE_OFFSET_START_Y_SHIFT) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cienum GVT_FB_EVENT { 888c2ecf20Sopenharmony_ci FB_MODE_SET_START = 1, 898c2ecf20Sopenharmony_ci FB_MODE_SET_END, 908c2ecf20Sopenharmony_ci FB_DISPLAY_FLIP, 918c2ecf20Sopenharmony_ci}; 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_cienum DDI_PORT { 948c2ecf20Sopenharmony_ci DDI_PORT_NONE = 0, 958c2ecf20Sopenharmony_ci DDI_PORT_B = 1, 968c2ecf20Sopenharmony_ci DDI_PORT_C = 2, 978c2ecf20Sopenharmony_ci DDI_PORT_D = 3, 988c2ecf20Sopenharmony_ci DDI_PORT_E = 4 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cistruct intel_gvt; 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci/* color space conversion and gamma correction are not included */ 1048c2ecf20Sopenharmony_cistruct intel_vgpu_primary_plane_format { 1058c2ecf20Sopenharmony_ci u8 enabled; /* plane is enabled */ 1068c2ecf20Sopenharmony_ci u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */ 1078c2ecf20Sopenharmony_ci u8 bpp; /* bits per pixel */ 1088c2ecf20Sopenharmony_ci u32 hw_format; /* format field in the PRI_CTL register */ 1098c2ecf20Sopenharmony_ci u32 drm_format; /* format in DRM definition */ 1108c2ecf20Sopenharmony_ci u32 base; /* framebuffer base in graphics memory */ 1118c2ecf20Sopenharmony_ci u64 base_gpa; 1128c2ecf20Sopenharmony_ci u32 x_offset; /* in pixels */ 1138c2ecf20Sopenharmony_ci u32 y_offset; /* in lines */ 1148c2ecf20Sopenharmony_ci u32 width; /* in pixels */ 1158c2ecf20Sopenharmony_ci u32 height; /* in lines */ 1168c2ecf20Sopenharmony_ci u32 stride; /* in bytes */ 1178c2ecf20Sopenharmony_ci}; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistruct intel_vgpu_sprite_plane_format { 1208c2ecf20Sopenharmony_ci u8 enabled; /* plane is enabled */ 1218c2ecf20Sopenharmony_ci u8 tiled; /* X-tiled */ 1228c2ecf20Sopenharmony_ci u8 bpp; /* bits per pixel */ 1238c2ecf20Sopenharmony_ci u32 hw_format; /* format field in the SPR_CTL register */ 1248c2ecf20Sopenharmony_ci u32 drm_format; /* format in DRM definition */ 1258c2ecf20Sopenharmony_ci u32 base; /* sprite base in graphics memory */ 1268c2ecf20Sopenharmony_ci u64 base_gpa; 1278c2ecf20Sopenharmony_ci u32 x_pos; /* in pixels */ 1288c2ecf20Sopenharmony_ci u32 y_pos; /* in lines */ 1298c2ecf20Sopenharmony_ci u32 x_offset; /* in pixels */ 1308c2ecf20Sopenharmony_ci u32 y_offset; /* in lines */ 1318c2ecf20Sopenharmony_ci u32 width; /* in pixels */ 1328c2ecf20Sopenharmony_ci u32 height; /* in lines */ 1338c2ecf20Sopenharmony_ci u32 stride; /* in bytes */ 1348c2ecf20Sopenharmony_ci}; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_cistruct intel_vgpu_cursor_plane_format { 1378c2ecf20Sopenharmony_ci u8 enabled; 1388c2ecf20Sopenharmony_ci u8 mode; /* cursor mode select */ 1398c2ecf20Sopenharmony_ci u8 bpp; /* bits per pixel */ 1408c2ecf20Sopenharmony_ci u32 drm_format; /* format in DRM definition */ 1418c2ecf20Sopenharmony_ci u32 base; /* cursor base in graphics memory */ 1428c2ecf20Sopenharmony_ci u64 base_gpa; 1438c2ecf20Sopenharmony_ci u32 x_pos; /* in pixels */ 1448c2ecf20Sopenharmony_ci u32 y_pos; /* in lines */ 1458c2ecf20Sopenharmony_ci u8 x_sign; /* X Position Sign */ 1468c2ecf20Sopenharmony_ci u8 y_sign; /* Y Position Sign */ 1478c2ecf20Sopenharmony_ci u32 width; /* in pixels */ 1488c2ecf20Sopenharmony_ci u32 height; /* in lines */ 1498c2ecf20Sopenharmony_ci u32 x_hot; /* in pixels */ 1508c2ecf20Sopenharmony_ci u32 y_hot; /* in pixels */ 1518c2ecf20Sopenharmony_ci}; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_cistruct intel_vgpu_pipe_format { 1548c2ecf20Sopenharmony_ci struct intel_vgpu_primary_plane_format primary; 1558c2ecf20Sopenharmony_ci struct intel_vgpu_sprite_plane_format sprite; 1568c2ecf20Sopenharmony_ci struct intel_vgpu_cursor_plane_format cursor; 1578c2ecf20Sopenharmony_ci enum DDI_PORT ddi_port; /* the DDI port that pipe is connected to */ 1588c2ecf20Sopenharmony_ci}; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_cistruct intel_vgpu_fb_format { 1618c2ecf20Sopenharmony_ci struct intel_vgpu_pipe_format pipes[I915_MAX_PIPES]; 1628c2ecf20Sopenharmony_ci}; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ciint intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, 1658c2ecf20Sopenharmony_ci struct intel_vgpu_primary_plane_format *plane); 1668c2ecf20Sopenharmony_ciint intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu, 1678c2ecf20Sopenharmony_ci struct intel_vgpu_cursor_plane_format *plane); 1688c2ecf20Sopenharmony_ciint intel_vgpu_decode_sprite_plane(struct intel_vgpu *vgpu, 1698c2ecf20Sopenharmony_ci struct intel_vgpu_sprite_plane_format *plane); 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#endif 172