gc_hal_driver.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. /****************************************************************************
  2. *
  3. * Copyright (c) 2005 - 2014 by Vivante Corp. All rights reserved.
  4. *
  5. * The material in this file is confidential and contains trade secrets
  6. * of Vivante Corporation. This is proprietary information owned by
  7. * Vivante Corporation. No part of this work may be disclosed,
  8. * reproduced, copied, transmitted, or used in any way for any purpose,
  9. * without the express written permission of Vivante Corporation.
  10. *
  11. *****************************************************************************/
  12. #ifndef __gc_hal_driver_h_
  13. #define __gc_hal_driver_h_
  14. #include "gc_hal_enum.h"
  15. #include "gc_hal_types.h"
  16. #if gcdENABLE_VG
  17. #include "gc_hal_driver_vg.h"
  18. #endif
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /******************************************************************************\
  23. ******************************* I/O Control Codes ******************************
  24. \******************************************************************************/
  25. #define gcvHAL_CLASS "galcore"
  26. #define IOCTL_GCHAL_INTERFACE 30000
  27. #define IOCTL_GCHAL_KERNEL_INTERFACE 30001
  28. #define IOCTL_GCHAL_TERMINATE 30002
  29. /******************************************************************************\
  30. ********************************* Command Codes ********************************
  31. \******************************************************************************/
  32. typedef enum _gceHAL_COMMAND_CODES
  33. {
  34. /* Generic query. */
  35. gcvHAL_QUERY_VIDEO_MEMORY,
  36. gcvHAL_QUERY_CHIP_IDENTITY,
  37. /* Contiguous memory. */
  38. gcvHAL_ALLOCATE_NON_PAGED_MEMORY,
  39. gcvHAL_FREE_NON_PAGED_MEMORY,
  40. gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY,
  41. gcvHAL_FREE_CONTIGUOUS_MEMORY,
  42. /* Video memory allocation. */
  43. gcvHAL_ALLOCATE_VIDEO_MEMORY, /* Enforced alignment. */
  44. gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY, /* No alignment. */
  45. gcvHAL_RELEASE_VIDEO_MEMORY,
  46. /* Physical-to-logical mapping. */
  47. gcvHAL_MAP_MEMORY,
  48. gcvHAL_UNMAP_MEMORY,
  49. /* Logical-to-physical mapping. */
  50. gcvHAL_MAP_USER_MEMORY,
  51. gcvHAL_UNMAP_USER_MEMORY,
  52. /* Surface lock/unlock. */
  53. gcvHAL_LOCK_VIDEO_MEMORY,
  54. gcvHAL_UNLOCK_VIDEO_MEMORY,
  55. /* Event queue. */
  56. gcvHAL_EVENT_COMMIT,
  57. gcvHAL_USER_SIGNAL,
  58. gcvHAL_SIGNAL,
  59. gcvHAL_WRITE_DATA,
  60. gcvHAL_COMMIT,
  61. gcvHAL_STALL,
  62. gcvHAL_READ_REGISTER,
  63. gcvHAL_WRITE_REGISTER,
  64. gcvHAL_GET_PROFILE_SETTING,
  65. gcvHAL_SET_PROFILE_SETTING,
  66. gcvHAL_READ_ALL_PROFILE_REGISTERS,
  67. gcvHAL_PROFILE_REGISTERS_2D,
  68. #if VIVANTE_PROFILER_PERDRAW
  69. gcvHAL_READ_PROFILER_REGISTER_SETTING,
  70. #endif
  71. /* Power management. */
  72. gcvHAL_SET_POWER_MANAGEMENT_STATE,
  73. gcvHAL_QUERY_POWER_MANAGEMENT_STATE,
  74. gcvHAL_GET_BASE_ADDRESS,
  75. gcvHAL_SET_IDLE, /* reserved */
  76. /* Queries. */
  77. gcvHAL_QUERY_KERNEL_SETTINGS,
  78. /* Reset. */
  79. gcvHAL_RESET,
  80. /* Map physical address into handle. */
  81. gcvHAL_MAP_PHYSICAL,
  82. /* Debugger stuff. */
  83. gcvHAL_DEBUG,
  84. /* Cache stuff. */
  85. gcvHAL_CACHE,
  86. /* TimeStamp */
  87. gcvHAL_TIMESTAMP,
  88. /* Database. */
  89. gcvHAL_DATABASE,
  90. /* Version. */
  91. gcvHAL_VERSION,
  92. /* Chip info */
  93. gcvHAL_CHIP_INFO,
  94. /* Process attaching/detaching. */
  95. gcvHAL_ATTACH,
  96. gcvHAL_DETACH,
  97. /* Composition. */
  98. gcvHAL_COMPOSE,
  99. /* Set timeOut value */
  100. gcvHAL_SET_TIMEOUT,
  101. /* Frame database. */
  102. gcvHAL_GET_FRAME_INFO,
  103. gcvHAL_QUERY_COMMAND_BUFFER,
  104. gcvHAL_COMMIT_DONE,
  105. /* GPU and event dump */
  106. gcvHAL_DUMP_GPU_STATE,
  107. gcvHAL_DUMP_EVENT,
  108. /* Virtual command buffer. */
  109. gcvHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER,
  110. gcvHAL_FREE_VIRTUAL_COMMAND_BUFFER,
  111. /* FSCALE_VAL. */
  112. gcvHAL_SET_FSCALE_VALUE,
  113. gcvHAL_GET_FSCALE_VALUE,
  114. gcvHAL_NAME_VIDEO_MEMORY,
  115. gcvHAL_IMPORT_VIDEO_MEMORY,
  116. /* Reset time stamp. */
  117. gcvHAL_QUERY_RESET_TIME_STAMP,
  118. /* Multi-GPU read/write. */
  119. gcvHAL_READ_REGISTER_EX,
  120. gcvHAL_WRITE_REGISTER_EX,
  121. /* Sync point operations. */
  122. gcvHAL_SYNC_POINT,
  123. /* Create native fence and return its fd. */
  124. gcvHAL_CREATE_NATIVE_FENCE,
  125. /* Destory MMU. */
  126. gcvHAL_DESTROY_MMU,
  127. /* Shared buffer. */
  128. gcvHAL_SHBUF,
  129. /* Config power management. */
  130. gcvHAL_CONFIG_POWER_MANAGEMENT,
  131. /* Connect a video node to an OS native fd. */
  132. gcvHAL_GET_VIDEO_MEMORY_FD,
  133. }
  134. gceHAL_COMMAND_CODES;
  135. /******************************************************************************\
  136. ****************************** Interface Structure *****************************
  137. \******************************************************************************/
  138. #define gcdMAX_PROFILE_FILE_NAME 128
  139. /* Kernel settings. */
  140. typedef struct _gcsKERNEL_SETTINGS
  141. {
  142. /* Used RealTime signal between kernel and user. */
  143. gctINT signal;
  144. }
  145. gcsKERNEL_SETTINGS;
  146. /* gcvHAL_QUERY_CHIP_IDENTITY */
  147. typedef struct _gcsHAL_QUERY_CHIP_IDENTITY * gcsHAL_QUERY_CHIP_IDENTITY_PTR;
  148. typedef struct _gcsHAL_QUERY_CHIP_IDENTITY
  149. {
  150. /* Chip model. */
  151. gceCHIPMODEL chipModel;
  152. /* Revision value.*/
  153. gctUINT32 chipRevision;
  154. /* Supported feature fields. */
  155. gctUINT32 chipFeatures;
  156. /* Supported minor feature fields. */
  157. gctUINT32 chipMinorFeatures;
  158. /* Supported minor feature 1 fields. */
  159. gctUINT32 chipMinorFeatures1;
  160. /* Supported minor feature 2 fields. */
  161. gctUINT32 chipMinorFeatures2;
  162. /* Supported minor feature 3 fields. */
  163. gctUINT32 chipMinorFeatures3;
  164. /* Supported minor feature 4 fields. */
  165. gctUINT32 chipMinorFeatures4;
  166. /* Supported minor feature 5 fields. */
  167. gctUINT32 chipMinorFeatures5;
  168. /* Number of streams supported. */
  169. gctUINT32 streamCount;
  170. /* Total number of temporary registers per thread. */
  171. gctUINT32 registerMax;
  172. /* Maximum number of threads. */
  173. gctUINT32 threadCount;
  174. /* Number of shader cores. */
  175. gctUINT32 shaderCoreCount;
  176. /* Size of the vertex cache. */
  177. gctUINT32 vertexCacheSize;
  178. /* Number of entries in the vertex output buffer. */
  179. gctUINT32 vertexOutputBufferSize;
  180. /* Number of pixel pipes. */
  181. gctUINT32 pixelPipes;
  182. /* Number of instructions. */
  183. gctUINT32 instructionCount;
  184. /* Number of constants. */
  185. gctUINT32 numConstants;
  186. /* Buffer size */
  187. gctUINT32 bufferSize;
  188. /* Number of varyings */
  189. gctUINT32 varyingsCount;
  190. /* Supertile layout style in hardware */
  191. gctUINT32 superTileMode;
  192. #if gcdMULTI_GPU
  193. /* Number of 3D GPUs */
  194. gctUINT32 gpuCoreCount;
  195. #endif
  196. /* Special control bits for 2D chip. */
  197. gctUINT32 chip2DControl;
  198. /* Product ID */
  199. gctUINT32 productID;
  200. /* Special ECO bits */
  201. gceECO_FLAG ecoFlags;
  202. }
  203. gcsHAL_QUERY_CHIP_IDENTITY;
  204. /* gcvHAL_COMPOSE. */
  205. typedef struct _gcsHAL_COMPOSE * gcsHAL_COMPOSE_PTR;
  206. typedef struct _gcsHAL_COMPOSE
  207. {
  208. /* Composition state buffer. */
  209. gctUINT64 physical;
  210. gctUINT64 logical;
  211. gctUINT offset;
  212. gctUINT size;
  213. /* Composition end signal. */
  214. gctUINT64 process;
  215. gctUINT64 signal;
  216. /* User signals. */
  217. gctUINT64 userProcess;
  218. gctUINT64 userSignal1;
  219. gctUINT64 userSignal2;
  220. #if defined(__QNXNTO__)
  221. /* Client pulse side-channel connection ID. */
  222. gctINT32 coid;
  223. /* Set by server. */
  224. gctINT32 rcvid;
  225. #endif
  226. }
  227. gcsHAL_COMPOSE;
  228. typedef struct _gcsHAL_INTERFACE
  229. {
  230. /* Command code. */
  231. gceHAL_COMMAND_CODES command;
  232. /* Hardware type. */
  233. gceHARDWARE_TYPE hardwareType;
  234. /* Status value. */
  235. gceSTATUS status;
  236. /* Handle to this interface channel. */
  237. gctUINT64 handle;
  238. /* Pid of the client. */
  239. gctUINT32 pid;
  240. /* Union of command structures. */
  241. union _u
  242. {
  243. /* gcvHAL_GET_BASE_ADDRESS */
  244. struct _gcsHAL_GET_BASE_ADDRESS
  245. {
  246. /* Physical memory address of internal memory. */
  247. OUT gctUINT32 baseAddress;
  248. }
  249. GetBaseAddress;
  250. /* gcvHAL_QUERY_VIDEO_MEMORY */
  251. struct _gcsHAL_QUERY_VIDEO_MEMORY
  252. {
  253. /* Physical memory address of internal memory. Just a name. */
  254. OUT gctUINT32 internalPhysical;
  255. /* Size in bytes of internal memory. */
  256. OUT gctUINT64 internalSize;
  257. /* Physical memory address of external memory. Just a name. */
  258. OUT gctUINT32 externalPhysical;
  259. /* Size in bytes of external memory.*/
  260. OUT gctUINT64 externalSize;
  261. /* Physical memory address of contiguous memory. Just a name. */
  262. OUT gctUINT32 contiguousPhysical;
  263. /* Size in bytes of contiguous memory.*/
  264. OUT gctUINT64 contiguousSize;
  265. }
  266. QueryVideoMemory;
  267. /* gcvHAL_QUERY_CHIP_IDENTITY */
  268. gcsHAL_QUERY_CHIP_IDENTITY QueryChipIdentity;
  269. /* gcvHAL_MAP_MEMORY */
  270. struct _gcsHAL_MAP_MEMORY
  271. {
  272. /* Physical memory address to map. Just a name on Linux/Qnx. */
  273. IN gctUINT32 physical;
  274. /* Number of bytes in physical memory to map. */
  275. IN gctUINT64 bytes;
  276. /* Address of mapped memory. */
  277. OUT gctUINT64 logical;
  278. }
  279. MapMemory;
  280. /* gcvHAL_UNMAP_MEMORY */
  281. struct _gcsHAL_UNMAP_MEMORY
  282. {
  283. /* Physical memory address to unmap. Just a name on Linux/Qnx. */
  284. IN gctUINT32 physical;
  285. /* Number of bytes in physical memory to unmap. */
  286. IN gctUINT64 bytes;
  287. /* Address of mapped memory to unmap. */
  288. IN gctUINT64 logical;
  289. }
  290. UnmapMemory;
  291. /* gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY */
  292. struct _gcsHAL_ALLOCATE_LINEAR_VIDEO_MEMORY
  293. {
  294. /* Number of bytes to allocate. */
  295. IN OUT gctUINT bytes;
  296. /* Buffer alignment. */
  297. IN gctUINT alignment;
  298. /* Type of allocation. */
  299. IN gceSURF_TYPE type;
  300. /* Flag of allocation. */
  301. IN gctUINT32 flag;
  302. /* Memory pool to allocate from. */
  303. IN OUT gcePOOL pool;
  304. /* Allocated video memory. */
  305. OUT gctUINT32 node;
  306. }
  307. AllocateLinearVideoMemory;
  308. /* gcvHAL_ALLOCATE_VIDEO_MEMORY */
  309. struct _gcsHAL_ALLOCATE_VIDEO_MEMORY
  310. {
  311. /* Width of rectangle to allocate. */
  312. IN OUT gctUINT width;
  313. /* Height of rectangle to allocate. */
  314. IN OUT gctUINT height;
  315. /* Depth of rectangle to allocate. */
  316. IN gctUINT depth;
  317. /* Format rectangle to allocate in gceSURF_FORMAT. */
  318. IN gceSURF_FORMAT format;
  319. /* Type of allocation. */
  320. IN gceSURF_TYPE type;
  321. /* Memory pool to allocate from. */
  322. IN OUT gcePOOL pool;
  323. /* Allocated video memory. */
  324. OUT gctUINT32 node;
  325. }
  326. AllocateVideoMemory;
  327. /* gcvHAL_RELEASE_VIDEO_MEMORY */
  328. struct _gcsHAL_RELEASE_VIDEO_MEMORY
  329. {
  330. /* Allocated video memory. */
  331. IN gctUINT32 node;
  332. #ifdef __QNXNTO__
  333. /* TODO: This is part of the unlock - why is it here? */
  334. /* Mapped logical address to unmap in user space. */
  335. OUT gctUINT64 memory;
  336. /* Number of bytes to allocated. */
  337. OUT gctUINT64 bytes;
  338. #endif
  339. }
  340. ReleaseVideoMemory;
  341. /* gcvHAL_LOCK_VIDEO_MEMORY */
  342. struct _gcsHAL_LOCK_VIDEO_MEMORY
  343. {
  344. /* Allocated video memory. */
  345. IN gctUINT32 node;
  346. /* Cache configuration. */
  347. /* Only gcvPOOL_CONTIGUOUS and gcvPOOL_VIRUTAL
  348. ** can be configured */
  349. IN gctBOOL cacheable;
  350. /* Hardware specific address. */
  351. OUT gctUINT32 address;
  352. /* Mapped logical address. */
  353. OUT gctUINT64 memory;
  354. /* Customer priviate handle*/
  355. OUT gctUINT32 gid;
  356. /* Bus address of a contiguous video node. */
  357. OUT gctUINT64 physicalAddress;
  358. }
  359. LockVideoMemory;
  360. /* gcvHAL_UNLOCK_VIDEO_MEMORY */
  361. struct _gcsHAL_UNLOCK_VIDEO_MEMORY
  362. {
  363. /* Allocated video memory. */
  364. IN gctUINT64 node;
  365. /* Type of surface. */
  366. IN gceSURF_TYPE type;
  367. /* Flag to unlock surface asynchroneously. */
  368. IN OUT gctBOOL asynchroneous;
  369. }
  370. UnlockVideoMemory;
  371. /* gcvHAL_ALLOCATE_NON_PAGED_MEMORY */
  372. struct _gcsHAL_ALLOCATE_NON_PAGED_MEMORY
  373. {
  374. /* Number of bytes to allocate. */
  375. IN OUT gctUINT64 bytes;
  376. /* Physical address of allocation. Just a name. */
  377. OUT gctUINT32 physical;
  378. /* Logical address of allocation. */
  379. OUT gctUINT64 logical;
  380. }
  381. AllocateNonPagedMemory;
  382. /* gcvHAL_FREE_NON_PAGED_MEMORY */
  383. struct _gcsHAL_FREE_NON_PAGED_MEMORY
  384. {
  385. /* Number of bytes allocated. */
  386. IN gctUINT64 bytes;
  387. /* Physical address of allocation. Just a name. */
  388. IN gctUINT32 physical;
  389. /* Logical address of allocation. */
  390. IN gctUINT64 logical;
  391. }
  392. FreeNonPagedMemory;
  393. /* gcvHAL_ALLOCATE_NON_PAGED_MEMORY */
  394. struct _gcsHAL_ALLOCATE_VIRTUAL_COMMAND_BUFFER
  395. {
  396. /* Number of bytes to allocate. */
  397. IN OUT gctUINT64 bytes;
  398. /* Physical address of allocation. Just a name. */
  399. OUT gctUINT32 physical;
  400. /* Logical address of allocation. */
  401. OUT gctUINT64 logical;
  402. }
  403. AllocateVirtualCommandBuffer;
  404. /* gcvHAL_FREE_NON_PAGED_MEMORY */
  405. struct _gcsHAL_FREE_VIRTUAL_COMMAND_BUFFER
  406. {
  407. /* Number of bytes allocated. */
  408. IN gctUINT64 bytes;
  409. /* Physical address of allocation. Just a name. */
  410. IN gctUINT32 physical;
  411. /* Logical address of allocation. */
  412. IN gctUINT64 logical;
  413. }
  414. FreeVirtualCommandBuffer;
  415. /* gcvHAL_EVENT_COMMIT. */
  416. struct _gcsHAL_EVENT_COMMIT
  417. {
  418. /* Event queue in gcsQUEUE. */
  419. IN gctUINT64 queue;
  420. #if gcdMULTI_GPU
  421. IN gceCORE_3D_MASK chipEnable;
  422. IN gceMULTI_GPU_MODE gpuMode;
  423. #endif
  424. }
  425. Event;
  426. /* gcvHAL_COMMIT */
  427. struct _gcsHAL_COMMIT
  428. {
  429. /* Context buffer object gckCONTEXT. */
  430. IN gctUINT64 context;
  431. /* Command buffer gcoCMDBUF. */
  432. IN gctUINT64 commandBuffer;
  433. /* State delta buffer in gcsSTATE_DELTA. */
  434. gctUINT64 delta;
  435. /* Event queue in gcsQUEUE. */
  436. IN gctUINT64 queue;
  437. #if gcdMULTI_GPU
  438. IN gceCORE_3D_MASK chipEnable;
  439. IN gceMULTI_GPU_MODE gpuMode;
  440. #endif
  441. }
  442. Commit;
  443. /* gcvHAL_MAP_USER_MEMORY */
  444. struct _gcsHAL_MAP_USER_MEMORY
  445. {
  446. /* Base address of user memory to map. */
  447. IN gctUINT64 memory;
  448. /* Physical address of user memory to map. */
  449. IN gctUINT32 physical;
  450. /* Size of user memory in bytes to map. */
  451. IN gctUINT64 size;
  452. /* Info record required by gcvHAL_UNMAP_USER_MEMORY. Just a name. */
  453. OUT gctUINT32 info;
  454. /* Physical address of mapped memory. */
  455. OUT gctUINT32 address;
  456. }
  457. MapUserMemory;
  458. /* gcvHAL_UNMAP_USER_MEMORY */
  459. struct _gcsHAL_UNMAP_USER_MEMORY
  460. {
  461. /* Base address of user memory to unmap. */
  462. IN gctUINT64 memory;
  463. /* Size of user memory in bytes to unmap. */
  464. IN gctUINT64 size;
  465. /* Info record returned by gcvHAL_MAP_USER_MEMORY. Just a name. */
  466. IN gctUINT32 info;
  467. /* Physical address of mapped memory as returned by
  468. gcvHAL_MAP_USER_MEMORY. */
  469. IN gctUINT32 address;
  470. }
  471. UnmapUserMemory;
  472. #if !USE_NEW_LINUX_SIGNAL
  473. /* gcsHAL_USER_SIGNAL */
  474. struct _gcsHAL_USER_SIGNAL
  475. {
  476. /* Command. */
  477. gceUSER_SIGNAL_COMMAND_CODES command;
  478. /* Signal ID. */
  479. IN OUT gctINT id;
  480. /* Reset mode. */
  481. IN gctBOOL manualReset;
  482. /* Wait timedout. */
  483. IN gctUINT32 wait;
  484. /* State. */
  485. IN gctBOOL state;
  486. }
  487. UserSignal;
  488. #endif
  489. /* gcvHAL_SIGNAL. */
  490. struct _gcsHAL_SIGNAL
  491. {
  492. /* Signal handle to signal gctSIGNAL. */
  493. IN gctUINT64 signal;
  494. /* Reserved gctSIGNAL. */
  495. IN gctUINT64 auxSignal;
  496. /* Process owning the signal gctHANDLE. */
  497. IN gctUINT64 process;
  498. #if defined(__QNXNTO__)
  499. /* Client pulse side-channel connection ID. Set by client in gcoOS_CreateSignal. */
  500. IN gctINT32 coid;
  501. /* Set by server. */
  502. IN gctINT32 rcvid;
  503. #endif
  504. /* Event generated from where of pipeline */
  505. IN gceKERNEL_WHERE fromWhere;
  506. }
  507. Signal;
  508. /* gcvHAL_WRITE_DATA. */
  509. struct _gcsHAL_WRITE_DATA
  510. {
  511. /* Address to write data to. */
  512. IN gctUINT32 address;
  513. /* Data to write. */
  514. IN gctUINT32 data;
  515. }
  516. WriteData;
  517. /* gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY */
  518. struct _gcsHAL_ALLOCATE_CONTIGUOUS_MEMORY
  519. {
  520. /* Number of bytes to allocate. */
  521. IN OUT gctUINT64 bytes;
  522. /* Hardware address of allocation. */
  523. OUT gctUINT32 address;
  524. /* Physical address of allocation. Just a name. */
  525. OUT gctUINT32 physical;
  526. /* Logical address of allocation. */
  527. OUT gctUINT64 logical;
  528. }
  529. AllocateContiguousMemory;
  530. /* gcvHAL_FREE_CONTIGUOUS_MEMORY */
  531. struct _gcsHAL_FREE_CONTIGUOUS_MEMORY
  532. {
  533. /* Number of bytes allocated. */
  534. IN gctUINT64 bytes;
  535. /* Physical address of allocation. Just a name. */
  536. IN gctUINT32 physical;
  537. /* Logical address of allocation. */
  538. IN gctUINT64 logical;
  539. }
  540. FreeContiguousMemory;
  541. /* gcvHAL_READ_REGISTER */
  542. struct _gcsHAL_READ_REGISTER
  543. {
  544. /* Logical address of memory to write data to. */
  545. IN gctUINT32 address;
  546. /* Data read. */
  547. OUT gctUINT32 data;
  548. }
  549. ReadRegisterData;
  550. /* gcvHAL_WRITE_REGISTER */
  551. struct _gcsHAL_WRITE_REGISTER
  552. {
  553. /* Logical address of memory to write data to. */
  554. IN gctUINT32 address;
  555. /* Data read. */
  556. IN gctUINT32 data;
  557. }
  558. WriteRegisterData;
  559. #if gcdMULTI_GPU
  560. /* gcvHAL_READ_REGISTER_EX */
  561. struct _gcsHAL_READ_REGISTER_EX
  562. {
  563. /* Logical address of memory to write data to. */
  564. IN gctUINT32 address;
  565. IN gctUINT32 coreSelect;
  566. /* Data read. */
  567. OUT gctUINT32 data[gcdMULTI_GPU];
  568. }
  569. ReadRegisterDataEx;
  570. /* gcvHAL_WRITE_REGISTER_EX */
  571. struct _gcsHAL_WRITE_REGISTER_EX
  572. {
  573. /* Logical address of memory to write data to. */
  574. IN gctUINT32 address;
  575. IN gctUINT32 coreSelect;
  576. /* Data read. */
  577. IN gctUINT32 data[gcdMULTI_GPU];
  578. }
  579. WriteRegisterDataEx;
  580. #endif
  581. #if VIVANTE_PROFILER
  582. /* gcvHAL_GET_PROFILE_SETTING */
  583. struct _gcsHAL_GET_PROFILE_SETTING
  584. {
  585. /* Enable profiling */
  586. OUT gctBOOL enable;
  587. }
  588. GetProfileSetting;
  589. /* gcvHAL_SET_PROFILE_SETTING */
  590. struct _gcsHAL_SET_PROFILE_SETTING
  591. {
  592. /* Enable profiling */
  593. IN gctBOOL enable;
  594. }
  595. SetProfileSetting;
  596. #if VIVANTE_PROFILER_PERDRAW
  597. /* gcvHAL_READ_PROFILER_REGISTER_SETTING */
  598. struct _gcsHAL_READ_PROFILER_REGISTER_SETTING
  599. {
  600. /*Should Clear Register*/
  601. IN gctBOOL bclear;
  602. }
  603. SetProfilerRegisterClear;
  604. #endif
  605. /* gcvHAL_READ_ALL_PROFILE_REGISTERS */
  606. struct _gcsHAL_READ_ALL_PROFILE_REGISTERS
  607. {
  608. #if VIVANTE_PROFILER_CONTEXT
  609. /* Context buffer object gckCONTEXT. Just a name. */
  610. IN gctUINT32 context;
  611. #endif
  612. /* Data read. */
  613. OUT gcsPROFILER_COUNTERS counters;
  614. }
  615. RegisterProfileData;
  616. /* gcvHAL_PROFILE_REGISTERS_2D */
  617. struct _gcsHAL_PROFILE_REGISTERS_2D
  618. {
  619. /* Data read in gcs2D_PROFILE. */
  620. OUT gctUINT64 hwProfile2D;
  621. }
  622. RegisterProfileData2D;
  623. #endif
  624. /* Power management. */
  625. /* gcvHAL_SET_POWER_MANAGEMENT_STATE */
  626. struct _gcsHAL_SET_POWER_MANAGEMENT
  627. {
  628. /* Data read. */
  629. IN gceCHIPPOWERSTATE state;
  630. }
  631. SetPowerManagement;
  632. /* gcvHAL_QUERY_POWER_MANAGEMENT_STATE */
  633. struct _gcsHAL_QUERY_POWER_MANAGEMENT
  634. {
  635. /* Data read. */
  636. OUT gceCHIPPOWERSTATE state;
  637. /* Idle query. */
  638. OUT gctBOOL isIdle;
  639. }
  640. QueryPowerManagement;
  641. /* gcvHAL_QUERY_KERNEL_SETTINGS */
  642. struct _gcsHAL_QUERY_KERNEL_SETTINGS
  643. {
  644. /* Settings.*/
  645. OUT gcsKERNEL_SETTINGS settings;
  646. }
  647. QueryKernelSettings;
  648. /* gcvHAL_MAP_PHYSICAL */
  649. struct _gcsHAL_MAP_PHYSICAL
  650. {
  651. /* gcvTRUE to map, gcvFALSE to unmap. */
  652. IN gctBOOL map;
  653. /* Physical address. */
  654. IN OUT gctUINT64 physical;
  655. }
  656. MapPhysical;
  657. /* gcvHAL_DEBUG */
  658. struct _gcsHAL_DEBUG
  659. {
  660. /* If gcvTRUE, set the debug information. */
  661. IN gctBOOL set;
  662. IN gctUINT32 level;
  663. IN gctUINT32 zones;
  664. IN gctBOOL enable;
  665. IN gceDEBUG_MESSAGE_TYPE type;
  666. IN gctUINT32 messageSize;
  667. /* Message to print if not empty. */
  668. IN gctCHAR message[80];
  669. }
  670. Debug;
  671. /* gcvHAL_CACHE */
  672. struct _gcsHAL_CACHE
  673. {
  674. IN gceCACHEOPERATION operation;
  675. IN gctUINT64 process;
  676. IN gctUINT64 logical;
  677. IN gctUINT64 bytes;
  678. IN gctUINT32 node;
  679. }
  680. Cache;
  681. /* gcvHAL_TIMESTAMP */
  682. struct _gcsHAL_TIMESTAMP
  683. {
  684. /* Timer select. */
  685. IN gctUINT32 timer;
  686. /* Timer request type (0-stop, 1-start, 2-send delta). */
  687. IN gctUINT32 request;
  688. /* Result of delta time in microseconds. */
  689. OUT gctINT32 timeDelta;
  690. }
  691. TimeStamp;
  692. /* gcvHAL_DATABASE */
  693. struct _gcsHAL_DATABASE
  694. {
  695. /* Set to gcvTRUE if you want to query a particular process ID.
  696. ** Set to gcvFALSE to query the last detached process. */
  697. IN gctBOOL validProcessID;
  698. /* Process ID to query. */
  699. IN gctUINT32 processID;
  700. /* Information. */
  701. OUT gcuDATABASE_INFO vidMem;
  702. OUT gcuDATABASE_INFO nonPaged;
  703. OUT gcuDATABASE_INFO contiguous;
  704. OUT gcuDATABASE_INFO gpuIdle;
  705. /* Detail information about video memory. */
  706. OUT gcuDATABASE_INFO vidMemPool[3];
  707. }
  708. Database;
  709. /* gcvHAL_VERSION */
  710. struct _gcsHAL_VERSION
  711. {
  712. /* Major version: N.n.n. */
  713. OUT gctINT32 major;
  714. /* Minor version: n.N.n. */
  715. OUT gctINT32 minor;
  716. /* Patch version: n.n.N. */
  717. OUT gctINT32 patch;
  718. /* Build version. */
  719. OUT gctUINT32 build;
  720. }
  721. Version;
  722. /* gcvHAL_CHIP_INFO */
  723. struct _gcsHAL_CHIP_INFO
  724. {
  725. /* Chip count. */
  726. OUT gctINT32 count;
  727. /* Chip types. */
  728. OUT gceHARDWARE_TYPE types[gcdCHIP_COUNT];
  729. }
  730. ChipInfo;
  731. /* gcvHAL_ATTACH */
  732. struct _gcsHAL_ATTACH
  733. {
  734. /* Handle of context buffer object. */
  735. OUT gctUINT32 context;
  736. /* Number of states in the buffer. */
  737. OUT gctUINT64 stateCount;
  738. /* Map context buffer to user or not. */
  739. IN gctBOOL map;
  740. /* Physical of context buffer. */
  741. OUT gctUINT32 physicals[2];
  742. /* Physical of context buffer. */
  743. OUT gctUINT64 logicals[2];
  744. /* Bytes of context buffer. */
  745. OUT gctUINT32 bytes;
  746. }
  747. Attach;
  748. /* gcvHAL_DETACH */
  749. struct _gcsHAL_DETACH
  750. {
  751. /* Context buffer object gckCONTEXT. Just a name. */
  752. IN gctUINT32 context;
  753. }
  754. Detach;
  755. /* gcvHAL_COMPOSE. */
  756. gcsHAL_COMPOSE Compose;
  757. /* gcvHAL_GET_FRAME_INFO. */
  758. struct _gcsHAL_GET_FRAME_INFO
  759. {
  760. /* gcsHAL_FRAME_INFO* */
  761. OUT gctUINT64 frameInfo;
  762. }
  763. GetFrameInfo;
  764. /* gcvHAL_SET_TIME_OUT. */
  765. struct _gcsHAL_SET_TIMEOUT
  766. {
  767. gctUINT32 timeOut;
  768. }
  769. SetTimeOut;
  770. #if gcdENABLE_VG
  771. /* gcvHAL_COMMIT */
  772. struct _gcsHAL_VGCOMMIT
  773. {
  774. /* Context buffer. gcsVGCONTEXT_PTR */
  775. IN gctUINT64 context;
  776. /* Command queue. gcsVGCMDQUEUE_PTR */
  777. IN gctUINT64 queue;
  778. /* Number of entries in the queue. */
  779. IN gctUINT entryCount;
  780. /* Task table. gcsTASK_MASTER_TABLE_PTR */
  781. IN gctUINT64 taskTable;
  782. }
  783. VGCommit;
  784. /* gcvHAL_QUERY_COMMAND_BUFFER */
  785. struct _gcsHAL_QUERY_COMMAND_BUFFER
  786. {
  787. /* Command buffer attributes. */
  788. OUT gcsCOMMAND_BUFFER_INFO information;
  789. }
  790. QueryCommandBuffer;
  791. #endif
  792. struct _gcsHAL_SET_FSCALE_VALUE
  793. {
  794. IN gctUINT value;
  795. }
  796. SetFscaleValue;
  797. struct _gcsHAL_GET_FSCALE_VALUE
  798. {
  799. OUT gctUINT value;
  800. OUT gctUINT minValue;
  801. OUT gctUINT maxValue;
  802. }
  803. GetFscaleValue;
  804. struct _gcsHAL_NAME_VIDEO_MEMORY
  805. {
  806. IN gctUINT32 handle;
  807. OUT gctUINT32 name;
  808. }
  809. NameVideoMemory;
  810. struct _gcsHAL_IMPORT_VIDEO_MEMORY
  811. {
  812. IN gctUINT32 name;
  813. OUT gctUINT32 handle;
  814. }
  815. ImportVideoMemory;
  816. struct _gcsHAL_QUERY_RESET_TIME_STAMP
  817. {
  818. OUT gctUINT64 timeStamp;
  819. }
  820. QueryResetTimeStamp;
  821. struct _gcsHAL_SYNC_POINT
  822. {
  823. /* Command. */
  824. gceSYNC_POINT_COMMAND_CODES command;
  825. /* Sync point. */
  826. IN OUT gctUINT64 syncPoint;
  827. /* From where. */
  828. IN gceKERNEL_WHERE fromWhere;
  829. /* Signaled state. */
  830. OUT gctBOOL state;
  831. }
  832. SyncPoint;
  833. struct _gcsHAL_CREATE_NATIVE_FENCE
  834. {
  835. /* Signal id to dup. */
  836. IN gctUINT64 syncPoint;
  837. /* Native fence file descriptor. */
  838. OUT gctINT fenceFD;
  839. }
  840. CreateNativeFence;
  841. struct _gcsHAL_DESTROY_MMU
  842. {
  843. /* Mmu object. */
  844. IN gctUINT64 mmu;
  845. }
  846. DestroyMmu;
  847. struct _gcsHAL_SHBUF
  848. {
  849. gceSHBUF_COMMAND_CODES command;
  850. /* Shared buffer. */
  851. IN OUT gctUINT64 id;
  852. /* User data to be shared. */
  853. IN gctUINT64 data;
  854. /* Data size. */
  855. IN OUT gctUINT32 bytes;
  856. }
  857. ShBuf;
  858. struct _gcsHAL_CONFIG_POWER_MANAGEMENT
  859. {
  860. IN gctBOOL enable;
  861. }
  862. ConfigPowerManagement;
  863. struct _gcsHAL_GET_VIDEO_MEMORY_FD
  864. {
  865. IN gctUINT32 handle;
  866. OUT gctINT fd;
  867. }
  868. GetVideoMemoryFd;
  869. }
  870. u;
  871. }
  872. gcsHAL_INTERFACE;
  873. #ifdef __cplusplus
  874. }
  875. #endif
  876. #endif /* __gc_hal_driver_h_ */