From 16e6f7da949c25ed46a121d352ac9ccf96adac16 Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Fri, 10 Jun 2011 12:28:37 +0530 Subject: [PATCH] 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 --- framebuffer.cpp | 53 ++++++++++++------------------------------------- gpu.cpp | 3 +-- gralloc_priv.h | 1 - 3 files changed, 14 insertions(+), 43 deletions(-) diff --git a/framebuffer.cpp b/framebuffer.cpp index 3da31f9..5df9a64 100644 --- a/framebuffer.cpp +++ b/framebuffer.cpp @@ -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; diff --git a/gpu.cpp b/gpu.cpp index d7774bf..dd73a91 100644 --- a/gpu.cpp +++ b/gpu.cpp @@ -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<finfo.line_length * (m->info.yres + m->yres_delta)); + vaddr += bufferSize; } hnd->base = vaddr; diff --git a/gralloc_priv.h b/gralloc_priv.h index 965fc6b..f729e5d 100644 --- a/gralloc_priv.h +++ b/gralloc_priv.h @@ -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