framebuffer: Fix locking

The gralloc locking did not lock
the framebuffer. Use genlock to
lock the framebuffers.

Change-Id: Ie8be6f7950f6df06a2293c3df863e19cd5386479
This commit is contained in:
Naseer Ahmed 2012-07-13 07:16:20 -07:00 committed by Andrew Sutherland
parent f08c954f02
commit c0872eecdd
2 changed files with 10 additions and 10 deletions

View File

@ -47,7 +47,7 @@ struct private_module_t {
uint32_t numBuffers;
uint32_t bufferMask;
pthread_mutex_t lock;
buffer_handle_t currentBuffer;
private_handle_t *currentBuffer;
struct fb_var_screeninfo info;
struct fb_fix_screeninfo finfo;
float xdpi;

View File

@ -39,6 +39,7 @@
#include "gralloc_priv.h"
#include "fb_priv.h"
#include "gr.h"
#include <genlock.h>
#include <cutils/properties.h>
#include <profiler.h>
@ -502,20 +503,19 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
if (private_handle_t::validate(buffer) < 0)
return -EINVAL;
fb_context_t* ctx = (fb_context_t*)dev;
fb_context_t* ctx = (fb_context_t*) dev;
private_handle_t *hnd = static_cast<private_handle_t*>
(const_cast<native_handle_t*>(buffer));
private_handle_t const* hnd =
reinterpret_cast<private_handle_t const*>(buffer);
private_module_t* m =
reinterpret_cast<private_module_t*>(dev->common.module);
if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) {
m->base.lock(&m->base, buffer,
PRIV_USAGE_LOCKED_FOR_POST,
0, 0, m->info.xres, m->info.yres, NULL);
genlock_lock_buffer(hnd, GENLOCK_READ_LOCK, GENLOCK_MAX_TIMEOUT);
if (m->currentBuffer) {
m->base.unlock(&m->base, m->currentBuffer);
genlock_unlock_buffer(m->currentBuffer);
m->currentBuffer = 0;
}
@ -524,11 +524,11 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
m->info.yoffset = offset / m->finfo.line_length;
if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
ALOGE("FBIOPUT_VSCREENINFO failed");
m->base.unlock(&m->base, buffer);
genlock_unlock_buffer(hnd);
return -errno;
}
CALC_FPS();
m->currentBuffer = buffer;
m->currentBuffer = hnd;
}
return 0;
}