libgralloc-qsd8k: Set the framebuffer offsets correctly
The offsets for the framebuffer needs to start at a 4K aligned address. Calculate the additional delta for the yoffset, the virtual address for flipping as well as the total framebuffer size required to achieve this Change-Id: Idfd70be10a24ac464ec820494b66d506a03a983b CRs-fixed: 273888
This commit is contained in:
parent
e9291d8e61
commit
32a41ee5dc
@ -694,26 +694,42 @@ int mapFrameBufferLocked(struct private_module_t* module)
|
||||
info.transp.length = 0;
|
||||
module->fbFormat = HAL_PIXEL_FORMAT_RGB_565;
|
||||
}
|
||||
|
||||
// Calculate the FbSize to map.
|
||||
int y = -1;
|
||||
do {
|
||||
y++;
|
||||
} while (((finfo.line_length * (info.yres + y)) % 4096) != 0);
|
||||
module->yres_delta = y;
|
||||
|
||||
/*
|
||||
* Request NUM_BUFFERS screens (at lest 2 for page flipping)
|
||||
*/
|
||||
int numberOfBuffers = (int)(finfo.smem_len/(info.yres * info.xres * (info.bits_per_pixel/8)));
|
||||
|
||||
// Calculate the number of buffers required
|
||||
int numberOfBuffers = 0;
|
||||
int requiredSize = info.xres * (info.bits_per_pixel/8) *
|
||||
(info.yres + module->yres_delta);
|
||||
for (int num = NUM_FRAMEBUFFERS_MAX; num > 0; num--) {
|
||||
int totalSizeRequired = num * requiredSize;
|
||||
if (finfo.smem_len >= totalSizeRequired) {
|
||||
numberOfBuffers = num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOGV("num supported framebuffers in kernel = %d", numberOfBuffers);
|
||||
|
||||
if (property_get("debug.gr.numframebuffers", property, NULL) > 0) {
|
||||
int num = atoi(property);
|
||||
if ((num >= NUM_FRAMEBUFFERS_MIN) && (num <= NUM_FRAMEBUFFERS_MAX)) {
|
||||
numberOfBuffers = num;
|
||||
int reqNum = atoi(property);
|
||||
if ((reqNum <= numberOfBuffers) && (reqNum >= NUM_FRAMEBUFFERS_MIN)
|
||||
&& (reqNum <= NUM_FRAMEBUFFERS_MAX)) {
|
||||
numberOfBuffers = reqNum;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberOfBuffers > NUM_FRAMEBUFFERS_MAX)
|
||||
numberOfBuffers = NUM_FRAMEBUFFERS_MAX;
|
||||
|
||||
info.yres_virtual = numberOfBuffers*(info.yres + module->yres_delta);
|
||||
LOGD("We support %d buffers", numberOfBuffers);
|
||||
|
||||
info.yres_virtual = info.yres * numberOfBuffers;
|
||||
|
||||
uint32_t flags = PAGE_FLIP;
|
||||
if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
|
||||
info.yres_virtual = info.yres;
|
||||
|
3
gpu.cpp
3
gpu.cpp
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -89,7 +90,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
|
||||
m->bufferMask |= (1LU<<i);
|
||||
break;
|
||||
}
|
||||
vaddr += bufferSize;
|
||||
vaddr += (m->finfo.line_length * (m->info.yres + m->yres_delta));
|
||||
}
|
||||
|
||||
hnd->base = vaddr;
|
||||
|
@ -212,6 +212,7 @@ struct private_module_t {
|
||||
struct avail_t avail[NUM_FRAMEBUFFERS_MAX];
|
||||
pthread_mutex_t qlock;
|
||||
pthread_cond_t qpost;
|
||||
uint32_t yres_delta;
|
||||
|
||||
enum {
|
||||
// flag to indicate we'll post this buffer
|
||||
|
Loading…
x
Reference in New Issue
Block a user