Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libhardware: Commit

hardware/libhardware


Commit MetaInfo

Revisióne5818bab949cba422e54fac1753826a4237ca11f (tree)
Tiempo2010-04-16 19:36:19
AutorYi Sun <beyounn@gmai...>
Commiter黃志偉

Log Message

fixed one deadlock in init_pmem_area

Also add a hack to make the gralloc to use ashmem.

Cambiar Resumen

Diferencia incremental

--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -134,7 +134,12 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev,
134134 // If we have only one buffer, we never use page-flipping. Instead,
135135 // we return a regular buffer which will be memcpy'ed to the main
136136 // screen when post is called.
137- int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
137+ /*
138+ * Yi added:
139+ * This is only a hack to make the alloc_buffer function to use
140+ * ashmem,since pmem is not available for now
141+ */
142+ int newUsage = (usage & ~GRALLOC_USAGE_HW_FB);// | GRALLOC_USAGE_HW_2D;
138143 return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle);
139144 }
140145
@@ -168,11 +173,8 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev,
168173 static int gralloc_alloc_framebuffer(alloc_device_t* dev,
169174 size_t size, int usage, buffer_handle_t* pHandle)
170175 {
171- private_module_t* m = reinterpret_cast<private_module_t*>(
172- dev->common.module);
173- pthread_mutex_lock(&m->lock);
176+
174177 int err = gralloc_alloc_framebuffer_locked(dev, size, usage, pHandle);
175- pthread_mutex_unlock(&m->lock);
176178 return err;
177179 }
178180
@@ -214,7 +216,6 @@ static int init_pmem_area_locked(private_module_t* m)
214216
215217 static int init_pmem_area(private_module_t* m)
216218 {
217- pthread_mutex_lock(&m->lock);
218219 int err = m->pmem_master;
219220 if (err == -1) {
220221 // first time, try to initialize pmem
@@ -228,7 +229,6 @@ static int init_pmem_area(private_module_t* m)
228229 // pmem OK
229230 err = 0;
230231 }
231- pthread_mutex_unlock(&m->lock);
232232 return err;
233233 }
234234
@@ -390,12 +390,15 @@ static int gralloc_alloc(alloc_device_t* dev,
390390 }
391391
392392 int err;
393+ private_module_t* m = reinterpret_cast<private_module_t*>(
394+ dev->common.module);
395+ pthread_mutex_lock(&m->lock);
393396 if (usage & GRALLOC_USAGE_HW_FB) {
394397 err = gralloc_alloc_framebuffer(dev, size, usage, pHandle);
395398 } else {
396399 err = gralloc_alloc_buffer(dev, size, usage, pHandle);
397400 }
398-
401+ pthread_mutex_unlock(&m->lock);
399402 if (err < 0) {
400403 return err;
401404 }
Show on old repository browser