eglGetMscRateCHROMIUM.patch 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. From 5cddfb828ddd82fc741549d5ee44cd9b94bd97f5 Mon Sep 17 00:00:00 2001
  2. From: Jonah Ryan-Davis <jonahr@google.com>
  3. Date: Mon, 30 Mar 2020 17:13:54 +0000
  4. Subject: [PATCH] Use EGL_ANGLE_sync_control_rate for eglGetMscRate call
  5. eglGetMscRateCHROMIUM is not universally supported, so we will
  6. switch to using the ANGLE version of the extension instead.
  7. Bug: chromium:1064078
  8. Change-Id: Ic57e2e55230df1d1c2c584e1cbf54331330a0b87
  9. Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2120453
  10. Reviewed-by: Zhenyao Mo <zmo@chromium.org>
  11. Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
  12. Cr-Commit-Position: refs/heads/master@{#754518}
  13. ---
  14. diff --git a/gpu/GLES2/extensions/ANGLE/EGL_ANGLE_sync_control_rate.txt b/gpu/GLES2/extensions/ANGLE/EGL_ANGLE_sync_control_rate.txt
  15. new file mode 100644
  16. index 0000000..2056ae8
  17. --- /dev/null
  18. +++ b/gpu/GLES2/extensions/ANGLE/EGL_ANGLE_sync_control_rate.txt
  19. @@ -0,0 +1,110 @@
  20. +Name
  21. +
  22. + ANGLE_sync_control_rate
  23. +
  24. +Name Strings
  25. +
  26. + EGL_ANGLE_sync_control_rate
  27. +
  28. +Contact
  29. +
  30. + Jonah Ryan-Davis, Google (jonahr 'at' google.com)
  31. +
  32. +Status
  33. +
  34. + Draft.
  35. +
  36. +Version
  37. +
  38. + Version 1, 2020-03-24
  39. +
  40. + Based on GLX_OML_sync_control Revision 6.0
  41. +
  42. +Number
  43. +
  44. + ???
  45. +
  46. +Dependencies
  47. +
  48. + The extension is written against the EGL 1.2 Specification, although it
  49. + should work on other versions of these specifications. This extension
  50. + also requires an operating system which supports CLOCK_MONOTONIC.
  51. +
  52. +Overview
  53. +
  54. + This extension provides counters which let applications know about the
  55. + timing of the last vertical retrace. By looking at the system clock, as
  56. + well as the refresh rate of the monitor, this should enable applications
  57. + to predict the position of future retraces so as to schedule an optimal
  58. + workload.
  59. +
  60. + This extension incorporates the use of three counters that provide
  61. + the necessary synchronization. The Unadjusted System Time (or UST)
  62. + is the 64-bit CLOCK_MONOTONIC clock; in particular this lets the
  63. + application schedule future vertical retraces by querying this clock.
  64. + The graphics Media Stream Counter (or graphics MSC) is a counter
  65. + that is unique to the graphics subsystem and increments for each
  66. + vertical retrace that occurs. The Swap Buffer Counter (SBC) is an
  67. + attribute of an EGLSurface and is incremented each time a swap
  68. + buffer action is performed on the associated surface.
  69. +
  70. + The use of these three counters allows the application to
  71. + synchronize graphics rendering to vertical retraces and/or swap
  72. + buffer actions. For example, by querying the synchronization values for
  73. + a given surface, the application can accurately predict the timing for
  74. + the next vertical retraces and schedule rendering accordingly.
  75. +
  76. +Issues
  77. +
  78. + None.
  79. +
  80. +IP Status
  81. +
  82. + No known issues.
  83. +
  84. +New Procedures and Functions
  85. +
  86. + Bool eglGetMscRateANGLE(EGLDisplay* dpy,
  87. + EGLSurface surface,
  88. + int32_t* numerator,
  89. + int32_t* denominator)
  90. +
  91. +New Tokens
  92. +
  93. + None
  94. +
  95. +Additions to the EGL 1.3 Specification
  96. +
  97. + The graphics MSC value is incremented once for each screen refresh.
  98. + For a non-interlaced display, this means that the graphics MSC value
  99. + is incremented for each frame. For an interlaced display, it means
  100. + that it will be incremented for each field. For a multi-monitor
  101. + system, the monitor used to determine MSC is the one where the surface
  102. + is located. If the surface spans multiple monitors, the monitor used
  103. + to determine MSC is the one with the biggest coverage in pixels.
  104. +
  105. + eglGetMscRateANGLE returns the rate at which the MSC will be incremented
  106. + for the display associated with <hdc>. The rate is expressed in Hertz
  107. + as <numerator> / <denominator>. If the MSC rate in Hertz is an
  108. + integer, then <denominator> will be 1 and <numerator> will be
  109. + the MSC rate.
  110. +
  111. + The function eglGetMscRateANGLE will return TRUE if the function
  112. + completed successfully, FALSE otherwise.
  113. +
  114. + Each time eglSwapBuffer succeeds, the SBC will be increased within a
  115. + finite time period.
  116. +
  117. +Errors
  118. +
  119. + The function eglGetMscRateANGLE will return FALSE if there is no
  120. + current EGLContext.
  121. +
  122. +New Implementation Dependent State
  123. +
  124. + None
  125. +
  126. +Revision History
  127. +
  128. + Version 1, 2020-03-24 (Jonah Ryan-Davis)
  129. + - Initial draft, based on GLX_OML_sync_control revision 6.0.
  130. diff --git a/gpu/GLES2/extensions/CHROMIUM/EGL_CHROMIUM_sync_control.txt b/gpu/GLES2/extensions/CHROMIUM/EGL_CHROMIUM_sync_control.txt
  131. index 14f4e56..f699f61 100644
  132. --- a/gpu/GLES2/extensions/CHROMIUM/EGL_CHROMIUM_sync_control.txt
  133. +++ b/gpu/GLES2/extensions/CHROMIUM/EGL_CHROMIUM_sync_control.txt
  134. @@ -16,7 +16,7 @@
  135. Version
  136. - Version 3, 2020-01-23
  137. + Version 2, 2015-05-05
  138. Based on GLX_OML_sync_control Revision 6.0
  139. @@ -70,12 +70,6 @@
  140. int64_t* msc,
  141. int64_t* sbc)
  142. - Bool eglGetMscRateCHROMIUM(EGLDisplay* dpy,
  143. - EGLSurface surface,
  144. - int32_t* numerator,
  145. - int32_t* denominator)
  146. -
  147. -
  148. New Tokens
  149. None
  150. @@ -112,22 +106,16 @@
  151. is located. If the surface spans multiple monitors, the monitor used
  152. to determine MSC is the one with the biggest coverage in pixels.
  153. - eglGetMscRateCHROMIUM returns the rate at which the MSC will be incremented
  154. - for the display associated with <hdc>. The rate is expressed in Hertz
  155. - as <numerator> / <denominator>. If the MSC rate in Hertz is an
  156. - integer, then <denominator> will be 1 and <numerator> will be
  157. - the MSC rate.
  158. -
  159. - The functions eglGetSyncValuesCHROMIUM, and eglGetMscRateCHROMIUM will
  160. - return TRUE if the function completed successfully, FALSE otherwise.
  161. + The function eglGetSyncValuesCHROMIUM will return TRUE if the function
  162. + completed successfully, FALSE otherwise.
  163. Each time eglSwapBuffer succeeds, the SBC will be increased within a
  164. finite time period.
  165. Errors
  166. - The functions eglGetSyncValuesCHROMIUM, and eglGetMscRateCHROMIUM will
  167. - return FALSE if there is no current EGLContext.
  168. + The function eglGetSyncValuesCHROMIUM will return FALSE if there is no
  169. + current EGLContext.
  170. New State
  171. @@ -144,10 +132,6 @@
  172. Revision History
  173. - Version 3, 2020-01-23 (Jonah Ryan-Davis)
  174. - - Add the function eglGetMscRateCHROMIUM based on glXGetMscRateOML from
  175. - GLX_OML_sync_control revision 6.0.
  176. -
  177. Version 2, 2015-05-05 (Chad Versace)
  178. - Rename to EGL_CHROMIUM_sync_control from EGL_CHROMIUM_get_sync_values.
  179. EGL_CHROMIUM_sync_control is the de facto extension name because all
  180. diff --git a/ui/gl/EGL/eglextchromium.h b/ui/gl/EGL/eglextchromium.h
  181. index e66d34a..22e3cf0 100644
  182. --- a/ui/gl/EGL/eglextchromium.h
  183. +++ b/ui/gl/EGL/eglextchromium.h
  184. @@ -22,21 +22,26 @@
  185. EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(
  186. EGLDisplay dpy, EGLSurface surface, EGLuint64CHROMIUM *ust,
  187. EGLuint64CHROMIUM *msc, EGLuint64CHROMIUM *sbc);
  188. -EGLAPI EGLBoolean EGLAPIENTRY eglGetMscRateCHROMIUM(EGLDisplay dpy,
  189. - EGLSurface surface,
  190. - EGLint* numerator,
  191. - EGLint* denominator);
  192. #endif /* EGL_EGLEXT_PROTOTYPES */
  193. typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCVALUESCHROMIUMPROC)
  194. (EGLDisplay dpy, EGLSurface surface, EGLuint64CHROMIUM *ust,
  195. EGLuint64CHROMIUM *msc, EGLuint64CHROMIUM *sbc);
  196. -typedef EGLBoolean(EGLAPIENTRYP PFNEGLGETMSCRATECHROMIUMPROC)(
  197. - EGLDisplay dpy,
  198. - EGLSurface surface,
  199. - EGLint* numerator,
  200. - EGLint* denominator);
  201. -#endif
  202. -#endif
  203. +#endif /* EGL_CHROMIUM_sync_control */
  204. +
  205. +#ifndef EGL_ANGLE_sync_control_rate
  206. +#define EGL_ANGLE_sync_control_rate 1
  207. +#ifdef EGL_EGLEXT_PROTOTYPES
  208. +EGLAPI EGLBoolean EGLAPIENTRY eglGetMscRateANGLE(EGLDisplay dpy,
  209. + EGLSurface surface,
  210. + EGLint* numerator,
  211. + EGLint* denominator);
  212. +#endif /* EGL_EGLEXT_PROTOTYPES */
  213. +typedef EGLBoolean(EGLAPIENTRYP PFNEGLGETMSCRATEANGLEPROC)(EGLDisplay dpy,
  214. + EGLSurface surface,
  215. + EGLint* numerator,
  216. + EGLint* denominator);
  217. +#endif /* EGL_ANGLE_sync_control_rate */
  218. +#endif /* KHRONOS_SUPPORT_INT64 */
  219. #ifdef __cplusplus
  220. }
  221. diff --git a/ui/gl/egl_bindings_autogen_mock.cc b/ui/gl/egl_bindings_autogen_mock.cc
  222. index f6562ad..d4d3a04 100644
  223. --- a/ui/gl/egl_bindings_autogen_mock.cc
  224. +++ b/ui/gl/egl_bindings_autogen_mock.cc
  225. @@ -299,12 +299,12 @@
  226. }
  227. EGLBoolean GL_BINDING_CALL
  228. -MockEGLInterface::Mock_eglGetMscRateCHROMIUM(EGLDisplay dpy,
  229. - EGLSurface surface,
  230. - EGLint* numerator,
  231. - EGLint* denominator) {
  232. - MakeEglMockFunctionUnique("eglGetMscRateCHROMIUM");
  233. - return interface_->GetMscRateCHROMIUM(dpy, surface, numerator, denominator);
  234. +MockEGLInterface::Mock_eglGetMscRateANGLE(EGLDisplay dpy,
  235. + EGLSurface surface,
  236. + EGLint* numerator,
  237. + EGLint* denominator) {
  238. + MakeEglMockFunctionUnique("eglGetMscRateANGLE");
  239. + return interface_->GetMscRateANGLE(dpy, surface, numerator, denominator);
  240. }
  241. EGLClientBuffer GL_BINDING_CALL
  242. @@ -706,8 +706,8 @@
  243. if (strcmp(name, "eglGetFrameTimestampsANDROID") == 0)
  244. return reinterpret_cast<GLFunctionPointerType>(
  245. Mock_eglGetFrameTimestampsANDROID);
  246. - if (strcmp(name, "eglGetMscRateCHROMIUM") == 0)
  247. - return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetMscRateCHROMIUM);
  248. + if (strcmp(name, "eglGetMscRateANGLE") == 0)
  249. + return reinterpret_cast<GLFunctionPointerType>(Mock_eglGetMscRateANGLE);
  250. if (strcmp(name, "eglGetNativeClientBufferANDROID") == 0)
  251. return reinterpret_cast<GLFunctionPointerType>(
  252. Mock_eglGetNativeClientBufferANDROID);
  253. diff --git a/ui/gl/egl_bindings_autogen_mock.h b/ui/gl/egl_bindings_autogen_mock.h
  254. index 06f1117..4b7eb01 100644
  255. --- a/ui/gl/egl_bindings_autogen_mock.h
  256. +++ b/ui/gl/egl_bindings_autogen_mock.h
  257. @@ -131,11 +131,10 @@
  258. EGLint numTimestamps,
  259. EGLint* timestamps,
  260. EGLnsecsANDROID* values);
  261. -static EGLBoolean GL_BINDING_CALL
  262. -Mock_eglGetMscRateCHROMIUM(EGLDisplay dpy,
  263. - EGLSurface surface,
  264. - EGLint* numerator,
  265. - EGLint* denominator);
  266. +static EGLBoolean GL_BINDING_CALL Mock_eglGetMscRateANGLE(EGLDisplay dpy,
  267. + EGLSurface surface,
  268. + EGLint* numerator,
  269. + EGLint* denominator);
  270. static EGLClientBuffer GL_BINDING_CALL Mock_eglGetNativeClientBufferANDROID(
  271. const struct AHardwareBuffer* ahardwarebuffer);
  272. static EGLBoolean GL_BINDING_CALL
  273. diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
  274. index 6a89047..01da79a 100755
  275. --- a/ui/gl/generate_bindings.py
  276. +++ b/ui/gl/generate_bindings.py
  277. @@ -2452,9 +2452,9 @@
  278. ] }],
  279. 'arguments': 'EGLDisplay dpy, EGLSurface surface, EGLint timestamp', },
  280. { 'return_type': 'EGLBoolean',
  281. - 'versions': [{ 'name': 'eglGetMscRateCHROMIUM',
  282. + 'versions': [{ 'name': 'eglGetMscRateANGLE',
  283. 'extensions': [
  284. - 'EGL_CHROMIUM_sync_control'
  285. + 'EGL_ANGLE_sync_control_rate'
  286. ] }],
  287. 'arguments':
  288. 'EGLDisplay dpy, EGLSurface surface, '
  289. diff --git a/ui/gl/gl_bindings_api_autogen_egl.h b/ui/gl/gl_bindings_api_autogen_egl.h
  290. index 8628d7c..30b0ba80 100644
  291. --- a/ui/gl/gl_bindings_api_autogen_egl.h
  292. +++ b/ui/gl/gl_bindings_api_autogen_egl.h
  293. @@ -111,10 +111,10 @@
  294. EGLBoolean eglGetFrameTimestampSupportedANDROIDFn(EGLDisplay dpy,
  295. EGLSurface surface,
  296. EGLint timestamp) override;
  297. -EGLBoolean eglGetMscRateCHROMIUMFn(EGLDisplay dpy,
  298. - EGLSurface surface,
  299. - EGLint* numerator,
  300. - EGLint* denominator) override;
  301. +EGLBoolean eglGetMscRateANGLEFn(EGLDisplay dpy,
  302. + EGLSurface surface,
  303. + EGLint* numerator,
  304. + EGLint* denominator) override;
  305. EGLClientBuffer eglGetNativeClientBufferANDROIDFn(
  306. const struct AHardwareBuffer* ahardwarebuffer) override;
  307. EGLBoolean eglGetNextFrameIdANDROIDFn(EGLDisplay dpy,
  308. diff --git a/ui/gl/gl_bindings_autogen_egl.cc b/ui/gl/gl_bindings_autogen_egl.cc
  309. index 2f1ed11..18444223 100644
  310. --- a/ui/gl/gl_bindings_autogen_egl.cc
  311. +++ b/ui/gl/gl_bindings_autogen_egl.cc
  312. @@ -187,6 +187,8 @@
  313. gfx::HasExtension(extensions, "EGL_ANGLE_stream_producer_d3d_texture");
  314. ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle = gfx::HasExtension(
  315. extensions, "EGL_ANGLE_surface_d3d_texture_2d_share_handle");
  316. + ext.b_EGL_ANGLE_sync_control_rate =
  317. + gfx::HasExtension(extensions, "EGL_ANGLE_sync_control_rate");
  318. ext.b_EGL_CHROMIUM_sync_control =
  319. gfx::HasExtension(extensions, "EGL_CHROMIUM_sync_control");
  320. ext.b_EGL_EXT_image_flush_external =
  321. @@ -278,9 +280,9 @@
  322. GetGLProcAddress("eglGetFrameTimestampSupportedANDROID"));
  323. }
  324. - if (ext.b_EGL_CHROMIUM_sync_control) {
  325. - fn.eglGetMscRateCHROMIUMFn = reinterpret_cast<eglGetMscRateCHROMIUMProc>(
  326. - GetGLProcAddress("eglGetMscRateCHROMIUM"));
  327. + if (ext.b_EGL_ANGLE_sync_control_rate) {
  328. + fn.eglGetMscRateANGLEFn = reinterpret_cast<eglGetMscRateANGLEProc>(
  329. + GetGLProcAddress("eglGetMscRateANGLE"));
  330. }
  331. if (ext.b_EGL_ANDROID_get_native_client_buffer) {
  332. @@ -602,12 +604,11 @@
  333. timestamp);
  334. }
  335. -EGLBoolean EGLApiBase::eglGetMscRateCHROMIUMFn(EGLDisplay dpy,
  336. - EGLSurface surface,
  337. - EGLint* numerator,
  338. - EGLint* denominator) {
  339. - return driver_->fn.eglGetMscRateCHROMIUMFn(dpy, surface, numerator,
  340. - denominator);
  341. +EGLBoolean EGLApiBase::eglGetMscRateANGLEFn(EGLDisplay dpy,
  342. + EGLSurface surface,
  343. + EGLint* numerator,
  344. + EGLint* denominator) {
  345. + return driver_->fn.eglGetMscRateANGLEFn(dpy, surface, numerator, denominator);
  346. }
  347. EGLClientBuffer EGLApiBase::eglGetNativeClientBufferANDROIDFn(
  348. @@ -1117,13 +1118,12 @@
  349. timestamp);
  350. }
  351. -EGLBoolean TraceEGLApi::eglGetMscRateCHROMIUMFn(EGLDisplay dpy,
  352. - EGLSurface surface,
  353. - EGLint* numerator,
  354. - EGLint* denominator) {
  355. - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceEGLAPI::eglGetMscRateCHROMIUM")
  356. - return egl_api_->eglGetMscRateCHROMIUMFn(dpy, surface, numerator,
  357. - denominator);
  358. +EGLBoolean TraceEGLApi::eglGetMscRateANGLEFn(EGLDisplay dpy,
  359. + EGLSurface surface,
  360. + EGLint* numerator,
  361. + EGLint* denominator) {
  362. + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceEGLAPI::eglGetMscRateANGLE")
  363. + return egl_api_->eglGetMscRateANGLEFn(dpy, surface, numerator, denominator);
  364. }
  365. EGLClientBuffer TraceEGLApi::eglGetNativeClientBufferANDROIDFn(
  366. @@ -1811,16 +1811,16 @@
  367. return result;
  368. }
  369. -EGLBoolean LogEGLApi::eglGetMscRateCHROMIUMFn(EGLDisplay dpy,
  370. - EGLSurface surface,
  371. - EGLint* numerator,
  372. - EGLint* denominator) {
  373. - GL_SERVICE_LOG("eglGetMscRateCHROMIUM"
  374. +EGLBoolean LogEGLApi::eglGetMscRateANGLEFn(EGLDisplay dpy,
  375. + EGLSurface surface,
  376. + EGLint* numerator,
  377. + EGLint* denominator) {
  378. + GL_SERVICE_LOG("eglGetMscRateANGLE"
  379. << "(" << dpy << ", " << surface << ", "
  380. << static_cast<const void*>(numerator) << ", "
  381. << static_cast<const void*>(denominator) << ")");
  382. EGLBoolean result =
  383. - egl_api_->eglGetMscRateCHROMIUMFn(dpy, surface, numerator, denominator);
  384. + egl_api_->eglGetMscRateANGLEFn(dpy, surface, numerator, denominator);
  385. GL_SERVICE_LOG("GL_RESULT: " << result);
  386. return result;
  387. }
  388. diff --git a/ui/gl/gl_bindings_autogen_egl.h b/ui/gl/gl_bindings_autogen_egl.h
  389. index 546e2c9..6cafd14 100644
  390. --- a/ui/gl/gl_bindings_autogen_egl.h
  391. +++ b/ui/gl/gl_bindings_autogen_egl.h
  392. @@ -141,7 +141,7 @@
  393. EGLDisplay dpy,
  394. EGLSurface surface,
  395. EGLint timestamp);
  396. -typedef EGLBoolean(GL_BINDING_CALL* eglGetMscRateCHROMIUMProc)(
  397. +typedef EGLBoolean(GL_BINDING_CALL* eglGetMscRateANGLEProc)(
  398. EGLDisplay dpy,
  399. EGLSurface surface,
  400. EGLint* numerator,
  401. @@ -296,6 +296,7 @@
  402. bool b_EGL_ANGLE_query_surface_pointer;
  403. bool b_EGL_ANGLE_stream_producer_d3d_texture;
  404. bool b_EGL_ANGLE_surface_d3d_texture_2d_share_handle;
  405. + bool b_EGL_ANGLE_sync_control_rate;
  406. bool b_EGL_CHROMIUM_sync_control;
  407. bool b_EGL_EXT_image_flush_external;
  408. bool b_EGL_KHR_fence_sync;
  409. @@ -351,7 +352,7 @@
  410. eglGetFrameTimestampsANDROIDProc eglGetFrameTimestampsANDROIDFn;
  411. eglGetFrameTimestampSupportedANDROIDProc
  412. eglGetFrameTimestampSupportedANDROIDFn;
  413. - eglGetMscRateCHROMIUMProc eglGetMscRateCHROMIUMFn;
  414. + eglGetMscRateANGLEProc eglGetMscRateANGLEFn;
  415. eglGetNativeClientBufferANDROIDProc eglGetNativeClientBufferANDROIDFn;
  416. eglGetNextFrameIdANDROIDProc eglGetNextFrameIdANDROIDFn;
  417. eglGetPlatformDisplayProc eglGetPlatformDisplayFn;
  418. @@ -512,10 +513,10 @@
  419. EGLDisplay dpy,
  420. EGLSurface surface,
  421. EGLint timestamp) = 0;
  422. - virtual EGLBoolean eglGetMscRateCHROMIUMFn(EGLDisplay dpy,
  423. - EGLSurface surface,
  424. - EGLint* numerator,
  425. - EGLint* denominator) = 0;
  426. + virtual EGLBoolean eglGetMscRateANGLEFn(EGLDisplay dpy,
  427. + EGLSurface surface,
  428. + EGLint* numerator,
  429. + EGLint* denominator) = 0;
  430. virtual EGLClientBuffer eglGetNativeClientBufferANDROIDFn(
  431. const struct AHardwareBuffer* ahardwarebuffer) = 0;
  432. virtual EGLBoolean eglGetNextFrameIdANDROIDFn(EGLDisplay dpy,
  433. @@ -685,8 +686,7 @@
  434. ::gl::g_current_egl_context->eglGetFrameTimestampsANDROIDFn
  435. #define eglGetFrameTimestampSupportedANDROID \
  436. ::gl::g_current_egl_context->eglGetFrameTimestampSupportedANDROIDFn
  437. -#define eglGetMscRateCHROMIUM \
  438. - ::gl::g_current_egl_context->eglGetMscRateCHROMIUMFn
  439. +#define eglGetMscRateANGLE ::gl::g_current_egl_context->eglGetMscRateANGLEFn
  440. #define eglGetNativeClientBufferANDROID \
  441. ::gl::g_current_egl_context->eglGetNativeClientBufferANDROIDFn
  442. #define eglGetNextFrameIdANDROID \
  443. diff --git a/ui/gl/gl_enums_implementation_autogen.h b/ui/gl/gl_enums_implementation_autogen.h
  444. index d35439c..1209923b 100644
  445. --- a/ui/gl/gl_enums_implementation_autogen.h
  446. +++ b/ui/gl/gl_enums_implementation_autogen.h
  447. @@ -829,10 +829,6 @@
  448. "GL_FILL_NV",
  449. },
  450. {
  451. - 0x1D00,
  452. - "GL_FLAT_CHROMIUM",
  453. - },
  454. - {
  455. 0x1E00,
  456. "GL_KEEP",
  457. },
  458. @@ -877,14 +873,6 @@
  459. "GL_FONT_NUM_GLYPH_INDICES_BIT_NV",
  460. },
  461. {
  462. - 0x2400,
  463. - "GL_EYE_LINEAR_CHROMIUM",
  464. - },
  465. - {
  466. - 0x2401,
  467. - "GL_OBJECT_LINEAR_CHROMIUM",
  468. - },
  469. - {
  470. 0x2600,
  471. "GL_NEAREST",
  472. },
  473. @@ -2053,10 +2041,6 @@
  474. "GL_MAX_CUBE_MAP_TEXTURE_SIZE",
  475. },
  476. {
  477. - 0x8576,
  478. - "GL_CONSTANT_CHROMIUM",
  479. - },
  480. - {
  481. 0x8589,
  482. "GL_SRC1_ALPHA_EXT",
  483. },
  484. @@ -4629,10 +4613,6 @@
  485. "GL_PATH_CLIENT_LENGTH_NV",
  486. },
  487. {
  488. - 0x907a,
  489. - "GL_PATH_MITER_LIMIT_CHROMIUM",
  490. - },
  491. - {
  492. 0x9080,
  493. "GL_PATH_FILL_MODE_NV",
  494. },
  495. @@ -4653,10 +4633,6 @@
  496. "GL_PATH_STROKE_MASK_NV",
  497. },
  498. {
  499. - 0x9086,
  500. - "GL_PATH_STROKE_BOUND_CHROMIUM",
  501. - },
  502. - {
  503. 0x9088,
  504. "GL_COUNT_UP_NV",
  505. },
  506. @@ -4965,14 +4941,6 @@
  507. "GL_CONTEXT_ROBUST_ACCESS_KHR",
  508. },
  509. {
  510. - 0x90a3,
  511. - "GL_SQUARE_CHROMIUM",
  512. - },
  513. - {
  514. - 0x90a4,
  515. - "GL_ROUND_CHROMIUM",
  516. - },
  517. - {
  518. 0x9100,
  519. "GL_TEXTURE_2D_MULTISAMPLE",
  520. },
  521. diff --git a/ui/gl/gl_mock_autogen_egl.h b/ui/gl/gl_mock_autogen_egl.h
  522. index bcdd2a3..ba2f95f 100644
  523. --- a/ui/gl/gl_mock_autogen_egl.h
  524. +++ b/ui/gl/gl_mock_autogen_egl.h
  525. @@ -121,7 +121,7 @@
  526. EGLnsecsANDROID* values));
  527. MOCK_METHOD3(GetFrameTimestampSupportedANDROID,
  528. EGLBoolean(EGLDisplay dpy, EGLSurface surface, EGLint timestamp));
  529. -MOCK_METHOD4(GetMscRateCHROMIUM,
  530. +MOCK_METHOD4(GetMscRateANGLE,
  531. EGLBoolean(EGLDisplay dpy,
  532. EGLSurface surface,
  533. EGLint* numerator,
  534. diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
  535. index 72268904..750f3ed 100644
  536. --- a/ui/gl/gl_surface_egl.cc
  537. +++ b/ui/gl/gl_surface_egl.cc
  538. @@ -174,6 +174,7 @@
  539. bool g_egl_create_context_bind_generates_resource_supported = false;
  540. bool g_egl_create_context_webgl_compatability_supported = false;
  541. bool g_egl_sync_control_supported = false;
  542. +bool g_egl_sync_control_rate_supported = false;
  543. bool g_egl_window_fixed_size_supported = false;
  544. bool g_egl_surfaceless_context_supported = false;
  545. bool g_egl_surface_orientation_supported = false;
  546. @@ -266,8 +267,12 @@
  547. }
  548. bool GetMscRate(int32_t* numerator, int32_t* denominator) override {
  549. + if (!g_egl_sync_control_rate_supported) {
  550. + return false;
  551. + }
  552. +
  553. - bool result = eglGetMscRateCHROMIUM(g_egl_display, surface_, numerator,
  554. - denominator) == EGL_TRUE;
  555. + bool result = eglGetMscRateANGLE(g_egl_display, surface_, numerator,
  556. + denominator) == EGL_TRUE;
  557. return result;
  558. }
  559. @@ -921,6 +920,8 @@
  560. g_egl_create_context_webgl_compatability_supported =
  561. HasEGLExtension("EGL_ANGLE_create_context_webgl_compatibility");
  562. g_egl_sync_control_supported = HasEGLExtension("EGL_CHROMIUM_sync_control");
  563. + g_egl_sync_control_rate_supported =
  564. + HasEGLExtension("EGL_ANGLE_sync_control_rate");
  565. g_egl_window_fixed_size_supported =
  566. HasEGLExtension("EGL_ANGLE_window_fixed_size");
  567. g_egl_surface_orientation_supported =
  568. @@ -1036,6 +1037,7 @@
  569. g_egl_create_context_bind_generates_resource_supported = false;
  570. g_egl_create_context_webgl_compatability_supported = false;
  571. g_egl_sync_control_supported = false;
  572. + g_egl_sync_control_rate_supported = false;
  573. g_egl_window_fixed_size_supported = false;
  574. g_egl_surface_orientation_supported = false;
  575. g_egl_surfaceless_context_supported = false;