mdss: display: allocate buffer from ion when debug writeback enabled

Debug writeback is used to output MDSS framebuffer contents to memory to
for debugging of MDSS core. Use ion buffer allocation for debug
writeback buffer instead of using memory from framebuffer base layer to
allow entire framebuffer area to be used for composition.

Change-Id: Ia1a91f5f14bed1d29691092142fc94f7a8b6f4d2
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
This commit is contained in:
Adrian Salido-Moreno 2012-06-28 15:48:10 -07:00 committed by Stephen Boyd
parent 5f79ee3705
commit 6252708c00

View file

@ -60,32 +60,40 @@ static DEFINE_MUTEX(mdss_mdp_wb_buf_lock);
static struct mdss_mdp_wb mdss_mdp_wb_info;
#ifdef DEBUG_WRITEBACK
/* for debugging: writeback output buffer to framebuffer memory */
/* for debugging: writeback output buffer to allocated memory */
static inline
struct mdss_mdp_data *mdss_mdp_wb_debug_buffer(struct msm_fb_data_type *mfd)
{
static struct ion_handle *ihdl;
static void *videomemory;
static void *mdss_wb_mem;
static struct mdss_mdp_data buffer = {
.num_planes = 1,
};
static ion_phys_addr_t mdss_wb_mem;
static struct mdss_mdp_data buffer = { .num_planes = 1, };
struct fb_info *fbi;
int img_size;
int offset;
size_t img_size;
fbi = mfd->fbi;
img_size = fbi->var.xres * fbi->var.yres * fbi->var.bits_per_pixel / 8;
offset = fbi->fix.smem_len - img_size;
videomemory = fbi->screen_base + offset;
mdss_wb_mem = (void *)(fbi->fix.smem_start + offset);
if (ihdl == NULL) {
ihdl = ion_alloc(mfd->iclient, img_size, SZ_4K,
ION_HEAP(ION_SF_HEAP_ID));
if (!IS_ERR_OR_NULL(ihdl)) {
videomemory = ion_map_kernel(mfd->iclient, ihdl, 0);
ion_phys(mfd->iclient, ihdl, &mdss_wb_mem, &img_size);
} else {
pr_err("unable to alloc fbmem from ion (%p)\n", ihdl);
ihdl = NULL;
}
}
buffer.p[0].addr = fbi->fix.smem_start + offset;
buffer.p[0].len = img_size;
if (mdss_wb_mem) {
buffer.p[0].addr = (u32) mdss_wb_mem;
buffer.p[0].len = img_size;
return &buffer;
return &buffer;
}
return NULL;
}
#else
static inline