fix formatting

This commit is contained in:
Markus Fröschle
2016-10-18 05:47:56 +00:00
parent f49fecf80c
commit 5c89fa5ec0
4 changed files with 347 additions and 320 deletions

View File

@@ -18,6 +18,7 @@
/* picture format */
#define PICT_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | ((type) << 16) | ((a) << 12) | ((r) << 8) | ((g) << 4) | ((b)))
/* gray/color formats use a visual index instead of argb */
#define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | ((type) << 16) | ((vi)))
#define PICT_FORMAT_BPP(f) (((f) >> 24) )
@@ -28,6 +29,7 @@
#define PICT_FORMAT_B(f) (((f) ) & 0x0f)
#define PICT_FORMAT_RGB(f) (((f) ) & 0xfff)
#define PICT_FORMAT_VIS(f) (((f) ) & 0xffff)
#define PICT_TYPE_OTHER 0
#define PICT_TYPE_A 1
#define PICT_TYPE_ARGB 2
@@ -35,38 +37,44 @@
#define PICT_TYPE_COLOR 4
#define PICT_TYPE_GRAY 5
#define PICT_FORMAT_COLOR(f) (PICT_FORMAT_TYPE(f) & 2)
/* 32bpp formats */
#define PICT_a8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8)
#define PICT_x8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8)
#define PICT_a8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8)
#define PICT_x8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8)
#define PICT_a8r8g8b8 PICT_FORMAT(32, PICT_TYPE_ARGB, 8, 8, 8, 8)
#define PICT_x8r8g8b8 PICT_FORMAT(32, PICT_TYPE_ARGB, 0, 8, 8, 8)
#define PICT_a8b8g8r8 PICT_FORMAT(32, PICT_TYPE_ABGR, 8, 8, 8, 8)
#define PICT_x8b8g8r8 PICT_FORMAT(32, PICT_TYPE_ABGR, 0, 8, 8, 8)
/* 24bpp formats */
#define PICT_r8g8b8 PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8)
#define PICT_b8g8r8 PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8)
#define PICT_r8g8b8 PICT_FORMAT(24, PICT_TYPE_ARGB, 0, 8, 8, 8)
#define PICT_b8g8r8 PICT_FORMAT(24, PICT_TYPE_ABGR, 0, 8, 8, 8)
/* 16bpp formats */
#define PICT_r5g6b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5)
#define PICT_b5g6r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5)
#define PICT_a1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,1,5,5,5)
#define PICT_x1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5)
#define PICT_a1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5)
#define PICT_x1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5)
#define PICT_a4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4)
#define PICT_x4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4)
#define PICT_a4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4)
#define PICT_x4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4)
#define PICT_r5g6b5 PICT_FORMAT(16, PICT_TYPE_ARGB, 0, 5, 6, 5)
#define PICT_b5g6r5 PICT_FORMAT(16, PICT_TYPE_ABGR, 0, 5, 6, 5)
#define PICT_a1r5g5b5 PICT_FORMAT(16, PICT_TYPE_ARGB, 1, 5, 5, 5)
#define PICT_x1r5g5b5 PICT_FORMAT(16, PICT_TYPE_ARGB, 0, 5, 5, 5)
#define PICT_a1b5g5r5 PICT_FORMAT(16, PICT_TYPE_ABGR, 1, 5, 5, 5)
#define PICT_x1b5g5r5 PICT_FORMAT(16, PICT_TYPE_ABGR, 0, 5, 5, 5)
#define PICT_a4r4g4b4 PICT_FORMAT(16, PICT_TYPE_ARGB, 4, 4, 4, 4)
#define PICT_x4r4g4b4 PICT_FORMAT(16, PICT_TYPE_ARGB, 4, 4, 4, 4)
#define PICT_a4b4g4r4 PICT_FORMAT(16, PICT_TYPE_ARGB, 4, 4, 4, 4)
#define PICT_x4b4g4r4 PICT_FORMAT(16, PICT_TYPE_ARGB, 4, 4, 4, 4)
/* 8bpp formats */
#define PICT_a8 PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0)
#define PICT_r3g3b2 PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2)
#define PICT_b2g3r3 PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2)
#define PICT_a2r2g2b2 PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2)
#define PICT_a2b2g2r2 PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2)
#define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0)
#define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0)
#define PICT_a8 PICT_FORMAT(8, PICT_TYPE_A, 8, 0, 0, 0)
#define PICT_r3g3b2 PICT_FORMAT(8, PICT_TYPE_ARGB, 0, 3, 3, 2)
#define PICT_b2g3r3 PICT_FORMAT(8, PICT_TYPE_ABGR, 0, 3, 3, 2)
#define PICT_a2r2g2b2 PICT_FORMAT(8, PICT_TYPE_ARGB, 2, 2, 2, 2)
#define PICT_a2b2g2r2 PICT_FORMAT(8, PICT_TYPE_ABGR, 2, 2, 2, 2)
#define PICT_c8 PICT_FORMAT(8, PICT_TYPE_COLOR, 0, 0, 0, 0)
#define PICT_g8 PICT_FORMAT(8, PICT_TYPE_GRAY, 0, 0, 0, 0)
/* fVDI */
#define MODE_EMUL_MONO_FLAG 1
#define MODE_VESA_FLAG 2 /* for modedb.c */
struct mode_option {
struct mode_option
{
short used; /* Whether the mode option was used or not. */
short width;
short height;
@@ -214,7 +222,7 @@ struct fb_bitfield
#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
#define FB_ACTIVATE_MASK 15
/* values */
/* values */
#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
@@ -228,8 +236,8 @@ struct fb_bitfield
#define FB_SYNC_EXT 4 /* external sync */
#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
#define FB_SYNC_BROADCAST 16 /* broadcast video timings */
/* vtotal = 144d/288n/576i => PAL */
/* vtotal = 121d/242n/484i => NTSC */
/* vtotal = 144d/288n/576i => PAL */
/* vtotal = 121d/242n/484i => NTSC */
#define FB_SYNC_ON_GREEN 32 /* sync on green */
#define FB_VMODE_NONINTERLACED 0 /* non interlaced */
@@ -241,8 +249,8 @@ struct fb_bitfield
#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
#define PICOS2KHZ(a) (1000000000UL/(a))
#define KHZ2PICOS(a) (1000000000UL/(a))
#define PICOS2KHZ(a) (1000000000UL / (a))
#define KHZ2PICOS(a) (1000000000UL / (a))
struct fb_var_screeninfo
{
@@ -291,7 +299,8 @@ struct fb_var_screeninfo
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
enum {
enum
{
/* screen: unblanked, hsync: on, vsync: on */
FB_BLANK_UNBLANK = VESA_NO_BLANKING,
/* screen: blanked, hsync: on, vsync: on */
@@ -353,6 +362,7 @@ struct file;
#define FB_MISC_PRIM_COLOR 1
#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
struct fb_chroma
{
unsigned long redx; /* in fraction of 1024 */
@@ -398,7 +408,7 @@ struct fb_monspecs
struct fb_ops
{
/* checks var and eventually tweaks if to soomething supported,
/* checks var and eventually tweaks if to something supported,
* DO NOT MODIFY PAR */
int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
/* set the video mode according to info->var */
@@ -517,7 +527,8 @@ extern void fb_var_to_videomode(struct fb_videomode *mode, struct fb_var_screeni
extern void fb_videomode_to_var(struct fb_var_screeninfo *var, struct fb_videomode *mode);
extern int fb_mode_is_equal(struct fb_videomode *mode1, struct fb_videomode *mode2);
struct fb_videomode {
struct fb_videomode
{
unsigned short refresh; /* optional */
unsigned short xres;
unsigned short yres;
@@ -535,7 +546,8 @@ struct fb_videomode {
extern const struct fb_videomode vesa_modes[];
/* timer */
/* timer FIXME: doesn't really fit yet to Coldfire timings */
#if defined(MACHINE_FIREBEE)
#define US_TO_TIMER(a) (((a) * 256) / 5000)

View File

@@ -1352,8 +1352,10 @@ static void radeon_timer_func(void)
struct fb_info *info = info_fb;
struct radeonfb_info *rinfo = info->par;
struct fb_var_screeninfo var;
uint32_t x, y;
int chg, disp;
uint32_t x;
uint32_t y;
int chg;
int disp;
#ifdef FIXME_LATER
static int32_t start_timer;
@@ -1380,19 +1382,21 @@ static void radeon_timer_func(void)
if ((info->screen_mono != NULL) && info->update_mono)
{
int32_t foreground = 255, background = 0;
uint8_t *src_buf = (uint8_t *)info->screen_mono;
int skipleft = ((int)src_buf & 3) << 3;
int32_t foreground = 255;
int32_t background = 0;
uint8_t *src_buf = (uint8_t *) info->screen_mono;
int skipleft = ((int) src_buf & 3) << 3;
int dst_x = 0;
int w = (int)info->var.xres_virtual;
int h = (int)info->var.yres_virtual;
int w = (int) info->var.xres_virtual;
int h = (int) info->var.yres_virtual;
// info->fbops->SetClippingRectangle(info,0,0,w-1,h-1);
src_buf = (uint8_t*)((int32_t)src_buf & ~3);
dst_x -= (int32_t)skipleft;
w += (int32_t)skipleft;
info->fbops->SetupForScanlineCPUToScreenColorExpandFill(info,(int)foreground,(int)background,3,0xffffffff);
info->fbops->SubsequentScanlineCPUToScreenColorExpandFill(info,(int)dst_x,0,w,h,skipleft);
src_buf = (uint8_t*) ((int32_t) src_buf & ~3);
dst_x -= (int32_t) skipleft;
w += (int32_t) skipleft;
info->fbops->SetupForScanlineCPUToScreenColorExpandFill(info, (int) foreground, (int) background, 3, 0xffffffff);
info->fbops->SubsequentScanlineCPUToScreenColorExpandFill(info, (int) dst_x, 0, w, h, skipleft);
while (--h >= 0)
{

View File

@@ -428,6 +428,7 @@ static void radeon_var_to_panel_info(struct radeonfb_info *rinfo, struct fb_var_
rinfo->panel_info.hAct_high = (var->sync & FB_SYNC_HOR_HIGH_ACT) != 0;
rinfo->panel_info.vAct_high = (var->sync & FB_SYNC_VERT_HIGH_ACT) != 0;
rinfo->panel_info.valid = 1;
/*
* We use a default of 200ms for the panel power delay,
* I need to have a real schedule() instead of mdelay's in the panel code.
@@ -577,7 +578,9 @@ void radeon_check_modes(struct radeonfb_info *rinfo, struct mode_option *resolut
has_default_mode = 1;
radeon_var_to_panel_info(rinfo, &info->var);
}
pickup_default:
/*
* Apply passed-in mode option if any
*/
@@ -587,6 +590,7 @@ pickup_default:
info->monspecs.modedb_len, NULL, (resolution->bpp >= 8) ? (unsigned int)resolution->bpp : 8) != 0)
has_default_mode = 1;
}
/*
* Still no mode, let's pick up a default from the db
*/

View File

@@ -17,36 +17,24 @@
#include "fb.h"
#include "radeonfb.h"
#include "driver_mem.h"
#include "bas_string.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 */
// #define DEBUG
#include "debug.h"
long mem_cmp(char *p1, char *p2, long size)
{
while(size--)
{
if (*p1++ != *p2++)
return(1);
}
return(0);
}
/*
* Frame buffer device initialization and setup routines
*/
#define FBPIXMAPSIZE (1024 * 8)
int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
{
int xoffset = var->xoffset;
int yoffset = var->yoffset;
int err;
// DPRINT("fb_pan_display\r\n");
dbg("\r\n");
if ((xoffset < 0) || (yoffset < 0)
|| ((xoffset + info->var.xres) > info->var.xres_virtual))
return -1; //-EINVAL;
@@ -64,15 +52,23 @@ int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
{
int err;
// DPRINT("fb_set_var\r\n");
dbg("\r\n");
if (var->activate & FB_ACTIVATE_INV_MODE)
{
/* return 1 if equal */
return(!mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)));
return !memcmp((char *) &info->var, (char *) var, sizeof(struct fb_var_screeninfo));
}
if ((var->activate & FB_ACTIVATE_FORCE)
|| mem_cmp((char *)&info->var, (char *)var, sizeof(struct fb_var_screeninfo)))
|| memcmp((char *) &info->var, (char *) var, sizeof(struct fb_var_screeninfo)))
{
if ((err = info->fbops->fb_check_var(var, info)))
{
return err;
}
if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
{
memcpy(&info->var, var, sizeof(struct fb_var_screeninfo));
@@ -80,12 +76,13 @@ int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
fb_pan_display(info, &info->var);
}
}
return 0;
}
int fb_blank(struct fb_info *info, int blank)
{
dbg("fb_blank\r\n");
dbg("\r\n");
if (blank > FB_BLANK_POWERDOWN)
blank = FB_BLANK_POWERDOWN;
return(info->fbops->fb_blank(blank, info));
@@ -98,11 +95,13 @@ int fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
void *argp = (void *) arg;
int i;
dbg("\r\n");
switch(cmd)
{
case FBIOGET_VSCREENINFO:
memcpy(argp, &info->var, sizeof(var));
return 0;
case FBIOPUT_VSCREENINFO:
memcpy(&var, argp, sizeof(var));
i = fb_set_var(info, &var);
@@ -110,9 +109,11 @@ int fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
return i;
memcpy(argp, &var, sizeof(var));
return 0;
case FBIOGET_FSCREENINFO:
memcpy(argp, &info->fix, sizeof(fix));
return 0;
case FBIOPAN_DISPLAY:
memcpy(&var, argp, sizeof(var));
i = fb_pan_display(info, &var);
@@ -120,13 +121,17 @@ int fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
return i;
memcpy(argp, &var, sizeof(var));
return 0;
case FBIOBLANK:
i = fb_blank(info, arg);
return i;
case FBIO_ALLOC:
return(offscreen_alloc(info,(long)arg));
case FBIO_FREE:
return(offscreen_free(info,(long)arg));
default:
return(info->fbops->fb_ioctl(cmd, arg, info));
}
@@ -155,6 +160,7 @@ struct fb_info *framebuffer_alloc(unsigned long size)
*/
extern struct fb_info *info_fb;
dbg("\r\n");
return info_fb;
}
@@ -169,6 +175,7 @@ struct fb_info *framebuffer_alloc(unsigned long size)
*/
void framebuffer_release(struct fb_info *info)
{
dbg("\r\n");
driver_mem_free(info->par);
}