1 1.1 riastrad /* $NetBSD: fb_decoder.h,v 1.2 2021/12/18 23:45:31 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice (including the next 14 1.1 riastrad * paragraph) shall be included in all copies or substantial portions of the 15 1.1 riastrad * Software. 16 1.1 riastrad * 17 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 1.1 riastrad * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 1.1 riastrad * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 1.1 riastrad * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 1.1 riastrad * SOFTWARE. 24 1.1 riastrad * 25 1.1 riastrad * Authors: 26 1.1 riastrad * Kevin Tian <kevin.tian (at) intel.com> 27 1.1 riastrad * 28 1.1 riastrad * Contributors: 29 1.1 riastrad * Bing Niu <bing.niu (at) intel.com> 30 1.1 riastrad * Xu Han <xu.han (at) intel.com> 31 1.1 riastrad * Ping Gao <ping.a.gao (at) intel.com> 32 1.1 riastrad * Xiaoguang Chen <xiaoguang.chen (at) intel.com> 33 1.1 riastrad * Yang Liu <yang2.liu (at) intel.com> 34 1.1 riastrad * Tina Zhang <tina.zhang (at) intel.com> 35 1.1 riastrad * 36 1.1 riastrad */ 37 1.1 riastrad 38 1.1 riastrad #ifndef _GVT_FB_DECODER_H_ 39 1.1 riastrad #define _GVT_FB_DECODER_H_ 40 1.1 riastrad 41 1.1 riastrad #include <linux/types.h> 42 1.1 riastrad 43 1.1 riastrad #define _PLANE_CTL_FORMAT_SHIFT 24 44 1.1 riastrad #define _PLANE_CTL_TILED_SHIFT 10 45 1.1 riastrad #define _PIPE_V_SRCSZ_SHIFT 0 46 1.1 riastrad #define _PIPE_V_SRCSZ_MASK (0xfff << _PIPE_V_SRCSZ_SHIFT) 47 1.1 riastrad #define _PIPE_H_SRCSZ_SHIFT 16 48 1.1 riastrad #define _PIPE_H_SRCSZ_MASK (0x1fff << _PIPE_H_SRCSZ_SHIFT) 49 1.1 riastrad 50 1.1 riastrad #define _PRI_PLANE_FMT_SHIFT 26 51 1.1 riastrad #define _PRI_PLANE_STRIDE_MASK (0x3ff << 6) 52 1.1 riastrad #define _PRI_PLANE_X_OFF_SHIFT 0 53 1.1 riastrad #define _PRI_PLANE_X_OFF_MASK (0x1fff << _PRI_PLANE_X_OFF_SHIFT) 54 1.1 riastrad #define _PRI_PLANE_Y_OFF_SHIFT 16 55 1.1 riastrad #define _PRI_PLANE_Y_OFF_MASK (0xfff << _PRI_PLANE_Y_OFF_SHIFT) 56 1.1 riastrad 57 1.1 riastrad #define _CURSOR_MODE 0x3f 58 1.1 riastrad #define _CURSOR_ALPHA_FORCE_SHIFT 8 59 1.1 riastrad #define _CURSOR_ALPHA_FORCE_MASK (0x3 << _CURSOR_ALPHA_FORCE_SHIFT) 60 1.1 riastrad #define _CURSOR_ALPHA_PLANE_SHIFT 10 61 1.1 riastrad #define _CURSOR_ALPHA_PLANE_MASK (0x3 << _CURSOR_ALPHA_PLANE_SHIFT) 62 1.1 riastrad #define _CURSOR_POS_X_SHIFT 0 63 1.1 riastrad #define _CURSOR_POS_X_MASK (0x1fff << _CURSOR_POS_X_SHIFT) 64 1.1 riastrad #define _CURSOR_SIGN_X_SHIFT 15 65 1.1 riastrad #define _CURSOR_SIGN_X_MASK (1 << _CURSOR_SIGN_X_SHIFT) 66 1.1 riastrad #define _CURSOR_POS_Y_SHIFT 16 67 1.1 riastrad #define _CURSOR_POS_Y_MASK (0xfff << _CURSOR_POS_Y_SHIFT) 68 1.1 riastrad #define _CURSOR_SIGN_Y_SHIFT 31 69 1.1 riastrad #define _CURSOR_SIGN_Y_MASK (1 << _CURSOR_SIGN_Y_SHIFT) 70 1.1 riastrad 71 1.1 riastrad #define _SPRITE_FMT_SHIFT 25 72 1.1 riastrad #define _SPRITE_COLOR_ORDER_SHIFT 20 73 1.1 riastrad #define _SPRITE_YUV_ORDER_SHIFT 16 74 1.1 riastrad #define _SPRITE_STRIDE_SHIFT 6 75 1.1 riastrad #define _SPRITE_STRIDE_MASK (0x1ff << _SPRITE_STRIDE_SHIFT) 76 1.1 riastrad #define _SPRITE_SIZE_WIDTH_SHIFT 0 77 1.1 riastrad #define _SPRITE_SIZE_HEIGHT_SHIFT 16 78 1.1 riastrad #define _SPRITE_SIZE_WIDTH_MASK (0x1fff << _SPRITE_SIZE_WIDTH_SHIFT) 79 1.1 riastrad #define _SPRITE_SIZE_HEIGHT_MASK (0xfff << _SPRITE_SIZE_HEIGHT_SHIFT) 80 1.1 riastrad #define _SPRITE_POS_X_SHIFT 0 81 1.1 riastrad #define _SPRITE_POS_Y_SHIFT 16 82 1.1 riastrad #define _SPRITE_POS_X_MASK (0x1fff << _SPRITE_POS_X_SHIFT) 83 1.1 riastrad #define _SPRITE_POS_Y_MASK (0xfff << _SPRITE_POS_Y_SHIFT) 84 1.1 riastrad #define _SPRITE_OFFSET_START_X_SHIFT 0 85 1.1 riastrad #define _SPRITE_OFFSET_START_Y_SHIFT 16 86 1.1 riastrad #define _SPRITE_OFFSET_START_X_MASK (0x1fff << _SPRITE_OFFSET_START_X_SHIFT) 87 1.1 riastrad #define _SPRITE_OFFSET_START_Y_MASK (0xfff << _SPRITE_OFFSET_START_Y_SHIFT) 88 1.1 riastrad 89 1.1 riastrad enum GVT_FB_EVENT { 90 1.1 riastrad FB_MODE_SET_START = 1, 91 1.1 riastrad FB_MODE_SET_END, 92 1.1 riastrad FB_DISPLAY_FLIP, 93 1.1 riastrad }; 94 1.1 riastrad 95 1.1 riastrad enum DDI_PORT { 96 1.1 riastrad DDI_PORT_NONE = 0, 97 1.1 riastrad DDI_PORT_B = 1, 98 1.1 riastrad DDI_PORT_C = 2, 99 1.1 riastrad DDI_PORT_D = 3, 100 1.1 riastrad DDI_PORT_E = 4 101 1.1 riastrad }; 102 1.1 riastrad 103 1.1 riastrad struct intel_gvt; 104 1.1 riastrad 105 1.1 riastrad /* color space conversion and gamma correction are not included */ 106 1.1 riastrad struct intel_vgpu_primary_plane_format { 107 1.1 riastrad u8 enabled; /* plane is enabled */ 108 1.1 riastrad u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */ 109 1.1 riastrad u8 bpp; /* bits per pixel */ 110 1.1 riastrad u32 hw_format; /* format field in the PRI_CTL register */ 111 1.1 riastrad u32 drm_format; /* format in DRM definition */ 112 1.1 riastrad u32 base; /* framebuffer base in graphics memory */ 113 1.1 riastrad u64 base_gpa; 114 1.1 riastrad u32 x_offset; /* in pixels */ 115 1.1 riastrad u32 y_offset; /* in lines */ 116 1.1 riastrad u32 width; /* in pixels */ 117 1.1 riastrad u32 height; /* in lines */ 118 1.1 riastrad u32 stride; /* in bytes */ 119 1.1 riastrad }; 120 1.1 riastrad 121 1.1 riastrad struct intel_vgpu_sprite_plane_format { 122 1.1 riastrad u8 enabled; /* plane is enabled */ 123 1.1 riastrad u8 tiled; /* X-tiled */ 124 1.1 riastrad u8 bpp; /* bits per pixel */ 125 1.1 riastrad u32 hw_format; /* format field in the SPR_CTL register */ 126 1.1 riastrad u32 drm_format; /* format in DRM definition */ 127 1.1 riastrad u32 base; /* sprite base in graphics memory */ 128 1.1 riastrad u64 base_gpa; 129 1.1 riastrad u32 x_pos; /* in pixels */ 130 1.1 riastrad u32 y_pos; /* in lines */ 131 1.1 riastrad u32 x_offset; /* in pixels */ 132 1.1 riastrad u32 y_offset; /* in lines */ 133 1.1 riastrad u32 width; /* in pixels */ 134 1.1 riastrad u32 height; /* in lines */ 135 1.1 riastrad u32 stride; /* in bytes */ 136 1.1 riastrad }; 137 1.1 riastrad 138 1.1 riastrad struct intel_vgpu_cursor_plane_format { 139 1.1 riastrad u8 enabled; 140 1.1 riastrad u8 mode; /* cursor mode select */ 141 1.1 riastrad u8 bpp; /* bits per pixel */ 142 1.1 riastrad u32 drm_format; /* format in DRM definition */ 143 1.1 riastrad u32 base; /* cursor base in graphics memory */ 144 1.1 riastrad u64 base_gpa; 145 1.1 riastrad u32 x_pos; /* in pixels */ 146 1.1 riastrad u32 y_pos; /* in lines */ 147 1.1 riastrad u8 x_sign; /* X Position Sign */ 148 1.1 riastrad u8 y_sign; /* Y Position Sign */ 149 1.1 riastrad u32 width; /* in pixels */ 150 1.1 riastrad u32 height; /* in lines */ 151 1.1 riastrad u32 x_hot; /* in pixels */ 152 1.1 riastrad u32 y_hot; /* in pixels */ 153 1.1 riastrad }; 154 1.1 riastrad 155 1.1 riastrad struct intel_vgpu_pipe_format { 156 1.1 riastrad struct intel_vgpu_primary_plane_format primary; 157 1.1 riastrad struct intel_vgpu_sprite_plane_format sprite; 158 1.1 riastrad struct intel_vgpu_cursor_plane_format cursor; 159 1.1 riastrad enum DDI_PORT ddi_port; /* the DDI port that pipe is connected to */ 160 1.1 riastrad }; 161 1.1 riastrad 162 1.1 riastrad struct intel_vgpu_fb_format { 163 1.1 riastrad struct intel_vgpu_pipe_format pipes[I915_MAX_PIPES]; 164 1.1 riastrad }; 165 1.1 riastrad 166 1.1 riastrad int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, 167 1.1 riastrad struct intel_vgpu_primary_plane_format *plane); 168 1.1 riastrad int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu, 169 1.1 riastrad struct intel_vgpu_cursor_plane_format *plane); 170 1.1 riastrad int intel_vgpu_decode_sprite_plane(struct intel_vgpu *vgpu, 171 1.1 riastrad struct intel_vgpu_sprite_plane_format *plane); 172 1.1 riastrad 173 1.1 riastrad #endif 174