| 1 | /*************************************************************************** |
| 2 | |
| 3 | Copyright 2000 Intel Corporation. All Rights Reserved. |
| 4 | |
| 5 | Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | copy of this software and associated documentation files (the |
| 7 | "Software"), to deal in the Software without restriction, including |
| 8 | without limitation the rights to use, copy, modify, merge, publish, |
| 9 | distribute, sub license, and/or sell copies of the Software, and to |
| 10 | permit persons to whom the Software is furnished to do so, subject to |
| 11 | the following conditions: |
| 12 | |
| 13 | The above copyright notice and this permission notice (including the |
| 14 | next paragraph) shall be included in all copies or substantial portions |
| 15 | of the Software. |
| 16 | |
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 20 | IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 21 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
| 23 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | |
| 25 | **************************************************************************/ |
| 26 | |
| 27 | #ifndef SNA_VIDEO_H |
| 28 | #define SNA_VIDEO_Hcxx . . $ `src/sna/sna_video.h:28:9`! |
| 29 | |
| 30 | #include <xf86_OSproc.h> |
| 31 | #include <xf86xv.h> |
| 32 | #include <fourcc.h> |
| 33 | |
| 34 | #if defined(XvMCExtensioncxx . . $ `<external>/9559255664802066005/xorg-server.h:145:9`!) && defined(ENABLE_XVMCcxx . . $ `config.h:29:9`!) |
| 35 | #define SNA_XVMCcxx . . $ `src/sna/sna_video.h:35:9`! 1 |
| 36 | #endif |
| 37 | |
| 38 | #define FOURCC_XVMCcxx . . $ `src/sna/sna_video.h:38:9`! (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X') |
| 39 | #define FOURCC_RGB565cxx . . $ `src/sna/sna_video.h:39:9`! ((16 << 24) + ('B' << 16) + ('G' << 8) + 'R') |
| 40 | #define FOURCC_RGB888cxx . . $ `src/sna/sna_video.h:40:9`! ((24 << 24) + ('B' << 16) + ('G' << 8) + 'R') |
| 41 | #define FOURCC_NV12cxx . . $ `src/sna/sna_video.h:41:9`! (('2' << 24) + ('1' << 16) + ('V' << 8) + 'N') |
| 42 | #define FOURCC_AYUVcxx . . $ `src/sna/sna_video.h:42:9`! (('V' << 24) + ('U' << 16) + ('Y' << 8) + 'A') |
| 43 | |
| 44 | /* |
| 45 | * Below, a dummy picture type that is used in XvPutImage |
| 46 | * only to do an overlay update. |
| 47 | * Introduced for the XvMC client lib. |
| 48 | * Defined to have a zero data size. |
| 49 | */ |
| 50 | #define XVMC_YUVcxx . . $ `src/sna/sna_video.h:50:9`! { \ |
| 51 | FOURCC_XVMC, XvYUV, LSBFirst, \ |
| 52 | {'X', 'V', 'M', 'C', 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}, \ |
| 53 | 12, XvPlanar, 3, 0, 0, 0, 0, 8, 8, 8, 1, 2, 2, 1, 2, 2, \ |
| 54 | {'Y', 'V', 'U', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ |
| 55 | XvTopToBottom \ |
| 56 | } |
| 57 | |
| 58 | #define XVMC_RGB565cxx . . $ `src/sna/sna_video.h:58:9`! { \ |
| 59 | FOURCC_RGB565, XvRGB, LSBFirst, \ |
| 60 | {'P', 'A', 'S', 'S', 'T', 'H', 'R', 'O', 'U', 'G', 'H', 'R', 'G', 'B', '1', '6'}, \ |
| 61 | 16, XvPacked, 1, 16, 0x1f<<11, 0x3f<<5, 0x1f<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
| 62 | {'B', 'G', 'R', 'X', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ |
| 63 | XvTopToBottom \ |
| 64 | } |
| 65 | |
| 66 | #define XVMC_RGB888cxx . . $ `src/sna/sna_video.h:66:9`! { \ |
| 67 | FOURCC_RGB888, XvRGB, LSBFirst, \ |
| 68 | {'P', 'A', 'S', 'S', 'T', 'H', 'R', 'O', 'U', 'G', 'H', 'R', 'G', 'B', '2', '4'}, \ |
| 69 | 32, XvPacked, 1, 24, 0xff<<16, 0xff<<8, 0xff<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
| 70 | {'B', 'G', 'R', 'X', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ |
| 71 | XvTopToBottom \ |
| 72 | } |
| 73 | |
| 74 | /* no standard define for this */ |
| 75 | #define XVIMAGE_NV12cxx . . $ `src/sna/sna_video.h:75:9`! { \ |
| 76 | FOURCC_NV12, XvYUV, LSBFirst, \ |
| 77 | {'N','V','1','2', 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ |
| 78 | 12, XvPlanar, 2, 0, 0, 0, 0, 8, 8, 8, 1, 2, 2, 1, 2, 2, \ |
| 79 | {'Y','U','V', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ |
| 80 | XvTopToBottom \ |
| 81 | } |
| 82 | |
| 83 | #define XVIMAGE_AYUVcxx . . $ `src/sna/sna_video.h:83:9`! { \ |
| 84 | FOURCC_AYUV, XvYUV, LSBFirst, \ |
| 85 | {'A', 'Y', 'U', 'V', 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}, \ |
| 86 | 32, XvPacked, 1, 0, 0, 0, 0, 8, 8, 8, 1, 1, 1, 1, 1, 1, \ |
| 87 | {'A', 'Y', 'U', 'V', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, \ |
| 88 | XvTopToBottom \ |
| 89 | } |
| 90 | |
| 91 | struct sna_videocxx . . $ sna_video# { |
| 92 | struct snacxx . . $ sna# *snacxx . . $ sna_video#sna.; |
| 93 | |
| 94 | int idxcxx . . $ sna_video#idx.; /* XXX expose struct plane instead? */ |
| 95 | |
| 96 | int brightnesscxx . . $ sna_video#brightness.; |
| 97 | int contrastcxx . . $ sna_video#contrast.; |
| 98 | int saturationcxx . . $ sna_video#saturation.; |
| 99 | xf86CrtcPtrcxx . . $ xf86CrtcPtr# desired_crtccxx . . $ sna_video#desired_crtc.; |
| 100 | |
| 101 | uint32_tcxx . . $ uint32_t# gamma0cxx . . $ sna_video#gamma0.; |
| 102 | uint32_tcxx . . $ uint32_t# gamma1cxx . . $ sna_video#gamma1.; |
| 103 | uint32_tcxx . . $ uint32_t# gamma2cxx . . $ sna_video#gamma2.; |
| 104 | uint32_tcxx . . $ uint32_t# gamma3cxx . . $ sna_video#gamma3.; |
| 105 | uint32_tcxx . . $ uint32_t# gamma4cxx . . $ sna_video#gamma4.; |
| 106 | uint32_tcxx . . $ uint32_t# gamma5cxx . . $ sna_video#gamma5.; |
| 107 | |
| 108 | unsigned color_keycxx . . $ sna_video#color_key.; |
| 109 | unsigned color_key_changedcxx . . $ sna_video#color_key_changed.; |
| 110 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! has_color_keycxx . . $ sna_video#has_color_key.; |
| 111 | |
| 112 | unsigned colorspacecxx . . $ sna_video#colorspace.; |
| 113 | unsigned colorspace_changedcxx . . $ sna_video#colorspace_changed.; |
| 114 | |
| 115 | /** YUV data buffers */ |
| 116 | struct kgem_bocxx . . $ kgem_bo# *old_bufcxx . . $ sna_video#old_buf.[2]; |
| 117 | struct kgem_bocxx . . $ kgem_bo# *bufcxx . . $ sna_video#buf.; |
| 118 | int widthcxx . . $ sna_video#width., heightcxx . . $ sna_video#height., formatcxx . . $ sna_video#format.; |
| 119 | |
| 120 | int alignmentcxx . . $ sna_video#alignment.; |
| 121 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! tiledcxx . . $ sna_video#tiled.; |
| 122 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! texturedcxx . . $ sna_video#textured.; |
| 123 | |
| 124 | struct kgem_bocxx . . $ kgem_bo# *bocxx . . $ sna_video#bo.[4]; |
| 125 | RegionReccxx . . $ RegionRec# clipcxx . . $ sna_video#clip.; |
| 126 | |
| 127 | int SyncToVblankcxx . . $ sna_video#SyncToVblank.; /* -1: auto, 0: off, 1: on */ |
| 128 | int AlwaysOnTopcxx . . $ sna_video#AlwaysOnTop.; |
| 129 | }; |
| 130 | |
| 131 | struct sna_video_framecxx . . $ sna_video_frame# { |
| 132 | struct kgem_bocxx . . $ kgem_bo# *bocxx . . $ sna_video_frame#bo.; |
| 133 | uint32_tcxx . . $ uint32_t# idcxx . . $ sna_video_frame#id.; |
| 134 | uint32_tcxx . . $ uint32_t# sizecxx . . $ sna_video_frame#size.; |
| 135 | uint32_tcxx . . $ uint32_t# UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 136 | uint32_tcxx . . $ uint32_t# VBufOffsetcxx . . $ sna_video_frame#VBufOffset.; |
| 137 | Rotationcxx . . $ Rotation# rotationcxx . . $ sna_video_frame#rotation.; |
| 138 | |
| 139 | uint16_tcxx . . $ uint16_t# widthcxx . . $ sna_video_frame#width., heightcxx . . $ sna_video_frame#height.; |
| 140 | uint16_tcxx . . $ uint16_t# pitchcxx . . $ sna_video_frame#pitch.[2]; |
| 141 | |
| 142 | /* extents */ |
| 143 | BoxReccxx . . $ BoxRec# imagecxx . . $ sna_video_frame#image.; |
| 144 | BoxReccxx . . $ BoxRec# srccxx . . $ sna_video_frame#src.; |
| 145 | }; |
| 146 | |
| 147 | static inline XvScreenPtrcxx . . $ XvScreenPtr# to_xvcxx . . $ to_xv(96cd7d10aa7f45f7).(ScreenPtrcxx . . $ ScreenPtr# screen) |
| 148 | { |
| 149 | return dixLookupPrivatecxx . . $ dixLookupPrivate(bcac45ccf2539feb).(&screen->devPrivatescxx . . $ _Screen#devPrivates., XvGetScreenKeycxx . . $ XvGetScreenKey(5dc0c0ea2fae2815).()); |
| 150 | } |
| 151 | |
| 152 | void sna_video_initcxx . . $ sna_video_init(8cc8bc1fa08eaefd).(struct snacxx . . $ sna# *sna, ScreenPtrcxx . . $ ScreenPtr# screen); |
| 153 | void sna_video_overlay_setupcxx . . $ sna_video_overlay_setup(8cc8bc1fa08eaefd).(struct snacxx . . $ sna# *sna, ScreenPtrcxx . . $ ScreenPtr# screen); |
| 154 | void sna_video_sprite_setupcxx . . $ sna_video_sprite_setup(8cc8bc1fa08eaefd).(struct snacxx . . $ sna# *sna, ScreenPtrcxx . . $ ScreenPtr# screen); |
| 155 | void sna_video_textured_setupcxx . . $ sna_video_textured_setup(8cc8bc1fa08eaefd).(struct snacxx . . $ sna# *sna, ScreenPtrcxx . . $ ScreenPtr# screen); |
| 156 | void sna_video_destroy_windowcxx . . $ sna_video_destroy_window(7d0588436b617946).(WindowPtrcxx . . $ WindowPtr# win); |
| 157 | void sna_video_closecxx . . $ sna_video_close(a7abbe1bcccb1d5a).(struct snacxx . . $ sna# *sna); |
| 158 | |
| 159 | XvAdaptorPtrcxx . . $ XvAdaptorPtr# sna_xv_adaptor_alloccxx . . $ sna_xv_adaptor_alloc(86e22ee1356d5d44).(struct snacxx . . $ sna# *sna); |
| 160 | int sna_xv_fixup_formatscxx . . $ sna_xv_fixup_formats(886cde0cca0d5506).(ScreenPtrcxx . . $ ScreenPtr# screen, |
| 161 | XvFormatPtrcxx . . $ XvFormatPtr# formats, |
| 162 | int num_formats); |
| 163 | int sna_xv_alloc_portcxx . . $ sna_xv_alloc_port(d011a7cb9e68b5dd).(unsigned long port, XvPortPtrcxx . . $ XvPortPtr# in, XvPortPtrcxx . . $ XvPortPtr# *out); |
| 164 | int sna_xv_free_portcxx . . $ sna_xv_free_port(7232dc0912135880).(XvPortPtrcxx . . $ XvPortPtr# port); |
| 165 | |
| 166 | static inline int xvmc_passthroughcxx . . $ xvmc_passthrough(7864480464b09eea).(int id) |
| 167 | { |
| 168 | switch (id) { |
| 169 | case FOURCC_XVMCcxx . . $ `src/sna/sna_video.h:38:9`!: |
| 170 | case FOURCC_RGB565cxx . . $ `src/sna/sna_video.h:39:9`!: |
| 171 | case FOURCC_RGB888cxx . . $ `src/sna/sna_video.h:40:9`!: |
| 172 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 173 | default: |
| 174 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | static inline int is_planar_fourcccxx . . $ is_planar_fourcc(7864480464b09eea).(int id) |
| 179 | { |
| 180 | switch (id) { |
| 181 | case FOURCC_YV12cxx . . $ `<external>/5950719045248363523/fourcc.h:59:9`!: |
| 182 | case FOURCC_I420cxx . . $ `<external>/5950719045248363523/fourcc.h:79:9`!: |
| 183 | case FOURCC_XVMCcxx . . $ `src/sna/sna_video.h:38:9`!: |
| 184 | case FOURCC_NV12cxx . . $ `src/sna/sna_video.h:41:9`!: |
| 185 | return 1; |
| 186 | default: |
| 187 | return 0; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | static inline int is_nv12_fourcccxx . . $ is_nv12_fourcc(7864480464b09eea).(int id) |
| 192 | { |
| 193 | switch (id) { |
| 194 | case FOURCC_NV12cxx . . $ `src/sna/sna_video.h:41:9`!: |
| 195 | return 1; |
| 196 | default: |
| 197 | return 0; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | static inline int is_ayuv_fourcccxx . . $ is_ayuv_fourcc(7864480464b09eea).(int id) |
| 202 | { |
| 203 | switch (id) { |
| 204 | case FOURCC_AYUVcxx . . $ `src/sna/sna_video.h:42:9`!: |
| 205 | return 1; |
| 206 | default: |
| 207 | return 0; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 212 | sna_video_clip_helpercxx . . $ sna_video_clip_helper(804bc8fbb93cabc9).(struct sna_videocxx . . $ sna_video# *video, |
| 213 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 214 | xf86CrtcPtrcxx . . $ xf86CrtcPtr# *crtc_ret, |
| 215 | BoxPtrcxx . . $ BoxPtr# dst, |
| 216 | short src_x, short src_y, |
| 217 | short drw_x, short drw_y, |
| 218 | short src_w, short src_h, |
| 219 | short drw_w, short drw_h, |
| 220 | RegionPtrcxx . . $ RegionPtr# reg); |
| 221 | |
| 222 | void |
| 223 | sna_video_frame_initcxx . . $ sna_video_frame_init(2045b8ad3954aa45).(struct sna_videocxx . . $ sna_video# *video, |
| 224 | int id, short width, short height, |
| 225 | struct sna_video_framecxx . . $ sna_video_frame# *frame); |
| 226 | |
| 227 | void |
| 228 | sna_video_frame_set_rotationcxx . . $ sna_video_frame_set_rotation(7ee302316a0aafb).(struct sna_videocxx . . $ sna_video# *video, |
| 229 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 230 | Rotationcxx . . $ Rotation# rotation); |
| 231 | |
| 232 | struct kgem_bocxx . . $ kgem_bo# * |
| 233 | sna_video_buffercxx . . $ sna_video_buffer(649416b9ae01239b).(struct sna_videocxx . . $ sna_video# *video, |
| 234 | struct sna_video_framecxx . . $ sna_video_frame# *frame); |
| 235 | |
| 236 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 237 | sna_video_copy_datacxx . . $ sna_video_copy_data(872f30cf9ffb429f).(struct sna_videocxx . . $ sna_video# *video, |
| 238 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 239 | const uint8_tcxx . . $ uint8_t# *buf); |
| 240 | void |
| 241 | sna_video_fill_colorkeycxx . . $ sna_video_fill_colorkey(ba2184acb741c4a).(struct sna_videocxx . . $ sna_video# *video, |
| 242 | const RegionReccxx . . $ RegionRec# *clip); |
| 243 | |
| 244 | void sna_video_buffer_finicxx . . $ sna_video_buffer_fini(129381b6c4e8a055).(struct sna_videocxx . . $ sna_video# *video); |
| 245 | |
| 246 | void sna_video_free_bufferscxx . . $ sna_video_free_buffers(129381b6c4e8a055).(struct sna_videocxx . . $ sna_video# *video); |
| 247 | |
| 248 | static inline XvPortPtrcxx . . $ XvPortPtr# |
| 249 | sna_window_get_portcxx . . $ sna_window_get_port(f7dc7d8c2f29203).(WindowPtrcxx . . $ WindowPtr# window) |
| 250 | { |
| 251 | return ((void **)__get_privatecxx . . $ `src/compat-api.h:189:9`!(window, sna_window_key))[2]; |
| 252 | } |
| 253 | |
| 254 | static inline void |
| 255 | sna_window_set_portcxx . . $ sna_window_set_port(9f735827aa970ebc).(WindowPtrcxx . . $ WindowPtr# window, XvPortPtrcxx . . $ XvPortPtr# port) |
| 256 | { |
| 257 | ((void **)__get_privatecxx . . $ `src/compat-api.h:189:9`!(window, sna_window_key))[2] = port; |
| 258 | } |
| 259 | |
| 260 | static inline int offset_and_clipcxx . . $ offset_and_clip(9b79fb6aee4c0440).(int x, int dx) |
| 261 | { |
| 262 | x += dx; |
| 263 | if (x <= 0) |
| 264 | return 0; |
| 265 | if (x >= MAXSHORTcxx . . $ `<external>/18388808314464358495/misc.h:165:9`!) |
| 266 | return MAXSHORTcxx . . $ `<external>/18388808314464358495/misc.h:165:9`!; |
| 267 | return x; |
| 268 | } |
| 269 | |
| 270 | static inline void init_video_regioncxx . . $ init_video_region(16ffa62c916b3828).(RegionReccxx . . $ RegionRec# *region, |
| 271 | DrawablePtrcxx . . $ DrawablePtr# draw, |
| 272 | int drw_x, int drw_y, |
| 273 | int drw_w, int drw_h) |
| 274 | { |
| 275 | region->extentscxx . . $ pixman_region16#extents..x1cxx . . $ pixman_box16#x1. = offset_and_clipcxx . . $ offset_and_clip(9b79fb6aee4c0440).(draw->xcxx . . $ _Drawable#x., drw_x); |
| 276 | region->extentscxx . . $ pixman_region16#extents..y1cxx . . $ pixman_box16#y1. = offset_and_clipcxx . . $ offset_and_clip(9b79fb6aee4c0440).(draw->ycxx . . $ _Drawable#y., drw_y); |
| 277 | region->extentscxx . . $ pixman_region16#extents..x2cxx . . $ pixman_box16#x2. = offset_and_clipcxx . . $ offset_and_clip(9b79fb6aee4c0440).(draw->xcxx . . $ _Drawable#x., drw_x + drw_w); |
| 278 | region->extentscxx . . $ pixman_region16#extents..y2cxx . . $ pixman_box16#y2. = offset_and_clipcxx . . $ offset_and_clip(9b79fb6aee4c0440).(draw->ycxx . . $ _Drawable#y., drw_y + drw_h); |
| 279 | region->datacxx . . $ pixman_region16#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 280 | } |
| 281 | |
| 282 | #endif /* SNA_VIDEO_H */ |