Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d335b16a
Commit
d335b16a
authored
Dec 27, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://are.twiddle.net/tga-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
f914915b
6c56ca7b
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
751 additions
and
1018 deletions
+751
-1018
drivers/video/Makefile
drivers/video/Makefile
+1
-1
drivers/video/cfbcopyarea.c
drivers/video/cfbcopyarea.c
+1
-1
drivers/video/cfbimgblt.c
drivers/video/cfbimgblt.c
+49
-45
drivers/video/tgafb.c
drivers/video/tgafb.c
+618
-902
include/linux/fb.h
include/linux/fb.h
+2
-0
include/video/tgafb.h
include/video/tgafb.h
+80
-69
No files found.
drivers/video/Makefile
View file @
d335b16a
...
...
@@ -48,7 +48,7 @@ obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
obj-$(CONFIG_FB_CLGEN)
+=
clgenfb.o
obj-$(CONFIG_FB_TRIDENT)
+=
tridentfb.o
obj-$(CONFIG_FB_S3TRIO)
+=
S3triofb.o
obj-$(CONFIG_FB_TGA)
+=
tgafb.o
obj-$(CONFIG_FB_TGA)
+=
tgafb.o
cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VESA)
+=
vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_VGA16)
+=
vga16fb.o cfbfillrect.o cfbcopyarea.o
\
cfbimgblt.o vgastate.o
...
...
drivers/video/cfbcopyarea.c
View file @
d335b16a
...
...
@@ -38,7 +38,7 @@
#define BYTES_PER_LONG 4
#else
#define FB_WRITEL fb_writeq
#define FB_READL fb_readq
(x)
#define FB_READL fb_readq
#define SHIFT_PER_LONG 6
#define BYTES_PER_LONG 8
#endif
...
...
drivers/video/cfbimgblt.c
View file @
d335b16a
...
...
@@ -21,13 +21,13 @@
*
* FIXME
* The code for 24 bit is horrible. It copies byte by byte size instead of
*
long
s like the other sizes. Needs to be optimized.
*
word
s like the other sizes. Needs to be optimized.
*
* Tony:
* Incorporate mask tables similar to fbcon-cfb*.c in 2.4 API. This speeds
* up the code significantly.
*
* Code for depths not multiples of BITS_PER_
LONG
is still kludgy, which is
* Code for depths not multiples of BITS_PER_
WORD
is still kludgy, which is
* still processed a bit at a time.
*
* Also need to add code to deal with cards endians that are different than
...
...
@@ -48,7 +48,11 @@
#define DPRINTK(fmt, args...)
#endif
static
u32
cfb_tab8
[]
=
{
/* The following code can *not* handle a 64-bit long. */
#define WORD u32
#define BITS_PER_WORD 32
static
WORD
const
cfb_tab8
[]
=
{
#if defined(__BIG_ENDIAN)
0x00000000
,
0x000000ff
,
0x0000ff00
,
0x0000ffff
,
0x00ff0000
,
0x00ff00ff
,
0x00ffff00
,
0x00ffffff
,
...
...
@@ -64,7 +68,7 @@ static u32 cfb_tab8[] = {
#endif
};
static
u32
cfb_tab16
[]
=
{
static
WORD
const
cfb_tab16
[]
=
{
#if defined(__BIG_ENDIAN)
0x00000000
,
0x0000ffff
,
0xffff0000
,
0xffffffff
#elif defined(__LITTLE_ENDIAN)
...
...
@@ -74,11 +78,11 @@ static u32 cfb_tab16[] = {
#endif
};
static
u32
cfb_tab32
[]
=
{
static
WORD
const
cfb_tab32
[]
=
{
0x00000000
,
0xffffffff
};
#if BITS_PER_
LONG
== 32
#if BITS_PER_
WORD
== 32
#define FB_WRITEL fb_writel
#define FB_READL fb_readl
#else
...
...
@@ -87,7 +91,7 @@ static u32 cfb_tab32[] = {
#endif
#if defined (__BIG_ENDIAN)
#define LEFT_POS(bpp) (BITS_PER_
LONG
- bpp)
#define LEFT_POS(bpp) (BITS_PER_
WORD
- bpp)
#define NEXT_POS(pos, bpp) ((pos) -= (bpp))
#define SHIFT_HIGH(val, bits) ((val) >> (bits))
#define SHIFT_LOW(val, bits) ((val) << (bits))
...
...
@@ -99,25 +103,25 @@ static u32 cfb_tab32[] = {
#endif
static
inline
void
color_imageblit
(
struct
fb_image
*
image
,
struct
fb_info
*
p
,
u8
*
dst1
,
unsigned
long
start_index
,
unsigned
long
pitch_index
)
WORD
start_index
,
WORD
pitch_index
)
{
/* Draw the penguin */
int
i
,
n
;
unsigned
long
bitmask
=
SHIFT_LOW
(
~
0UL
,
BITS_PER_LONG
-
p
->
var
.
bits_per_pixel
);
u
nsigned
long
*
palette
=
(
unsigned
long
*
)
p
->
pseudo_palette
;
unsigned
long
*
dst
,
*
dst2
,
color
=
0
,
val
,
shift
;
unsigned
long
null_bits
=
BITS_PER_LONG
-
p
->
var
.
bits_per_pixel
;
WORD
bitmask
=
SHIFT_LOW
(
~
0UL
,
BITS_PER_WORD
-
p
->
var
.
bits_per_pixel
);
u
32
*
palette
=
(
u32
*
)
p
->
pseudo_palette
;
WORD
*
dst
,
*
dst2
,
color
=
0
,
val
,
shift
;
WORD
null_bits
=
BITS_PER_WORD
-
p
->
var
.
bits_per_pixel
;
u8
*
src
=
image
->
data
;
dst2
=
(
unsigned
long
*
)
dst1
;
dst2
=
(
WORD
*
)
dst1
;
for
(
i
=
image
->
height
;
i
--
;
)
{
n
=
image
->
width
;
dst
=
(
unsigned
long
*
)
dst1
;
dst
=
(
WORD
*
)
dst1
;
shift
=
0
;
val
=
0
;
if
(
start_index
)
{
unsigned
long
start_mask
=
~
(
SHIFT_HIGH
(
~
0UL
,
start_index
));
WORD
start_mask
=
~
(
SHIFT_HIGH
(
~
0UL
,
start_index
));
val
=
FB_READL
(
dst
)
&
start_mask
;
shift
=
start_index
;
...
...
@@ -134,14 +138,14 @@ static inline void color_imageblit(struct fb_image *image, struct fb_info *p, u8
if
(
shift
==
null_bits
)
val
=
0
;
else
val
=
SHIFT_LOW
(
color
,
BITS_PER_
LONG
-
shift
);
val
=
SHIFT_LOW
(
color
,
BITS_PER_
WORD
-
shift
);
}
shift
+=
p
->
var
.
bits_per_pixel
;
shift
&=
(
BITS_PER_
LONG
-
1
);
shift
&=
(
BITS_PER_
WORD
-
1
);
src
++
;
}
if
(
shift
)
{
unsigned
long
end_mask
=
SHIFT_HIGH
(
~
0UL
,
shift
);
WORD
end_mask
=
SHIFT_HIGH
(
~
0UL
,
shift
);
FB_WRITEL
((
FB_READL
(
dst
)
&
end_mask
)
|
val
,
dst
);
}
...
...
@@ -149,35 +153,35 @@ static inline void color_imageblit(struct fb_image *image, struct fb_info *p, u8
if
(
pitch_index
)
{
dst2
+=
p
->
fix
.
line_length
;
dst1
=
(
char
*
)
dst2
;
(
unsigned
long
)
dst1
&=
~
(
sizeof
(
unsigned
long
)
-
1
);
(
size_t
)
dst1
&=
~
(
sizeof
(
WORD
)
-
1
);
start_index
+=
pitch_index
;
start_index
&=
BITS_PER_
LONG
-
1
;
start_index
&=
BITS_PER_
WORD
-
1
;
}
}
}
static
inline
void
slow_imageblit
(
struct
fb_image
*
image
,
struct
fb_info
*
p
,
u8
*
dst1
,
unsigned
long
fgcolor
,
unsigned
long
bgcolor
,
unsigned
long
start_index
,
unsigned
long
pitch_index
)
WORD
fgcolor
,
WORD
bgcolor
,
WORD
start_index
,
WORD
pitch_index
)
{
unsigned
long
i
,
j
,
l
=
8
;
unsigned
long
shift
,
color
,
bpp
=
p
->
var
.
bits_per_pixel
;
unsigned
long
*
dst
,
*
dst2
,
val
,
pitch
=
p
->
fix
.
line_length
;
unsigned
long
null_bits
=
BITS_PER_LONG
-
bpp
;
WORD
i
,
j
,
l
=
8
;
WORD
shift
,
color
,
bpp
=
p
->
var
.
bits_per_pixel
;
WORD
*
dst
,
*
dst2
,
val
,
pitch
=
p
->
fix
.
line_length
;
WORD
null_bits
=
BITS_PER_WORD
-
bpp
;
u8
*
src
=
image
->
data
;
dst2
=
(
unsigned
long
*
)
dst1
;
dst2
=
(
WORD
*
)
dst1
;
for
(
i
=
image
->
height
;
i
--
;
)
{
shift
=
0
;
val
=
0
;
j
=
image
->
width
;
dst
=
(
unsigned
long
*
)
dst1
;
dst
=
(
WORD
*
)
dst1
;
/* write leading bits */
if
(
start_index
)
{
unsigned
long
start_mask
=
~
(
SHIFT_HIGH
(
~
0UL
,
start_index
));
WORD
start_mask
=
~
(
SHIFT_HIGH
(
~
0UL
,
start_index
));
val
=
FB_READL
(
dst
)
&
start_mask
;
shift
=
start_index
;
...
...
@@ -196,15 +200,15 @@ static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8
if
(
shift
==
null_bits
)
val
=
0
;
else
val
=
SHIFT_LOW
(
color
,
BITS_PER_
LONG
-
shift
);
val
=
SHIFT_LOW
(
color
,
BITS_PER_
WORD
-
shift
);
}
shift
+=
bpp
;
shift
&=
(
BITS_PER_
LONG
-
1
);
shift
&=
(
BITS_PER_
WORD
-
1
);
if
(
!
l
)
{
l
=
8
;
src
++
;
};
}
/* write trailing bits */
if
(
shift
)
{
unsigned
long
end_mask
=
SHIFT_HIGH
(
~
0UL
,
shift
);
WORD
end_mask
=
SHIFT_HIGH
(
~
0UL
,
shift
);
FB_WRITEL
((
FB_READL
(
dst
)
&
end_mask
)
|
val
,
dst
);
}
...
...
@@ -213,24 +217,24 @@ static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8
if
(
pitch_index
)
{
dst2
+=
pitch
;
dst1
=
(
char
*
)
dst2
;
(
unsigned
long
)
dst1
&=
~
(
sizeof
(
unsigned
long
)
-
1
);
(
size_t
)
dst1
&=
~
(
sizeof
(
WORD
)
-
1
);
start_index
+=
pitch_index
;
start_index
&=
BITS_PER_
LONG
-
1
;
start_index
&=
BITS_PER_
WORD
-
1
;
}
}
}
static
inline
void
fast_imageblit
(
struct
fb_image
*
image
,
struct
fb_info
*
p
,
u8
*
dst1
,
unsigned
long
fgcolor
,
unsigned
long
bgcolor
)
WORD
fgcolor
,
WORD
bgcolor
)
{
int
i
,
j
,
k
,
l
=
8
,
n
;
unsigned
long
bit_mask
,
end_mask
,
eorx
;
unsigned
long
fgx
=
fgcolor
,
bgx
=
bgcolor
,
pad
,
bpp
=
p
->
var
.
bits_per_pixel
;
unsigned
long
tmp
=
(
1
<<
bpp
)
-
1
;
unsigned
long
ppw
=
BITS_PER_LONG
/
bpp
,
ppos
;
unsigned
long
*
dst
;
WORD
bit_mask
,
end_mask
,
eorx
;
WORD
fgx
=
fgcolor
,
bgx
=
bgcolor
,
pad
,
bpp
=
p
->
var
.
bits_per_pixel
;
WORD
tmp
=
(
1
<<
bpp
)
-
1
;
WORD
ppw
=
BITS_PER_WORD
/
bpp
,
ppos
;
WORD
*
dst
;
u32
*
tab
=
NULL
;
char
*
src
=
image
->
data
;
...
...
@@ -263,7 +267,7 @@ static inline void fast_imageblit(struct fb_image *image, struct fb_info *p, u8
k
=
image
->
width
/
ppw
;
for
(
i
=
image
->
height
;
i
--
;
)
{
dst
=
(
unsigned
long
*
)
dst1
;
dst
=
(
WORD
*
)
dst1
;
for
(
j
=
k
;
j
--
;
)
{
l
-=
ppw
;
...
...
@@ -291,8 +295,8 @@ static inline void fast_imageblit(struct fb_image *image, struct fb_info *p, u8
void
cfb_imageblit
(
struct
fb_info
*
p
,
struct
fb_image
*
image
)
{
int
x2
,
y2
,
vxres
,
vyres
;
unsigned
long
fgcolor
,
bgcolor
,
start_index
,
bitstart
,
pitch_index
=
0
;
unsigned
long
bpl
=
sizeof
(
unsigned
long
),
bpp
=
p
->
var
.
bits_per_pixel
;
WORD
fgcolor
,
bgcolor
,
start_index
,
bitstart
,
pitch_index
=
0
;
WORD
bpl
=
sizeof
(
WORD
),
bpp
=
p
->
var
.
bits_per_pixel
;
u8
*
dst1
;
vxres
=
p
->
var
.
xres_virtual
;
...
...
@@ -315,7 +319,7 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
image
->
height
=
y2
-
image
->
dy
;
bitstart
=
(
image
->
dy
*
p
->
fix
.
line_length
*
8
)
+
(
image
->
dx
*
bpp
);
start_index
=
bitstart
&
(
BITS_PER_
LONG
-
1
);
start_index
=
bitstart
&
(
BITS_PER_
WORD
-
1
);
pitch_index
=
(
p
->
fix
.
line_length
&
(
bpl
-
1
))
*
8
;
bitstart
/=
8
;
...
...
@@ -332,7 +336,7 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
bgcolor
=
image
->
bg_color
;
}
if
(
BITS_PER_
LONG
%
bpp
==
0
&&
!
start_index
&&
!
pitch_index
&&
if
(
BITS_PER_
WORD
%
bpp
==
0
&&
!
start_index
&&
!
pitch_index
&&
bpp
>=
8
&&
bpp
<=
32
&&
(
image
->
width
&
7
)
==
0
)
fast_imageblit
(
image
,
p
,
dst1
,
fgcolor
,
bgcolor
);
else
...
...
drivers/video/tgafb.c
View file @
d335b16a
This diff is collapsed.
Click to expand it.
include/linux/fb.h
View file @
d335b16a
...
...
@@ -424,9 +424,11 @@ struct fb_info {
#define fb_readb __raw_readb
#define fb_readw __raw_readw
#define fb_readl __raw_readl
#define fb_readq __raw_readq
#define fb_writeb __raw_writeb
#define fb_writew __raw_writew
#define fb_writel __raw_writel
#define fb_writeq __raw_writeq
#define fb_memset memset_io
#else
...
...
drivers
/video/tgafb.h
→
include
/video/tgafb.h
View file @
d335b16a
...
...
@@ -13,17 +13,17 @@
#ifndef TGAFB_H
#define TGAFB_H
/*
* TGA hardware description (minimal)
*/
/*
* TGA hardware description (minimal)
*/
#define TGA_TYPE_8PLANE 0
#define TGA_TYPE_24PLANE 1
#define TGA_TYPE_24PLUSZ 3
/*
* Offsets within Memory Space
*/
/*
* Offsets within Memory Space
*/
#define TGA_ROM_OFFSET 0x0000000
#define TGA_REGS_OFFSET 0x0100000
...
...
@@ -52,9 +52,9 @@
#define TGA_CMD_STAT_REG 0x01f8
/*
* u
seful defines for managing the registers
*/
/*
* U
seful defines for managing the registers
*/
#define TGA_HORIZ_ODD 0x80000000
#define TGA_HORIZ_POLARITY 0x40000000
...
...
@@ -77,17 +77,17 @@
#define TGA_VALID_CURSOR 0x04
/*
* u
seful defines for managing the ICS1562 PLL clock
*/
/*
* U
seful defines for managing the ICS1562 PLL clock
*/
#define TGA_PLL_BASE_FREQ 14318
/* .18 */
#define TGA_PLL_MAX_FREQ 230000
/*
* u
seful defines for managing the BT485 on the 8-plane TGA
*/
/*
* U
seful defines for managing the BT485 on the 8-plane TGA
*/
#define BT485_READ_BIT 0x01
#define BT485_WRITE_BIT 0x00
...
...
@@ -111,9 +111,9 @@
#define BT485_CUR_HIGH_Y 0x1e
/*
* u
seful defines for managing the BT463 on the 24-plane TGAs
*/
/*
* U
seful defines for managing the BT463 on the 24-plane TGAs
*/
#define BT463_ADDR_LO 0x0
#define BT463_ADDR_HI 0x1
...
...
@@ -139,61 +139,72 @@
#define BT463_WINDOW_TYPE_BASE 0x0300
/*
* The framebuffer driver private data.
*/
/*
* Macros for reading/writing TGA and RAMDAC registers
*/
#define TGA_WRITE_REG(v,r) \
{ writel((v), fb_info.tga_regs_base+(r)); mb(); }
#define TGA_READ_REG(r) readl(fb_info.tga_regs_base+(r))
#define BT485_WRITE(v,r) \
TGA_WRITE_REG((r),TGA_RAMDAC_SETUP_REG); \
TGA_WRITE_REG(((v)&0xff)|((r)<<8),TGA_RAMDAC_REG);
#define BT463_LOAD_ADDR(a) \
TGA_WRITE_REG(BT463_ADDR_LO<<2, TGA_RAMDAC_SETUP_REG); \
TGA_WRITE_REG((BT463_ADDR_LO<<10)|((a)&0xff), TGA_RAMDAC_REG); \
TGA_WRITE_REG(BT463_ADDR_HI<<2, TGA_RAMDAC_SETUP_REG); \
TGA_WRITE_REG((BT463_ADDR_HI<<10)|(((a)>>8)&0xff), TGA_RAMDAC_REG);
#define BT463_WRITE(m,a,v) \
BT463_LOAD_ADDR((a)); \
TGA_WRITE_REG(((m)<<2),TGA_RAMDAC_SETUP_REG); \
TGA_WRITE_REG(((m)<<10)|((v)&0xff),TGA_RAMDAC_REG);
/*
* This structure describes the board.
*/
struct
tgafb_info
{
/* Use the generic framebuffer ops */
struct
fb_info_gen
gen
;
/* Device dependent information */
u8
tga_type
;
/* TGA_TYPE_XXX */
u8
tga_chip_rev
;
/* dc21030 revision */
u64
tga_mem_base
;
u64
tga_fb_base
;
u64
tga_regs_base
;
struct
fb_var_screeninfo
default_var
;
/* default video mode */
struct
tga_par
{
/* PCI device. */
struct
pci_dev
*
pdev
;
/* Device dependent information. */
void
*
tga_mem_base
;
void
*
tga_fb_base
;
void
*
tga_regs_base
;
u8
tga_type
;
/* TGA_TYPE_XXX */
u8
tga_chip_rev
;
/* dc21030 revision */
/* Remember blank mode. */
u8
vesa_blanked
;
/* Define the video mode. */
u32
xres
,
yres
;
/* resolution in pixels */
u32
htimings
;
/* horizontal timing register */
u32
vtimings
;
/* vertical timing register */
u32
pll_freq
;
/* pixclock in mhz */
u32
bits_per_pixel
;
/* bits per pixel */
u32
sync_on_green
;
/* set if sync is on green */
};
/*
* This structure uniquely defines a video mode.
*/
/*
* Macros for reading/writing TGA and RAMDAC registers
*/
struct
tgafb_par
{
u32
xres
,
yres
;
/* resolution in pixels */
u32
htimings
;
/* horizontal timing register */
u32
vtimings
;
/* vertical timing register */
u32
pll_freq
;
/* pixclock in mhz */
u32
bits_per_pixel
;
/* bits per pixel */
u32
sync_on_green
;
/* set if sync is on green */
};
static
inline
void
TGA_WRITE_REG
(
struct
tga_par
*
par
,
u32
v
,
u32
r
)
{
writel
(
v
,
par
->
tga_regs_base
+
r
);
}
static
inline
u32
TGA_READ_REG
(
struct
tga_par
*
par
,
u32
r
)
{
return
readl
(
par
->
tga_regs_base
+
r
);
}
static
inline
void
BT485_WRITE
(
struct
tga_par
*
par
,
u8
v
,
u8
r
)
{
TGA_WRITE_REG
(
par
,
r
,
TGA_RAMDAC_SETUP_REG
);
TGA_WRITE_REG
(
par
,
v
|
(
r
<<
8
),
TGA_RAMDAC_REG
);
}
static
inline
void
BT463_LOAD_ADDR
(
struct
tga_par
*
par
,
u16
a
)
{
TGA_WRITE_REG
(
par
,
BT463_ADDR_LO
<<
2
,
TGA_RAMDAC_SETUP_REG
);
TGA_WRITE_REG
(
par
,
(
BT463_ADDR_LO
<<
10
)
|
(
a
&
0xff
),
TGA_RAMDAC_REG
);
TGA_WRITE_REG
(
par
,
BT463_ADDR_HI
<<
2
,
TGA_RAMDAC_SETUP_REG
);
TGA_WRITE_REG
(
par
,
(
BT463_ADDR_HI
<<
10
)
|
(
a
>>
8
),
TGA_RAMDAC_REG
);
}
static
inline
void
BT463_WRITE
(
struct
tga_par
*
par
,
u32
m
,
u16
a
,
u8
v
)
{
BT463_LOAD_ADDR
(
par
,
a
);
TGA_WRITE_REG
(
par
,
m
<<
2
,
TGA_RAMDAC_SETUP_REG
);
TGA_WRITE_REG
(
par
,
m
<<
10
|
v
,
TGA_RAMDAC_REG
);
}
#endif
/* TGAFB_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment