more dependencies resolved

This commit is contained in:
Markus Fröschle
2013-12-29 08:58:58 +00:00
parent 3e480541f8
commit 0297c08b8e
11 changed files with 191 additions and 249 deletions

View File

@@ -11,15 +11,25 @@
* for more details.
*/
#include <bas_string.h>
#include "bas_types.h"
#include "bas_printf.h"
#include "bas_string.h"
#include "fb.h"
#include "radeonfb.h"
#include "driver_mem.h"
#define DBG_FBMEM
#ifdef DBG_FBMEM
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
#else
#define dbg(format, arg...) do { ; } while (0)
#endif /* DBG_FBMEM */
long mem_cmp(char *p1, char *p2, long size)
{
while(size--)
{
if(*p1++ != *p2++)
if (*p1++ != *p2++)
return(1);
}
return(0);
@@ -37,14 +47,14 @@ int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
int yoffset = var->yoffset;
int err;
// DPRINT("fb_pan_display\r\n");
if((xoffset < 0) || (yoffset < 0)
if ((xoffset < 0) || (yoffset < 0)
|| ((xoffset + info->var.xres) > info->var.xres_virtual))
return -1; //-EINVAL;
if((err = info->fbops->fb_pan_display(var, info)))
if ((err = info->fbops->fb_pan_display(var, info)))
return err;
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
if(var->vmode & FB_VMODE_YWRAP)
if (var->vmode & FB_VMODE_YWRAP)
info->var.vmode |= FB_VMODE_YWRAP;
else
info->var.vmode &= ~FB_VMODE_YWRAP;
@@ -55,15 +65,15 @@ int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
{
int err;
// DPRINT("fb_set_var\r\n");
if(var->activate & FB_ACTIVATE_INV_MODE)
if (var->activate & FB_ACTIVATE_INV_MODE)
/* return 1 if equal */
return(!mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)));
if((var->activate & FB_ACTIVATE_FORCE)
if ((var->activate & FB_ACTIVATE_FORCE)
|| mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)))
{
if((err = info->fbops->fb_check_var(var, info)))
if ((err = info->fbops->fb_check_var(var, info)))
return err;
if((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
{
memcpy(&info->var, var, sizeof(struct fb_var_screeninfo));
info->fbops->fb_set_par(info);
@@ -75,19 +85,19 @@ int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
int fb_blank(struct fb_info *info, int blank)
{
// DPRINT("fb_blank\r\n");
if(blank > FB_BLANK_POWERDOWN)
dbg("fb_blank\r\n");
if (blank > FB_BLANK_POWERDOWN)
blank = FB_BLANK_POWERDOWN;
return(info->fbops->fb_blank(blank, info));
}
int fb_ioctl(unsigned int cmd, unsigned long arg)
int fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
struct fb_info *info = info_fvdi;
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
void *argp = (void *)arg;
void *argp = (void *) arg;
int i;
switch(cmd)
{
case FBIOGET_VSCREENINFO:
@@ -96,7 +106,7 @@ int fb_ioctl(unsigned int cmd, unsigned long arg)
case FBIOPUT_VSCREENINFO:
memcpy(&var, argp, sizeof(var));
i = fb_set_var(info, &var);
if(i)
if (i)
return i;
memcpy(argp, &var, sizeof(var));
return 0;
@@ -106,7 +116,7 @@ int fb_ioctl(unsigned int cmd, unsigned long arg)
case FBIOPAN_DISPLAY:
memcpy(&var, argp, sizeof(var));
i = fb_pan_display(info, &var);
if(i)
if (i)
return i;
memcpy(argp, &var, sizeof(var));
return 0;
@@ -123,10 +133,6 @@ int fb_ioctl(unsigned int cmd, unsigned long arg)
}
#if 1
static struct radeonfb_info struct_radeon_info;
/**
* framebuffer_alloc - creates a new frame buffer info structure
*
@@ -142,24 +148,23 @@ static struct radeonfb_info struct_radeon_info;
*/
struct fb_info *framebuffer_alloc(unsigned long size)
{
static struct fb_info struct_info;
struct fb_info *info = &struct_info;
memset(info, 0, sizeof(struct fb_info));
if(size)
struct fb_info *info = driver_mem_alloc(sizeof(struct fb_info));
if (info == NULL)
{
if(size <= sizeof(struct radeonfb_info))
{
memset(&struct_radeon_info, 0, sizeof(struct radeonfb_info));
info->par = (void *)&struct_radeon_info;
}
else
{
char *p = Funcs_malloc(size, 3);
if(!p)
return NULL;
memset(p, 0, size);
info->par = p;
}
dbg("%s: could not allocate fb_info structure\r\n", __FUNCTION__);
return 0;
}
memset(info, 0, sizeof(struct fb_info));
if (size)
{
char *p = driver_mem_alloc(size);
if (!p)
return NULL;
memset(p, 0, size);
info->par = p;
}
return info;
}
@@ -175,59 +180,6 @@ struct fb_info *framebuffer_alloc(unsigned long size)
*/
void framebuffer_release(struct fb_info *info)
{
if(info->par != (void *)&struct_radeon_info)
Funcs_free(info->par);
driver_mem_free(info->par);
}
#else
/**
* framebuffer_alloc - creates a new frame buffer info structure
*
* @size: size of driver private data, can be zero
* @dev: pointer to the device for this fb, this can be NULL
*
* Creates a new frame buffer info structure. Also reserves @size bytes
* for driver private data (info->par). info->par (if any) will be
* aligned to sizeof(long).
*
* Returns the new structure, or NULL if an error occured.
*
*/
struct fb_info *framebuffer_alloc(unsigned long size)
{
#define BYTES_PER_LONG (32/8)
#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG))
int fb_info_size = sizeof(struct fb_info);
struct fb_info *info;
char *p;
if(size)
fb_info_size += PADDING;
p = Funcs_malloc(fb_info_size + size, 3);
if(!p)
return NULL;
memset(p, 0, fb_info_size + size);
info = (struct fb_info *) p;
if(size)
info->par = p + fb_info_size;
return info;
#undef PADDING
#undef BYTES_PER_LONG
}
/**
* framebuffer_release - marks the structure available for freeing
*
* @info: frame buffer info structure
*
* Drop the reference count of the class_device embedded in the
* framebuffer info structure.
*
*/
void framebuffer_release(struct fb_info *info)
{
Funcs_free(info);
}
#endif