Advertisement
Guest User

Untitled

a guest
Dec 11th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.53 KB | None | 0 0
  1. diff --git a/api/current.xml b/api/current.xml
  2. index d6f2e87..6d9dded 100644
  3. --- a/api/current.xml
  4. +++ b/api/current.xml
  5. @@ -749,6 +749,17 @@
  6. visibility="public"
  7. >
  8. </field>
  9. +<field name="RAW_AUDIO"
  10. + type="java.lang.String"
  11. + transient="false"
  12. + volatile="false"
  13. + value="&quot;android.permission.RAW_AUDIO&quot;"
  14. + static="true"
  15. + final="true"
  16. + deprecated="not deprecated"
  17. + visibility="public"
  18. +>
  19. +</field>
  20. <field name="READ_CALENDAR"
  21. type="java.lang.String"
  22. transient="false"
  23. @@ -24759,7 +24770,7 @@
  24. extends="java.lang.Object"
  25. abstract="false"
  26. static="false"
  27. - final="false"
  28. + final="true"
  29. deprecated="not deprecated"
  30. visibility="public"
  31. >
  32. @@ -24808,7 +24819,7 @@
  33. deprecated="not deprecated"
  34. visibility="public"
  35. >
  36. -<parameter name="name" type="java.lang.String">
  37. +<parameter name="uuid" type="java.util.UUID">
  38. </parameter>
  39. </method>
  40. <method name="getProfileGroups"
  41. @@ -24822,6 +24833,41 @@
  42. visibility="public"
  43. >
  44. </method>
  45. +<method name="getStatusBarIndicator"
  46. + return="boolean"
  47. + abstract="false"
  48. + native="false"
  49. + synchronized="false"
  50. + static="false"
  51. + final="false"
  52. + deprecated="not deprecated"
  53. + visibility="public"
  54. +>
  55. +</method>
  56. +<method name="getUuid"
  57. + return="java.util.UUID"
  58. + abstract="false"
  59. + native="false"
  60. + synchronized="false"
  61. + static="false"
  62. + final="false"
  63. + deprecated="not deprecated"
  64. + visibility="public"
  65. +>
  66. +</method>
  67. +<method name="setStatusBarIndicator"
  68. + return="void"
  69. + abstract="false"
  70. + native="false"
  71. + synchronized="false"
  72. + static="false"
  73. + final="false"
  74. + deprecated="not deprecated"
  75. + visibility="public"
  76. +>
  77. +<parameter name="newStatusBarIndicator" type="boolean">
  78. +</parameter>
  79. +</method>
  80. <method name="writeToParcel"
  81. return="void"
  82. abstract="false"
  83. @@ -24842,7 +24888,7 @@
  84. extends="java.lang.Object"
  85. abstract="false"
  86. static="false"
  87. - final="false"
  88. + final="true"
  89. deprecated="not deprecated"
  90. visibility="public"
  91. >
  92. @@ -24870,8 +24916,8 @@
  93. visibility="public"
  94. >
  95. </method>
  96. -<method name="getName"
  97. - return="java.lang.String"
  98. +<method name="getRingerMode"
  99. + return="android.app.ProfileGroup.Mode"
  100. abstract="false"
  101. native="false"
  102. synchronized="false"
  103. @@ -24881,8 +24927,8 @@
  104. visibility="public"
  105. >
  106. </method>
  107. -<method name="getRingerMode"
  108. - return="android.app.ProfileGroup.Mode"
  109. +<method name="getRingerOverride"
  110. + return="android.net.Uri"
  111. abstract="false"
  112. native="false"
  113. synchronized="false"
  114. @@ -24892,8 +24938,8 @@
  115. visibility="public"
  116. >
  117. </method>
  118. -<method name="getRingerOverride"
  119. - return="android.net.Uri"
  120. +<method name="getSoundMode"
  121. + return="android.app.ProfileGroup.Mode"
  122. abstract="false"
  123. native="false"
  124. synchronized="false"
  125. @@ -24903,8 +24949,8 @@
  126. visibility="public"
  127. >
  128. </method>
  129. -<method name="getSoundMode"
  130. - return="android.app.ProfileGroup.Mode"
  131. +<method name="getSoundOverride"
  132. + return="android.net.Uri"
  133. abstract="false"
  134. native="false"
  135. synchronized="false"
  136. @@ -24914,8 +24960,8 @@
  137. visibility="public"
  138. >
  139. </method>
  140. -<method name="getSoundOverride"
  141. - return="android.net.Uri"
  142. +<method name="getUuid"
  143. + return="java.util.UUID"
  144. abstract="false"
  145. native="false"
  146. synchronized="false"
  147. @@ -25022,12 +25068,25 @@
  148. synchronized="false"
  149. static="false"
  150. final="false"
  151. - deprecated="not deprecated"
  152. + deprecated="deprecated"
  153. visibility="public"
  154. >
  155. <parameter name="profileName" type="java.lang.String">
  156. </parameter>
  157. </method>
  158. +<method name="getProfile"
  159. + return="android.app.Profile"
  160. + abstract="false"
  161. + native="false"
  162. + synchronized="false"
  163. + static="false"
  164. + final="false"
  165. + deprecated="not deprecated"
  166. + visibility="public"
  167. +>
  168. +<parameter name="profileUuid" type="java.util.UUID">
  169. +</parameter>
  170. +</method>
  171. <method name="getProfileNames"
  172. return="java.lang.String[]"
  173. abstract="false"
  174. @@ -25050,6 +25109,32 @@
  175. visibility="public"
  176. >
  177. </method>
  178. +<method name="profileExists"
  179. + return="boolean"
  180. + abstract="false"
  181. + native="false"
  182. + synchronized="false"
  183. + static="false"
  184. + final="false"
  185. + deprecated="not deprecated"
  186. + visibility="public"
  187. +>
  188. +<parameter name="profileName" type="java.lang.String">
  189. +</parameter>
  190. +</method>
  191. +<method name="profileExists"
  192. + return="boolean"
  193. + abstract="false"
  194. + native="false"
  195. + synchronized="false"
  196. + static="false"
  197. + final="false"
  198. + deprecated="not deprecated"
  199. + visibility="public"
  200. +>
  201. +<parameter name="profileUuid" type="java.util.UUID">
  202. +</parameter>
  203. +</method>
  204. <method name="setActiveProfile"
  205. return="void"
  206. abstract="false"
  207. @@ -25057,12 +25142,25 @@
  208. synchronized="false"
  209. static="false"
  210. final="false"
  211. - deprecated="not deprecated"
  212. + deprecated="deprecated"
  213. visibility="public"
  214. >
  215. <parameter name="profileName" type="java.lang.String">
  216. </parameter>
  217. </method>
  218. +<method name="setActiveProfile"
  219. + return="void"
  220. + abstract="false"
  221. + native="false"
  222. + synchronized="false"
  223. + static="false"
  224. + final="false"
  225. + deprecated="not deprecated"
  226. + visibility="public"
  227. +>
  228. +<parameter name="profileUuid" type="java.util.UUID">
  229. +</parameter>
  230. +</method>
  231. </class>
  232. <class name="ProgressDialog"
  233. extends="android.app.AlertDialog"
  234. @@ -77381,7 +77479,7 @@
  235. type="float"
  236. transient="false"
  237. volatile="false"
  238. - value="0.001f"
  239. + value="0.0010f"
  240. static="true"
  241. final="true"
  242. deprecated="not deprecated"
  243. @@ -133143,6 +133241,50 @@
  244. </parameter>
  245. </method>
  246. </class>
  247. +<class name="MultiSelectListPreference"
  248. + extends="android.preference.ListPreference"
  249. + abstract="false"
  250. + static="false"
  251. + final="false"
  252. + deprecated="not deprecated"
  253. + visibility="public"
  254. +>
  255. +<constructor name="MultiSelectListPreference"
  256. + type="android.preference.MultiSelectListPreference"
  257. + static="false"
  258. + final="false"
  259. + deprecated="not deprecated"
  260. + visibility="public"
  261. +>
  262. +<parameter name="context" type="android.content.Context">
  263. +</parameter>
  264. +</constructor>
  265. +<constructor name="MultiSelectListPreference"
  266. + type="android.preference.MultiSelectListPreference"
  267. + static="false"
  268. + final="false"
  269. + deprecated="not deprecated"
  270. + visibility="public"
  271. +>
  272. +<parameter name="context" type="android.content.Context">
  273. +</parameter>
  274. +<parameter name="attrs" type="android.util.AttributeSet">
  275. +</parameter>
  276. +</constructor>
  277. +<method name="parseStoredValue"
  278. + return="java.lang.String[]"
  279. + abstract="false"
  280. + native="false"
  281. + synchronized="false"
  282. + static="true"
  283. + final="false"
  284. + deprecated="not deprecated"
  285. + visibility="public"
  286. +>
  287. +<parameter name="val" type="java.lang.CharSequence">
  288. +</parameter>
  289. +</method>
  290. +</class>
  291. <class name="Preference"
  292. extends="java.lang.Object"
  293. abstract="false"
  294. @@ -154288,6 +154430,17 @@
  295. visibility="public"
  296. >
  297. </method>
  298. +<method name="isDormancyRejected"
  299. + return="boolean"
  300. + abstract="false"
  301. + native="false"
  302. + synchronized="false"
  303. + static="true"
  304. + final="false"
  305. + deprecated="not deprecated"
  306. + visibility="public"
  307. +>
  308. +</method>
  309. <method name="isNetworkRoaming"
  310. return="boolean"
  311. abstract="false"
  312. @@ -154314,6 +154467,19 @@
  313. <parameter name="events" type="int">
  314. </parameter>
  315. </method>
  316. +<method name="setDormancyRejected"
  317. + return="boolean"
  318. + abstract="false"
  319. + native="false"
  320. + synchronized="false"
  321. + static="true"
  322. + final="false"
  323. + deprecated="not deprecated"
  324. + visibility="public"
  325. +>
  326. +<parameter name="rejected" type="boolean">
  327. +</parameter>
  328. +</method>
  329. <field name="ACTION_PHONE_STATE_CHANGED"
  330. type="java.lang.String"
  331. transient="false"
  332. diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
  333. index 0be26a7..0574fac 100644
  334. --- a/include/ui/GraphicBuffer.h
  335. +++ b/include/ui/GraphicBuffer.h
  336. @@ -150,6 +150,8 @@ private:
  337. GraphicBufferMapper& mBufferMapper;
  338. ssize_t mInitCheck;
  339. int mIndex;
  340. +public:
  341. + unsigned int mTexId;
  342. };
  343.  
  344. }; // namespace android
  345. diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
  346. index dffa788..ae38d90 100644
  347. --- a/include/ui/GraphicBufferAllocator.h
  348. +++ b/include/ui/GraphicBufferAllocator.h
  349. @@ -63,13 +63,16 @@ public:
  350.  
  351.  
  352. status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage,
  353. - buffer_handle_t* handle, int32_t* stride);
  354. + buffer_handle_t* handle, int32_t* stride, unsigned int* text);
  355.  
  356. status_t free(buffer_handle_t handle);
  357.  
  358. void dump(String8& res) const;
  359. static void dumpToSystemLog();
  360.  
  361. + static ogl_alloc_t ogl_alloc;
  362. + static ogl_free_t ogl_free;
  363. +
  364. private:
  365. struct alloc_rec_t {
  366. uint32_t w;
  367. diff --git a/libs/surfaceflinger_client/ISurface.cpp b/libs/surfaceflinger_client/ISurface.cpp
  368. index bdf3277..7f75d9d 100644
  369. --- a/libs/surfaceflinger_client/ISurface.cpp
  370. +++ b/libs/surfaceflinger_client/ISurface.cpp
  371. @@ -81,6 +81,7 @@ public:
  372. data.writeInt32(h);
  373. data.writeInt32(format);
  374. data.writeInt32(usage);
  375. + LOGW("Calling remote request buffer");
  376. remote()->transact(REQUEST_BUFFER, data, &reply);
  377. sp<GraphicBuffer> buffer = new GraphicBuffer();
  378. reply.read(*buffer);
  379. diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
  380. index 017e94c..e3e5951 100644
  381. --- a/libs/surfaceflinger_client/Surface.cpp
  382. +++ b/libs/surfaceflinger_client/Surface.cpp
  383. @@ -1061,6 +1061,7 @@ status_t Surface::getBufferLocked(int index,
  384. }
  385. } else {
  386. err = err<0 ? err : status_t(NO_MEMORY);
  387. + LOGE("Err: %d, handle %p", err, buffer->handle);
  388. }
  389. }
  390. return err;
  391. diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp
  392. index 6360e39..985221f 100644
  393. --- a/libs/ui/FramebufferNativeWindow.cpp
  394. +++ b/libs/ui/FramebufferNativeWindow.cpp
  395. @@ -136,14 +136,14 @@ FramebufferNativeWindow::FramebufferNativeWindow()
  396.  
  397. err = grDev->alloc(grDev,
  398. fbDev->width, fbDev->height, fbDev->format,
  399. - GRALLOC_USAGE_HW_FB, &buffers[0]->handle, &buffers[0]->stride);
  400. + GRALLOC_USAGE_HW_FB, &buffers[0]->handle, &buffers[0]->stride, NULL, NULL, NULL);
  401.  
  402. LOGE_IF(err, "fb buffer 0 allocation failed w=%d, h=%d, err=%s",
  403. fbDev->width, fbDev->height, strerror(-err));
  404.  
  405. err = grDev->alloc(grDev,
  406. fbDev->width, fbDev->height, fbDev->format,
  407. - GRALLOC_USAGE_HW_FB, &buffers[1]->handle, &buffers[1]->stride);
  408. + GRALLOC_USAGE_HW_FB, &buffers[1]->handle, &buffers[1]->stride, NULL, NULL, NULL);
  409.  
  410. LOGE_IF(err, "fb buffer 1 allocation failed w=%d, h=%d, err=%s",
  411. fbDev->width, fbDev->height, strerror(-err));
  412. @@ -363,6 +363,8 @@ int FramebufferNativeWindow::queueBuffer(ANativeWindow* window,
  413. GraphicLog& logger(GraphicLog::getInstance());
  414. logger.log(GraphicLog::SF_FB_POST_BEFORE, index);
  415.  
  416. + LOGE("post");
  417. +
  418. int res = fb->post(fb, handle);
  419.  
  420. logger.log(GraphicLog::SF_FB_POST_AFTER, index);
  421. diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
  422. index 3671954..b4074c0 100644
  423. --- a/libs/ui/GraphicBuffer.cpp
  424. +++ b/libs/ui/GraphicBuffer.cpp
  425. @@ -134,7 +134,8 @@ status_t GraphicBuffer::initSize(uint32_t w, uint32_t h, PixelFormat format,
  426. uint32_t reqUsage)
  427. {
  428. GraphicBufferAllocator& allocator = GraphicBufferAllocator::get();
  429. - status_t err = allocator.alloc(w, h, format, reqUsage, &handle, &stride);
  430. + status_t err = allocator.alloc(w, h, format, reqUsage, &handle, &stride, &mTexId);
  431. + LOGW("Called allocator: handle: 0x%08X", handle);
  432. if (err == NO_ERROR) {
  433. this->width = w;
  434. this->height = h;
  435. diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
  436. index cd802d6..8d1765c 100644
  437. --- a/libs/ui/GraphicBufferAllocator.cpp
  438. +++ b/libs/ui/GraphicBufferAllocator.cpp
  439. @@ -24,9 +24,21 @@
  440.  
  441. #include <ui/GraphicBufferAllocator.h>
  442.  
  443. +#include <GLES/gl.h>
  444. +
  445. #include <private/ui/sw_gralloc_handle.h>
  446.  
  447. namespace android {
  448. +
  449. +void* ogl_alloc_tmp(int w, int h, int format)
  450. +{
  451. + LOGE("ogl_alloc used before surfaceflinger setup callback");
  452. + return NULL;
  453. +}
  454. +
  455. +ogl_alloc_t GraphicBufferAllocator::ogl_alloc;
  456. +ogl_free_t GraphicBufferAllocator::ogl_free;
  457. +
  458. // ---------------------------------------------------------------------------
  459.  
  460. ANDROID_SINGLETON_STATIC_INSTANCE( GraphicBufferAllocator )
  461. @@ -44,6 +56,7 @@ GraphicBufferAllocator::GraphicBufferAllocator()
  462. if (err == 0) {
  463. gralloc_open(module, &mAllocDev);
  464. }
  465. +// ogl_alloc = ogl_alloc_tmp;
  466. }
  467.  
  468. GraphicBufferAllocator::~GraphicBufferAllocator()
  469. @@ -81,7 +94,7 @@ void GraphicBufferAllocator::dumpToSystemLog()
  470. }
  471.  
  472. status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
  473. - int usage, buffer_handle_t* handle, int32_t* stride)
  474. + int usage, buffer_handle_t* handle, int32_t* stride, unsigned int *text)
  475. {
  476. // make sure to not allocate a N x 0 or 0 x N buffer, since this is
  477. // allowed from an API stand-point allocate a 1x1 buffer instead.
  478. @@ -90,8 +103,16 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma
  479.  
  480. // we have a h/w allocator and h/w buffer is requested
  481. status_t err;
  482. -
  483. - err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);
  484. +
  485. + LOGW("alloc(%u, %u, %d, %08x, ...)",
  486. + w, h, format, usage);
  487. +
  488. + if (usage & GRALLOC_USAGE_HW_MASK) {
  489. + err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride, text, ogl_alloc, ogl_free);
  490. + } else {
  491. + err = sw_gralloc_handle_t::alloc(w, h, format, usage, handle, stride);
  492. + }
  493. +
  494.  
  495. LOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
  496. w, h, format, usage, err, strerror(-err));
  497. diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
  498. index b33c2a8..41177f8 100644
  499. --- a/services/audioflinger/Android.mk
  500. +++ b/services/audioflinger/Android.mk
  501. @@ -35,6 +35,7 @@ endif
  502. LOCAL_MODULE:= libaudiointerface
  503.  
  504. ifeq ($(BOARD_HAVE_BLUETOOTH),true)
  505. +khjakjsh
  506. LOCAL_SRC_FILES += A2dpAudioInterface.cpp
  507. LOCAL_SHARED_LIBRARIES += liba2dp
  508. LOCAL_CFLAGS += -DWITH_BLUETOOTH -DWITH_A2DP
  509. @@ -107,6 +108,7 @@ endif
  510. LOCAL_MODULE:= libaudioflinger
  511.  
  512. ifeq ($(BOARD_HAVE_BLUETOOTH),true)
  513. +lkjlkj
  514. LOCAL_CFLAGS += -DWITH_BLUETOOTH -DWITH_A2DP
  515. LOCAL_SHARED_LIBRARIES += liba2dp
  516. ifeq ($(BOARD_FORCE_STATIC_A2DP),true)
  517. diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
  518. index 853180d..1e6c7e6 100644
  519. --- a/services/surfaceflinger/Android.mk
  520. +++ b/services/surfaceflinger/Android.mk
  521. @@ -13,6 +13,7 @@ LOCAL_SRC_FILES:= \
  522. LayerBlur.cpp \
  523. LayerDim.cpp \
  524. MessageQueue.cpp \
  525. + OGLAlloc.cpp \
  526. SurfaceFlinger.cpp \
  527. TextureManager.cpp \
  528. Transform.cpp
  529. diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
  530. index 844cf18..8c70d2b 100644
  531. --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
  532. +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
  533. @@ -94,7 +94,11 @@ int DisplayHardware::getWidth() const { return mWidth; }
  534. int DisplayHardware::getHeight() const { return mHeight; }
  535. PixelFormat DisplayHardware::getFormat() const { return mFormat; }
  536. uint32_t DisplayHardware::getMaxTextureSize() const { return mMaxTextureSize; }
  537. -uint32_t DisplayHardware::getMaxViewportDims() const { return mMaxViewportDims; }
  538. +uint32_t DisplayHardware::getMaxViewportDims() const {
  539. + if(mMaxViewportDims[0] > mMaxViewportDims[1])
  540. + return mMaxViewportDims[0];
  541. + return mMaxViewportDims[1];
  542. +}
  543.  
  544. void DisplayHardware::init(uint32_t dpy)
  545. {
  546. @@ -235,7 +239,7 @@ void DisplayHardware::init(uint32_t dpy)
  547. eglQueryString(display, EGL_EXTENSIONS));
  548.  
  549. glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
  550. - glGetIntegerv(GL_MAX_VIEWPORT_DIMS, &mMaxViewportDims);
  551. + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims);
  552.  
  553.  
  554. #ifdef EGL_ANDROID_swap_rectangle
  555. @@ -267,7 +271,7 @@ void DisplayHardware::init(uint32_t dpy)
  556. LOGI("version : %s", extensions.getVersion());
  557. LOGI("extensions: %s", extensions.getExtension());
  558. LOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize);
  559. - LOGI("GL_MAX_VIEWPORT_DIMS = %d", mMaxViewportDims);
  560. + LOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]);
  561. LOGI("flags = %08x", mFlags);
  562.  
  563. // Unbind the context from this thread
  564. @@ -318,12 +322,12 @@ void DisplayHardware::flip(const Region& dirty) const
  565. EGLSurface surface = mSurface;
  566.  
  567. #ifdef EGL_ANDROID_swap_rectangle
  568. - if (mFlags & SWAP_RECTANGLE) {
  569. + /* if (mFlags & SWAP_RECTANGLE) {
  570. const Region newDirty(dirty.intersect(bounds()));
  571. const Rect b(newDirty.getBounds());
  572. eglSetSwapRectangleANDROID(dpy, surface,
  573. b.left, b.top, b.width(), b.height());
  574. - }
  575. + } */
  576. #endif
  577.  
  578. if (mFlags & PARTIAL_UPDATES) {
  579. @@ -332,20 +336,22 @@ void DisplayHardware::flip(const Region& dirty) const
  580.  
  581. mPageFlipCount++;
  582. eglSwapBuffers(dpy, surface);
  583. +// framebuffer_device_t *fbDev = (framebuffer_device_t *)mNativeWindow->getDevice();
  584. +// fbDev->post(fbDev, handle);
  585. // glFinish here prevents the impedence mismatch between software-rendered
  586. // surfaceflinger surfaces in another thread. Shows no perf loss with vsync on.
  587. glFinish();
  588. checkEGLErrors("eglSwapBuffers");
  589.  
  590. // for debugging
  591. - //glClearColor(1,0,0,0);
  592. - //glClear(GL_COLOR_BUFFER_BIT);
  593. +// glClearColor(1,0,0,0);
  594. +// glClear(GL_COLOR_BUFFER_BIT);
  595. }
  596.  
  597. status_t DisplayHardware::postBypassBuffer(const native_handle_t* handle) const
  598. {
  599. framebuffer_device_t *fbDev = (framebuffer_device_t *)mNativeWindow->getDevice();
  600. - return fbDev->post(fbDev, handle);
  601. + return 0;//fbDev->post(fbDev, handle);
  602. }
  603.  
  604. uint32_t DisplayHardware::getFlags() const
  605. diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.h b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
  606. index 79ef2a7..f6d2a28 100644
  607. --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.h
  608. +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.h
  609. @@ -108,7 +108,7 @@ private:
  610. PixelFormat mFormat;
  611. uint32_t mFlags;
  612. mutable uint32_t mPageFlipCount;
  613. - GLint mMaxViewportDims;
  614. + GLint mMaxViewportDims[2];
  615. GLint mMaxTextureSize;
  616.  
  617. sp<FramebufferNativeWindow> mNativeWindow;
  618. diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
  619. index e311ee5..bf33e44 100644
  620. --- a/services/surfaceflinger/Layer.cpp
  621. +++ b/services/surfaceflinger/Layer.cpp
  622. @@ -26,6 +26,7 @@
  623. #include <utils/StopWatch.h>
  624.  
  625. #include <ui/GraphicBuffer.h>
  626. +#include <ui/GraphicBufferAllocator.h>
  627. #include <ui/PixelFormat.h>
  628.  
  629. #include <surfaceflinger/Surface.h>
  630. @@ -196,26 +197,21 @@ void Layer::reloadTexture(const Region& dirty)
  631. return;
  632. }
  633.  
  634. - if (mGLExtensions.haveDirectTexture()) {
  635. - EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay());
  636. - if (mBufferManager.initEglImage(dpy, buffer) != NO_ERROR) {
  637. - // not sure what we can do here...
  638. - goto slowpath;
  639. - }
  640. - } else {
  641. -slowpath:
  642. - GGLSurface t;
  643. - if (buffer->usage & GRALLOC_USAGE_SW_READ_MASK) {
  644. + EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay());
  645. + mBufferManager.initEglImage(dpy, buffer);
  646. + GGLSurface t;
  647. + if (buffer->usage & GRALLOC_USAGE_SW_READ_MASK) {
  648. status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_OFTEN);
  649. LOGE_IF(res, "error %d (%s) locking buffer %p",
  650. res, strerror(res), buffer.get());
  651. if (res == NO_ERROR) {
  652. - mBufferManager.loadTexture(dirty, t);
  653. + // mBufferManager.loadTexture(dirty, t);
  654. + // glBindTexture(GL_TEXTURE_2D, buffer->mTexId);
  655. +
  656. buffer->unlock();
  657. }
  658. - } else {
  659. - // we can't do anything
  660. - }
  661. + }else{
  662. + LOGE("Unable to load texture");
  663. }
  664. }
  665.  
  666. @@ -229,6 +225,7 @@ void Layer::drawForSreenShot() const
  667.  
  668. void Layer::onDraw(const Region& clip) const
  669. {
  670. + LOGW("Layer Draw");
  671. Texture tex(mBufferManager.getActiveTexture());
  672. if (tex.name == -1LU) {
  673. // the texture has not been created yet, this Layer has
  674. @@ -874,6 +871,8 @@ status_t Layer::BufferManager::destroy(EGLDisplay dpy)
  675. status_t Layer::BufferManager::initEglImage(EGLDisplay dpy,
  676. const sp<GraphicBuffer>& buffer)
  677. {
  678. +
  679. + LOGE("BufferManager: initEglImage");
  680. status_t err = NO_INIT;
  681. ssize_t index = mActiveBuffer;
  682. if (index >= 0) {
  683. @@ -885,21 +884,18 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy,
  684. // that is being used in initEglImage.
  685. // (e.g. dirty flag in texture)
  686. Mutex::Autolock _l(mLock);
  687. - Image& texture(mBufferData[index].texture);
  688. - err = mTextureManager.initEglImage(&texture, dpy, buffer);
  689. + err = mTextureManager.initEglImage(&mBufferData[index].texture, dpy, buffer);
  690. }
  691. - // if EGLImage fails, we switch to regular texture mode, and we
  692. - // free all resources associated with using EGLImages.
  693. if (err == NO_ERROR) {
  694. mFailover = false;
  695. destroyTexture(&mFailoverTexture, dpy);
  696. - } else {
  697. - mFailover = true;
  698. - const size_t num = mNumBuffers;
  699. - for (size_t i=0 ; i<num ; i++) {
  700. - destroyTexture(&mBufferData[i].texture, dpy);
  701. - }
  702. - }
  703. + }else{
  704. + mFailover = true;
  705. + const size_t num = mNumBuffers;
  706. + for (size_t i=0 ; i<num ; i++) {
  707. + destroyTexture(&mBufferData[i].texture, dpy);
  708. + }
  709. + }
  710. } else {
  711. // we failed once, don't try again
  712. err = BAD_VALUE;
  713. @@ -921,7 +917,7 @@ status_t Layer::BufferManager::destroyTexture(Image* tex, EGLDisplay dpy)
  714. tex->name = -1U;
  715. }
  716. if (tex->image != EGL_NO_IMAGE_KHR) {
  717. - eglDestroyImageKHR(dpy, tex->image);
  718. +// eglDestroyImageKHR(dpy, tex->image);
  719. tex->image = EGL_NO_IMAGE_KHR;
  720. }
  721. return NO_ERROR;
  722. diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
  723. index 2c4f756..5f7e088 100644
  724. --- a/services/surfaceflinger/Layer.h
  725. +++ b/services/surfaceflinger/Layer.h
  726. @@ -157,7 +157,7 @@ private:
  727. static const size_t NUM_BUFFERS = 2;
  728. struct BufferData {
  729. sp<GraphicBuffer> buffer;
  730. - Image texture;
  731. + Texture texture;
  732. };
  733. // this lock protect mBufferData[].buffer but since there
  734. // is very little contention, we have only one like for
  735. diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
  736. index 550030a..ab8ee63 100644
  737. --- a/services/surfaceflinger/LayerBase.cpp
  738. +++ b/services/surfaceflinger/LayerBase.cpp
  739. @@ -341,8 +341,13 @@ void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red,
  740.  
  741. TextureManager::deactivateTextures();
  742.  
  743. + LOGW("clearWithOpengl");
  744. +
  745. glDisable(GL_BLEND);
  746. glDisable(GL_DITHER);
  747. +
  748. + // glClearColor(.2f,.4f,.3f,.5f);
  749. + // glClear(GL_COLOR_BUFFER_BIT);
  750.  
  751. Region::const_iterator it = clip.begin();
  752. Region::const_iterator const end = clip.end();
  753. @@ -374,6 +379,8 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  754. const DisplayHardware& hw(graphicPlane(0).displayHardware());
  755. const uint32_t fbHeight = hw.getHeight();
  756. const State& s(drawingState());
  757. +
  758. + LOGW("DrawWithOpenGL");
  759.  
  760. // bind our texture
  761. TextureManager::activateTexture(texture, needsFiltering());
  762. @@ -451,6 +458,17 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  763. glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env);
  764. }
  765.  
  766. + //TODO: this should be done a single time during texture setup. but it seems to get clobbered.
  767. + // find the smallest power-of-two that will accommodate our surface
  768. + int potWidth = 1 << (31 - clz(width));
  769. + int potHeight = 1 << (31 - clz(height));
  770. + if (potWidth < width) potWidth <<= 1;
  771. + if (potHeight < height) potHeight <<= 1;
  772. + float wScale = float(width) / potWidth;
  773. + float hScale = float(height) / potHeight;
  774. +
  775. + int NPOTAdjust = true;
  776. +
  777. /*
  778. * compute texture coordinates
  779. * here, we handle NPOT, cropping and buffer transformations
  780. @@ -459,8 +477,8 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  781. GLfloat cl, ct, cr, cb;
  782. if (!mBufferCrop.isEmpty()) {
  783. // source is cropped
  784. - const GLfloat us = (texture.NPOTAdjust ? texture.wScale : 1.0f) / width;
  785. - const GLfloat vs = (texture.NPOTAdjust ? texture.hScale : 1.0f) / height;
  786. + const GLfloat us = (NPOTAdjust ? wScale : 1.0f) / width;
  787. + const GLfloat vs = (NPOTAdjust ? hScale : 1.0f) / height;
  788. cl = mBufferCrop.left * us;
  789. ct = mBufferCrop.top * vs;
  790. cr = mBufferCrop.right * us;
  791. @@ -468,10 +486,12 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  792. } else {
  793. cl = 0;
  794. ct = 0;
  795. - cr = (texture.NPOTAdjust ? texture.wScale : 1.0f);
  796. - cb = (texture.NPOTAdjust ? texture.hScale : 1.0f);
  797. + cr = (NPOTAdjust ? wScale : 1.0f);
  798. + cb = (NPOTAdjust ? hScale : 1.0f);
  799. }
  800.  
  801. + LOGE("Drawing %d %f %f", NPOTAdjust, wScale, hScale);
  802. +
  803. /*
  804. * For the buffer transformation, we apply the rotation last.
  805. * Since we're transforming the texture-coordinates, we need
  806. @@ -532,14 +552,20 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  807. texCoords[vRT].u = cr;
  808. texCoords[vRT].v = ct;
  809.  
  810. + GLfloat colors[] = {1,0,0,.5f, 1,1,0,.5f, 1,0,1,0.5f, 1,1,1,0.5f};
  811. +
  812. if (needsDithering()) {
  813. glEnable(GL_DITHER);
  814. } else {
  815. glDisable(GL_DITHER);
  816. }
  817.  
  818. +// glDisable(GL_TEXTURE_2D);
  819. +// glShadeModel(GL_SMOOTH);
  820. glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  821. +// glEnableClientState(GL_COLOR_ARRAY);
  822. glVertexPointer(2, GL_FLOAT, 0, mVertices);
  823. +// glColorPointer(4, GL_FLOAT, 0, colors);
  824. glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
  825.  
  826. Region::const_iterator it = clip.begin();
  827. @@ -550,6 +576,7 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
  828. glScissor(r.left, sy, r.width(), r.height());
  829. glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
  830. }
  831. +// glDisableClientState(GL_COLOR_ARRAY);
  832. glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  833. }
  834.  
  835. diff --git a/services/surfaceflinger/LayerBlur.cpp b/services/surfaceflinger/LayerBlur.cpp
  836. index 9204aad..62ab983 100644
  837. --- a/services/surfaceflinger/LayerBlur.cpp
  838. +++ b/services/surfaceflinger/LayerBlur.cpp
  839. @@ -147,9 +147,9 @@ void LayerBlur::onDraw(const Region& clip) const
  840. Region::const_iterator const end = clip.end();
  841. if (it != end) {
  842. #if defined(GL_OES_EGL_image_external)
  843. - if (GLExtensions::getInstance().haveTextureExternal()) {
  844. +/* if (GLExtensions::getInstance().haveTextureExternal()) {
  845. glDisable(GL_TEXTURE_EXTERNAL_OES);
  846. - }
  847. + }*/
  848. #endif
  849. glEnable(GL_TEXTURE_2D);
  850. glBindTexture(GL_TEXTURE_2D, mTextureName);
  851. diff --git a/services/surfaceflinger/LayerBuffer.cpp b/services/surfaceflinger/LayerBuffer.cpp
  852. index 7a1404d..f771e02 100644
  853. --- a/services/surfaceflinger/LayerBuffer.cpp
  854. +++ b/services/surfaceflinger/LayerBuffer.cpp
  855. @@ -639,7 +639,7 @@ void LayerBuffer::BufferSource::clearTempBufferImage() const
  856. {
  857. // delete the image
  858. EGLDisplay dpy(getFlinger()->graphicPlane(0).getEGLDisplay());
  859. - eglDestroyImageKHR(dpy, mTexture.image);
  860. + // eglDestroyImageKHR(dpy, mTexture.image);
  861.  
  862. // and the associated texture (recreate a name)
  863. glDeleteTextures(1, &mTexture.name);
  864. diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp
  865. index de1c7e1..fcd7a69 100644
  866. --- a/services/surfaceflinger/LayerDim.cpp
  867. +++ b/services/surfaceflinger/LayerDim.cpp
  868. @@ -107,9 +107,9 @@ void LayerDim::onDraw(const Region& clip) const
  869. glColor4f(0, 0, 0, alpha);
  870.  
  871. #if defined(GL_OES_EGL_image_external)
  872. - if (GLExtensions::getInstance().haveTextureExternal()) {
  873. +/* if (GLExtensions::getInstance().haveTextureExternal()) {
  874. glDisable(GL_TEXTURE_EXTERNAL_OES);
  875. - }
  876. + } */
  877. #endif
  878. #ifdef AVOID_DRAW_TEXTURE
  879. if (!sUseTexture) {
  880. diff --git a/services/surfaceflinger/OGLAlloc.cpp b/services/surfaceflinger/OGLAlloc.cpp
  881. new file mode 100644
  882. index 0000000..7cfd808
  883. --- /dev/null
  884. +++ b/services/surfaceflinger/OGLAlloc.cpp
  885. @@ -0,0 +1,204 @@
  886. +/*
  887. + * Copyright (C) 2011 The HTC-Linux Project
  888. + *
  889. + * Licensed under the Apache License, Version 2.0 (the "License");
  890. + * you may not use this file except in compliance with the License.
  891. + * You may obtain a copy of the License at
  892. + *
  893. + * http://www.apache.org/licenses/LICENSE-2.0
  894. + *
  895. + * Unless required by applicable law or agreed to in writing, software
  896. + * distributed under the License is distributed on an "AS IS" BASIS,
  897. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  898. + * See the License for the specific language governing permissions and
  899. + * limitations under the License.
  900. + */
  901. +
  902. +#include <limits.h>
  903. +#include <unistd.h>
  904. +#include <fcntl.h>
  905. +#include <errno.h>
  906. +#include <pthread.h>
  907. +#include <stdlib.h>
  908. +#include <string.h>
  909. +
  910. +#include <sys/mman.h>
  911. +#include <sys/stat.h>
  912. +#include <sys/types.h>
  913. +#include <sys/ioctl.h>
  914. +
  915. +#include <utils/Errors.h>
  916. +#include <utils/Log.h>
  917. +#include <utils/StopWatch.h>
  918. +
  919. +#include <hardware/hardware.h>
  920. +
  921. +#include <linux/android_pmem.h>
  922. +
  923. +#include <GLES/gl.h>
  924. +
  925. +#include "OGLAlloc.h"
  926. +#include "clz.h"
  927. +
  928. +namespace android {
  929. +
  930. +// ---------------------------------------------------------------------------
  931. +
  932. +static void checkGLErrors()
  933. +{
  934. + do {
  935. + // there could be more than one error flag
  936. + GLenum error = glGetError();
  937. + if (error == GL_NO_ERROR)
  938. + break;
  939. + LOGE("GL error 0x%04x", int(error));
  940. + } while(true);
  941. +}
  942. +
  943. +static unsigned int* gpu1_base=0;
  944. +static int textures_allocated=0;
  945. +static int createGLTexture(int w, int h, int format, GLuint *text, int *stride, int *size)
  946. +{
  947. + int i, j, base;
  948. +
  949. + int bpp = 0;
  950. + GLuint components = GL_RGBA;
  951. + GLuint data_format = GL_UNSIGNED_BYTE;
  952. +
  953. + //init_texture_access();
  954. + /* if(!gpu1_base)
  955. + {
  956. + LOGE("GPU not properly initialized during memory allocation");
  957. + return -1;
  958. + }*/
  959. +
  960. + LOGE("createGLTexture: 1");
  961. +
  962. + textures_allocated++;
  963. +
  964. + switch (format) {
  965. + case HAL_PIXEL_FORMAT_RGBA_8888:
  966. + case HAL_PIXEL_FORMAT_RGBX_8888:
  967. + bpp = 4;
  968. + break;
  969. + case HAL_PIXEL_FORMAT_RGB_565:
  970. + components = GL_RGB;
  971. + data_format = GL_UNSIGNED_SHORT_5_6_5;
  972. + bpp = 2;
  973. + break;
  974. + case HAL_PIXEL_FORMAT_RGBA_4444:
  975. + data_format = GL_UNSIGNED_SHORT_4_4_4_4;
  976. + bpp = 2;
  977. + break;
  978. + default:
  979. + return -EINVAL;
  980. + }
  981. +
  982. + LOGE("createGLTexture: 2");
  983. +
  984. + *stride = w;
  985. + *size = w * h * bpp;
  986. +
  987. + LOGE("createGLTexture: 3");
  988. +
  989. + glEnable (GL_TEXTURE_2D);
  990. + checkGLErrors();
  991. + glGenTextures(1,text);
  992. + checkGLErrors();
  993. + glBindTexture(GL_TEXTURE_2D, *text);
  994. + checkGLErrors();
  995. +
  996. + unsigned int* data = (unsigned int*)malloc(w*h*bpp);
  997. + for(i=0; i < w*h*bpp/4; i++)
  998. + {
  999. + data[i] = rand();
  1000. + }
  1001. +
  1002. + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  1003. + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  1004. + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  1005. + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  1006. + checkGLErrors();
  1007. +
  1008. + glTexImage2D(GL_TEXTURE_2D, 0,
  1009. + components, w, h, 0,
  1010. + components, data_format, data);
  1011. + checkGLErrors();
  1012. +
  1013. + //We have to use the texture of the blob will not actually upload it to
  1014. + //Gpu memory
  1015. + //TODO: make sure this drawing takes place in some small corner of the display
  1016. + //or potentially out of the viewport all together.
  1017. + GLfloat vertices[] = {50,50, 75,50, 50,75, 75,75};
  1018. + GLfloat texcoords[] = {0,0, 0,1, 1,1, 1,0};
  1019. +
  1020. + glEnableClientState(GL_VERTEX_ARRAY);
  1021. + glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  1022. +
  1023. + glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
  1024. + glVertexPointer(2, GL_FLOAT, 0, vertices);
  1025. + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  1026. +
  1027. + //TODO: make sure this was really disabled when we started
  1028. + //also check that VERTEX_ARRAY was already on
  1029. + glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  1030. +
  1031. + glFinish();
  1032. + checkGLErrors();
  1033. +
  1034. + //TODO: get gpu1 size from somewhere
  1035. + //Lets find it
  1036. + base=0;
  1037. + for(i=0x2F0000/4; i < (13*1024*1024-w*h*bpp)/4; i++)
  1038. + {
  1039. + base=i;
  1040. + for(j=0; j < w*h*bpp/4; j++)
  1041. + {
  1042. + if(gpu1_base[i+j] != data[j])
  1043. + {
  1044. + if(textures_allocated==1)
  1045. + LOGE("Got 0x%8.8X Expected 0x%8.8X at 0x%8.8X", gpu1_base[i+j], data[j], i);
  1046. + base=0;
  1047. + break;
  1048. + }
  1049. + }
  1050. + if(base||textures_allocated==1)
  1051. + break;
  1052. + }
  1053. +
  1054. + if(base)
  1055. + LOGW("Located texture at 0x%8.8X", base*4);
  1056. + else
  1057. + LOGE("Failed to locate texture");
  1058. +
  1059. + free(data);
  1060. + return base*4;
  1061. +}
  1062. +
  1063. +
  1064. +void* OGLAlloc::Alloc(int w, int h, int format, GLuint *text, int* stride, int* size, void* base)
  1065. +{
  1066. + gpu1_base = (unsigned int*)base;
  1067. + //TODO: check if we can reuse part of an already allocated texture
  1068. +
  1069. + // find the smallest power-of-two that will accommodate our surface
  1070. + int potWidth = 1 << (31 - clz(w));
  1071. + int potHeight = 1 << (31 - clz(h));
  1072. + if (potWidth < w) potWidth <<= 1;
  1073. + if (potHeight < h) potHeight <<= 1;
  1074. +
  1075. + int loc = createGLTexture(potWidth,potHeight,format,text,stride,size);
  1076. + // glDeleteTextures(1,text);
  1077. +
  1078. + return (void*)loc;
  1079. +}
  1080. +
  1081. +void OGLAlloc::Free(GLuint text)
  1082. +{
  1083. + glDeleteTextures(1,&text);
  1084. +}
  1085. +
  1086. +// ---------------------------------------------------------------------------
  1087. +
  1088. +}; // namespace android
  1089. +
  1090. diff --git a/services/surfaceflinger/OGLAlloc.h b/services/surfaceflinger/OGLAlloc.h
  1091. new file mode 100644
  1092. index 0000000..e987a59
  1093. --- /dev/null
  1094. +++ b/services/surfaceflinger/OGLAlloc.h
  1095. @@ -0,0 +1,34 @@
  1096. +/*
  1097. + * Copyright (C) 2011 The HTC-Linux Project
  1098. + *
  1099. + * Licensed under the Apache License, Version 2.0 (the "License");
  1100. + * you may not use this file except in compliance with the License.
  1101. + * You may obtain a copy of the License at
  1102. + *
  1103. + * http://www.apache.org/licenses/LICENSE-2.0
  1104. + *
  1105. + * Unless required by applicable law or agreed to in writing, software
  1106. + * distributed under the License is distributed on an "AS IS" BASIS,
  1107. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1108. + * See the License for the specific language governing permissions and
  1109. + * limitations under the License.
  1110. + */
  1111. +
  1112. +#ifndef ANDROID_OGLALLOC_H
  1113. +#define ANDROID_OGLALLOC_H
  1114. +
  1115. +namespace android {
  1116. +
  1117. +// ---------------------------------------------------------------------------
  1118. +
  1119. +class OGLAlloc {
  1120. +public:
  1121. + static void* Alloc(int w, int h, int format, GLuint *text, int* stride, int* size, void* base);
  1122. + static void Free(GLuint text);
  1123. +};
  1124. +
  1125. +// ---------------------------------------------------------------------------
  1126. +
  1127. +}; // namespace android
  1128. +
  1129. +#endif //ANDROID_OGLALLOC_H
  1130. diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
  1131. index b8a59c1..3a4ca40 100644
  1132. --- a/services/surfaceflinger/SurfaceFlinger.cpp
  1133. +++ b/services/surfaceflinger/SurfaceFlinger.cpp
  1134. @@ -51,6 +51,7 @@
  1135. #include "LayerBuffer.h"
  1136. #include "LayerDim.h"
  1137. #include "SurfaceFlinger.h"
  1138. +#include "OGLAlloc.h"
  1139.  
  1140. #include "DisplayHardware/DisplayHardware.h"
  1141.  
  1142. @@ -74,6 +75,87 @@ extern "C" void NvDispMgrAutoOrientation(int rotation);
  1143. namespace android {
  1144. // ---------------------------------------------------------------------------
  1145.  
  1146. + SurfaceFlinger *theFlinger;
  1147. + pid_t drawing_thread;
  1148. +
  1149. + class MessageOglAlloc : public MessageBase {
  1150. + public:
  1151. + status_t result;
  1152. + int w, h, format, stride, size;
  1153. + GLuint text;
  1154. + void* base;
  1155. + MessageOglAlloc(int w, int h, int format, void* base)
  1156. + : w(w), h(h), format(format), base(base) {
  1157. + }
  1158. + status_t getResult() const {
  1159. + return result;
  1160. + }
  1161. + virtual bool handler() {
  1162. + LOGE("Running ogl_alloc from surfaceflinger main thread");
  1163. + base = OGLAlloc::Alloc(w,h,format,&text,&stride,&size,base);
  1164. +// Mutex::Autolock _l(flinger->mStateLock);
  1165. +// result = flinger->turnElectronBeamOffImplLocked(mode);
  1166. + return true;
  1167. + }
  1168. + };
  1169. +
  1170. + class MessageOglFree : public MessageBase {
  1171. + public:
  1172. + status_t result;
  1173. + GLuint text;
  1174. + MessageOglFree(unsigned int text_i)
  1175. + {
  1176. + text = text_i;
  1177. + }
  1178. + status_t getResult() const {
  1179. + return result;
  1180. + }
  1181. + virtual bool handler() {
  1182. + LOGE("Running ogl_free from surfaceflinger main thread");
  1183. + OGLAlloc::Free(text);
  1184. +// Mutex::Autolock _l(flinger->mStateLock);
  1185. +// result = flinger->turnElectronBeamOffImplLocked(mode);
  1186. + return true;
  1187. + }
  1188. + };
  1189. +
  1190. +void *ogl_alloc(int w, int h, int format, GLuint *text, int *stride, int *size, void* base)
  1191. +{
  1192. + int res;
  1193. +
  1194. + LOGE("Running ogl_alloc from libsurfaceflinger");
  1195. + sp<MessageOglAlloc> msg = new MessageOglAlloc(w,h,format,base);
  1196. +
  1197. + if(drawing_thread == gettid())
  1198. + {
  1199. + LOGE("ogl_alloc called from drawing thread");
  1200. + res = msg->handler();
  1201. + } else
  1202. + res = theFlinger->postMessageSync(msg, 0,0);
  1203. + LOGE("ogl_alloc: 1");
  1204. + *text = msg->text;
  1205. + *stride = msg->stride;
  1206. + *size = msg->size;
  1207. + LOGE("ogl_alloc: 2");
  1208. + return msg->base;
  1209. +}
  1210. +
  1211. +void ogl_free(unsigned int text)
  1212. +{
  1213. + LOGE("Running ogl_free from libsurfaceflinger");
  1214. +
  1215. + sp<MessageOglFree> msg = new MessageOglFree(text);
  1216. + int res;
  1217. + if(drawing_thread == gettid())
  1218. + {
  1219. + LOGE("ogl_free called from drawing thread");
  1220. + res = msg->handler();
  1221. + } else
  1222. + res = theFlinger->postMessageSync(msg, 0,0);
  1223. +
  1224. + LOGE("ogl_free complete");
  1225. +}
  1226. +
  1227. SurfaceFlinger::SurfaceFlinger()
  1228. : BnSurfaceComposer(), Thread(false),
  1229. mTransactionFlags(0),
  1230. @@ -108,6 +190,7 @@ SurfaceFlinger::SurfaceFlinger()
  1231. mUse16bppAlpha(false)
  1232. {
  1233. init();
  1234. + theFlinger = this;
  1235. }
  1236.  
  1237. void SurfaceFlinger::init()
  1238. @@ -137,6 +220,9 @@ void SurfaceFlinger::init()
  1239. property_get("debug.sf.render_color_blue", value, "824");
  1240. mRenderColorB = atoi(value);
  1241.  
  1242. + GraphicBufferAllocator::ogl_alloc = ogl_alloc;
  1243. + GraphicBufferAllocator::ogl_free = ogl_free;
  1244. +
  1245. // perf setting for the dynamic 16bpp alpha mode
  1246. property_get("persist.sys.use_16bpp_alpha", value, "0");
  1247. mUse16bppAlpha = atoi(value) == 1;
  1248. @@ -390,6 +476,8 @@ status_t SurfaceFlinger::postMessageSync(const sp<MessageBase>& msg,
  1249.  
  1250. bool SurfaceFlinger::threadLoop()
  1251. {
  1252. + drawing_thread = gettid();
  1253. +
  1254. waitForEvent();
  1255.  
  1256. // call Layer's destructor
  1257. @@ -884,7 +972,7 @@ void SurfaceFlinger::handleRepaint()
  1258. glMatrixMode(GL_MODELVIEW);
  1259. glLoadIdentity();
  1260.  
  1261. - uint32_t flags = hw.getFlags();
  1262. + /* uint32_t flags = hw.getFlags();
  1263. if ((flags & DisplayHardware::SWAP_RECTANGLE) ||
  1264. (flags & DisplayHardware::BUFFER_PRESERVED))
  1265. {
  1266. @@ -906,14 +994,14 @@ void SurfaceFlinger::handleRepaint()
  1267. // We need to redraw the rectangle that will be updated
  1268. // (pushed to the framebuffer).
  1269. // This is needed because PARTIAL_UPDATES only takes one
  1270. - // rectangle instead of a region (see DisplayHardware::flip())
  1271. + // rectangle instead of a region (see DisplayHardware::flip()) */
  1272. mDirtyRegion.set(mInvalidRegion.bounds());
  1273. - } else {
  1274. +/* } else {
  1275. // we need to redraw everything (the whole screen)
  1276. mDirtyRegion.set(hw.bounds());
  1277. mInvalidRegion = mDirtyRegion;
  1278. }
  1279. - }
  1280. + }*/
  1281.  
  1282. // compose all surfaces
  1283. composeSurfaces(mDirtyRegion);
  1284. @@ -1024,9 +1112,9 @@ void SurfaceFlinger::drawWormhole() const
  1285. glTexCoordPointer(2, GL_SHORT, 0, tcoords);
  1286. glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  1287. #if defined(GL_OES_EGL_image_external)
  1288. - if (GLExtensions::getInstance().haveTextureExternal()) {
  1289. + /* if (GLExtensions::getInstance().haveTextureExternal()) {
  1290. glDisable(GL_TEXTURE_EXTERNAL_OES);
  1291. - }
  1292. + }*/
  1293. #endif
  1294. glEnable(GL_TEXTURE_2D);
  1295. glBindTexture(GL_TEXTURE_2D, mWormholeTexName);
  1296. @@ -1309,20 +1397,11 @@ sp<Layer> SurfaceFlinger::createNormalSurface(
  1297. switch (format) { // TODO: take h/w into account
  1298. case PIXEL_FORMAT_TRANSPARENT:
  1299. case PIXEL_FORMAT_TRANSLUCENT:
  1300. - format = PIXEL_FORMAT_RGBA_8888;
  1301. + format = PIXEL_FORMAT_RGBA_4444;
  1302. break;
  1303. case PIXEL_FORMAT_OPAQUE:
  1304.  
  1305. - if (mUse16bppAlpha) {
  1306. - format = PIXEL_FORMAT_RGB_565;
  1307. - //LOGD("Using 16bpp alpha PIXEL_FORMAT_RGB_565 (window %d x %d)", w, h);
  1308. - } else {
  1309. -#ifndef NO_RGBX_8888
  1310. - format = PIXEL_FORMAT_RGBX_8888;
  1311. -#else
  1312. - format = PIXEL_FORMAT_RGBA_8888;
  1313. -#endif
  1314. - }
  1315. + format = PIXEL_FORMAT_RGB_565;
  1316. break;
  1317. }
  1318.  
  1319. @@ -1675,9 +1754,9 @@ status_t SurfaceFlinger::onTransact(
  1320. status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,
  1321. GLuint* textureName, GLfloat* uOut, GLfloat* vOut)
  1322. {
  1323. - if (!GLExtensions::getInstance().haveFramebufferObject())
  1324. + // if (!GLExtensions::getInstance().haveFramebufferObject())
  1325. return INVALID_OPERATION;
  1326. -
  1327. +/*
  1328. // get screen geometry
  1329. const DisplayHardware& hw(graphicPlane(dpy).displayHardware());
  1330. const uint32_t hw_w = hw.getWidth();
  1331. @@ -1726,7 +1805,7 @@ status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,
  1332. *textureName = tname;
  1333. *uOut = u;
  1334. *vOut = v;
  1335. - return NO_ERROR;
  1336. + return NO_ERROR; */
  1337. }
  1338.  
  1339. // ---------------------------------------------------------------------------
  1340. @@ -1740,12 +1819,12 @@ status_t SurfaceFlinger::electronBeamOffAnimationImplLocked()
  1341. status_t result = PERMISSION_DENIED;
  1342.  
  1343. #ifndef HAS_LIMITED_EGL
  1344. - if (!GLExtensions::getInstance().haveFramebufferObject())
  1345. + // if (!GLExtensions::getInstance().haveFramebufferObject())
  1346. return INVALID_OPERATION;
  1347. #endif
  1348.  
  1349. // get screen geometry
  1350. - const DisplayHardware& hw(graphicPlane(0).displayHardware());
  1351. + /* const DisplayHardware& hw(graphicPlane(0).displayHardware());
  1352. const uint32_t hw_w = hw.getWidth();
  1353. const uint32_t hw_h = hw.getHeight();
  1354. const Region screenBounds(hw.bounds());
  1355. @@ -1876,20 +1955,20 @@ status_t SurfaceFlinger::electronBeamOffAnimationImplLocked()
  1356. glColorMask(1,1,1,1);
  1357. glEnable(GL_SCISSOR_TEST);
  1358. glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  1359. - glDeleteTextures(1, &tname);
  1360. - return NO_ERROR;
  1361. + glDeleteTextures(1, &tname);
  1362. + return NO_ERROR; */
  1363. }
  1364.  
  1365. status_t SurfaceFlinger::electronBeamOnAnimationImplLocked()
  1366. {
  1367. status_t result = PERMISSION_DENIED;
  1368.  
  1369. -#ifndef HAS_LIMITED_EGL
  1370. - if (!GLExtensions::getInstance().haveFramebufferObject())
  1371. +//#ifndef HAS_LIMITED_EGL
  1372. +// if (!GLExtensions::getInstance().haveFramebufferObject())
  1373. return INVALID_OPERATION;
  1374. -#endif
  1375. +//#endif
  1376.  
  1377. - // get screen geometry
  1378. +/* // get screen geometry
  1379. const DisplayHardware& hw(graphicPlane(0).displayHardware());
  1380. const uint32_t hw_w = hw.getWidth();
  1381. const uint32_t hw_h = hw.getHeight();
  1382. @@ -2021,9 +2100,9 @@ status_t SurfaceFlinger::electronBeamOnAnimationImplLocked()
  1383. glColorMask(1,1,1,1);
  1384. glEnable(GL_SCISSOR_TEST);
  1385. glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  1386. - glDeleteTextures(1, &tname);
  1387. + glDeleteTextures(1, &tname); */
  1388.  
  1389. - return NO_ERROR;
  1390. + return NO_ERROR;
  1391. }
  1392.  
  1393. // ---------------------------------------------------------------------------
  1394. @@ -2145,10 +2224,10 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
  1395. if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT))
  1396. return BAD_VALUE;
  1397.  
  1398. - if (!GLExtensions::getInstance().haveFramebufferObject())
  1399. +// if (!GLExtensions::getInstance().haveFramebufferObject())
  1400. return INVALID_OPERATION;
  1401.  
  1402. - // get screen geometry
  1403. + /* // get screen geometry
  1404. const DisplayHardware& hw(graphicPlane(dpy).displayHardware());
  1405. const uint32_t hw_w = hw.getWidth();
  1406. const uint32_t hw_h = hw.getHeight();
  1407. @@ -2241,7 +2320,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
  1408.  
  1409. hw.compositionComplete();
  1410.  
  1411. - return result;
  1412. + return result;*/
  1413. }
  1414.  
  1415.  
  1416. diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
  1417. index afa9a21..b51db1d 100644
  1418. --- a/services/surfaceflinger/SurfaceFlinger.h
  1419. +++ b/services/surfaceflinger/SurfaceFlinger.h
  1420. @@ -307,6 +307,9 @@ private:
  1421. void waitForEvent();
  1422. public: // hack to work around gcc 4.0.3 bug
  1423. void signalEvent();
  1424. +
  1425. + status_t postMessageSync(const sp<MessageBase>& msg,
  1426. + nsecs_t reltime=0, uint32_t flags = 0);
  1427. private:
  1428. void handleConsoleEvents();
  1429. void handleTransaction(uint32_t transactionFlags);
  1430. @@ -369,16 +372,12 @@ private:
  1431. void debugShowFPS() const;
  1432. void drawWormhole() const;
  1433.  
  1434. -
  1435. mutable MessageQueue mEventQueue;
  1436.  
  1437. status_t postMessageAsync(const sp<MessageBase>& msg,
  1438. nsecs_t reltime=0, uint32_t flags = 0);
  1439.  
  1440. - status_t postMessageSync(const sp<MessageBase>& msg,
  1441. - nsecs_t reltime=0, uint32_t flags = 0);
  1442. -
  1443. - // access must be protected by mStateLock
  1444. + // access must be protected by mStateLock
  1445. mutable Mutex mStateLock;
  1446. State mCurrentState;
  1447. State mDrawingState;
  1448. diff --git a/services/surfaceflinger/TextureManager.cpp b/services/surfaceflinger/TextureManager.cpp
  1449. index 9e24f90..45e2f94 100644
  1450. --- a/services/surfaceflinger/TextureManager.cpp
  1451. +++ b/services/surfaceflinger/TextureManager.cpp
  1452. @@ -33,6 +33,12 @@
  1453. #include "GLExtensions.h"
  1454. #include "TextureManager.h"
  1455.  
  1456. +extern "C"
  1457. +{
  1458. +#include <fcntl.h>
  1459. +#include <linux/android_pmem.h>
  1460. +#include <sys/mman.h>
  1461. +}
  1462. namespace android {
  1463.  
  1464. // ---------------------------------------------------------------------------
  1465. @@ -44,10 +50,10 @@ TextureManager::TextureManager()
  1466.  
  1467. GLenum TextureManager::getTextureTarget(const Image* image) {
  1468. #if defined(GL_OES_EGL_image_external)
  1469. - switch (image->target) {
  1470. +/* switch (image->target) {
  1471. case Texture::TEXTURE_EXTERNAL:
  1472. return GL_TEXTURE_EXTERNAL_OES;
  1473. - }
  1474. + }*/
  1475. #endif
  1476. return GL_TEXTURE_2D;
  1477. }
  1478. @@ -57,6 +63,8 @@ status_t TextureManager::initTexture(Texture* texture)
  1479. if (texture->name != -1UL)
  1480. return INVALID_OPERATION;
  1481.  
  1482. + LOGE("Unsupported initTexture");
  1483. +
  1484. GLuint textureName = -1;
  1485. glGenTextures(1, &textureName);
  1486. texture->name = textureName;
  1487. @@ -75,6 +83,8 @@ status_t TextureManager::initTexture(Texture* texture)
  1488.  
  1489. status_t TextureManager::initTexture(Image* pImage, int32_t format)
  1490. {
  1491. + LOGE("init texture");
  1492. +
  1493. if (pImage->name != -1UL)
  1494. return INVALID_OPERATION;
  1495.  
  1496. @@ -84,14 +94,16 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format)
  1497. pImage->width = 0;
  1498. pImage->height = 0;
  1499.  
  1500. + LOGE("TextureName after init %d", textureName);
  1501. +
  1502. GLenum target = GL_TEXTURE_2D;
  1503. #if defined(GL_OES_EGL_image_external)
  1504. - if (GLExtensions::getInstance().haveTextureExternal()) {
  1505. +/* if (GLExtensions::getInstance().haveTextureExternal()) {
  1506. if (format && isYuvFormat(format)) {
  1507. target = GL_TEXTURE_EXTERNAL_OES;
  1508. pImage->target = Texture::TEXTURE_EXTERNAL;
  1509. }
  1510. - }
  1511. + }*/
  1512. #endif
  1513.  
  1514. glBindTexture(target, textureName);
  1515. @@ -131,37 +143,36 @@ bool TextureManager::isYuvFormat(int format)
  1516. return false;
  1517. }
  1518.  
  1519. -status_t TextureManager::initEglImage(Image* pImage,
  1520. +status_t TextureManager::initEglImage(Texture* pImage,
  1521. EGLDisplay dpy, const sp<GraphicBuffer>& buffer)
  1522. {
  1523. status_t err = NO_ERROR;
  1524. +
  1525. + LOGE("initEglImage");
  1526. +
  1527. if (!pImage->dirty) return err;
  1528.  
  1529. + LOGE("initEglImage dirty");
  1530. +
  1531. // free the previous image
  1532. - if (pImage->image != EGL_NO_IMAGE_KHR) {
  1533. - eglDestroyImageKHR(dpy, pImage->image);
  1534. - pImage->image = EGL_NO_IMAGE_KHR;
  1535. + if (pImage->image != NULL) {
  1536. + //TODO: destory the tex somhow. glDeleteTexture probably does it
  1537. +// eglDestroyImageKHR(dpy, pImage->image);
  1538. + pImage->image = NULL;
  1539. }
  1540.  
  1541. // construct an EGL_NATIVE_BUFFER_ANDROID
  1542. android_native_buffer_t* clientBuf = buffer->getNativeBuffer();
  1543.  
  1544. - // create the new EGLImageKHR
  1545. - const EGLint attrs[] = {
  1546. - EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
  1547. - EGL_NONE, EGL_NONE
  1548. - };
  1549. - pImage->image = eglCreateImageKHR(
  1550. - dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
  1551. - (EGLClientBuffer)clientBuf, attrs);
  1552. -
  1553. - if (pImage->image != EGL_NO_IMAGE_KHR) {
  1554. - if (pImage->name == -1UL) {
  1555. - initTexture(pImage, buffer->format);
  1556. - }
  1557. + pImage->image = (void*)buffer->mTexId;
  1558. + //TODO: do glTexImage2d
  1559. +
  1560. + if (pImage->image != NULL) {
  1561. + //TODO: go glTexSubImage
  1562. + pImage->name = buffer->mTexId;
  1563. const GLenum target = getTextureTarget(pImage);
  1564. glBindTexture(target, pImage->name);
  1565. - glEGLImageTargetTexture2DOES(target, (GLeglImageOES)pImage->image);
  1566. + // glEGLImageTargetTexture2DOES(target, (GLeglImageOES)pImage->image); */
  1567. GLint error = glGetError();
  1568. if (error != GL_NO_ERROR) {
  1569. LOGE("glEGLImageTargetTexture2DOES(%p) failed err=0x%04x",
  1570. @@ -172,6 +183,18 @@ status_t TextureManager::initEglImage(Image* pImage,
  1571. pImage->dirty = false;
  1572. pImage->width = clientBuf->width;
  1573. pImage->height = clientBuf->height;
  1574. +
  1575. + // find the smallest power-of-two that will accommodate our surface
  1576. + int potWidth = 1 << (31 - clz(pImage->width));
  1577. + int potHeight = 1 << (31 - clz(pImage->height));
  1578. + if (potWidth < pImage->width) potWidth <<= 1;
  1579. + if (potHeight < pImage->height) potHeight <<= 1;
  1580. + pImage->wScale = float(pImage->width) / potWidth;
  1581. + pImage->hScale = float(pImage->height) / potHeight;
  1582. +
  1583. + pImage->NPOTAdjust = true;
  1584. +
  1585. + LOGW("Scale factors: %f, %f", pImage->wScale, pImage->hScale);
  1586. }
  1587. } else {
  1588. LOGE("eglCreateImageKHR() failed. err=0x%4x", eglGetError());
  1589. @@ -212,7 +235,7 @@ status_t TextureManager::loadTexture(Texture* texture,
  1590.  
  1591. int unpack = __builtin_ctz(t.stride * bytesPerPixel(t.format));
  1592. unpack = 1 << ((unpack > 3) ? 3 : unpack);
  1593. - glPixelStorei(GL_UNPACK_ALIGNMENT, unpack);
  1594. + glPixelStorei(GL_UNPACK_ALIGNMENT, unpack);
  1595.  
  1596. /*
  1597. * round to POT if needed
  1598. @@ -234,7 +257,7 @@ status_t TextureManager::loadTexture(Texture* texture,
  1599. texture->potHeight = t.height;
  1600. }
  1601.  
  1602. - Rect bounds(dirty.bounds());
  1603. +/* Rect bounds(dirty.bounds());
  1604. GLvoid* data = 0;
  1605. if (texture->width != t.width || texture->height != t.height) {
  1606. texture->width = t.width;
  1607. @@ -273,18 +296,22 @@ status_t TextureManager::loadTexture(Texture* texture,
  1608. }
  1609. }
  1610. if (!data) {
  1611. + //To determine the effect of texture copy speed: bounds.bottom -= (bounds.bottom - bounds.top)/2;
  1612. if (t.format == HAL_PIXEL_FORMAT_RGB_565) {
  1613. + LOGW("565 texture update");
  1614. glTexSubImage2D(GL_TEXTURE_2D, 0,
  1615. 0, bounds.top, t.width, bounds.height(),
  1616. GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
  1617. t.data + bounds.top*t.stride*2);
  1618. } else if (t.format == HAL_PIXEL_FORMAT_RGBA_4444) {
  1619. + LOGW("4444 texture update");
  1620. glTexSubImage2D(GL_TEXTURE_2D, 0,
  1621. 0, bounds.top, t.width, bounds.height(),
  1622. GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4,
  1623. t.data + bounds.top*t.stride*2);
  1624. } else if (t.format == HAL_PIXEL_FORMAT_RGBA_8888 ||
  1625. t.format == HAL_PIXEL_FORMAT_RGBX_8888) {
  1626. + LOGW("8888 texture update");
  1627. glTexSubImage2D(GL_TEXTURE_2D, 0,
  1628. 0, bounds.top, t.width, bounds.height(),
  1629. GL_RGBA, GL_UNSIGNED_BYTE,
  1630. @@ -296,7 +323,7 @@ status_t TextureManager::loadTexture(Texture* texture,
  1631. GL_LUMINANCE, GL_UNSIGNED_BYTE,
  1632. t.data + bounds.top*t.stride);
  1633. }
  1634. - }
  1635. + } */
  1636. return NO_ERROR;
  1637. }
  1638.  
  1639. @@ -307,13 +334,13 @@ void TextureManager::activateTexture(const Texture& texture, bool filter)
  1640. glBindTexture(GL_TEXTURE_2D, texture.name);
  1641. glEnable(GL_TEXTURE_2D);
  1642. #if defined(GL_OES_EGL_image_external)
  1643. - if (GLExtensions::getInstance().haveTextureExternal()) {
  1644. +/* if (GLExtensions::getInstance().haveTextureExternal()) {
  1645. glDisable(GL_TEXTURE_EXTERNAL_OES);
  1646. }
  1647. } else {
  1648. glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture.name);
  1649. glEnable(GL_TEXTURE_EXTERNAL_OES);
  1650. - glDisable(GL_TEXTURE_2D);
  1651. + glDisable(GL_TEXTURE_2D); */
  1652. #endif
  1653. }
  1654.  
  1655. @@ -330,9 +357,9 @@ void TextureManager::deactivateTextures()
  1656. {
  1657. glDisable(GL_TEXTURE_2D);
  1658. #if defined(GL_OES_EGL_image_external)
  1659. - if (GLExtensions::getInstance().haveTextureExternal()) {
  1660. +/* if (GLExtensions::getInstance().haveTextureExternal()) {
  1661. glDisable(GL_TEXTURE_EXTERNAL_OES);
  1662. - }
  1663. + }*/
  1664. #endif
  1665. }
  1666.  
  1667. diff --git a/services/surfaceflinger/TextureManager.h b/services/surfaceflinger/TextureManager.h
  1668. index 18c4348..238be2f 100644
  1669. --- a/services/surfaceflinger/TextureManager.h
  1670. +++ b/services/surfaceflinger/TextureManager.h
  1671. @@ -39,7 +39,7 @@ class GraphicBuffer;
  1672.  
  1673. struct Image {
  1674. enum { TEXTURE_2D=0, TEXTURE_EXTERNAL=1 };
  1675. - Image() : name(-1U), image(EGL_NO_IMAGE_KHR), width(0), height(0),
  1676. + Image() : name(-1U), image(NULL), width(0), height(0),
  1677. dirty(1), target(TEXTURE_2D) { }
  1678. GLuint name;
  1679. EGLImageKHR image;
  1680. @@ -76,7 +76,7 @@ public:
  1681. const Region& dirty, const GGLSurface& t);
  1682.  
  1683. // make active buffer an EGLImage if needed
  1684. - status_t initEglImage(Image* texture,
  1685. + status_t initEglImage(Texture* texture,
  1686. EGLDisplay dpy, const sp<GraphicBuffer>& buffer);
  1687.  
  1688. // activate a texture
  1689. diff --git a/tests/LargeAssetTest/assets/million-ints b/tests/LargeAssetTest/assets/million-ints
  1690. index 0607de1..ea7f904 100644
  1691. Binary files a/tests/LargeAssetTest/assets/million-ints and b/tests/LargeAssetTest/assets/million-ints differ
  1692.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement