Revert "libgralloc-qsd8k: Align the framebuffer only for GPU or C2D composition"

This reverts commit 80df10595720594cf661b8812507ba75b2bafd1e.

Revert "libgralloc-qsd8k: Set the framebuffer offsets correctly"

This reverts commit 09a31858f42978c29e0c7014713748d413b3c587.

It is no longer a requirement for GPU to be 4k aligned, hence
reverting these 2 changes.

Change-Id: I39e6f6324353a3c19bfdf523f8862408ef9a4093
This commit is contained in:
Naseer Ahmed 2011-06-10 12:28:37 +05:30
parent ff8d4b30ae
commit 16e6f7da94
3 changed files with 14 additions and 43 deletions

View File

@ -750,7 +750,7 @@ int mapFrameBufferLocked(struct private_module_t* module)
* stream and is written to video memory as that unmodified. This implies
* big-endian byte order if bits_per_pixel is greater than 8.
*/
bool pageAlignmentRequired = true;
if(info.bits_per_pixel == 32) {
/*
* Explicitly request RGBA_8888
@ -768,14 +768,11 @@ int mapFrameBufferLocked(struct private_module_t* module)
/* Note: the GL driver does not have a r=8 g=8 b=8 a=0 config, so if we do
* not use the MDP for composition (i.e. hw composition == 0), ask for
* RGBA instead of RGBX. */
if (property_get("debug.sf.hw", property, NULL) > 0 && atoi(property) == 0) {
if (property_get("debug.sf.hw", property, NULL) > 0 && atoi(property) == 0)
module->fbFormat = HAL_PIXEL_FORMAT_RGBX_8888;
pageAlignmentRequired = false;
} else if(property_get("debug.composition.type", property, NULL) > 0 &&
(strncmp(property, "mdp", 3) == 0)) {
else if(property_get("debug.composition.type", property, NULL) > 0 && (strncmp(property, "mdp", 3) == 0))
module->fbFormat = HAL_PIXEL_FORMAT_RGBX_8888;
pageAlignmentRequired = false;
} else
else
module->fbFormat = HAL_PIXEL_FORMAT_RGBA_8888;
} else {
/*
@ -791,51 +788,27 @@ int mapFrameBufferLocked(struct private_module_t* module)
info.transp.offset = 0;
info.transp.length = 0;
module->fbFormat = HAL_PIXEL_FORMAT_RGB_565;
if ((property_get("debug.sf.hw", property, NULL) > 0 && atoi(property) == 0) ||
(property_get("debug.composition.type", property, NULL) > 0 &&
(strncmp(property, "mdp", 3) == 0))) {
pageAlignmentRequired = false;
}
}
if (pageAlignmentRequired) {
// Calculate the FbSize to map.
int y = -1;
do {
y++;
} while (((finfo.line_length * (info.yres + y)) % 4096) != 0);
module->yres_delta = y;
} else
module->yres_delta = 0;
/*
* Request NUM_BUFFERS screens (at lest 2 for page flipping)
*/
// 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;
}
}
int numberOfBuffers = (int)(finfo.smem_len/(info.yres * info.xres * (info.bits_per_pixel/8)));
LOGV("num supported framebuffers in kernel = %d", numberOfBuffers);
if (property_get("debug.gr.numframebuffers", property, NULL) > 0) {
int reqNum = atoi(property);
if ((reqNum <= numberOfBuffers) && (reqNum >= NUM_FRAMEBUFFERS_MIN)
&& (reqNum <= NUM_FRAMEBUFFERS_MAX)) {
numberOfBuffers = reqNum;
int num = atoi(property);
if ((num >= NUM_FRAMEBUFFERS_MIN) && (num <= NUM_FRAMEBUFFERS_MAX)) {
numberOfBuffers = num;
}
}
info.yres_virtual = numberOfBuffers*(info.yres + module->yres_delta);
if (numberOfBuffers > NUM_FRAMEBUFFERS_MAX)
numberOfBuffers = NUM_FRAMEBUFFERS_MAX;
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;

View File

@ -1,6 +1,5 @@
/*
* 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.
@ -90,7 +89,7 @@ int gpu_context_t::gralloc_alloc_framebuffer_locked(size_t size, int usage,
m->bufferMask |= (1LU<<i);
break;
}
vaddr += (m->finfo.line_length * (m->info.yres + m->yres_delta));
vaddr += bufferSize;
}
hnd->base = vaddr;

View File

@ -264,7 +264,6 @@ 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