svga3d_surfacedefs.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  1. /**************************************************************************
  2. *
  3. * Copyright © 2008-2015 VMware, Inc., Palo Alto, CA., USA
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the
  8. * "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sub license, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice (including the
  15. * next paragraph) shall be included in all copies or substantial portions
  16. * of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  21. * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
  22. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  24. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. *
  26. **************************************************************************/
  27. /*
  28. * svga3d_surfacedefs.h --
  29. *
  30. * Surface definitions and inlineable utilities for SVGA3d.
  31. */
  32. #ifndef _SVGA3D_SURFACEDEFS_H_
  33. #define _SVGA3D_SURFACEDEFS_H_
  34. #define INCLUDE_ALLOW_USERLEVEL
  35. #define INCLUDE_ALLOW_MODULE
  36. #include "includeCheck.h"
  37. #include <linux/kernel.h>
  38. #include <drm/vmwgfx_drm.h>
  39. #include "svga3d_reg.h"
  40. #define surf_size_struct struct drm_vmw_size
  41. /*
  42. * enum svga3d_block_desc - describes generic properties about formats.
  43. */
  44. enum svga3d_block_desc {
  45. /* Nothing special can be said about this format. */
  46. SVGA3DBLOCKDESC_NONE = 0,
  47. /* Format contains Blue/U data */
  48. SVGA3DBLOCKDESC_BLUE = 1 << 0,
  49. SVGA3DBLOCKDESC_W = 1 << 0,
  50. SVGA3DBLOCKDESC_BUMP_L = 1 << 0,
  51. /* Format contains Green/V data */
  52. SVGA3DBLOCKDESC_GREEN = 1 << 1,
  53. SVGA3DBLOCKDESC_V = 1 << 1,
  54. /* Format contains Red/W/Luminance data */
  55. SVGA3DBLOCKDESC_RED = 1 << 2,
  56. SVGA3DBLOCKDESC_U = 1 << 2,
  57. SVGA3DBLOCKDESC_LUMINANCE = 1 << 2,
  58. /* Format contains Alpha/Q data */
  59. SVGA3DBLOCKDESC_ALPHA = 1 << 3,
  60. SVGA3DBLOCKDESC_Q = 1 << 3,
  61. /* Format is a buffer */
  62. SVGA3DBLOCKDESC_BUFFER = 1 << 4,
  63. /* Format is compressed */
  64. SVGA3DBLOCKDESC_COMPRESSED = 1 << 5,
  65. /* Format uses IEEE floating point */
  66. SVGA3DBLOCKDESC_FP = 1 << 6,
  67. /* Three separate blocks store data. */
  68. SVGA3DBLOCKDESC_PLANAR_YUV = 1 << 7,
  69. /* 2 planes of Y, UV, e.g., NV12. */
  70. SVGA3DBLOCKDESC_2PLANAR_YUV = 1 << 8,
  71. /* 3 planes of separate Y, U, V, e.g., YV12. */
  72. SVGA3DBLOCKDESC_3PLANAR_YUV = 1 << 9,
  73. /* Block with a stencil channel */
  74. SVGA3DBLOCKDESC_STENCIL = 1 << 11,
  75. /* Typeless format */
  76. SVGA3DBLOCKDESC_TYPELESS = 1 << 12,
  77. /* Channels are signed integers */
  78. SVGA3DBLOCKDESC_SINT = 1 << 13,
  79. /* Channels are unsigned integers */
  80. SVGA3DBLOCKDESC_UINT = 1 << 14,
  81. /* Channels are normalized (when sampling) */
  82. SVGA3DBLOCKDESC_NORM = 1 << 15,
  83. /* Channels are in SRGB */
  84. SVGA3DBLOCKDESC_SRGB = 1 << 16,
  85. /* Shared exponent */
  86. SVGA3DBLOCKDESC_EXP = 1 << 17,
  87. /* Format contains color data. */
  88. SVGA3DBLOCKDESC_COLOR = 1 << 18,
  89. /* Format contains depth data. */
  90. SVGA3DBLOCKDESC_DEPTH = 1 << 19,
  91. /* Format contains bump data. */
  92. SVGA3DBLOCKDESC_BUMP = 1 << 20,
  93. /* Format contains YUV video data. */
  94. SVGA3DBLOCKDESC_YUV_VIDEO = 1 << 21,
  95. /* For mixed unsigned/signed formats. */
  96. SVGA3DBLOCKDESC_MIXED = 1 << 22,
  97. /* For distingushing CxV8U8. */
  98. SVGA3DBLOCKDESC_CX = 1 << 23,
  99. /* Different compressed format groups. */
  100. SVGA3DBLOCKDESC_BC1 = 1 << 24,
  101. SVGA3DBLOCKDESC_BC2 = 1 << 25,
  102. SVGA3DBLOCKDESC_BC3 = 1 << 26,
  103. SVGA3DBLOCKDESC_BC4 = 1 << 27,
  104. SVGA3DBLOCKDESC_BC5 = 1 << 28,
  105. SVGA3DBLOCKDESC_A_UINT = SVGA3DBLOCKDESC_ALPHA |
  106. SVGA3DBLOCKDESC_UINT |
  107. SVGA3DBLOCKDESC_COLOR,
  108. SVGA3DBLOCKDESC_A_UNORM = SVGA3DBLOCKDESC_A_UINT |
  109. SVGA3DBLOCKDESC_NORM,
  110. SVGA3DBLOCKDESC_R_UINT = SVGA3DBLOCKDESC_RED |
  111. SVGA3DBLOCKDESC_UINT |
  112. SVGA3DBLOCKDESC_COLOR,
  113. SVGA3DBLOCKDESC_R_UNORM = SVGA3DBLOCKDESC_R_UINT |
  114. SVGA3DBLOCKDESC_NORM,
  115. SVGA3DBLOCKDESC_R_SINT = SVGA3DBLOCKDESC_RED |
  116. SVGA3DBLOCKDESC_SINT |
  117. SVGA3DBLOCKDESC_COLOR,
  118. SVGA3DBLOCKDESC_R_SNORM = SVGA3DBLOCKDESC_R_SINT |
  119. SVGA3DBLOCKDESC_NORM,
  120. SVGA3DBLOCKDESC_G_UINT = SVGA3DBLOCKDESC_GREEN |
  121. SVGA3DBLOCKDESC_UINT |
  122. SVGA3DBLOCKDESC_COLOR,
  123. SVGA3DBLOCKDESC_RG_UINT = SVGA3DBLOCKDESC_RED |
  124. SVGA3DBLOCKDESC_GREEN |
  125. SVGA3DBLOCKDESC_UINT |
  126. SVGA3DBLOCKDESC_COLOR,
  127. SVGA3DBLOCKDESC_RG_UNORM = SVGA3DBLOCKDESC_RG_UINT |
  128. SVGA3DBLOCKDESC_NORM,
  129. SVGA3DBLOCKDESC_RG_SINT = SVGA3DBLOCKDESC_RED |
  130. SVGA3DBLOCKDESC_GREEN |
  131. SVGA3DBLOCKDESC_SINT |
  132. SVGA3DBLOCKDESC_COLOR,
  133. SVGA3DBLOCKDESC_RG_SNORM = SVGA3DBLOCKDESC_RG_SINT |
  134. SVGA3DBLOCKDESC_NORM,
  135. SVGA3DBLOCKDESC_RGB_UINT = SVGA3DBLOCKDESC_RED |
  136. SVGA3DBLOCKDESC_GREEN |
  137. SVGA3DBLOCKDESC_BLUE |
  138. SVGA3DBLOCKDESC_UINT |
  139. SVGA3DBLOCKDESC_COLOR,
  140. SVGA3DBLOCKDESC_RGB_SINT = SVGA3DBLOCKDESC_RED |
  141. SVGA3DBLOCKDESC_GREEN |
  142. SVGA3DBLOCKDESC_BLUE |
  143. SVGA3DBLOCKDESC_SINT |
  144. SVGA3DBLOCKDESC_COLOR,
  145. SVGA3DBLOCKDESC_RGB_UNORM = SVGA3DBLOCKDESC_RGB_UINT |
  146. SVGA3DBLOCKDESC_NORM,
  147. SVGA3DBLOCKDESC_RGB_UNORM_SRGB = SVGA3DBLOCKDESC_RGB_UNORM |
  148. SVGA3DBLOCKDESC_SRGB,
  149. SVGA3DBLOCKDESC_RGBA_UINT = SVGA3DBLOCKDESC_RED |
  150. SVGA3DBLOCKDESC_GREEN |
  151. SVGA3DBLOCKDESC_BLUE |
  152. SVGA3DBLOCKDESC_ALPHA |
  153. SVGA3DBLOCKDESC_UINT |
  154. SVGA3DBLOCKDESC_COLOR,
  155. SVGA3DBLOCKDESC_RGBA_UNORM = SVGA3DBLOCKDESC_RGBA_UINT |
  156. SVGA3DBLOCKDESC_NORM,
  157. SVGA3DBLOCKDESC_RGBA_UNORM_SRGB = SVGA3DBLOCKDESC_RGBA_UNORM |
  158. SVGA3DBLOCKDESC_SRGB,
  159. SVGA3DBLOCKDESC_RGBA_SINT = SVGA3DBLOCKDESC_RED |
  160. SVGA3DBLOCKDESC_GREEN |
  161. SVGA3DBLOCKDESC_BLUE |
  162. SVGA3DBLOCKDESC_ALPHA |
  163. SVGA3DBLOCKDESC_SINT |
  164. SVGA3DBLOCKDESC_COLOR,
  165. SVGA3DBLOCKDESC_RGBA_SNORM = SVGA3DBLOCKDESC_RGBA_SINT |
  166. SVGA3DBLOCKDESC_NORM,
  167. SVGA3DBLOCKDESC_RGBA_FP = SVGA3DBLOCKDESC_RED |
  168. SVGA3DBLOCKDESC_GREEN |
  169. SVGA3DBLOCKDESC_BLUE |
  170. SVGA3DBLOCKDESC_ALPHA |
  171. SVGA3DBLOCKDESC_FP |
  172. SVGA3DBLOCKDESC_COLOR,
  173. SVGA3DBLOCKDESC_UV = SVGA3DBLOCKDESC_U |
  174. SVGA3DBLOCKDESC_V |
  175. SVGA3DBLOCKDESC_BUMP,
  176. SVGA3DBLOCKDESC_UVL = SVGA3DBLOCKDESC_UV |
  177. SVGA3DBLOCKDESC_BUMP_L |
  178. SVGA3DBLOCKDESC_MIXED |
  179. SVGA3DBLOCKDESC_BUMP,
  180. SVGA3DBLOCKDESC_UVW = SVGA3DBLOCKDESC_UV |
  181. SVGA3DBLOCKDESC_W |
  182. SVGA3DBLOCKDESC_BUMP,
  183. SVGA3DBLOCKDESC_UVWA = SVGA3DBLOCKDESC_UVW |
  184. SVGA3DBLOCKDESC_ALPHA |
  185. SVGA3DBLOCKDESC_MIXED |
  186. SVGA3DBLOCKDESC_BUMP,
  187. SVGA3DBLOCKDESC_UVWQ = SVGA3DBLOCKDESC_U |
  188. SVGA3DBLOCKDESC_V |
  189. SVGA3DBLOCKDESC_W |
  190. SVGA3DBLOCKDESC_Q |
  191. SVGA3DBLOCKDESC_BUMP,
  192. SVGA3DBLOCKDESC_L_UNORM = SVGA3DBLOCKDESC_LUMINANCE |
  193. SVGA3DBLOCKDESC_UINT |
  194. SVGA3DBLOCKDESC_NORM |
  195. SVGA3DBLOCKDESC_COLOR,
  196. SVGA3DBLOCKDESC_LA_UNORM = SVGA3DBLOCKDESC_LUMINANCE |
  197. SVGA3DBLOCKDESC_ALPHA |
  198. SVGA3DBLOCKDESC_UINT |
  199. SVGA3DBLOCKDESC_NORM |
  200. SVGA3DBLOCKDESC_COLOR,
  201. SVGA3DBLOCKDESC_R_FP = SVGA3DBLOCKDESC_RED |
  202. SVGA3DBLOCKDESC_FP |
  203. SVGA3DBLOCKDESC_COLOR,
  204. SVGA3DBLOCKDESC_RG_FP = SVGA3DBLOCKDESC_R_FP |
  205. SVGA3DBLOCKDESC_GREEN |
  206. SVGA3DBLOCKDESC_COLOR,
  207. SVGA3DBLOCKDESC_RGB_FP = SVGA3DBLOCKDESC_RG_FP |
  208. SVGA3DBLOCKDESC_BLUE |
  209. SVGA3DBLOCKDESC_COLOR,
  210. SVGA3DBLOCKDESC_YUV = SVGA3DBLOCKDESC_YUV_VIDEO |
  211. SVGA3DBLOCKDESC_COLOR,
  212. SVGA3DBLOCKDESC_AYUV = SVGA3DBLOCKDESC_ALPHA |
  213. SVGA3DBLOCKDESC_YUV_VIDEO |
  214. SVGA3DBLOCKDESC_COLOR,
  215. SVGA3DBLOCKDESC_RGB_EXP = SVGA3DBLOCKDESC_RED |
  216. SVGA3DBLOCKDESC_GREEN |
  217. SVGA3DBLOCKDESC_BLUE |
  218. SVGA3DBLOCKDESC_EXP |
  219. SVGA3DBLOCKDESC_COLOR,
  220. SVGA3DBLOCKDESC_COMP_TYPELESS = SVGA3DBLOCKDESC_COMPRESSED |
  221. SVGA3DBLOCKDESC_TYPELESS,
  222. SVGA3DBLOCKDESC_COMP_UNORM = SVGA3DBLOCKDESC_COMPRESSED |
  223. SVGA3DBLOCKDESC_UINT |
  224. SVGA3DBLOCKDESC_NORM |
  225. SVGA3DBLOCKDESC_COLOR,
  226. SVGA3DBLOCKDESC_COMP_SNORM = SVGA3DBLOCKDESC_COMPRESSED |
  227. SVGA3DBLOCKDESC_SINT |
  228. SVGA3DBLOCKDESC_NORM |
  229. SVGA3DBLOCKDESC_COLOR,
  230. SVGA3DBLOCKDESC_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_COMP_UNORM |
  231. SVGA3DBLOCKDESC_SRGB,
  232. SVGA3DBLOCKDESC_BC1_COMP_TYPELESS = SVGA3DBLOCKDESC_BC1 |
  233. SVGA3DBLOCKDESC_COMP_TYPELESS,
  234. SVGA3DBLOCKDESC_BC1_COMP_UNORM = SVGA3DBLOCKDESC_BC1 |
  235. SVGA3DBLOCKDESC_COMP_UNORM,
  236. SVGA3DBLOCKDESC_BC1_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC1_COMP_UNORM |
  237. SVGA3DBLOCKDESC_SRGB,
  238. SVGA3DBLOCKDESC_BC2_COMP_TYPELESS = SVGA3DBLOCKDESC_BC2 |
  239. SVGA3DBLOCKDESC_COMP_TYPELESS,
  240. SVGA3DBLOCKDESC_BC2_COMP_UNORM = SVGA3DBLOCKDESC_BC2 |
  241. SVGA3DBLOCKDESC_COMP_UNORM,
  242. SVGA3DBLOCKDESC_BC2_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC2_COMP_UNORM |
  243. SVGA3DBLOCKDESC_SRGB,
  244. SVGA3DBLOCKDESC_BC3_COMP_TYPELESS = SVGA3DBLOCKDESC_BC3 |
  245. SVGA3DBLOCKDESC_COMP_TYPELESS,
  246. SVGA3DBLOCKDESC_BC3_COMP_UNORM = SVGA3DBLOCKDESC_BC3 |
  247. SVGA3DBLOCKDESC_COMP_UNORM,
  248. SVGA3DBLOCKDESC_BC3_COMP_UNORM_SRGB = SVGA3DBLOCKDESC_BC3_COMP_UNORM |
  249. SVGA3DBLOCKDESC_SRGB,
  250. SVGA3DBLOCKDESC_BC4_COMP_TYPELESS = SVGA3DBLOCKDESC_BC4 |
  251. SVGA3DBLOCKDESC_COMP_TYPELESS,
  252. SVGA3DBLOCKDESC_BC4_COMP_UNORM = SVGA3DBLOCKDESC_BC4 |
  253. SVGA3DBLOCKDESC_COMP_UNORM,
  254. SVGA3DBLOCKDESC_BC4_COMP_SNORM = SVGA3DBLOCKDESC_BC4 |
  255. SVGA3DBLOCKDESC_COMP_SNORM,
  256. SVGA3DBLOCKDESC_BC5_COMP_TYPELESS = SVGA3DBLOCKDESC_BC5 |
  257. SVGA3DBLOCKDESC_COMP_TYPELESS,
  258. SVGA3DBLOCKDESC_BC5_COMP_UNORM = SVGA3DBLOCKDESC_BC5 |
  259. SVGA3DBLOCKDESC_COMP_UNORM,
  260. SVGA3DBLOCKDESC_BC5_COMP_SNORM = SVGA3DBLOCKDESC_BC5 |
  261. SVGA3DBLOCKDESC_COMP_SNORM,
  262. SVGA3DBLOCKDESC_NV12 = SVGA3DBLOCKDESC_YUV_VIDEO |
  263. SVGA3DBLOCKDESC_PLANAR_YUV |
  264. SVGA3DBLOCKDESC_2PLANAR_YUV |
  265. SVGA3DBLOCKDESC_COLOR,
  266. SVGA3DBLOCKDESC_YV12 = SVGA3DBLOCKDESC_YUV_VIDEO |
  267. SVGA3DBLOCKDESC_PLANAR_YUV |
  268. SVGA3DBLOCKDESC_3PLANAR_YUV |
  269. SVGA3DBLOCKDESC_COLOR,
  270. SVGA3DBLOCKDESC_DEPTH_UINT = SVGA3DBLOCKDESC_DEPTH |
  271. SVGA3DBLOCKDESC_UINT,
  272. SVGA3DBLOCKDESC_DEPTH_UNORM = SVGA3DBLOCKDESC_DEPTH_UINT |
  273. SVGA3DBLOCKDESC_NORM,
  274. SVGA3DBLOCKDESC_DS = SVGA3DBLOCKDESC_DEPTH |
  275. SVGA3DBLOCKDESC_STENCIL,
  276. SVGA3DBLOCKDESC_DS_UINT = SVGA3DBLOCKDESC_DEPTH |
  277. SVGA3DBLOCKDESC_STENCIL |
  278. SVGA3DBLOCKDESC_UINT,
  279. SVGA3DBLOCKDESC_DS_UNORM = SVGA3DBLOCKDESC_DS_UINT |
  280. SVGA3DBLOCKDESC_NORM,
  281. SVGA3DBLOCKDESC_DEPTH_FP = SVGA3DBLOCKDESC_DEPTH |
  282. SVGA3DBLOCKDESC_FP,
  283. SVGA3DBLOCKDESC_UV_UINT = SVGA3DBLOCKDESC_UV |
  284. SVGA3DBLOCKDESC_UINT,
  285. SVGA3DBLOCKDESC_UV_SNORM = SVGA3DBLOCKDESC_UV |
  286. SVGA3DBLOCKDESC_SINT |
  287. SVGA3DBLOCKDESC_NORM,
  288. SVGA3DBLOCKDESC_UVCX_SNORM = SVGA3DBLOCKDESC_UV_SNORM |
  289. SVGA3DBLOCKDESC_CX,
  290. SVGA3DBLOCKDESC_UVWQ_SNORM = SVGA3DBLOCKDESC_UVWQ |
  291. SVGA3DBLOCKDESC_SINT |
  292. SVGA3DBLOCKDESC_NORM,
  293. };
  294. struct svga3d_channel_def {
  295. union {
  296. u8 blue;
  297. u8 w_bump;
  298. u8 l_bump;
  299. u8 uv_video;
  300. u8 u_video;
  301. };
  302. union {
  303. u8 green;
  304. u8 stencil;
  305. u8 v_bump;
  306. u8 v_video;
  307. };
  308. union {
  309. u8 red;
  310. u8 u_bump;
  311. u8 luminance;
  312. u8 y_video;
  313. u8 depth;
  314. u8 data;
  315. };
  316. union {
  317. u8 alpha;
  318. u8 q_bump;
  319. u8 exp;
  320. };
  321. };
  322. /*
  323. * struct svga3d_surface_desc - describes the actual pixel data.
  324. *
  325. * @format: Format
  326. * @block_desc: Block description
  327. * @block_size: Dimensions in pixels of a block
  328. * @bytes_per_block: Size of block in bytes
  329. * @pitch_bytes_per_block: Size of a block in bytes for purposes of pitch
  330. * @bit_depth: Channel bit depths
  331. * @bit_offset: Channel bit masks (in bits offset from the start of the pointer)
  332. */
  333. struct svga3d_surface_desc {
  334. SVGA3dSurfaceFormat format;
  335. enum svga3d_block_desc block_desc;
  336. surf_size_struct block_size;
  337. u32 bytes_per_block;
  338. u32 pitch_bytes_per_block;
  339. struct svga3d_channel_def bit_depth;
  340. struct svga3d_channel_def bit_offset;
  341. };
  342. static const struct svga3d_surface_desc svga3d_surface_descs[] = {
  343. {SVGA3D_FORMAT_INVALID, SVGA3DBLOCKDESC_NONE,
  344. {1, 1, 1}, 0, 0,
  345. {{0}, {0}, {0}, {0}},
  346. {{0}, {0}, {0}, {0}}},
  347. {SVGA3D_X8R8G8B8, SVGA3DBLOCKDESC_RGB_UNORM,
  348. {1, 1, 1}, 4, 4,
  349. {{8}, {8}, {8}, {0}},
  350. {{0}, {8}, {16}, {24}}},
  351. {SVGA3D_A8R8G8B8, SVGA3DBLOCKDESC_RGBA_UNORM,
  352. {1, 1, 1}, 4, 4,
  353. {{8}, {8}, {8}, {8}},
  354. {{0}, {8}, {16}, {24}}},
  355. {SVGA3D_R5G6B5, SVGA3DBLOCKDESC_RGB_UNORM,
  356. {1, 1, 1}, 2, 2,
  357. {{5}, {6}, {5}, {0}},
  358. {{0}, {5}, {11}, {0}}},
  359. {SVGA3D_X1R5G5B5, SVGA3DBLOCKDESC_RGB_UNORM,
  360. {1, 1, 1}, 2, 2,
  361. {{5}, {5}, {5}, {0}},
  362. {{0}, {5}, {10}, {0}}},
  363. {SVGA3D_A1R5G5B5, SVGA3DBLOCKDESC_RGBA_UNORM,
  364. {1, 1, 1}, 2, 2,
  365. {{5}, {5}, {5}, {1}},
  366. {{0}, {5}, {10}, {15}}},
  367. {SVGA3D_A4R4G4B4, SVGA3DBLOCKDESC_RGBA_UNORM,
  368. {1, 1, 1}, 2, 2,
  369. {{4}, {4}, {4}, {4}},
  370. {{0}, {4}, {8}, {12}}},
  371. {SVGA3D_Z_D32, SVGA3DBLOCKDESC_DEPTH_UNORM,
  372. {1, 1, 1}, 4, 4,
  373. {{0}, {0}, {32}, {0}},
  374. {{0}, {0}, {0}, {0}}},
  375. {SVGA3D_Z_D16, SVGA3DBLOCKDESC_DEPTH_UNORM,
  376. {1, 1, 1}, 2, 2,
  377. {{0}, {0}, {16}, {0}},
  378. {{0}, {0}, {0}, {0}}},
  379. {SVGA3D_Z_D24S8, SVGA3DBLOCKDESC_DS_UNORM,
  380. {1, 1, 1}, 4, 4,
  381. {{0}, {8}, {24}, {0}},
  382. {{0}, {0}, {8}, {0}}},
  383. {SVGA3D_Z_D15S1, SVGA3DBLOCKDESC_DS_UNORM,
  384. {1, 1, 1}, 2, 2,
  385. {{0}, {1}, {15}, {0}},
  386. {{0}, {0}, {1}, {0}}},
  387. {SVGA3D_LUMINANCE8, SVGA3DBLOCKDESC_L_UNORM,
  388. {1, 1, 1}, 1, 1,
  389. {{0}, {0}, {8}, {0}},
  390. {{0}, {0}, {0}, {0}}},
  391. {SVGA3D_LUMINANCE4_ALPHA4, SVGA3DBLOCKDESC_LA_UNORM,
  392. {1, 1, 1}, 1, 1,
  393. {{0}, {0}, {4}, {4}},
  394. {{0}, {0}, {0}, {4}}},
  395. {SVGA3D_LUMINANCE16, SVGA3DBLOCKDESC_L_UNORM,
  396. {1, 1, 1}, 2, 2,
  397. {{0}, {0}, {16}, {0}},
  398. {{0}, {0}, {0}, {0}}},
  399. {SVGA3D_LUMINANCE8_ALPHA8, SVGA3DBLOCKDESC_LA_UNORM,
  400. {1, 1, 1}, 2, 2,
  401. {{0}, {0}, {8}, {8}},
  402. {{0}, {0}, {0}, {8}}},
  403. {SVGA3D_DXT1, SVGA3DBLOCKDESC_BC1_COMP_UNORM,
  404. {4, 4, 1}, 8, 8,
  405. {{0}, {0}, {64}, {0}},
  406. {{0}, {0}, {0}, {0}}},
  407. {SVGA3D_DXT2, SVGA3DBLOCKDESC_BC2_COMP_UNORM,
  408. {4, 4, 1}, 16, 16,
  409. {{0}, {0}, {128}, {0}},
  410. {{0}, {0}, {0}, {0}}},
  411. {SVGA3D_DXT3, SVGA3DBLOCKDESC_BC2_COMP_UNORM,
  412. {4, 4, 1}, 16, 16,
  413. {{0}, {0}, {128}, {0}},
  414. {{0}, {0}, {0}, {0}}},
  415. {SVGA3D_DXT4, SVGA3DBLOCKDESC_BC3_COMP_UNORM,
  416. {4, 4, 1}, 16, 16,
  417. {{0}, {0}, {128}, {0}},
  418. {{0}, {0}, {0}, {0}}},
  419. {SVGA3D_DXT5, SVGA3DBLOCKDESC_BC3_COMP_UNORM,
  420. {4, 4, 1}, 16, 16,
  421. {{0}, {0}, {128}, {0}},
  422. {{0}, {0}, {0}, {0}}},
  423. {SVGA3D_BUMPU8V8, SVGA3DBLOCKDESC_UV_SNORM,
  424. {1, 1, 1}, 2, 2,
  425. {{0}, {8}, {8}, {0}},
  426. {{0}, {8}, {0}, {0}}},
  427. {SVGA3D_BUMPL6V5U5, SVGA3DBLOCKDESC_UVL,
  428. {1, 1, 1}, 2, 2,
  429. {{6}, {5}, {5}, {0}},
  430. {{10}, {5}, {0}, {0}}},
  431. {SVGA3D_BUMPX8L8V8U8, SVGA3DBLOCKDESC_UVL,
  432. {1, 1, 1}, 4, 4,
  433. {{8}, {8}, {8}, {0}},
  434. {{16}, {8}, {0}, {0}}},
  435. {SVGA3D_FORMAT_DEAD1, SVGA3DBLOCKDESC_UVL,
  436. {1, 1, 1}, 3, 3,
  437. {{8}, {8}, {8}, {0}},
  438. {{16}, {8}, {0}, {0}}},
  439. {SVGA3D_ARGB_S10E5, SVGA3DBLOCKDESC_RGBA_FP,
  440. {1, 1, 1}, 8, 8,
  441. {{16}, {16}, {16}, {16}},
  442. {{32}, {16}, {0}, {48}}},
  443. {SVGA3D_ARGB_S23E8, SVGA3DBLOCKDESC_RGBA_FP,
  444. {1, 1, 1}, 16, 16,
  445. {{32}, {32}, {32}, {32}},
  446. {{64}, {32}, {0}, {96}}},
  447. {SVGA3D_A2R10G10B10, SVGA3DBLOCKDESC_RGBA_UNORM,
  448. {1, 1, 1}, 4, 4,
  449. {{10}, {10}, {10}, {2}},
  450. {{0}, {10}, {20}, {30}}},
  451. {SVGA3D_V8U8, SVGA3DBLOCKDESC_UV_SNORM,
  452. {1, 1, 1}, 2, 2,
  453. {{0}, {8}, {8}, {0}},
  454. {{0}, {8}, {0}, {0}}},
  455. {SVGA3D_Q8W8V8U8, SVGA3DBLOCKDESC_UVWQ_SNORM,
  456. {1, 1, 1}, 4, 4,
  457. {{8}, {8}, {8}, {8}},
  458. {{16}, {8}, {0}, {24}}},
  459. {SVGA3D_CxV8U8, SVGA3DBLOCKDESC_UVCX_SNORM,
  460. {1, 1, 1}, 2, 2,
  461. {{0}, {8}, {8}, {0}},
  462. {{0}, {8}, {0}, {0}}},
  463. {SVGA3D_X8L8V8U8, SVGA3DBLOCKDESC_UVL,
  464. {1, 1, 1}, 4, 4,
  465. {{8}, {8}, {8}, {0}},
  466. {{16}, {8}, {0}, {0}}},
  467. {SVGA3D_A2W10V10U10, SVGA3DBLOCKDESC_UVWA,
  468. {1, 1, 1}, 4, 4,
  469. {{10}, {10}, {10}, {2}},
  470. {{20}, {10}, {0}, {30}}},
  471. {SVGA3D_ALPHA8, SVGA3DBLOCKDESC_A_UNORM,
  472. {1, 1, 1}, 1, 1,
  473. {{0}, {0}, {0}, {8}},
  474. {{0}, {0}, {0}, {0}}},
  475. {SVGA3D_R_S10E5, SVGA3DBLOCKDESC_R_FP,
  476. {1, 1, 1}, 2, 2,
  477. {{0}, {0}, {16}, {0}},
  478. {{0}, {0}, {0}, {0}}},
  479. {SVGA3D_R_S23E8, SVGA3DBLOCKDESC_R_FP,
  480. {1, 1, 1}, 4, 4,
  481. {{0}, {0}, {32}, {0}},
  482. {{0}, {0}, {0}, {0}}},
  483. {SVGA3D_RG_S10E5, SVGA3DBLOCKDESC_RG_FP,
  484. {1, 1, 1}, 4, 4,
  485. {{0}, {16}, {16}, {0}},
  486. {{0}, {16}, {0}, {0}}},
  487. {SVGA3D_RG_S23E8, SVGA3DBLOCKDESC_RG_FP,
  488. {1, 1, 1}, 8, 8,
  489. {{0}, {32}, {32}, {0}},
  490. {{0}, {32}, {0}, {0}}},
  491. {SVGA3D_BUFFER, SVGA3DBLOCKDESC_BUFFER,
  492. {1, 1, 1}, 1, 1,
  493. {{0}, {0}, {8}, {0}},
  494. {{0}, {0}, {0}, {0}}},
  495. {SVGA3D_Z_D24X8, SVGA3DBLOCKDESC_DEPTH_UNORM,
  496. {1, 1, 1}, 4, 4,
  497. {{0}, {0}, {24}, {0}},
  498. {{0}, {0}, {8}, {0}}},
  499. {SVGA3D_V16U16, SVGA3DBLOCKDESC_UV_SNORM,
  500. {1, 1, 1}, 4, 4,
  501. {{0}, {16}, {16}, {0}},
  502. {{0}, {16}, {0}, {0}}},
  503. {SVGA3D_G16R16, SVGA3DBLOCKDESC_RG_UNORM,
  504. {1, 1, 1}, 4, 4,
  505. {{0}, {16}, {16}, {0}},
  506. {{0}, {16}, {0}, {0}}},
  507. {SVGA3D_A16B16G16R16, SVGA3DBLOCKDESC_RGBA_UNORM,
  508. {1, 1, 1}, 8, 8,
  509. {{16}, {16}, {16}, {16}},
  510. {{32}, {16}, {0}, {48}}},
  511. {SVGA3D_UYVY, SVGA3DBLOCKDESC_YUV,
  512. {2, 1, 1}, 4, 4,
  513. {{8}, {0}, {8}, {0}},
  514. {{0}, {0}, {8}, {0}}},
  515. {SVGA3D_YUY2, SVGA3DBLOCKDESC_YUV,
  516. {2, 1, 1}, 4, 4,
  517. {{8}, {0}, {8}, {0}},
  518. {{8}, {0}, {0}, {0}}},
  519. {SVGA3D_NV12, SVGA3DBLOCKDESC_NV12,
  520. {2, 2, 1}, 6, 2,
  521. {{0}, {0}, {48}, {0}},
  522. {{0}, {0}, {0}, {0}}},
  523. {SVGA3D_AYUV, SVGA3DBLOCKDESC_AYUV,
  524. {1, 1, 1}, 4, 4,
  525. {{8}, {8}, {8}, {8}},
  526. {{0}, {8}, {16}, {24}}},
  527. {SVGA3D_R32G32B32A32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  528. {1, 1, 1}, 16, 16,
  529. {{32}, {32}, {32}, {32}},
  530. {{64}, {32}, {0}, {96}}},
  531. {SVGA3D_R32G32B32A32_UINT, SVGA3DBLOCKDESC_RGBA_UINT,
  532. {1, 1, 1}, 16, 16,
  533. {{32}, {32}, {32}, {32}},
  534. {{64}, {32}, {0}, {96}}},
  535. {SVGA3D_R32G32B32A32_SINT, SVGA3DBLOCKDESC_RGBA_SINT,
  536. {1, 1, 1}, 16, 16,
  537. {{32}, {32}, {32}, {32}},
  538. {{64}, {32}, {0}, {96}}},
  539. {SVGA3D_R32G32B32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  540. {1, 1, 1}, 12, 12,
  541. {{32}, {32}, {32}, {0}},
  542. {{64}, {32}, {0}, {0}}},
  543. {SVGA3D_R32G32B32_FLOAT, SVGA3DBLOCKDESC_RGB_FP,
  544. {1, 1, 1}, 12, 12,
  545. {{32}, {32}, {32}, {0}},
  546. {{64}, {32}, {0}, {0}}},
  547. {SVGA3D_R32G32B32_UINT, SVGA3DBLOCKDESC_RGB_UINT,
  548. {1, 1, 1}, 12, 12,
  549. {{32}, {32}, {32}, {0}},
  550. {{64}, {32}, {0}, {0}}},
  551. {SVGA3D_R32G32B32_SINT, SVGA3DBLOCKDESC_RGB_SINT,
  552. {1, 1, 1}, 12, 12,
  553. {{32}, {32}, {32}, {0}},
  554. {{64}, {32}, {0}, {0}}},
  555. {SVGA3D_R16G16B16A16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  556. {1, 1, 1}, 8, 8,
  557. {{16}, {16}, {16}, {16}},
  558. {{32}, {16}, {0}, {48}}},
  559. {SVGA3D_R16G16B16A16_UINT, SVGA3DBLOCKDESC_RGBA_UINT,
  560. {1, 1, 1}, 8, 8,
  561. {{16}, {16}, {16}, {16}},
  562. {{32}, {16}, {0}, {48}}},
  563. {SVGA3D_R16G16B16A16_SNORM, SVGA3DBLOCKDESC_RGBA_SNORM,
  564. {1, 1, 1}, 8, 8,
  565. {{16}, {16}, {16}, {16}},
  566. {{32}, {16}, {0}, {48}}},
  567. {SVGA3D_R16G16B16A16_SINT, SVGA3DBLOCKDESC_RGBA_SINT,
  568. {1, 1, 1}, 8, 8,
  569. {{16}, {16}, {16}, {16}},
  570. {{32}, {16}, {0}, {48}}},
  571. {SVGA3D_R32G32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  572. {1, 1, 1}, 8, 8,
  573. {{0}, {32}, {32}, {0}},
  574. {{0}, {32}, {0}, {0}}},
  575. {SVGA3D_R32G32_UINT, SVGA3DBLOCKDESC_RG_UINT,
  576. {1, 1, 1}, 8, 8,
  577. {{0}, {32}, {32}, {0}},
  578. {{0}, {32}, {0}, {0}}},
  579. {SVGA3D_R32G32_SINT, SVGA3DBLOCKDESC_RG_SINT,
  580. {1, 1, 1}, 8, 8,
  581. {{0}, {32}, {32}, {0}},
  582. {{0}, {32}, {0}, {0}}},
  583. {SVGA3D_R32G8X24_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  584. {1, 1, 1}, 8, 8,
  585. {{0}, {8}, {32}, {0}},
  586. {{0}, {32}, {0}, {0}}},
  587. {SVGA3D_D32_FLOAT_S8X24_UINT, SVGA3DBLOCKDESC_DS,
  588. {1, 1, 1}, 8, 8,
  589. {{0}, {8}, {32}, {0}},
  590. {{0}, {32}, {0}, {0}}},
  591. {SVGA3D_R32_FLOAT_X8X24, SVGA3DBLOCKDESC_R_FP,
  592. {1, 1, 1}, 8, 8,
  593. {{0}, {0}, {32}, {0}},
  594. {{0}, {0}, {0}, {0}}},
  595. {SVGA3D_X32_G8X24_UINT, SVGA3DBLOCKDESC_G_UINT,
  596. {1, 1, 1}, 8, 8,
  597. {{0}, {8}, {0}, {0}},
  598. {{0}, {32}, {0}, {0}}},
  599. {SVGA3D_R10G10B10A2_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  600. {1, 1, 1}, 4, 4,
  601. {{10}, {10}, {10}, {2}},
  602. {{20}, {10}, {0}, {30}}},
  603. {SVGA3D_R10G10B10A2_UINT, SVGA3DBLOCKDESC_RGBA_UINT,
  604. {1, 1, 1}, 4, 4,
  605. {{10}, {10}, {10}, {2}},
  606. {{20}, {10}, {0}, {30}}},
  607. {SVGA3D_R11G11B10_FLOAT, SVGA3DBLOCKDESC_RGB_FP,
  608. {1, 1, 1}, 4, 4,
  609. {{10}, {11}, {11}, {0}},
  610. {{22}, {11}, {0}, {0}}},
  611. {SVGA3D_R8G8B8A8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  612. {1, 1, 1}, 4, 4,
  613. {{8}, {8}, {8}, {8}},
  614. {{16}, {8}, {0}, {24}}},
  615. {SVGA3D_R8G8B8A8_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  616. {1, 1, 1}, 4, 4,
  617. {{8}, {8}, {8}, {8}},
  618. {{16}, {8}, {0}, {24}}},
  619. {SVGA3D_R8G8B8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_UNORM_SRGB,
  620. {1, 1, 1}, 4, 4,
  621. {{8}, {8}, {8}, {8}},
  622. {{16}, {8}, {0}, {24}}},
  623. {SVGA3D_R8G8B8A8_UINT, SVGA3DBLOCKDESC_RGBA_UINT,
  624. {1, 1, 1}, 4, 4,
  625. {{8}, {8}, {8}, {8}},
  626. {{16}, {8}, {0}, {24}}},
  627. {SVGA3D_R8G8B8A8_SINT, SVGA3DBLOCKDESC_RGBA_SINT,
  628. {1, 1, 1}, 4, 4,
  629. {{8}, {8}, {8}, {8}},
  630. {{16}, {8}, {0}, {24}}},
  631. {SVGA3D_R16G16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  632. {1, 1, 1}, 4, 4,
  633. {{0}, {16}, {16}, {0}},
  634. {{0}, {16}, {0}, {0}}},
  635. {SVGA3D_R16G16_UINT, SVGA3DBLOCKDESC_RG_UINT,
  636. {1, 1, 1}, 4, 4,
  637. {{0}, {16}, {16}, {0}},
  638. {{0}, {16}, {0}, {0}}},
  639. {SVGA3D_R16G16_SINT, SVGA3DBLOCKDESC_RG_SINT,
  640. {1, 1, 1}, 4, 4,
  641. {{0}, {16}, {16}, {0}},
  642. {{0}, {16}, {0}, {0}}},
  643. {SVGA3D_R32_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  644. {1, 1, 1}, 4, 4,
  645. {{0}, {0}, {32}, {0}},
  646. {{0}, {0}, {0}, {0}}},
  647. {SVGA3D_D32_FLOAT, SVGA3DBLOCKDESC_DEPTH_FP,
  648. {1, 1, 1}, 4, 4,
  649. {{0}, {0}, {32}, {0}},
  650. {{0}, {0}, {0}, {0}}},
  651. {SVGA3D_R32_UINT, SVGA3DBLOCKDESC_R_UINT,
  652. {1, 1, 1}, 4, 4,
  653. {{0}, {0}, {32}, {0}},
  654. {{0}, {0}, {0}, {0}}},
  655. {SVGA3D_R32_SINT, SVGA3DBLOCKDESC_R_SINT,
  656. {1, 1, 1}, 4, 4,
  657. {{0}, {0}, {32}, {0}},
  658. {{0}, {0}, {0}, {0}}},
  659. {SVGA3D_R24G8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  660. {1, 1, 1}, 4, 4,
  661. {{0}, {8}, {24}, {0}},
  662. {{0}, {24}, {0}, {0}}},
  663. {SVGA3D_D24_UNORM_S8_UINT, SVGA3DBLOCKDESC_DS_UNORM,
  664. {1, 1, 1}, 4, 4,
  665. {{0}, {8}, {24}, {0}},
  666. {{0}, {24}, {0}, {0}}},
  667. {SVGA3D_R24_UNORM_X8, SVGA3DBLOCKDESC_R_UNORM,
  668. {1, 1, 1}, 4, 4,
  669. {{0}, {0}, {24}, {0}},
  670. {{0}, {0}, {0}, {0}}},
  671. {SVGA3D_X24_G8_UINT, SVGA3DBLOCKDESC_G_UINT,
  672. {1, 1, 1}, 4, 4,
  673. {{0}, {8}, {0}, {0}},
  674. {{0}, {24}, {0}, {0}}},
  675. {SVGA3D_R8G8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  676. {1, 1, 1}, 2, 2,
  677. {{0}, {8}, {8}, {0}},
  678. {{0}, {8}, {0}, {0}}},
  679. {SVGA3D_R8G8_UNORM, SVGA3DBLOCKDESC_RG_UNORM,
  680. {1, 1, 1}, 2, 2,
  681. {{0}, {8}, {8}, {0}},
  682. {{0}, {8}, {0}, {0}}},
  683. {SVGA3D_R8G8_UINT, SVGA3DBLOCKDESC_RG_UINT,
  684. {1, 1, 1}, 2, 2,
  685. {{0}, {8}, {8}, {0}},
  686. {{0}, {8}, {0}, {0}}},
  687. {SVGA3D_R8G8_SINT, SVGA3DBLOCKDESC_RG_SINT,
  688. {1, 1, 1}, 2, 2,
  689. {{0}, {8}, {8}, {0}},
  690. {{0}, {8}, {0}, {0}}},
  691. {SVGA3D_R16_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  692. {1, 1, 1}, 2, 2,
  693. {{0}, {0}, {16}, {0}},
  694. {{0}, {0}, {0}, {0}}},
  695. {SVGA3D_R16_UNORM, SVGA3DBLOCKDESC_R_UNORM,
  696. {1, 1, 1}, 2, 2,
  697. {{0}, {0}, {16}, {0}},
  698. {{0}, {0}, {0}, {0}}},
  699. {SVGA3D_R16_UINT, SVGA3DBLOCKDESC_R_UINT,
  700. {1, 1, 1}, 2, 2,
  701. {{0}, {0}, {16}, {0}},
  702. {{0}, {0}, {0}, {0}}},
  703. {SVGA3D_R16_SNORM, SVGA3DBLOCKDESC_R_SNORM,
  704. {1, 1, 1}, 2, 2,
  705. {{0}, {0}, {16}, {0}},
  706. {{0}, {0}, {0}, {0}}},
  707. {SVGA3D_R16_SINT, SVGA3DBLOCKDESC_R_SINT,
  708. {1, 1, 1}, 2, 2,
  709. {{0}, {0}, {16}, {0}},
  710. {{0}, {0}, {0}, {0}}},
  711. {SVGA3D_R8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  712. {1, 1, 1}, 1, 1,
  713. {{0}, {0}, {8}, {0}},
  714. {{0}, {0}, {0}, {0}}},
  715. {SVGA3D_R8_UNORM, SVGA3DBLOCKDESC_R_UNORM,
  716. {1, 1, 1}, 1, 1,
  717. {{0}, {0}, {8}, {0}},
  718. {{0}, {0}, {0}, {0}}},
  719. {SVGA3D_R8_UINT, SVGA3DBLOCKDESC_R_UINT,
  720. {1, 1, 1}, 1, 1,
  721. {{0}, {0}, {8}, {0}},
  722. {{0}, {0}, {0}, {0}}},
  723. {SVGA3D_R8_SNORM, SVGA3DBLOCKDESC_R_SNORM,
  724. {1, 1, 1}, 1, 1,
  725. {{0}, {0}, {8}, {0}},
  726. {{0}, {0}, {0}, {0}}},
  727. {SVGA3D_R8_SINT, SVGA3DBLOCKDESC_R_SINT,
  728. {1, 1, 1}, 1, 1,
  729. {{0}, {0}, {8}, {0}},
  730. {{0}, {0}, {0}, {0}}},
  731. {SVGA3D_P8, SVGA3DBLOCKDESC_NONE,
  732. {1, 1, 1}, 1, 1,
  733. {{0}, {0}, {8}, {0}},
  734. {{0}, {0}, {0}, {0}}},
  735. {SVGA3D_R9G9B9E5_SHAREDEXP, SVGA3DBLOCKDESC_RGB_EXP,
  736. {1, 1, 1}, 4, 4,
  737. {{9}, {9}, {9}, {5}},
  738. {{18}, {9}, {0}, {27}}},
  739. {SVGA3D_R8G8_B8G8_UNORM, SVGA3DBLOCKDESC_NONE,
  740. {2, 1, 1}, 4, 4,
  741. {{0}, {8}, {8}, {0}},
  742. {{0}, {0}, {8}, {0}}},
  743. {SVGA3D_G8R8_G8B8_UNORM, SVGA3DBLOCKDESC_NONE,
  744. {2, 1, 1}, 4, 4,
  745. {{0}, {8}, {8}, {0}},
  746. {{0}, {8}, {0}, {0}}},
  747. {SVGA3D_BC1_TYPELESS, SVGA3DBLOCKDESC_BC1_COMP_TYPELESS,
  748. {4, 4, 1}, 8, 8,
  749. {{0}, {0}, {64}, {0}},
  750. {{0}, {0}, {0}, {0}}},
  751. {SVGA3D_BC1_UNORM_SRGB, SVGA3DBLOCKDESC_BC1_COMP_UNORM_SRGB,
  752. {4, 4, 1}, 8, 8,
  753. {{0}, {0}, {64}, {0}},
  754. {{0}, {0}, {0}, {0}}},
  755. {SVGA3D_BC2_TYPELESS, SVGA3DBLOCKDESC_BC2_COMP_TYPELESS,
  756. {4, 4, 1}, 16, 16,
  757. {{0}, {0}, {128}, {0}},
  758. {{0}, {0}, {0}, {0}}},
  759. {SVGA3D_BC2_UNORM_SRGB, SVGA3DBLOCKDESC_BC2_COMP_UNORM_SRGB,
  760. {4, 4, 1}, 16, 16,
  761. {{0}, {0}, {128}, {0}},
  762. {{0}, {0}, {0}, {0}}},
  763. {SVGA3D_BC3_TYPELESS, SVGA3DBLOCKDESC_BC3_COMP_TYPELESS,
  764. {4, 4, 1}, 16, 16,
  765. {{0}, {0}, {128}, {0}},
  766. {{0}, {0}, {0}, {0}}},
  767. {SVGA3D_BC3_UNORM_SRGB, SVGA3DBLOCKDESC_BC3_COMP_UNORM_SRGB,
  768. {4, 4, 1}, 16, 16,
  769. {{0}, {0}, {128}, {0}},
  770. {{0}, {0}, {0}, {0}}},
  771. {SVGA3D_BC4_TYPELESS, SVGA3DBLOCKDESC_BC4_COMP_TYPELESS,
  772. {4, 4, 1}, 8, 8,
  773. {{0}, {0}, {64}, {0}},
  774. {{0}, {0}, {0}, {0}}},
  775. {SVGA3D_ATI1, SVGA3DBLOCKDESC_BC4_COMP_UNORM,
  776. {4, 4, 1}, 8, 8,
  777. {{0}, {0}, {64}, {0}},
  778. {{0}, {0}, {0}, {0}}},
  779. {SVGA3D_BC4_SNORM, SVGA3DBLOCKDESC_BC4_COMP_SNORM,
  780. {4, 4, 1}, 8, 8,
  781. {{0}, {0}, {64}, {0}},
  782. {{0}, {0}, {0}, {0}}},
  783. {SVGA3D_BC5_TYPELESS, SVGA3DBLOCKDESC_BC5_COMP_TYPELESS,
  784. {4, 4, 1}, 16, 16,
  785. {{0}, {0}, {128}, {0}},
  786. {{0}, {0}, {0}, {0}}},
  787. {SVGA3D_ATI2, SVGA3DBLOCKDESC_BC5_COMP_UNORM,
  788. {4, 4, 1}, 16, 16,
  789. {{0}, {0}, {128}, {0}},
  790. {{0}, {0}, {0}, {0}}},
  791. {SVGA3D_BC5_SNORM, SVGA3DBLOCKDESC_BC5_COMP_SNORM,
  792. {4, 4, 1}, 16, 16,
  793. {{0}, {0}, {128}, {0}},
  794. {{0}, {0}, {0}, {0}}},
  795. {SVGA3D_R10G10B10_XR_BIAS_A2_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  796. {1, 1, 1}, 4, 4,
  797. {{10}, {10}, {10}, {2}},
  798. {{20}, {10}, {0}, {30}}},
  799. {SVGA3D_B8G8R8A8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  800. {1, 1, 1}, 4, 4,
  801. {{8}, {8}, {8}, {8}},
  802. {{0}, {8}, {16}, {24}}},
  803. {SVGA3D_B8G8R8A8_UNORM_SRGB, SVGA3DBLOCKDESC_RGBA_UNORM_SRGB,
  804. {1, 1, 1}, 4, 4,
  805. {{8}, {8}, {8}, {8}},
  806. {{0}, {8}, {16}, {24}}},
  807. {SVGA3D_B8G8R8X8_TYPELESS, SVGA3DBLOCKDESC_TYPELESS,
  808. {1, 1, 1}, 4, 4,
  809. {{8}, {8}, {8}, {0}},
  810. {{0}, {8}, {16}, {24}}},
  811. {SVGA3D_B8G8R8X8_UNORM_SRGB, SVGA3DBLOCKDESC_RGB_UNORM_SRGB,
  812. {1, 1, 1}, 4, 4,
  813. {{8}, {8}, {8}, {0}},
  814. {{0}, {8}, {16}, {24}}},
  815. {SVGA3D_Z_DF16, SVGA3DBLOCKDESC_DEPTH_UNORM,
  816. {1, 1, 1}, 2, 2,
  817. {{0}, {0}, {16}, {0}},
  818. {{0}, {0}, {0}, {0}}},
  819. {SVGA3D_Z_DF24, SVGA3DBLOCKDESC_DEPTH_UNORM,
  820. {1, 1, 1}, 4, 4,
  821. {{0}, {0}, {24}, {0}},
  822. {{0}, {0}, {8}, {0}}},
  823. {SVGA3D_Z_D24S8_INT, SVGA3DBLOCKDESC_DS_UNORM,
  824. {1, 1, 1}, 4, 4,
  825. {{0}, {8}, {24}, {0}},
  826. {{0}, {0}, {8}, {0}}},
  827. {SVGA3D_YV12, SVGA3DBLOCKDESC_YV12,
  828. {2, 2, 1}, 6, 2,
  829. {{0}, {0}, {48}, {0}},
  830. {{0}, {0}, {0}, {0}}},
  831. {SVGA3D_R32G32B32A32_FLOAT, SVGA3DBLOCKDESC_RGBA_FP,
  832. {1, 1, 1}, 16, 16,
  833. {{32}, {32}, {32}, {32}},
  834. {{64}, {32}, {0}, {96}}},
  835. {SVGA3D_R16G16B16A16_FLOAT, SVGA3DBLOCKDESC_RGBA_FP,
  836. {1, 1, 1}, 8, 8,
  837. {{16}, {16}, {16}, {16}},
  838. {{32}, {16}, {0}, {48}}},
  839. {SVGA3D_R16G16B16A16_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  840. {1, 1, 1}, 8, 8,
  841. {{16}, {16}, {16}, {16}},
  842. {{32}, {16}, {0}, {48}}},
  843. {SVGA3D_R32G32_FLOAT, SVGA3DBLOCKDESC_RG_FP,
  844. {1, 1, 1}, 8, 8,
  845. {{0}, {32}, {32}, {0}},
  846. {{0}, {32}, {0}, {0}}},
  847. {SVGA3D_R10G10B10A2_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  848. {1, 1, 1}, 4, 4,
  849. {{10}, {10}, {10}, {2}},
  850. {{20}, {10}, {0}, {30}}},
  851. {SVGA3D_R8G8B8A8_SNORM, SVGA3DBLOCKDESC_RGBA_SNORM,
  852. {1, 1, 1}, 4, 4,
  853. {{8}, {8}, {8}, {8}},
  854. {{16}, {8}, {0}, {24}}},
  855. {SVGA3D_R16G16_FLOAT, SVGA3DBLOCKDESC_RG_FP,
  856. {1, 1, 1}, 4, 4,
  857. {{0}, {16}, {16}, {0}},
  858. {{0}, {16}, {0}, {0}}},
  859. {SVGA3D_R16G16_UNORM, SVGA3DBLOCKDESC_RG_UNORM,
  860. {1, 1, 1}, 4, 4,
  861. {{0}, {16}, {16}, {0}},
  862. {{0}, {16}, {0}, {0}}},
  863. {SVGA3D_R16G16_SNORM, SVGA3DBLOCKDESC_RG_SNORM,
  864. {1, 1, 1}, 4, 4,
  865. {{0}, {16}, {16}, {0}},
  866. {{0}, {16}, {0}, {0}}},
  867. {SVGA3D_R32_FLOAT, SVGA3DBLOCKDESC_R_FP,
  868. {1, 1, 1}, 4, 4,
  869. {{0}, {0}, {32}, {0}},
  870. {{0}, {0}, {0}, {0}}},
  871. {SVGA3D_R8G8_SNORM, SVGA3DBLOCKDESC_RG_SNORM,
  872. {1, 1, 1}, 2, 2,
  873. {{0}, {8}, {8}, {0}},
  874. {{0}, {8}, {0}, {0}}},
  875. {SVGA3D_R16_FLOAT, SVGA3DBLOCKDESC_R_FP,
  876. {1, 1, 1}, 2, 2,
  877. {{0}, {0}, {16}, {0}},
  878. {{0}, {0}, {0}, {0}}},
  879. {SVGA3D_D16_UNORM, SVGA3DBLOCKDESC_DEPTH_UNORM,
  880. {1, 1, 1}, 2, 2,
  881. {{0}, {0}, {16}, {0}},
  882. {{0}, {0}, {0}, {0}}},
  883. {SVGA3D_A8_UNORM, SVGA3DBLOCKDESC_A_UNORM,
  884. {1, 1, 1}, 1, 1,
  885. {{0}, {0}, {0}, {8}},
  886. {{0}, {0}, {0}, {0}}},
  887. {SVGA3D_BC1_UNORM, SVGA3DBLOCKDESC_BC1_COMP_UNORM,
  888. {4, 4, 1}, 8, 8,
  889. {{0}, {0}, {64}, {0}},
  890. {{0}, {0}, {0}, {0}}},
  891. {SVGA3D_BC2_UNORM, SVGA3DBLOCKDESC_BC2_COMP_UNORM,
  892. {4, 4, 1}, 16, 16,
  893. {{0}, {0}, {128}, {0}},
  894. {{0}, {0}, {0}, {0}}},
  895. {SVGA3D_BC3_UNORM, SVGA3DBLOCKDESC_BC3_COMP_UNORM,
  896. {4, 4, 1}, 16, 16,
  897. {{0}, {0}, {128}, {0}},
  898. {{0}, {0}, {0}, {0}}},
  899. {SVGA3D_B5G6R5_UNORM, SVGA3DBLOCKDESC_RGB_UNORM,
  900. {1, 1, 1}, 2, 2,
  901. {{5}, {6}, {5}, {0}},
  902. {{0}, {5}, {11}, {0}}},
  903. {SVGA3D_B5G5R5A1_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  904. {1, 1, 1}, 2, 2,
  905. {{5}, {5}, {5}, {1}},
  906. {{0}, {5}, {10}, {15}}},
  907. {SVGA3D_B8G8R8A8_UNORM, SVGA3DBLOCKDESC_RGBA_UNORM,
  908. {1, 1, 1}, 4, 4,
  909. {{8}, {8}, {8}, {8}},
  910. {{0}, {8}, {16}, {24}}},
  911. {SVGA3D_B8G8R8X8_UNORM, SVGA3DBLOCKDESC_RGB_UNORM,
  912. {1, 1, 1}, 4, 4,
  913. {{8}, {8}, {8}, {0}},
  914. {{0}, {8}, {16}, {24}}},
  915. {SVGA3D_BC4_UNORM, SVGA3DBLOCKDESC_BC4_COMP_UNORM,
  916. {4, 4, 1}, 8, 8,
  917. {{0}, {0}, {64}, {0}},
  918. {{0}, {0}, {0}, {0}}},
  919. {SVGA3D_BC5_UNORM, SVGA3DBLOCKDESC_BC5_COMP_UNORM,
  920. {4, 4, 1}, 16, 16,
  921. {{0}, {0}, {128}, {0}},
  922. {{0}, {0}, {0}, {0}}},
  923. };
  924. static inline u32 clamped_umul32(u32 a, u32 b)
  925. {
  926. uint64_t tmp = (uint64_t) a*b;
  927. return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp;
  928. }
  929. /**
  930. * svga3dsurface_get_desc - Look up the appropriate SVGA3dSurfaceDesc for the
  931. * given format.
  932. */
  933. static inline const struct svga3d_surface_desc *
  934. svga3dsurface_get_desc(SVGA3dSurfaceFormat format)
  935. {
  936. if (format < ARRAY_SIZE(svga3d_surface_descs))
  937. return &svga3d_surface_descs[format];
  938. return &svga3d_surface_descs[SVGA3D_FORMAT_INVALID];
  939. }
  940. /**
  941. * svga3dsurface_get_mip_size - Given a base level size and the mip level,
  942. * compute the size of the mip level.
  943. */
  944. static inline surf_size_struct
  945. svga3dsurface_get_mip_size(surf_size_struct base_level, u32 mip_level)
  946. {
  947. surf_size_struct size;
  948. size.width = max_t(u32, base_level.width >> mip_level, 1);
  949. size.height = max_t(u32, base_level.height >> mip_level, 1);
  950. size.depth = max_t(u32, base_level.depth >> mip_level, 1);
  951. size.pad64 = 0;
  952. return size;
  953. }
  954. static inline void
  955. svga3dsurface_get_size_in_blocks(const struct svga3d_surface_desc *desc,
  956. const surf_size_struct *pixel_size,
  957. surf_size_struct *block_size)
  958. {
  959. block_size->width = __KERNEL_DIV_ROUND_UP(pixel_size->width,
  960. desc->block_size.width);
  961. block_size->height = __KERNEL_DIV_ROUND_UP(pixel_size->height,
  962. desc->block_size.height);
  963. block_size->depth = __KERNEL_DIV_ROUND_UP(pixel_size->depth,
  964. desc->block_size.depth);
  965. }
  966. static inline bool
  967. svga3dsurface_is_planar_surface(const struct svga3d_surface_desc *desc)
  968. {
  969. return (desc->block_desc & SVGA3DBLOCKDESC_PLANAR_YUV) != 0;
  970. }
  971. static inline u32
  972. svga3dsurface_calculate_pitch(const struct svga3d_surface_desc *desc,
  973. const surf_size_struct *size)
  974. {
  975. u32 pitch;
  976. surf_size_struct blocks;
  977. svga3dsurface_get_size_in_blocks(desc, size, &blocks);
  978. pitch = blocks.width * desc->pitch_bytes_per_block;
  979. return pitch;
  980. }
  981. /**
  982. * svga3dsurface_get_image_buffer_size - Calculates image buffer size.
  983. *
  984. * Return the number of bytes of buffer space required to store one image of a
  985. * surface, optionally using the specified pitch.
  986. *
  987. * If pitch is zero, it is assumed that rows are tightly packed.
  988. *
  989. * This function is overflow-safe. If the result would have overflowed, instead
  990. * we return MAX_UINT32.
  991. */
  992. static inline u32
  993. svga3dsurface_get_image_buffer_size(const struct svga3d_surface_desc *desc,
  994. const surf_size_struct *size,
  995. u32 pitch)
  996. {
  997. surf_size_struct image_blocks;
  998. u32 slice_size, total_size;
  999. svga3dsurface_get_size_in_blocks(desc, size, &image_blocks);
  1000. if (svga3dsurface_is_planar_surface(desc)) {
  1001. total_size = clamped_umul32(image_blocks.width,
  1002. image_blocks.height);
  1003. total_size = clamped_umul32(total_size, image_blocks.depth);
  1004. total_size = clamped_umul32(total_size, desc->bytes_per_block);
  1005. return total_size;
  1006. }
  1007. if (pitch == 0)
  1008. pitch = svga3dsurface_calculate_pitch(desc, size);
  1009. slice_size = clamped_umul32(image_blocks.height, pitch);
  1010. total_size = clamped_umul32(slice_size, image_blocks.depth);
  1011. return total_size;
  1012. }
  1013. /**
  1014. * svga3dsurface_get_serialized_size - Get the serialized size for the image.
  1015. */
  1016. static inline u32
  1017. svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format,
  1018. surf_size_struct base_level_size,
  1019. u32 num_mip_levels,
  1020. u32 num_layers)
  1021. {
  1022. const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
  1023. u32 total_size = 0;
  1024. u32 mip;
  1025. for (mip = 0; mip < num_mip_levels; mip++) {
  1026. surf_size_struct size =
  1027. svga3dsurface_get_mip_size(base_level_size, mip);
  1028. total_size += svga3dsurface_get_image_buffer_size(desc,
  1029. &size, 0);
  1030. }
  1031. return total_size * num_layers;
  1032. }
  1033. /**
  1034. * svga3dsurface_get_serialized_size_extended - Returns the number of bytes
  1035. * required for a surface with given parameters. Support for sample count.
  1036. */
  1037. static inline u32
  1038. svga3dsurface_get_serialized_size_extended(SVGA3dSurfaceFormat format,
  1039. surf_size_struct base_level_size,
  1040. u32 num_mip_levels,
  1041. u32 num_layers,
  1042. u32 num_samples)
  1043. {
  1044. uint64_t total_size =
  1045. svga3dsurface_get_serialized_size(format,
  1046. base_level_size,
  1047. num_mip_levels,
  1048. num_layers);
  1049. total_size *= max_t(u32, 1, num_samples);
  1050. return min_t(uint64_t, total_size, (uint64_t)U32_MAX);
  1051. }
  1052. /**
  1053. * svga3dsurface_get_pixel_offset - Compute the offset (in bytes) to a pixel
  1054. * in an image (or volume).
  1055. *
  1056. * @width: The image width in pixels.
  1057. * @height: The image height in pixels
  1058. */
  1059. static inline u32
  1060. svga3dsurface_get_pixel_offset(SVGA3dSurfaceFormat format,
  1061. u32 width, u32 height,
  1062. u32 x, u32 y, u32 z)
  1063. {
  1064. const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
  1065. const u32 bw = desc->block_size.width, bh = desc->block_size.height;
  1066. const u32 bd = desc->block_size.depth;
  1067. const u32 rowstride = __KERNEL_DIV_ROUND_UP(width, bw) *
  1068. desc->bytes_per_block;
  1069. const u32 imgstride = __KERNEL_DIV_ROUND_UP(height, bh) * rowstride;
  1070. const u32 offset = (z / bd * imgstride +
  1071. y / bh * rowstride +
  1072. x / bw * desc->bytes_per_block);
  1073. return offset;
  1074. }
  1075. static inline u32
  1076. svga3dsurface_get_image_offset(SVGA3dSurfaceFormat format,
  1077. surf_size_struct baseLevelSize,
  1078. u32 numMipLevels,
  1079. u32 face,
  1080. u32 mip)
  1081. {
  1082. u32 offset;
  1083. u32 mipChainBytes;
  1084. u32 mipChainBytesToLevel;
  1085. u32 i;
  1086. const struct svga3d_surface_desc *desc;
  1087. surf_size_struct mipSize;
  1088. u32 bytes;
  1089. desc = svga3dsurface_get_desc(format);
  1090. mipChainBytes = 0;
  1091. mipChainBytesToLevel = 0;
  1092. for (i = 0; i < numMipLevels; i++) {
  1093. mipSize = svga3dsurface_get_mip_size(baseLevelSize, i);
  1094. bytes = svga3dsurface_get_image_buffer_size(desc, &mipSize, 0);
  1095. mipChainBytes += bytes;
  1096. if (i < mip)
  1097. mipChainBytesToLevel += bytes;
  1098. }
  1099. offset = mipChainBytes * face + mipChainBytesToLevel;
  1100. return offset;
  1101. }
  1102. /**
  1103. * svga3dsurface_is_gb_screen_target_format - Is the specified format usable as
  1104. * a ScreenTarget?
  1105. * (with just the GBObjects cap-bit
  1106. * set)
  1107. * @format: format to queried
  1108. *
  1109. * RETURNS:
  1110. * true if queried format is valid for screen targets
  1111. */
  1112. static inline bool
  1113. svga3dsurface_is_gb_screen_target_format(SVGA3dSurfaceFormat format)
  1114. {
  1115. return (format == SVGA3D_X8R8G8B8 ||
  1116. format == SVGA3D_A8R8G8B8 ||
  1117. format == SVGA3D_R5G6B5 ||
  1118. format == SVGA3D_X1R5G5B5 ||
  1119. format == SVGA3D_A1R5G5B5 ||
  1120. format == SVGA3D_P8);
  1121. }
  1122. /**
  1123. * svga3dsurface_is_dx_screen_target_format - Is the specified format usable as
  1124. * a ScreenTarget?
  1125. * (with DX10 enabled)
  1126. *
  1127. * @format: format to queried
  1128. *
  1129. * Results:
  1130. * true if queried format is valid for screen targets
  1131. */
  1132. static inline bool
  1133. svga3dsurface_is_dx_screen_target_format(SVGA3dSurfaceFormat format)
  1134. {
  1135. return (format == SVGA3D_R8G8B8A8_UNORM ||
  1136. format == SVGA3D_B8G8R8A8_UNORM ||
  1137. format == SVGA3D_B8G8R8X8_UNORM);
  1138. }
  1139. /**
  1140. * svga3dsurface_is_screen_target_format - Is the specified format usable as a
  1141. * ScreenTarget?
  1142. * (for some combination of caps)
  1143. *
  1144. * @format: format to queried
  1145. *
  1146. * Results:
  1147. * true if queried format is valid for screen targets
  1148. */
  1149. static inline bool
  1150. svga3dsurface_is_screen_target_format(SVGA3dSurfaceFormat format)
  1151. {
  1152. if (svga3dsurface_is_gb_screen_target_format(format)) {
  1153. return true;
  1154. }
  1155. return svga3dsurface_is_dx_screen_target_format(format);
  1156. }
  1157. #endif /* _SVGA3D_SURFACEDEFS_H_ */