Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Xf86 Video Fbturbo
Commits
43236f5b
Commit
43236f5b
authored
Dec 27, 2006
by
Michel Dänzer
Browse files
Fix shadow framebuffer, and by extension rotation.
Based on Adam Jackson's shadow framebuffer fixes in xf86-video-vesa.
parent
643573a5
Changes
1
Show whitespace changes
Inline
Side-by-side
src/fbdev.c
View file @
43236f5b
...
@@ -63,11 +63,6 @@ static Bool FBDevDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
...
@@ -63,11 +63,6 @@ static Bool FBDevDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op,
enum
{
FBDEV_ROTATE_NONE
=
0
,
FBDEV_ROTATE_CW
=
270
,
FBDEV_ROTATE_UD
=
180
,
FBDEV_ROTATE_CCW
=
90
};
enum
{
FBDEV_ROTATE_NONE
=
0
,
FBDEV_ROTATE_CW
=
270
,
FBDEV_ROTATE_UD
=
180
,
FBDEV_ROTATE_CCW
=
90
};
/*static ShadowUpdateProc updateFuncs[] =
{ shadowUpdatePacked, shadowUpdateRotate8_270, shadowUpdateRotate8_180, shadowUpdateRotate8_90,
shadowUpdatePacked, shadowUpdateRotate16_270, shadowUpdateRotate16_180, shadowUpdateRotate16_90,
shadowUpdatePacked, shadowUpdateRotate32_270, shadowUpdateRotate32_180, shadowUpdateRotate32_90 }; */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
...
@@ -234,7 +229,9 @@ typedef struct {
...
@@ -234,7 +229,9 @@ typedef struct {
int
lineLength
;
int
lineLength
;
int
rotate
;
int
rotate
;
Bool
shadowFB
;
Bool
shadowFB
;
void
*
shadow
;
CloseScreenProcPtr
CloseScreen
;
CloseScreenProcPtr
CloseScreen
;
CreateScreenResourcesProcPtr
CreateScreenResources
;
void
(
*
PointerMoved
)(
int
index
,
int
x
,
int
y
);
void
(
*
PointerMoved
)(
int
index
,
int
x
,
int
y
);
EntityInfoPtr
pEnt
;
EntityInfoPtr
pEnt
;
/* DGA info */
/* DGA info */
...
@@ -613,33 +610,47 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
...
@@ -613,33 +610,47 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
return
TRUE
;
return
TRUE
;
}
}
static
Bool
static
Bool
FBDev
ShadowInit
(
ScreenPtr
pScreen
,
FBDevPtr
fPtr
)
FBDev
CreateScreenResources
(
ScreenPtr
pScreen
)
{
{
PixmapPtr
pPixmap
;
PixmapPtr
pPixmap
;
ShadowUpdateProc
update
;
ScrnInfoPtr
pScrn
=
xf86Screens
[
pScreen
->
myNum
];
ShadowWindowProc
window
;
FBDevPtr
fPtr
=
FBDEVPTR
(
pScrn
);
Bool
ret
;
pPixmap
=
pScreen
->
CreatePixmap
(
pScreen
,
pScreen
->
width
,
pScreen
->
height
,
pScreen
->
CreateScreenResources
=
fPtr
->
CreateScreenResources
;
pScreen
->
rootDepth
);
ret
=
pScreen
->
CreateScreenResources
(
pScreen
);
if
(
!
pPixmap
)
pScreen
->
CreateScreenResources
=
FBDevCreateScreenResources
;
if
(
!
ret
)
return
FALSE
;
return
FALSE
;
if
(
!
shadowSetup
(
pScreen
))
{
pPixmap
=
pScreen
->
GetScreenPixmap
(
pScreen
);
pScreen
->
DestroyPixmap
(
pPixmap
);
if
(
!
shadowAdd
(
pScreen
,
pPixmap
,
fPtr
->
rotate
?
shadowUpdateRotatePackedWeak
()
:
shadowUpdatePackedWeak
(),
FBDevWindowLinear
,
fPtr
->
rotate
,
NULL
))
{
return
FALSE
;
return
FALSE
;
}
}
update
=
fPtr
->
rotate
?
shadowUpdateRotatePackedWeak
()
return
TRUE
;
:
shadowUpdatePackedWeak
();
}
static
Bool
FBDevShadowInit
(
ScreenPtr
pScreen
)
{
ScrnInfoPtr
pScrn
=
xf86Screens
[
pScreen
->
myNum
];
FBDevPtr
fPtr
=
FBDEVPTR
(
pScrn
);
if
(
!
shadowAdd
(
pScreen
,
pPixmap
,
update
,
FBDevWindowLinear
,
if
(
!
shadowSetup
(
pScreen
))
{
fPtr
->
rotate
,
NULL
))
{
pScreen
->
DestroyPixmap
(
pPixmap
);
return
FALSE
;
return
FALSE
;
}
else
{
return
TRUE
;
}
}
fPtr
->
CreateScreenResources
=
pScreen
->
CreateScreenResources
;
pScreen
->
CreateScreenResources
=
FBDevCreateScreenResources
;
return
TRUE
;
}
}
...
@@ -650,7 +661,7 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
...
@@ -650,7 +661,7 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
FBDevPtr
fPtr
=
FBDEVPTR
(
pScrn
);
FBDevPtr
fPtr
=
FBDEVPTR
(
pScrn
);
VisualPtr
visual
;
VisualPtr
visual
;
int
init_picture
=
0
;
int
init_picture
=
0
;
int
ret
,
flags
,
width
,
height
;
int
ret
,
flags
;
int
type
;
int
type
;
TRACE_ENTER
(
"FBDevScreenInit"
);
TRACE_ENTER
(
"FBDevScreenInit"
);
...
@@ -707,11 +718,9 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
...
@@ -707,11 +718,9 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if
(
fPtr
->
rotate
==
FBDEV_ROTATE_CW
||
fPtr
->
rotate
==
FBDEV_ROTATE_CCW
)
if
(
fPtr
->
rotate
==
FBDEV_ROTATE_CW
||
fPtr
->
rotate
==
FBDEV_ROTATE_CCW
)
{
{
height
=
pScrn
->
virtualX
;
int
tmp
=
pScrn
->
virtualX
;
width
=
pScrn
->
displayWidth
=
pScrn
->
virtualY
;
pScrn
->
virtualX
=
pScrn
->
displayWidth
=
pScrn
->
virtualY
;
}
else
{
pScrn
->
virtualY
=
tmp
;
height
=
pScrn
->
virtualY
;
width
=
pScrn
->
virtualX
;
}
}
if
(
fPtr
->
rotate
&&
!
fPtr
->
PointerMoved
)
{
if
(
fPtr
->
rotate
&&
!
fPtr
->
PointerMoved
)
{
...
@@ -721,6 +730,17 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
...
@@ -721,6 +730,17 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
fPtr
->
fbstart
=
fPtr
->
fbmem
+
fPtr
->
fboff
;
fPtr
->
fbstart
=
fPtr
->
fbmem
+
fPtr
->
fboff
;
if
(
fPtr
->
shadowFB
)
{
fPtr
->
shadow
=
xcalloc
(
1
,
pScrn
->
virtualX
*
pScrn
->
virtualY
*
pScrn
->
bitsPerPixel
);
if
(
!
fPtr
->
shadow
)
{
xf86DrvMsg
(
pScrn
->
scrnIndex
,
X_ERROR
,
"Failed to allocate shadow framebuffer
\n
"
);
return
FALSE
;
}
}
switch
((
type
=
fbdevHWGetType
(
pScrn
)))
switch
((
type
=
fbdevHWGetType
(
pScrn
)))
{
{
#ifdef USE_AFB
#ifdef USE_AFB
...
@@ -751,8 +771,11 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
...
@@ -751,8 +771,11 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
case
16
:
case
16
:
case
24
:
case
24
:
case
32
:
case
32
:
ret
=
fbScreenInit
(
pScreen
,
fPtr
->
fbstart
,
width
,
height
,
ret
=
fbScreenInit
(
pScreen
,
fPtr
->
shadowFB
?
fPtr
->
shadow
pScrn
->
xDpi
,
pScrn
->
yDpi
,
pScrn
->
displayWidth
,
pScrn
->
bitsPerPixel
);
:
fPtr
->
fbstart
,
pScrn
->
virtualX
,
pScrn
->
virtualY
,
pScrn
->
xDpi
,
pScrn
->
yDpi
,
pScrn
->
displayWidth
,
pScrn
->
bitsPerPixel
);
init_picture
=
1
;
init_picture
=
1
;
break
;
break
;
default:
default:
...
@@ -817,7 +840,7 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
...
@@ -817,7 +840,7 @@ FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg
(
pScrn
->
scrnIndex
,
X_WARNING
,
xf86DrvMsg
(
pScrn
->
scrnIndex
,
X_WARNING
,
"Render extension initialisation failed
\n
"
);
"Render extension initialisation failed
\n
"
);
if
(
fPtr
->
shadowFB
&&
!
FBDevShadowInit
(
pScreen
,
fPtr
))
{
if
(
fPtr
->
shadowFB
&&
!
FBDevShadowInit
(
pScreen
))
{
xf86DrvMsg
(
scrnIndex
,
X_ERROR
,
xf86DrvMsg
(
scrnIndex
,
X_ERROR
,
"shadow framebuffer initialization failed
\n
"
);
"shadow framebuffer initialization failed
\n
"
);
return
FALSE
;
return
FALSE
;
...
@@ -920,6 +943,10 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
...
@@ -920,6 +943,10 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
fbdevHWRestore
(
pScrn
);
fbdevHWRestore
(
pScrn
);
fbdevHWUnmapVidmem
(
pScrn
);
fbdevHWUnmapVidmem
(
pScrn
);
if
(
fPtr
->
shadow
)
{
xfree
(
fPtr
->
shadow
);
fPtr
->
shadow
=
NULL
;
}
if
(
fPtr
->
pDGAMode
)
{
if
(
fPtr
->
pDGAMode
)
{
xfree
(
fPtr
->
pDGAMode
);
xfree
(
fPtr
->
pDGAMode
);
fPtr
->
pDGAMode
=
NULL
;
fPtr
->
pDGAMode
=
NULL
;
...
@@ -927,6 +954,7 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
...
@@ -927,6 +954,7 @@ FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen)
}
}
pScrn
->
vtSema
=
FALSE
;
pScrn
->
vtSema
=
FALSE
;
pScreen
->
CreateScreenResources
=
fPtr
->
CreateScreenResources
;
pScreen
->
CloseScreen
=
fPtr
->
CloseScreen
;
pScreen
->
CloseScreen
=
fPtr
->
CloseScreen
;
return
(
*
pScreen
->
CloseScreen
)(
scrnIndex
,
pScreen
);
return
(
*
pScreen
->
CloseScreen
)(
scrnIndex
,
pScreen
);
}
}
...
@@ -952,7 +980,7 @@ FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
...
@@ -952,7 +980,7 @@ FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
else
else
*
size
=
fPtr
->
lineLength
=
fbdevHWGetLineLength
(
pScrn
);
*
size
=
fPtr
->
lineLength
=
fbdevHWGetLineLength
(
pScrn
);
return
((
CARD8
*
)
fPtr
->
fb
mem
+
fPtr
->
fboff
+
row
*
fPtr
->
lineLength
+
offset
);
return
((
CARD8
*
)
fPtr
->
fb
start
+
row
*
fPtr
->
lineLength
+
offset
);
}
}
static
void
static
void
...
...
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