| 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 | /* |
| 28 | * i830_video.c: i830/i845 Xv driver. |
| 29 | * |
| 30 | * Copyright © 2002 by Alan Hourihane and David Dawes |
| 31 | * |
| 32 | * Authors: |
| 33 | * Alan Hourihane <[email protected]> |
| 34 | * David Dawes <[email protected]> |
| 35 | * |
| 36 | * Derived from i810 Xv driver: |
| 37 | * |
| 38 | * Authors of i810 code: |
| 39 | * Jonathan Bian <[email protected]> |
| 40 | * Offscreen Images: |
| 41 | * Matt Sottek <[email protected]> |
| 42 | */ |
| 43 | |
| 44 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:410:9`! |
| 45 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 46 | #endif |
| 47 | |
| 48 | #include <inttypes.h> |
| 49 | #include <math.h> |
| 50 | #include <string.h> |
| 51 | #include <errno.h> |
| 52 | |
| 53 | #include <sys/mman.h> |
| 54 | |
| 55 | #include "sna.h"cxx . . $ `<file>/src/sna/sna.h`/ |
| 56 | #include "sna_reg.h"cxx . . $ `<file>/src/sna/sna_reg.h`/ |
| 57 | #include "sna_video.h"cxx . . $ `<file>/src/sna/sna_video.h`/ |
| 58 | |
| 59 | #include "intel_options.h"cxx . . $ `<file>/src/intel_options.h`/ |
| 60 | |
| 61 | #include <xf86xv.h> |
| 62 | #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) |
| 63 | #include <sys/types.h> |
| 64 | #include <sys/endian.h> |
| 65 | #ifdef __OpenBSD__ |
| 66 | #define bswap_32 swap32 |
| 67 | #else |
| 68 | #define bswap_32 bswap32 |
| 69 | #endif |
| 70 | #else |
| 71 | #include <byteswap.h> |
| 72 | #endif |
| 73 | |
| 74 | #ifdef SNA_XVMCcxx . . $ `src/sna/sna_video.h:35:9`! |
| 75 | #define _SNA_XVMC_SERVER_cxx . . $ `src/sna/sna_video.c:75:9`! |
| 76 | #include "sna_video_hwmc.h"cxx . . $ `<file>/src/sna/sna_video_hwmc.h`/ |
| 77 | #else |
| 78 | static inline void sna_video_xvmc_setup(struct sna *sna, ScreenPtr ptr) |
| 79 | { |
| 80 | DBG(("%s: XvMC not compiled in\n", __FUNCTION__)); |
| 81 | } |
| 82 | #endif |
| 83 | |
| 84 | void sna_video_free_bufferscxx . . $ sna_video_free_buffers(129381b6c4e8a055).(struct sna_videocxx . . $ sna_video# *video) |
| 85 | { |
| 86 | unsigned int i; |
| 87 | |
| 88 | for (i = 0; i < ARRAY_SIZEcxx . . $ `<external>/7126665466336981124/dix.h:68:9`!(video->old_buf); i++) { |
| 89 | if (video->old_bufcxx . . $ sna_video#old_buf.[i]) { |
| 90 | kgem_bo_destroycxx . . $ kgem_bo_destroy(acb82a203cb9de7a).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., video->old_bufcxx . . $ sna_video#old_buf.[i]); |
| 91 | video->old_bufcxx . . $ sna_video#old_buf.[i] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | if (video->bufcxx . . $ sna_video#buf.) { |
| 96 | kgem_bo_destroycxx . . $ kgem_bo_destroy(acb82a203cb9de7a).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., video->bufcxx . . $ sna_video#buf.); |
| 97 | video->bufcxx . . $ sna_video#buf. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | struct kgem_bocxx . . $ kgem_bo# * |
| 102 | sna_video_buffercxx . . $ sna_video_buffer(649416b9ae01239b).(struct sna_videocxx . . $ sna_video# *video, |
| 103 | struct sna_video_framecxx . . $ sna_video_frame# *frame) |
| 104 | { |
| 105 | /* Free the current buffer if we're going to have to reallocate */ |
| 106 | if (video->bufcxx . . $ sna_video#buf. && __kgem_bo_sizecxx . . $ __kgem_bo_size(345c111e15e07519).(video->bufcxx . . $ sna_video#buf.) < frame->sizecxx . . $ sna_video_frame#size.) |
| 107 | sna_video_free_bufferscxx . . $ sna_video_free_buffers(129381b6c4e8a055).(video); |
| 108 | |
| 109 | if (video->bufcxx . . $ sna_video#buf. && video->bufcxx . . $ sna_video#buf.->scanoutcxx . . $ kgem_bo#scanout.) { |
| 110 | if (frame->widthcxx . . $ sna_video_frame#width. != video->widthcxx . . $ sna_video#width. || |
| 111 | frame->heightcxx . . $ sna_video_frame#height. != video->heightcxx . . $ sna_video#height. || |
| 112 | frame->idcxx . . $ sna_video_frame#id. != video->formatcxx . . $ sna_video#format.) |
| 113 | sna_video_free_bufferscxx . . $ sna_video_free_buffers(129381b6c4e8a055).(video); |
| 114 | } |
| 115 | |
| 116 | if (video->bufcxx . . $ sna_video#buf. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 117 | if (video->tiledcxx . . $ sna_video#tiled.) { |
| 118 | video->bufcxx . . $ sna_video#buf. = kgem_create_2dcxx . . $ kgem_create_2d(6358bcea2a5cdff9).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., |
| 119 | frame->widthcxx . . $ sna_video_frame#width., frame->heightcxx . . $ sna_video_frame#height., 32, |
| 120 | I915_TILING_Xcxx . . $ `<external>/17903803794487424948/i915_drm.h:1658:9`!, CREATE_EXACTcxx . . $ CREATE_EXACT.); |
| 121 | } else { |
| 122 | video->bufcxx . . $ sna_video#buf. = kgem_create_linearcxx . . $ kgem_create_linear(b75dbb0fcba8b1f4).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->sizecxx . . $ sna_video_frame#size., |
| 123 | CREATE_GTT_MAPcxx . . $ CREATE_GTT_MAP.); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | video->widthcxx . . $ sna_video#width. = frame->widthcxx . . $ sna_video_frame#width.; |
| 128 | video->heightcxx . . $ sna_video#height. = frame->heightcxx . . $ sna_video_frame#height.; |
| 129 | video->formatcxx . . $ sna_video#format. = frame->idcxx . . $ sna_video_frame#id.; |
| 130 | |
| 131 | return video->bufcxx . . $ sna_video#buf.; |
| 132 | } |
| 133 | |
| 134 | void sna_video_buffer_finicxx . . $ sna_video_buffer_fini(129381b6c4e8a055).(struct sna_videocxx . . $ sna_video# *video) |
| 135 | { |
| 136 | struct kgem_bocxx . . $ kgem_bo# *bo; |
| 137 | |
| 138 | bo = video->old_bufcxx . . $ sna_video#old_buf.[1]; |
| 139 | video->old_bufcxx . . $ sna_video#old_buf.[1] = video->old_bufcxx . . $ sna_video#old_buf.[0]; |
| 140 | video->old_bufcxx . . $ sna_video#old_buf.[0] = video->bufcxx . . $ sna_video#buf.; |
| 141 | video->bufcxx . . $ sna_video#buf. = bo; |
| 142 | } |
| 143 | |
| 144 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 145 | sna_video_clip_helpercxx . . $ sna_video_clip_helper(804bc8fbb93cabc9).(struct sna_videocxx . . $ sna_video# *video, |
| 146 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 147 | xf86CrtcPtrcxx . . $ xf86CrtcPtr# *crtc_ret, |
| 148 | BoxPtrcxx . . $ BoxPtr# dst, |
| 149 | short src_x, short src_y, |
| 150 | short drw_x, short drw_y, |
| 151 | short src_w, short src_h, |
| 152 | short drw_w, short drw_h, |
| 153 | RegionPtrcxx . . $ RegionPtr# reg) |
| 154 | { |
| 155 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ret; |
| 156 | RegionReccxx . . $ RegionRec# crtc_region_local; |
| 157 | RegionPtrcxx . . $ RegionPtr# crtc_region = reg; |
| 158 | INT32cxx . . $ INT32# x1, x2, y1, y2; |
| 159 | xf86CrtcPtrcxx . . $ xf86CrtcPtr# crtc; |
| 160 | |
| 161 | x1 = src_x; |
| 162 | x2 = src_x + src_w; |
| 163 | y1 = src_y; |
| 164 | y2 = src_y + src_h; |
| 165 | |
| 166 | dst->x1cxx . . $ pixman_box16#x1. = drw_x; |
| 167 | dst->x2cxx . . $ pixman_box16#x2. = drw_x + drw_w; |
| 168 | dst->y1cxx . . $ pixman_box16#y1. = drw_y; |
| 169 | dst->y2cxx . . $ pixman_box16#y2. = drw_y + drw_h; |
| 170 | |
| 171 | /* |
| 172 | * For overlay video, compute the relevant CRTC and |
| 173 | * clip video to that |
| 174 | */ |
| 175 | crtc = sna_covering_crtccxx . . $ sna_covering_crtc(921fe5f352d43aae).(video->snacxx . . $ sna_video#sna., dst, video->desired_crtccxx . . $ sna_video#desired_crtc.); |
| 176 | |
| 177 | /* For textured video, we don't actually want to clip at all. */ |
| 178 | if (crtc && !video->texturedcxx . . $ sna_video#textured.) { |
| 179 | crtc_region_local.extentscxx . . $ pixman_region16#extents. = crtc->boundscxx . . $ _xf86Crtc#bounds.; |
| 180 | crtc_region_local.datacxx . . $ pixman_region16#data. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 181 | crtc_region = &crtc_region_local; |
| 182 | RegionIntersectcxx . . $ RegionIntersect(e4fcd09d0a6b8050).(crtc_region, crtc_region, reg); |
| 183 | } |
| 184 | *crtc_ret = crtc; |
| 185 | |
| 186 | ret = xf86XVClipVideoHelpercxx . . $ xf86XVClipVideoHelper(7a6737b15d0aa8c0).(dst, &x1, &x2, &y1, &y2, |
| 187 | crtc_region, frame->widthcxx . . $ sna_video_frame#width., frame->heightcxx . . $ sna_video_frame#height.); |
| 188 | if (crtc_region != reg) |
| 189 | RegionUninitcxx . . $ RegionUninit(353c1b2f50b7675c).(crtc_region); |
| 190 | |
| 191 | frame->srccxx . . $ sna_video_frame#src..x1cxx . . $ pixman_box16#x1. = x1 >> 16; |
| 192 | frame->srccxx . . $ sna_video_frame#src..y1cxx . . $ pixman_box16#y1. = y1 >> 16; |
| 193 | frame->srccxx . . $ sna_video_frame#src..x2cxx . . $ pixman_box16#x2. = (x2 + 0xffff) >> 16; |
| 194 | frame->srccxx . . $ sna_video_frame#src..y2cxx . . $ pixman_box16#y2. = (y2 + 0xffff) >> 16; |
| 195 | |
| 196 | frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1. = frame->srccxx . . $ sna_video_frame#src..x1cxx . . $ pixman_box16#x1. & ~1; |
| 197 | frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->src.x2, 2); |
| 198 | if (is_planar_fourcccxx . . $ is_planar_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 199 | frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1. = frame->srccxx . . $ sna_video_frame#src..y1cxx . . $ pixman_box16#y1. & ~1; |
| 200 | frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->src.y2, 2); |
| 201 | } else { |
| 202 | frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1. = frame->srccxx . . $ sna_video_frame#src..y1cxx . . $ pixman_box16#y1.; |
| 203 | frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. = frame->srccxx . . $ sna_video_frame#src..y2cxx . . $ pixman_box16#y2.; |
| 204 | } |
| 205 | |
| 206 | return ret; |
| 207 | } |
| 208 | |
| 209 | void |
| 210 | sna_video_frame_initcxx . . $ sna_video_frame_init(2045b8ad3954aa45).(struct sna_videocxx . . $ sna_video# *video, |
| 211 | int id, short width, short height, |
| 212 | struct sna_video_framecxx . . $ sna_video_frame# *frame) |
| 213 | { |
| 214 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: id=%d [planar? %d], width=%d, height=%d, align=%d\n", |
| 215 | __FUNCTION__, id, is_planar_fourcc(id), width, height, video->alignment)); |
| 216 | assertcxx . . $ `/usr/include/assert.h:50:10`!(width && height); |
| 217 | |
| 218 | frame->bocxx . . $ sna_video_frame#bo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 219 | frame->idcxx . . $ sna_video_frame#id. = id; |
| 220 | frame->widthcxx . . $ sna_video_frame#width. = width; |
| 221 | frame->heightcxx . . $ sna_video_frame#height. = height; |
| 222 | frame->rotationcxx . . $ sna_video_frame#rotation. = 0; |
| 223 | } |
| 224 | |
| 225 | void |
| 226 | sna_video_frame_set_rotationcxx . . $ sna_video_frame_set_rotation(7ee302316a0aafb).(struct sna_videocxx . . $ sna_video# *video, |
| 227 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 228 | Rotationcxx . . $ Rotation# rotation) |
| 229 | { |
| 230 | unsigned width = frame->widthcxx . . $ sna_video_frame#width.; |
| 231 | unsigned height = frame->heightcxx . . $ sna_video_frame#height.; |
| 232 | unsigned align; |
| 233 | |
| 234 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: rotation=%d\n", __FUNCTION__, rotation)); |
| 235 | frame->rotationcxx . . $ sna_video_frame#rotation. = rotation; |
| 236 | |
| 237 | align = video->alignmentcxx . . $ sna_video#alignment.; |
| 238 | #if SNA_XVMCcxx . . $ `src/sna/sna_video.h:35:9`! |
| 239 | /* for i915 xvmc, hw requires 1kb aligned surfaces */ |
| 240 | if (frame->idcxx . . $ sna_video_frame#id. == FOURCC_XVMCcxx . . $ `src/sna/sna_video.h:38:9`! && video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem..gencxx . . $ kgem#gen. < 040 && align < 1024) |
| 241 | align = 1024; |
| 242 | #endif |
| 243 | |
| 244 | /* Determine the desired destination pitch (representing the |
| 245 | * chroma's pitch in the planar case). |
| 246 | */ |
| 247 | if (is_nv12_fourcccxx . . $ is_nv12_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 248 | assertcxx . . $ `/usr/include/assert.h:50:10`!((width & 1) == 0); |
| 249 | assertcxx . . $ `/usr/include/assert.h:50:10`!((height & 1) == 0); |
| 250 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 251 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(height, align); |
| 252 | frame->pitchcxx . . $ sna_video_frame#pitch.[1] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(height, align); |
| 253 | frame->sizecxx . . $ sna_video_frame#size. = width * frame->pitchcxx . . $ sna_video_frame#pitch.[1] + |
| 254 | width / 2 * frame->pitchcxx . . $ sna_video_frame#pitch.[0]; |
| 255 | } else { |
| 256 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(width, align); |
| 257 | frame->pitchcxx . . $ sna_video_frame#pitch.[1] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(width, align); |
| 258 | frame->sizecxx . . $ sna_video_frame#size. = height * frame->pitchcxx . . $ sna_video_frame#pitch.[1] + |
| 259 | height / 2 * frame->pitchcxx . . $ sna_video_frame#pitch.[0]; |
| 260 | } |
| 261 | |
| 262 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 263 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[1] * width; |
| 264 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 265 | } else { |
| 266 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[1] * height; |
| 267 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 268 | } |
| 269 | } else if (is_planar_fourcccxx . . $ is_planar_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 270 | assertcxx . . $ `/usr/include/assert.h:50:10`!((width & 1) == 0); |
| 271 | assertcxx . . $ `/usr/include/assert.h:50:10`!((height & 1) == 0); |
| 272 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 273 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((height / 2), align); |
| 274 | frame->pitchcxx . . $ sna_video_frame#pitch.[1] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(height, align); |
| 275 | frame->sizecxx . . $ sna_video_frame#size. = width; |
| 276 | } else { |
| 277 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((width / 2), align); |
| 278 | frame->pitchcxx . . $ sna_video_frame#pitch.[1] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(width, align); |
| 279 | frame->sizecxx . . $ sna_video_frame#size. = height; |
| 280 | } |
| 281 | frame->sizecxx . . $ sna_video_frame#size. *= frame->pitchcxx . . $ sna_video_frame#pitch.[0] + frame->pitchcxx . . $ sna_video_frame#pitch.[1]; |
| 282 | |
| 283 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 284 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[1] * width; |
| 285 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = |
| 286 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. + (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * width / 2; |
| 287 | } else { |
| 288 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[1] * height; |
| 289 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = |
| 290 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. + (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * height / 2; |
| 291 | } |
| 292 | } else { |
| 293 | switch (frame->idcxx . . $ sna_video_frame#id.) { |
| 294 | case FOURCC_RGB888cxx . . $ `src/sna/sna_video.h:40:9`!: |
| 295 | case FOURCC_AYUVcxx . . $ `src/sna/sna_video.h:42:9`!: |
| 296 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 297 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((height << 2), align); |
| 298 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * width; |
| 299 | } else { |
| 300 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((width << 2), align); |
| 301 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * height; |
| 302 | } |
| 303 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = 0; |
| 304 | break; |
| 305 | case FOURCC_RGB565cxx . . $ `src/sna/sna_video.h:39:9`!: |
| 306 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 307 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((height << 1), align); |
| 308 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * width; |
| 309 | } else { |
| 310 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((width << 1), align); |
| 311 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * height; |
| 312 | } |
| 313 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = 0; |
| 314 | break; |
| 315 | |
| 316 | default: |
| 317 | if (rotation & (RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`! | RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!)) { |
| 318 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((height << 1), align); |
| 319 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * width; |
| 320 | } else { |
| 321 | frame->pitchcxx . . $ sna_video_frame#pitch.[0] = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((width << 1), align); |
| 322 | frame->sizecxx . . $ sna_video_frame#size. = (int)frame->pitchcxx . . $ sna_video_frame#pitch.[0] * height; |
| 323 | } |
| 324 | break; |
| 325 | } |
| 326 | frame->pitchcxx . . $ sna_video_frame#pitch.[1] = 0; |
| 327 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = 0; |
| 328 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = 0; |
| 329 | } |
| 330 | |
| 331 | assertcxx . . $ `/usr/include/assert.h:50:10`!(frame->size); |
| 332 | } |
| 333 | |
| 334 | static void plane_dimscxx . . $ plane_dims(689edfb4c5eeb614).(const struct sna_video_framecxx . . $ sna_video_frame# *frame, int sub, |
| 335 | int *x, int *y, int *w, int *h) |
| 336 | { |
| 337 | *x = frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 338 | *y = frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 339 | *w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 340 | *h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 341 | |
| 342 | if (sub) { |
| 343 | *x >>= 1; *w >>= 1; |
| 344 | *y >>= 1; *h >>= 1; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | static void sna_memcpy_cbcr_planecxx . . $ sna_memcpy_cbcr_plane(fe7e7edd66193a9c).(struct sna_videocxx . . $ sna_video# *video, |
| 349 | uint16_tcxx . . $ uint16_t# *dst, const uint16_tcxx . . $ uint16_t# *src, |
| 350 | const struct sna_video_framecxx . . $ sna_video_frame# *frame) |
| 351 | { |
| 352 | int dstPitch = frame->pitchcxx . . $ sna_video_frame#pitch.[0] >> 1, srcPitch; |
| 353 | const uint16_tcxx . . $ uint16_t# *s; |
| 354 | int i, j = 0; |
| 355 | int x, y, w, h; |
| 356 | |
| 357 | plane_dimscxx . . $ plane_dims(689edfb4c5eeb614).(frame, 1, &x, &y, &w, &h); |
| 358 | |
| 359 | srcPitch = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((frame->width >> 1), 2); |
| 360 | |
| 361 | src += y * srcPitch + x; |
| 362 | if (!video->texturedcxx . . $ sna_video#textured.) |
| 363 | x = y = 0; |
| 364 | |
| 365 | switch (frame->rotationcxx . . $ sna_video_frame#rotation.) { |
| 366 | case RR_Rotate_0cxx . . $ `<external>/17919557788947152127/randr.h:143:9`!: |
| 367 | dst += y * dstPitch + x; |
| 368 | if (srcPitch == dstPitch && srcPitch == w) |
| 369 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, (srcPitch * h) << 1); |
| 370 | else while (h--) { |
| 371 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, w << 1); |
| 372 | src += srcPitch; |
| 373 | dst += dstPitch; |
| 374 | } |
| 375 | break; |
| 376 | case RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`!: |
| 377 | for (i = 0; i < h; i++) { |
| 378 | s = src; |
| 379 | for (j = 0; j < w; j++) |
| 380 | dst[i + ((x + w - j - 1) * dstPitch)] = *s++; |
| 381 | src += srcPitch; |
| 382 | } |
| 383 | break; |
| 384 | case RR_Rotate_180cxx . . $ `<external>/17919557788947152127/randr.h:145:9`!: |
| 385 | for (i = 0; i < h; i++) { |
| 386 | s = src; |
| 387 | for (j = 0; j < w; j++) { |
| 388 | dst[(x + w - j - 1) + |
| 389 | ((h - i - 1) * dstPitch)] = *s++; |
| 390 | } |
| 391 | src += srcPitch; |
| 392 | } |
| 393 | break; |
| 394 | case RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!: |
| 395 | for (i = 0; i < h; i++) { |
| 396 | s = src; |
| 397 | for (j = 0; j < w; j++) { |
| 398 | dst[(h - i - 1) + (x + j * dstPitch)] = *s++; |
| 399 | } |
| 400 | src += srcPitch; |
| 401 | } |
| 402 | break; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | static void sna_memcpy_planecxx . . $ sna_memcpy_plane(7c19a117c92eec9c).(struct sna_videocxx . . $ sna_video# *video, |
| 407 | uint8_tcxx . . $ uint8_t# *dst, const uint8_tcxx . . $ uint8_t# *src, |
| 408 | const struct sna_video_framecxx . . $ sna_video_frame# *frame, int sub) |
| 409 | { |
| 410 | int dstPitch = frame->pitchcxx . . $ sna_video_frame#pitch.[!sub], srcPitch; |
| 411 | const uint8_tcxx . . $ uint8_t# *s; |
| 412 | int i, j = 0; |
| 413 | int x, y, w, h; |
| 414 | |
| 415 | plane_dimscxx . . $ plane_dims(689edfb4c5eeb614).(frame, sub, &x, &y, &w, &h); |
| 416 | |
| 417 | if (sub) |
| 418 | srcPitch = ALIGNcxx . . $ `src/sna/sna.h:541:9`!((frame->width >> 1), 4); |
| 419 | else |
| 420 | srcPitch = ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->width, 4); |
| 421 | |
| 422 | src += y * srcPitch + x; |
| 423 | if (!video->texturedcxx . . $ sna_video#textured.) |
| 424 | x = y = 0; |
| 425 | |
| 426 | switch (frame->rotationcxx . . $ sna_video_frame#rotation.) { |
| 427 | case RR_Rotate_0cxx . . $ `<external>/17919557788947152127/randr.h:143:9`!: |
| 428 | dst += y * dstPitch + x; |
| 429 | if (srcPitch == dstPitch && srcPitch == w) |
| 430 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, srcPitch * h); |
| 431 | else while (h--) { |
| 432 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, w); |
| 433 | src += srcPitch; |
| 434 | dst += dstPitch; |
| 435 | } |
| 436 | break; |
| 437 | case RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`!: |
| 438 | for (i = 0; i < h; i++) { |
| 439 | s = src; |
| 440 | for (j = 0; j < w; j++) |
| 441 | dst[i + ((x + w - j - 1) * dstPitch)] = *s++; |
| 442 | src += srcPitch; |
| 443 | } |
| 444 | break; |
| 445 | case RR_Rotate_180cxx . . $ `<external>/17919557788947152127/randr.h:145:9`!: |
| 446 | for (i = 0; i < h; i++) { |
| 447 | s = src; |
| 448 | for (j = 0; j < w; j++) { |
| 449 | dst[(x + w - j - 1) + |
| 450 | ((h - i - 1) * dstPitch)] = *s++; |
| 451 | } |
| 452 | src += srcPitch; |
| 453 | } |
| 454 | break; |
| 455 | case RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!: |
| 456 | for (i = 0; i < h; i++) { |
| 457 | s = src; |
| 458 | for (j = 0; j < w; j++) { |
| 459 | dst[(h - i - 1) + (x + j * dstPitch)] = *s++; |
| 460 | } |
| 461 | src += srcPitch; |
| 462 | } |
| 463 | break; |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | static void |
| 468 | sna_copy_nv12_datacxx . . $ sna_copy_nv12_data(c144ab9a070146cb).(struct sna_videocxx . . $ sna_video# *video, |
| 469 | const struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 470 | const uint8_tcxx . . $ uint8_t# *src, uint8_tcxx . . $ uint8_t# *dst) |
| 471 | { |
| 472 | sna_memcpy_planecxx . . $ sna_memcpy_plane(7c19a117c92eec9c).(video, dst, src, frame, 0); |
| 473 | src += frame->heightcxx . . $ sna_video_frame#height. * ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->width, 4); |
| 474 | dst += frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 475 | sna_memcpy_cbcr_planecxx . . $ sna_memcpy_cbcr_plane(fe7e7edd66193a9c).(video, (void*)dst, (void*)src, frame); |
| 476 | } |
| 477 | |
| 478 | static void |
| 479 | sna_copy_planar_datacxx . . $ sna_copy_planar_data(c144ab9a070146cb).(struct sna_videocxx . . $ sna_video# *video, |
| 480 | const struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 481 | const uint8_tcxx . . $ uint8_t# *src, uint8_tcxx . . $ uint8_t# *dst) |
| 482 | { |
| 483 | uint8_tcxx . . $ uint8_t# *d; |
| 484 | |
| 485 | sna_memcpy_planecxx . . $ sna_memcpy_plane(7c19a117c92eec9c).(video, dst, src, frame, 0); |
| 486 | src += frame->heightcxx . . $ sna_video_frame#height. * ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->width, 4); |
| 487 | |
| 488 | if (frame->idcxx . . $ sna_video_frame#id. == FOURCC_I420cxx . . $ `<external>/5950719045248363523/fourcc.h:79:9`!) |
| 489 | d = dst + frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 490 | else |
| 491 | d = dst + frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset.; |
| 492 | sna_memcpy_planecxx . . $ sna_memcpy_plane(7c19a117c92eec9c).(video, d, src, frame, 1); |
| 493 | src += (frame->heightcxx . . $ sna_video_frame#height. >> 1) * ALIGNcxx . . $ `src/sna/sna.h:541:9`!(frame->width >> 1, 4); |
| 494 | |
| 495 | if (frame->idcxx . . $ sna_video_frame#id. == FOURCC_I420cxx . . $ `<external>/5950719045248363523/fourcc.h:79:9`!) |
| 496 | d = dst + frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset.; |
| 497 | else |
| 498 | d = dst + frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 499 | sna_memcpy_planecxx . . $ sna_memcpy_plane(7c19a117c92eec9c).(video, d, src, frame, 1); |
| 500 | } |
| 501 | |
| 502 | static void |
| 503 | sna_copy_packed_datacxx . . $ sna_copy_packed_data(c144ab9a070146cb).(struct sna_videocxx . . $ sna_video# *video, |
| 504 | const struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 505 | const uint8_tcxx . . $ uint8_t# *buf, |
| 506 | uint8_tcxx . . $ uint8_t# *dst) |
| 507 | { |
| 508 | int pitch = frame->widthcxx . . $ sna_video_frame#width. << 1; |
| 509 | const uint8_tcxx . . $ uint8_t# *src, *s; |
| 510 | int x, y, w, h; |
| 511 | int i, j; |
| 512 | |
| 513 | if (video->texturedcxx . . $ sna_video#textured.) { |
| 514 | /* XXX support copying cropped extents */ |
| 515 | x = y = 0; |
| 516 | w = frame->widthcxx . . $ sna_video_frame#width.; |
| 517 | h = frame->heightcxx . . $ sna_video_frame#height.; |
| 518 | } else { |
| 519 | x = frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 520 | y = frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 521 | w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 522 | h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 523 | } |
| 524 | |
| 525 | src = buf + (y * pitch) + (x << 1); |
| 526 | |
| 527 | switch (frame->rotationcxx . . $ sna_video_frame#rotation.) { |
| 528 | case RR_Rotate_0cxx . . $ `<external>/17919557788947152127/randr.h:143:9`!: |
| 529 | w <<= 1; |
| 530 | for (i = 0; i < h; i++) { |
| 531 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, src, w); |
| 532 | src += pitch; |
| 533 | dst += frame->pitchcxx . . $ sna_video_frame#pitch.[0]; |
| 534 | } |
| 535 | break; |
| 536 | case RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`!: |
| 537 | h <<= 1; |
| 538 | for (i = 0; i < h; i += 2) { |
| 539 | s = src; |
| 540 | for (j = 0; j < w; j++) { |
| 541 | /* Copy Y */ |
| 542 | dst[(i + 0) + ((w - j - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s; |
| 543 | s += 2; |
| 544 | } |
| 545 | src += pitch; |
| 546 | } |
| 547 | h >>= 1; |
| 548 | src = buf + (y * pitch) + (x << 1); |
| 549 | for (i = 0; i < h; i += 2) { |
| 550 | for (j = 0; j < w; j += 2) { |
| 551 | /* Copy U */ |
| 552 | dst[((i * 2) + 1) + ((w - j - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 1 + (i * pitch)]; |
| 553 | dst[((i * 2) + 1) + ((w - j - 2) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 1 + ((i + 1) * pitch)]; |
| 554 | /* Copy V */ dst[((i * 2) + 3) + ((w - j - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 3 + (i * pitch)]; |
| 555 | dst[((i * 2) + 3) + ((w - j - 2) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 3 + ((i + 1) * pitch)]; |
| 556 | } |
| 557 | } |
| 558 | break; |
| 559 | case RR_Rotate_180cxx . . $ `<external>/17919557788947152127/randr.h:145:9`!: |
| 560 | w <<= 1; |
| 561 | for (i = 0; i < h; i++) { |
| 562 | s = src; |
| 563 | for (j = 0; j < w; j += 4) { |
| 564 | dst[(w - j - 4) + ((h - i - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s++; |
| 565 | dst[(w - j - 3) + ((h - i - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s++; |
| 566 | dst[(w - j - 2) + ((h - i - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s++; |
| 567 | dst[(w - j - 1) + ((h - i - 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s++; |
| 568 | } |
| 569 | src += pitch; |
| 570 | } |
| 571 | break; |
| 572 | case RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!: |
| 573 | h <<= 1; |
| 574 | for (i = 0; i < h; i += 2) { |
| 575 | s = src; |
| 576 | for (j = 0; j < w; j++) { |
| 577 | /* Copy Y */ |
| 578 | dst[(h - i - 2) + (j * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = *s; |
| 579 | s += 2; |
| 580 | } |
| 581 | src += pitch; |
| 582 | } |
| 583 | h >>= 1; |
| 584 | src = buf + (y * pitch) + (x << 1); |
| 585 | for (i = 0; i < h; i += 2) { |
| 586 | for (j = 0; j < w; j += 2) { |
| 587 | /* Copy U */ |
| 588 | dst[(((h - i) * 2) - 3) + (j * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 1 + (i * pitch)]; |
| 589 | dst[(((h - i) * 2) - 3) + ((j + 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 1 + ((i + 1) * pitch)]; |
| 590 | /* Copy V */ |
| 591 | dst[(((h - i) * 2) - 1) + (j * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 3 + (i * pitch)]; |
| 592 | dst[(((h - i) * 2) - 1) + ((j + 1) * frame->pitchcxx . . $ sna_video_frame#pitch.[0])] = src[(j * 2) + 3 + ((i + 1) * pitch)]; |
| 593 | } |
| 594 | } |
| 595 | break; |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | static void |
| 600 | sna_copy_ayuv_datacxx . . $ sna_copy_ayuv_data(c144ab9a070146cb).(struct sna_videocxx . . $ sna_video# *video, |
| 601 | const struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 602 | const uint8_tcxx . . $ uint8_t# *buf, |
| 603 | uint8_tcxx . . $ uint8_t# *dst) |
| 604 | { |
| 605 | int pitch = frame->widthcxx . . $ sna_video_frame#width. << 2; |
| 606 | const uint32_tcxx . . $ uint32_t# *src_dw; |
| 607 | const uint8_tcxx . . $ uint8_t# *src; |
| 608 | uint32_tcxx . . $ uint32_t# *dst_dw = (uint32_tcxx . . $ uint32_t# *)dst; |
| 609 | int x, y, w, h; |
| 610 | int i, j; |
| 611 | |
| 612 | if (video->texturedcxx . . $ sna_video#textured.) { |
| 613 | /* XXX support copying cropped extents */ |
| 614 | x = y = 0; |
| 615 | w = frame->widthcxx . . $ sna_video_frame#width.; |
| 616 | h = frame->heightcxx . . $ sna_video_frame#height.; |
| 617 | } else { |
| 618 | x = frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 619 | y = frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 620 | w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 621 | h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 622 | } |
| 623 | |
| 624 | src = buf + (y * pitch) + (x << 2); |
| 625 | src_dw = (uint32_tcxx . . $ uint32_t# *)src; |
| 626 | |
| 627 | switch (frame->rotationcxx . . $ sna_video_frame#rotation.) { |
| 628 | case RR_Rotate_0cxx . . $ `<external>/17919557788947152127/randr.h:143:9`!: |
| 629 | for (i = 0; i < h; i++) { |
| 630 | for (j = 0; j < w; j++) { |
| 631 | /* |
| 632 | * Have to reverse bytes order, because the only |
| 633 | * player which supports AYUV format currently is |
| 634 | * Gstreamer and it supports in bad way, even though |
| 635 | * spec says MSB:AYUV, we get the bytes opposite way. |
| 636 | */ |
| 637 | dst_dw[i * w + j] = bswap_32cxx . . $ `<external>/11871147157791630944/byteswap.h:35:9`!(src_dw[i * w + j]); |
| 638 | } |
| 639 | } |
| 640 | break; |
| 641 | case RR_Rotate_90cxx . . $ `<external>/17919557788947152127/randr.h:144:9`!: |
| 642 | for (i = 0; i < h; i++) { |
| 643 | for (j = 0; j < w; j++) { |
| 644 | dst_dw[(w - j - 1) * h + i] = bswap_32cxx . . $ `<external>/11871147157791630944/byteswap.h:35:9`!(src_dw[i * w + j]); |
| 645 | } |
| 646 | } |
| 647 | break; |
| 648 | case RR_Rotate_180cxx . . $ `<external>/17919557788947152127/randr.h:145:9`!: |
| 649 | for (i = 0; i < h; i++) { |
| 650 | for (j = 0; j < w; j++) { |
| 651 | dst_dw[(h - i - 1) * w + w - j - 1] = bswap_32cxx . . $ `<external>/11871147157791630944/byteswap.h:35:9`!(src_dw[i * w + j]); |
| 652 | } |
| 653 | } |
| 654 | break; |
| 655 | case RR_Rotate_270cxx . . $ `<external>/17919557788947152127/randr.h:146:9`!: |
| 656 | for (i = 0; i < h; i++) { |
| 657 | for (j = 0; j < w; j++) { |
| 658 | dst_dw[(w - j - 1) * h + i] = bswap_32cxx . . $ `<external>/11871147157791630944/byteswap.h:35:9`!(src_dw[i * w + j]); |
| 659 | } |
| 660 | } |
| 661 | break; |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! |
| 666 | sna_video_copy_datacxx . . $ sna_video_copy_data(872f30cf9ffb429f).(struct sna_videocxx . . $ sna_video# *video, |
| 667 | struct sna_video_framecxx . . $ sna_video_frame# *frame, |
| 668 | const uint8_tcxx . . $ uint8_t# *buf) |
| 669 | { |
| 670 | uint8_tcxx . . $ uint8_t# *dst; |
| 671 | |
| 672 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: handle=%d, size=%dx%d [%d], pitch=[%d,%d] rotation=%d, is-texture=%d\n", |
| 673 | __FUNCTION__, frame->bo ? frame->bo->handle : 0, |
| 674 | frame->width, frame->height, frame->size, frame->pitch[0], frame->pitch[1], |
| 675 | frame->rotation, video->textured)); |
| 676 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: image=(%d, %d), (%d, %d), source=(%d, %d), (%d, %d)\n", |
| 677 | __FUNCTION__, |
| 678 | frame->image.x1, frame->image.y1, frame->image.x2, frame->image.y2, |
| 679 | frame->src.x1, frame->src.y1, frame->src.x2, frame->src.y2)); |
| 680 | assertcxx . . $ `/usr/include/assert.h:50:10`!(frame->width && frame->height); |
| 681 | assertcxx . . $ `/usr/include/assert.h:50:10`!(frame->rotation); |
| 682 | assertcxx . . $ `/usr/include/assert.h:50:10`!(frame->size); |
| 683 | |
| 684 | /* In the common case, we can simply the upload in a single pwrite */ |
| 685 | if (frame->rotationcxx . . $ sna_video_frame#rotation. == RR_Rotate_0cxx . . $ `<external>/17919557788947152127/randr.h:143:9`! && !video->tiledcxx . . $ sna_video#tiled. && !is_ayuv_fourcccxx . . $ is_ayuv_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 686 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: unrotated, untiled fast paths: is-planar?=%d\n", |
| 687 | __FUNCTION__, is_planar_fourcc(frame->id))); |
| 688 | if (is_nv12_fourcccxx . . $ is_nv12_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 689 | int w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 690 | int h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 691 | if (ALIGNcxx . . $ `src/sna/sna.h:541:9`!(h, 2) == frame->heightcxx . . $ sna_video_frame#height. && |
| 692 | ALIGNcxx . . $ `src/sna/sna.h:541:9`!(w, 4) == frame->pitchcxx . . $ sna_video_frame#pitch.[0] && |
| 693 | ALIGNcxx . . $ `src/sna/sna.h:541:9`!(w, 4) == frame->pitchcxx . . $ sna_video_frame#pitch.[1]) { |
| 694 | if (frame->bocxx . . $ sna_video_frame#bo.) { |
| 695 | if (!kgem_bo_writecxx . . $ kgem_bo_write(3c48850bceaed3e1).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->bocxx . . $ sna_video_frame#bo., |
| 696 | buf, frame->sizecxx . . $ sna_video_frame#size.)) |
| 697 | goto use_gtt; |
| 698 | } else { |
| 699 | frame->bocxx . . $ sna_video_frame#bo. = kgem_create_buffercxx . . $ kgem_create_buffer(d04e4a54afad65e5).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->sizecxx . . $ sna_video_frame#size., |
| 700 | KGEM_BUFFER_WRITEcxx . . $ `src/sna/kgem.h:830:9`! | KGEM_BUFFER_WRITE_INPLACEcxx . . $ `src/sna/kgem.h:834:9`!, |
| 701 | (void **)&dst); |
| 702 | if (frame->bocxx . . $ sna_video_frame#bo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 703 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 704 | |
| 705 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, buf, frame->sizecxx . . $ sna_video_frame#size.); |
| 706 | } |
| 707 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 708 | } |
| 709 | } else if (is_planar_fourcccxx . . $ is_planar_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) { |
| 710 | int w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 711 | int h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 712 | if (ALIGNcxx . . $ `src/sna/sna.h:541:9`!(h, 2) == frame->heightcxx . . $ sna_video_frame#height. && |
| 713 | ALIGNcxx . . $ `src/sna/sna.h:541:9`!(w >> 1, 4) == frame->pitchcxx . . $ sna_video_frame#pitch.[0] && |
| 714 | ALIGNcxx . . $ `src/sna/sna.h:541:9`!(w, 4) == frame->pitchcxx . . $ sna_video_frame#pitch.[1]) { |
| 715 | if (frame->bocxx . . $ sna_video_frame#bo.) { |
| 716 | if (!kgem_bo_writecxx . . $ kgem_bo_write(3c48850bceaed3e1).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->bocxx . . $ sna_video_frame#bo., |
| 717 | buf, frame->sizecxx . . $ sna_video_frame#size.)) |
| 718 | goto use_gtt; |
| 719 | } else { |
| 720 | frame->bocxx . . $ sna_video_frame#bo. = kgem_create_buffercxx . . $ kgem_create_buffer(d04e4a54afad65e5).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->sizecxx . . $ sna_video_frame#size., |
| 721 | KGEM_BUFFER_WRITEcxx . . $ `src/sna/kgem.h:830:9`! | KGEM_BUFFER_WRITE_INPLACEcxx . . $ `src/sna/kgem.h:834:9`!, |
| 722 | (void **)&dst); |
| 723 | if (frame->bocxx . . $ sna_video_frame#bo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 724 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 725 | |
| 726 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, buf, frame->sizecxx . . $ sna_video_frame#size.); |
| 727 | } |
| 728 | if (frame->idcxx . . $ sna_video_frame#id. != FOURCC_I420cxx . . $ `<external>/5950719045248363523/fourcc.h:79:9`!) { |
| 729 | uint32_tcxx . . $ uint32_t# tmp; |
| 730 | tmp = frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset.; |
| 731 | frame->VBufOffsetcxx . . $ sna_video_frame#VBufOffset. = frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset.; |
| 732 | frame->UBufOffsetcxx . . $ sna_video_frame#UBufOffset. = tmp; |
| 733 | } |
| 734 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 735 | } |
| 736 | } else { |
| 737 | int x, y, w, h; |
| 738 | |
| 739 | if (video->texturedcxx . . $ sna_video#textured.) { |
| 740 | /* XXX support copying cropped extents */ |
| 741 | x = y = 0; |
| 742 | w = frame->widthcxx . . $ sna_video_frame#width.; |
| 743 | h = frame->heightcxx . . $ sna_video_frame#height.; |
| 744 | } else { |
| 745 | x = frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 746 | y = frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 747 | w = frame->imagecxx . . $ sna_video_frame#image..x2cxx . . $ pixman_box16#x2. - frame->imagecxx . . $ sna_video_frame#image..x1cxx . . $ pixman_box16#x1.; |
| 748 | h = frame->imagecxx . . $ sna_video_frame#image..y2cxx . . $ pixman_box16#y2. - frame->imagecxx . . $ sna_video_frame#image..y1cxx . . $ pixman_box16#y1.; |
| 749 | } |
| 750 | |
| 751 | if (w*2 == frame->pitchcxx . . $ sna_video_frame#pitch.[0]) { |
| 752 | buf += (2U*y * frame->widthcxx . . $ sna_video_frame#width.) + (x << 1); |
| 753 | if (frame->bocxx . . $ sna_video_frame#bo.) { |
| 754 | if (!kgem_bo_writecxx . . $ kgem_bo_write(3c48850bceaed3e1).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->bocxx . . $ sna_video_frame#bo., |
| 755 | buf, 2U*h*frame->widthcxx . . $ sna_video_frame#width.)) |
| 756 | goto use_gtt; |
| 757 | } else { |
| 758 | frame->bocxx . . $ sna_video_frame#bo. = kgem_create_buffercxx . . $ kgem_create_buffer(d04e4a54afad65e5).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->sizecxx . . $ sna_video_frame#size., |
| 759 | KGEM_BUFFER_WRITEcxx . . $ `src/sna/kgem.h:830:9`! | KGEM_BUFFER_WRITE_INPLACEcxx . . $ `src/sna/kgem.h:834:9`!, |
| 760 | (void **)&dst); |
| 761 | if (frame->bocxx . . $ sna_video_frame#bo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 762 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 763 | |
| 764 | memcpycxx . . $ memcpy(cc817cb175f282d).(dst, buf, 2U*h*frame->widthcxx . . $ sna_video_frame#width.); |
| 765 | } |
| 766 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | DBGcxx . . $ `src/sna/debug.h:35:9`!(("%s: source cropped, fallback\n", __FUNCTION__)); |
| 771 | } |
| 772 | |
| 773 | use_gtt: /* copy data, must use GTT so that we keep the overlay uncached */ |
| 774 | if (frame->bocxx . . $ sna_video_frame#bo.) { |
| 775 | dst = kgem_bo_map__gttcxx . . $ kgem_bo_map__gtt(2cf92fbefefb81de).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->bocxx . . $ sna_video_frame#bo.); |
| 776 | if (dst == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 777 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 778 | } else { |
| 779 | frame->bocxx . . $ sna_video_frame#bo. = kgem_create_buffercxx . . $ kgem_create_buffer(d04e4a54afad65e5).(&video->snacxx . . $ sna_video#sna.->kgemcxx . . $ sna#kgem., frame->sizecxx . . $ sna_video_frame#size., |
| 780 | KGEM_BUFFER_WRITEcxx . . $ `src/sna/kgem.h:830:9`! | KGEM_BUFFER_WRITE_INPLACEcxx . . $ `src/sna/kgem.h:834:9`!, |
| 781 | (void **)&dst); |
| 782 | if (frame->bocxx . . $ sna_video_frame#bo. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 783 | return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 784 | } |
| 785 | |
| 786 | if (is_nv12_fourcccxx . . $ is_nv12_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) |
| 787 | sna_copy_nv12_datacxx . . $ sna_copy_nv12_data(c144ab9a070146cb).(video, frame, buf, dst); |
| 788 | else if (is_planar_fourcccxx . . $ is_planar_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) |
| 789 | sna_copy_planar_datacxx . . $ sna_copy_planar_data(c144ab9a070146cb).(video, frame, buf, dst); |
| 790 | else if (is_ayuv_fourcccxx . . $ is_ayuv_fourcc(7864480464b09eea).(frame->idcxx . . $ sna_video_frame#id.)) |
| 791 | sna_copy_ayuv_datacxx . . $ sna_copy_ayuv_data(c144ab9a070146cb).(video, frame, buf, dst); |
| 792 | else |
| 793 | sna_copy_packed_datacxx . . $ sna_copy_packed_data(c144ab9a070146cb).(video, frame, buf, dst); |
| 794 | |
| 795 | return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 796 | } |
| 797 | |
| 798 | void sna_video_fill_colorkeycxx . . $ sna_video_fill_colorkey(ba2184acb741c4a).(struct sna_videocxx . . $ sna_video# *video, |
| 799 | const RegionReccxx . . $ RegionRec# *clip) |
| 800 | { |
| 801 | struct snacxx . . $ sna# *sna = video->snacxx . . $ sna_video#sna.; |
| 802 | PixmapPtrcxx . . $ PixmapPtr# front = sna->frontcxx . . $ sna#front.; |
| 803 | struct kgem_bocxx . . $ kgem_bo# *bo = __sna_pixmap_get_bocxx . . $ __sna_pixmap_get_bo(7de55692dd6e3c3b).(front); |
| 804 | uint8_tcxx . . $ uint8_t# *dst, *tmp; |
| 805 | int w, width; |
| 806 | |
| 807 | if (video->AlwaysOnTopcxx . . $ sna_video#AlwaysOnTop. || RegionEqualcxx . . $ RegionEqual(678c1f2019dcae33).(&video->clipcxx . . $ sna_video#clip., (RegionPtrcxx . . $ RegionPtr#)clip)) |
| 808 | return; |
| 809 | |
| 810 | assertcxx . . $ `/usr/include/assert.h:50:10`!(bo); |
| 811 | if (!wedgedcxx . . $ wedged(99a00183d23f5b6).(sna) && |
| 812 | sna_blt_fill_boxescxx . . $ sna_blt_fill_boxes(616a53ce4e0a1cc6).(sna, GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, bo, |
| 813 | front->drawablecxx . . $ _Pixmap#drawable..bitsPerPixelcxx . . $ _Drawable#bitsPerPixel., |
| 814 | video->color_keycxx . . $ sna_video#color_key., |
| 815 | region_rectscxx . . $ region_rects(442658933ad7f8b7).(clip), |
| 816 | region_num_rectscxx . . $ region_num_rects(b2619d5288bc5588).(clip))) { |
| 817 | RegionCopycxx . . $ RegionCopy(678c1f2019dcae33).(&video->clipcxx . . $ sna_video#clip., (RegionPtrcxx . . $ RegionPtr#)clip); |
| 818 | return; |
| 819 | } |
| 820 | |
| 821 | dst = kgem_bo_map__gttcxx . . $ kgem_bo_map__gtt(2cf92fbefefb81de).(&sna->kgemcxx . . $ sna#kgem., bo); |
| 822 | if (dst == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 823 | return; |
| 824 | |
| 825 | w = front->drawablecxx . . $ _Pixmap#drawable..bitsPerPixelcxx . . $ _Drawable#bitsPerPixel./8; |
| 826 | width = (clip->extentscxx . . $ pixman_region16#extents..x2cxx . . $ pixman_box16#x2. - clip->extentscxx . . $ pixman_region16#extents..x1cxx . . $ pixman_box16#x1.) * w; |
| 827 | tmp = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(width); |
| 828 | if (tmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 829 | return; |
| 830 | |
| 831 | memcpycxx . . $ memcpy(cc817cb175f282d).(tmp, &video->color_keycxx . . $ sna_video#color_key., w); |
| 832 | while (2 * w < width) { |
| 833 | memcpycxx . . $ memcpy(cc817cb175f282d).(tmp + w, tmp, w); |
| 834 | w *= 2; |
| 835 | } |
| 836 | if (w < width) |
| 837 | memcpycxx . . $ memcpy(cc817cb175f282d).(tmp + w, tmp, width - w); |
| 838 | |
| 839 | if (sigtrap_getcxx . . $ `src/sna/sna.h:1371:9`!() == 0) { |
| 840 | const BoxReccxx . . $ BoxRec# *box = region_rectscxx . . $ region_rects(442658933ad7f8b7).(clip); |
| 841 | int n = region_num_rectscxx . . $ region_num_rects(b2619d5288bc5588).(clip); |
| 842 | |
| 843 | w = front->drawablecxx . . $ _Pixmap#drawable..bitsPerPixelcxx . . $ _Drawable#bitsPerPixel./8; |
| 844 | do { |
| 845 | int y = box->y1cxx . . $ pixman_box16#y1.; |
| 846 | uint8_tcxx . . $ uint8_t# *row = dst + y*bo->pitchcxx . . $ kgem_bo#pitch. + w*box->x1cxx . . $ pixman_box16#x1.; |
| 847 | |
| 848 | width = (box->x2cxx . . $ pixman_box16#x2. - box->x1cxx . . $ pixman_box16#x1.) * w; |
| 849 | while (y < box->y2cxx . . $ pixman_box16#y2.) { |
| 850 | memcpycxx . . $ memcpy(cc817cb175f282d).(row, tmp, width); |
| 851 | row += bo->pitchcxx . . $ kgem_bo#pitch.; |
| 852 | y++; |
| 853 | } |
| 854 | box++; |
| 855 | } while (--n); |
| 856 | sigtrap_putcxx . . $ sigtrap_put(49f6e7a06ebc5aa8).(); |
| 857 | |
| 858 | RegionCopycxx . . $ RegionCopy(678c1f2019dcae33).(&video->clipcxx . . $ sna_video#clip., (RegionPtrcxx . . $ RegionPtr#)clip); |
| 859 | } |
| 860 | |
| 861 | freecxx . . $ free(5d22bdacc48458e8).(tmp); |
| 862 | } |
| 863 | |
| 864 | XvAdaptorPtrcxx . . $ XvAdaptorPtr# sna_xv_adaptor_alloccxx . . $ sna_xv_adaptor_alloc(86e22ee1356d5d44).(struct snacxx . . $ sna# *sna) |
| 865 | { |
| 866 | XvAdaptorPtrcxx . . $ XvAdaptorPtr# new_adaptors; |
| 867 | |
| 868 | new_adaptors = realloccxx . . $ realloc(417ab160f6baadc6).(sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors., |
| 869 | (sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors.+1)*sizeof(XvAdaptorReccxx . . $ XvAdaptorRec#)); |
| 870 | if (new_adaptors == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 871 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 872 | |
| 873 | if (sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors. && new_adaptors != sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.) { |
| 874 | XvAdaptorPtrcxx . . $ XvAdaptorPtr# adaptor = new_adaptors; |
| 875 | int i = sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors., j; |
| 876 | while (i--) { |
| 877 | for (j = 0; j < adaptor->nPortscxx . . $ $anonymous_type_dff90da1b2397d0b_5#nPorts.; j++) |
| 878 | adaptor->pPortscxx . . $ $anonymous_type_dff90da1b2397d0b_5#pPorts.[j].pAdaptorcxx . . $ _XvPortRec#pAdaptor. = adaptor; |
| 879 | adaptor++; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors. = new_adaptors; |
| 884 | return &sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors.++]; |
| 885 | } |
| 886 | |
| 887 | int |
| 888 | sna_xv_alloc_portcxx . . $ sna_xv_alloc_port(d011a7cb9e68b5dd).(unsigned long port, XvPortPtrcxx . . $ XvPortPtr# in, XvPortPtrcxx . . $ XvPortPtr# *out) |
| 889 | { |
| 890 | *out = in; |
| 891 | return Successcxx . . $ `<external>/1208737181511191802/X.h:350:9`!; |
| 892 | } |
| 893 | |
| 894 | int |
| 895 | sna_xv_free_portcxx . . $ sna_xv_free_port(7232dc0912135880).(XvPortPtrcxx . . $ XvPortPtr# port) |
| 896 | { |
| 897 | return Successcxx . . $ `<external>/1208737181511191802/X.h:350:9`!; |
| 898 | } |
| 899 | |
| 900 | int |
| 901 | sna_xv_fixup_formatscxx . . $ sna_xv_fixup_formats(886cde0cca0d5506).(ScreenPtrcxx . . $ ScreenPtr# screen, XvFormatPtrcxx . . $ XvFormatPtr# formats, int num_formats) |
| 902 | { |
| 903 | XvFormatPtrcxx . . $ XvFormatPtr# out = formats; |
| 904 | int count = 0; |
| 905 | |
| 906 | while (num_formats--) { |
| 907 | int num_visuals = screen->numVisualscxx . . $ _Screen#numVisuals.; |
| 908 | VisualPtrcxx . . $ VisualPtr# v = screen->visualscxx . . $ _Screen#visuals.; |
| 909 | |
| 910 | while (num_visuals--) { |
| 911 | if (v->classcxx . . $ _Visual#class. == TrueColorcxx . . $ `<external>/1208737181511191802/X.h:708:9`! && |
| 912 | v->nplanescxx . . $ _Visual#nplanes. == formats->depthcxx . . $ $anonymous_type_dff90da1b2397d0b_1#depth.) { |
| 913 | int tmp = out[count].depthcxx . . $ $anonymous_type_dff90da1b2397d0b_1#depth.; |
| 914 | out[count].depthcxx . . $ $anonymous_type_dff90da1b2397d0b_1#depth. = formats->depthcxx . . $ $anonymous_type_dff90da1b2397d0b_1#depth.; |
| 915 | out[count].visualcxx . . $ $anonymous_type_dff90da1b2397d0b_1#visual. = v->vidcxx . . $ _Visual#vid.; |
| 916 | formats->depthcxx . . $ $anonymous_type_dff90da1b2397d0b_1#depth. = tmp; |
| 917 | count++; |
| 918 | break; |
| 919 | } |
| 920 | v++; |
| 921 | } |
| 922 | |
| 923 | formats++; |
| 924 | } |
| 925 | |
| 926 | return count; |
| 927 | } |
| 928 | |
| 929 | #if XORG_XV_VERSIONcxx . . $ `src/compat-api.h:218:9`! < 2 |
| 930 | static int |
| 931 | sna_xv_query_adaptors(ScreenPtr screen, |
| 932 | XvAdaptorPtr *adaptors, |
| 933 | int *num_adaptors) |
| 934 | { |
| 935 | struct sna *sna = to_sna_from_screen(screen); |
| 936 | |
| 937 | *num_adaptors = sna->xv.num_adaptors; |
| 938 | *adaptors = sna->xv.adaptors; |
| 939 | return Success; |
| 940 | } |
| 941 | |
| 942 | static Bool |
| 943 | sna_xv_close_screen(CLOSE_SCREEN_ARGS_DECL) |
| 944 | { |
| 945 | struct sna *sna = to_sna_from_screen(screen); |
| 946 | sna_video_close(sna); |
| 947 | return TRUE; |
| 948 | } |
| 949 | #endif |
| 950 | |
| 951 | void sna_video_initcxx . . $ sna_video_init(8cc8bc1fa08eaefd).(struct snacxx . . $ sna# *sna, ScreenPtrcxx . . $ ScreenPtr# screen) |
| 952 | { |
| 953 | XvScreenPtrcxx . . $ XvScreenPtr# xv; |
| 954 | |
| 955 | if (noXvExtensioncxx . . $ noXvExtension.) |
| 956 | return; |
| 957 | |
| 958 | if (xf86LoaderCheckSymbolcxx . . $ xf86LoaderCheckSymbol(5c4306d8553b3696).("xf86XVListGenericAdaptors")) { |
| 959 | XF86VideoAdaptorPtrcxx . . $ XF86VideoAdaptorPtr# *adaptors = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 960 | int num_adaptors = xf86XVListGenericAdaptorscxx . . $ xf86XVListGenericAdaptors(ffc9d8c68be0088).(sna->scrncxx . . $ sna#scrn., &adaptors); |
| 961 | if (num_adaptors) |
| 962 | xf86DrvMsgcxx . . $ xf86DrvMsg(68e14d797711febb).(sna->scrncxx . . $ sna#scrn.->scrnIndexcxx . . $ _ScrnInfoRec#scrnIndex., X_ERRORcxx . . $ X_ERROR., |
| 963 | "Ignoring generic xf86XV adaptors"); |
| 964 | freecxx . . $ free(5d22bdacc48458e8).(adaptors); |
| 965 | } |
| 966 | |
| 967 | if (XvScreenInitcxx . . $ XvScreenInit(d38b7d3414297794).(screen) != Successcxx . . $ `<external>/1208737181511191802/X.h:350:9`!) |
| 968 | return; |
| 969 | |
| 970 | xv = to_xvcxx . . $ to_xv(96cd7d10aa7f45f7).(screen); |
| 971 | #if XORG_XV_VERSIONcxx . . $ `src/compat-api.h:218:9`! < 2 |
| 972 | xv->ddCloseScreen = sna_xv_close_screen; |
| 973 | xv->ddQueryAdaptors = sna_xv_query_adaptors; |
| 974 | #endif |
| 975 | |
| 976 | sna_video_textured_setupcxx . . $ sna_video_textured_setup(8cc8bc1fa08eaefd).(sna, screen); |
| 977 | sna_video_sprite_setupcxx . . $ sna_video_sprite_setup(8cc8bc1fa08eaefd).(sna, screen); |
| 978 | sna_video_overlay_setupcxx . . $ sna_video_overlay_setup(8cc8bc1fa08eaefd).(sna, screen); |
| 979 | |
| 980 | if (sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors. >= 2 && |
| 981 | xf86ReturnOptValBoolcxx . . $ xf86ReturnOptValBool(f5815cd44395110f).(sna->Optionscxx . . $ sna#Options., OPTION_PREFER_OVERLAYcxx . . $ OPTION_PREFER_OVERLAY., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!)) { |
| 982 | XvAdaptorReccxx . . $ XvAdaptorRec# tmp; |
| 983 | |
| 984 | tmp = sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[0]; |
| 985 | sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[0] = sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[1]; |
| 986 | sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[1] = tmp; |
| 987 | } |
| 988 | |
| 989 | xv->nAdaptorscxx . . $ $anonymous_type_dff90da1b2397d0b_6#nAdaptors. = sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors.; |
| 990 | xv->pAdaptorscxx . . $ $anonymous_type_dff90da1b2397d0b_6#pAdaptors. = sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.; |
| 991 | |
| 992 | sna_video_xvmc_setupcxx . . $ sna_video_xvmc_setup(8cc8bc1fa08eaefd).(sna, screen); |
| 993 | } |
| 994 | |
| 995 | void sna_video_destroy_windowcxx . . $ sna_video_destroy_window(7d0588436b617946).(WindowPtrcxx . . $ WindowPtr# win) |
| 996 | { |
| 997 | XvPortPtrcxx . . $ XvPortPtr# port; |
| 998 | |
| 999 | port = sna_window_get_portcxx . . $ sna_window_get_port(f7dc7d8c2f29203).(win); |
| 1000 | if (port) { |
| 1001 | #if XORG_XV_VERSIONcxx . . $ `src/compat-api.h:218:9`! < 2 |
| 1002 | port->pAdaptor->ddStopVideo(NULL, port, &win->drawable); |
| 1003 | #else |
| 1004 | port->pAdaptorcxx . . $ _XvPortRec#pAdaptor.->ddStopVideocxx . . $ $anonymous_type_dff90da1b2397d0b_5#ddStopVideo.(port, &win->drawablecxx . . $ _Window#drawable.); |
| 1005 | #endif |
| 1006 | } |
| 1007 | assertcxx . . $ `/usr/include/assert.h:50:10`!(sna_window_get_port(win) == NULL); |
| 1008 | } |
| 1009 | |
| 1010 | void sna_video_closecxx . . $ sna_video_close(a7abbe1bcccb1d5a).(struct snacxx . . $ sna# *sna) |
| 1011 | { |
| 1012 | int i; |
| 1013 | |
| 1014 | for (i = 0; i < sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors.; i++) { |
| 1015 | freecxx . . $ free(5d22bdacc48458e8).(sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[i].pPortscxx . . $ $anonymous_type_dff90da1b2397d0b_5#pPorts.->devPrivcxx . . $ _XvPortRec#devPriv..ptrcxx . . $ _DevUnion#ptr.); |
| 1016 | freecxx . . $ free(5d22bdacc48458e8).(sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[i].pPortscxx . . $ $anonymous_type_dff90da1b2397d0b_5#pPorts.); |
| 1017 | freecxx . . $ free(5d22bdacc48458e8).(sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.[i].pEncodingscxx . . $ $anonymous_type_dff90da1b2397d0b_5#pEncodings.); |
| 1018 | } |
| 1019 | freecxx . . $ free(5d22bdacc48458e8).(sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors.); |
| 1020 | |
| 1021 | sna->xvcxx . . $ sna#xv..adaptorscxx . . $ sna_xv#adaptors. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 1022 | sna->xvcxx . . $ sna#xv..num_adaptorscxx . . $ sna_xv#num_adaptors. = 0; |
| 1023 | } |