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
ddbaf79a
Commit
ddbaf79a
authored
Nov 24, 2010
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nvc0: implement fbcon acceleration
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
966a5b7d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
300 additions
and
6 deletions
+300
-6
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/Makefile
+3
-2
drivers/gpu/drm/nouveau/nouveau_fbcon.c
drivers/gpu/drm/nouveau/nouveau_fbcon.c
+20
-4
drivers/gpu/drm/nouveau/nouveau_fbcon.h
drivers/gpu/drm/nouveau/nouveau_fbcon.h
+6
-0
drivers/gpu/drm/nouveau/nvc0_fbcon.c
drivers/gpu/drm/nouveau/nvc0_fbcon.c
+271
-0
No files found.
drivers/gpu/drm/nouveau/Makefile
View file @
ddbaf79a
...
@@ -22,9 +22,10 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
...
@@ -22,9 +22,10 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
nv84_crypt.o
\
nv84_crypt.o
\
nv04_instmem.o nv50_instmem.o nvc0_instmem.o
\
nv04_instmem.o nv50_instmem.o nvc0_instmem.o
\
nv50_evo.o nv50_crtc.o nv50_dac.o nv50_sor.o
\
nv50_evo.o nv50_crtc.o nv50_dac.o nv50_sor.o
\
nv50_cursor.o nv50_display.o
nv50_fbcon.o
\
nv50_cursor.o nv50_display.o
\
nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o
\
nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o
\
nv04_crtc.o nv04_display.o nv04_cursor.o nv04_fbcon.o
\
nv04_crtc.o nv04_display.o nv04_cursor.o
\
nv04_fbcon.o nv50_fbcon.o nvc0_fbcon.o
\
nv10_gpio.o nv50_gpio.o
\
nv10_gpio.o nv50_gpio.o
\
nv50_calc.o
\
nv50_calc.o
\
nv04_pm.o nv50_pm.o nva3_pm.o
\
nv04_pm.o nv50_pm.o nva3_pm.o
\
...
...
drivers/gpu/drm/nouveau/nouveau_fbcon.c
View file @
ddbaf79a
...
@@ -68,6 +68,8 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
...
@@ -68,6 +68,8 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
else
else
if
(
dev_priv
->
card_type
<
NV_C0
)
if
(
dev_priv
->
card_type
<
NV_C0
)
ret
=
nv50_fbcon_fillrect
(
info
,
rect
);
ret
=
nv50_fbcon_fillrect
(
info
,
rect
);
else
ret
=
nvc0_fbcon_fillrect
(
info
,
rect
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
}
}
...
@@ -98,6 +100,8 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image)
...
@@ -98,6 +100,8 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image)
else
else
if
(
dev_priv
->
card_type
<
NV_C0
)
if
(
dev_priv
->
card_type
<
NV_C0
)
ret
=
nv50_fbcon_copyarea
(
info
,
image
);
ret
=
nv50_fbcon_copyarea
(
info
,
image
);
else
ret
=
nvc0_fbcon_copyarea
(
info
,
image
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
}
}
...
@@ -128,6 +132,8 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
...
@@ -128,6 +132,8 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
else
else
if
(
dev_priv
->
card_type
<
NV_C0
)
if
(
dev_priv
->
card_type
<
NV_C0
)
ret
=
nv50_fbcon_imageblit
(
info
,
image
);
ret
=
nv50_fbcon_imageblit
(
info
,
image
);
else
ret
=
nvc0_fbcon_imageblit
(
info
,
image
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
mutex_unlock
(
&
dev_priv
->
channel
->
mutex
);
}
}
...
@@ -163,10 +169,18 @@ nouveau_fbcon_sync(struct fb_info *info)
...
@@ -163,10 +169,18 @@ nouveau_fbcon_sync(struct fb_info *info)
return
0
;
return
0
;
}
}
if
(
dev_priv
->
card_type
>=
NV_C0
)
{
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x010c
,
1
);
OUT_RING
(
chan
,
0
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0100
,
1
);
OUT_RING
(
chan
,
0
);
}
else
{
BEGIN_RING
(
chan
,
0
,
0x0104
,
1
);
BEGIN_RING
(
chan
,
0
,
0x0104
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
0
);
BEGIN_RING
(
chan
,
0
,
0x0100
,
1
);
BEGIN_RING
(
chan
,
0
,
0x0100
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
0
);
}
nouveau_bo_wr32
(
chan
->
notifier_bo
,
chan
->
m2mf_ntfy
+
3
,
0xffffffff
);
nouveau_bo_wr32
(
chan
->
notifier_bo
,
chan
->
m2mf_ntfy
+
3
,
0xffffffff
);
FIRE_RING
(
chan
);
FIRE_RING
(
chan
);
mutex_unlock
(
&
chan
->
mutex
);
mutex_unlock
(
&
chan
->
mutex
);
...
@@ -374,6 +388,8 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
...
@@ -374,6 +388,8 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
else
else
if
(
dev_priv
->
card_type
<
NV_C0
)
if
(
dev_priv
->
card_type
<
NV_C0
)
ret
=
nv50_fbcon_accel_init
(
info
);
ret
=
nv50_fbcon_accel_init
(
info
);
else
ret
=
nvc0_fbcon_accel_init
(
info
);
if
(
ret
==
0
)
if
(
ret
==
0
)
info
->
fbops
=
&
nouveau_fbcon_ops
;
info
->
fbops
=
&
nouveau_fbcon_ops
;
...
...
drivers/gpu/drm/nouveau/nouveau_fbcon.h
View file @
ddbaf79a
...
@@ -44,11 +44,17 @@ int nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region);
...
@@ -44,11 +44,17 @@ int nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region);
int
nv04_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
);
int
nv04_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
);
int
nv04_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
);
int
nv04_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
);
int
nv04_fbcon_accel_init
(
struct
fb_info
*
info
);
int
nv04_fbcon_accel_init
(
struct
fb_info
*
info
);
int
nv50_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
);
int
nv50_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
);
int
nv50_fbcon_copyarea
(
struct
fb_info
*
info
,
const
struct
fb_copyarea
*
region
);
int
nv50_fbcon_copyarea
(
struct
fb_info
*
info
,
const
struct
fb_copyarea
*
region
);
int
nv50_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
);
int
nv50_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
);
int
nv50_fbcon_accel_init
(
struct
fb_info
*
info
);
int
nv50_fbcon_accel_init
(
struct
fb_info
*
info
);
int
nvc0_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
);
int
nvc0_fbcon_copyarea
(
struct
fb_info
*
info
,
const
struct
fb_copyarea
*
region
);
int
nvc0_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
);
int
nvc0_fbcon_accel_init
(
struct
fb_info
*
info
);
void
nouveau_fbcon_gpu_lockup
(
struct
fb_info
*
info
);
void
nouveau_fbcon_gpu_lockup
(
struct
fb_info
*
info
);
int
nouveau_fbcon_init
(
struct
drm_device
*
dev
);
int
nouveau_fbcon_init
(
struct
drm_device
*
dev
);
...
...
drivers/gpu/drm/nouveau/nvc0_fbcon.c
0 → 100644
View file @
ddbaf79a
/*
* Copyright 2010 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "drmP.h"
#include "nouveau_drv.h"
#include "nouveau_dma.h"
#include "nouveau_ramht.h"
#include "nouveau_fbcon.h"
#include "nouveau_mm.h"
int
nvc0_fbcon_fillrect
(
struct
fb_info
*
info
,
const
struct
fb_fillrect
*
rect
)
{
struct
nouveau_fbdev
*
nfbdev
=
info
->
par
;
struct
drm_device
*
dev
=
nfbdev
->
dev
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_channel
*
chan
=
dev_priv
->
channel
;
int
ret
;
ret
=
RING_SPACE
(
chan
,
rect
->
rop
==
ROP_COPY
?
7
:
11
);
if
(
ret
)
return
ret
;
if
(
rect
->
rop
!=
ROP_COPY
)
{
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x02ac
,
1
);
OUT_RING
(
chan
,
1
);
}
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0588
,
1
);
if
(
info
->
fix
.
visual
==
FB_VISUAL_TRUECOLOR
||
info
->
fix
.
visual
==
FB_VISUAL_DIRECTCOLOR
)
OUT_RING
(
chan
,
((
uint32_t
*
)
info
->
pseudo_palette
)[
rect
->
color
]);
else
OUT_RING
(
chan
,
rect
->
color
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0600
,
4
);
OUT_RING
(
chan
,
rect
->
dx
);
OUT_RING
(
chan
,
rect
->
dy
);
OUT_RING
(
chan
,
rect
->
dx
+
rect
->
width
);
OUT_RING
(
chan
,
rect
->
dy
+
rect
->
height
);
if
(
rect
->
rop
!=
ROP_COPY
)
{
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x02ac
,
1
);
OUT_RING
(
chan
,
3
);
}
FIRE_RING
(
chan
);
return
0
;
}
int
nvc0_fbcon_copyarea
(
struct
fb_info
*
info
,
const
struct
fb_copyarea
*
region
)
{
struct
nouveau_fbdev
*
nfbdev
=
info
->
par
;
struct
drm_device
*
dev
=
nfbdev
->
dev
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_channel
*
chan
=
dev_priv
->
channel
;
int
ret
;
ret
=
RING_SPACE
(
chan
,
12
);
if
(
ret
)
return
ret
;
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0110
,
1
);
OUT_RING
(
chan
,
0
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x08b0
,
4
);
OUT_RING
(
chan
,
region
->
dx
);
OUT_RING
(
chan
,
region
->
dy
);
OUT_RING
(
chan
,
region
->
width
);
OUT_RING
(
chan
,
region
->
height
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x08d0
,
4
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
region
->
sx
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
region
->
sy
);
FIRE_RING
(
chan
);
return
0
;
}
int
nvc0_fbcon_imageblit
(
struct
fb_info
*
info
,
const
struct
fb_image
*
image
)
{
struct
nouveau_fbdev
*
nfbdev
=
info
->
par
;
struct
drm_device
*
dev
=
nfbdev
->
dev
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_channel
*
chan
=
dev_priv
->
channel
;
uint32_t
width
,
dwords
,
*
data
=
(
uint32_t
*
)
image
->
data
;
uint32_t
mask
=
~
(
~
0
>>
(
32
-
info
->
var
.
bits_per_pixel
));
uint32_t
*
palette
=
info
->
pseudo_palette
;
int
ret
;
if
(
image
->
depth
!=
1
)
return
-
ENODEV
;
ret
=
RING_SPACE
(
chan
,
11
);
if
(
ret
)
return
ret
;
width
=
ALIGN
(
image
->
width
,
32
);
dwords
=
(
width
*
image
->
height
)
>>
5
;
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0814
,
2
);
if
(
info
->
fix
.
visual
==
FB_VISUAL_TRUECOLOR
||
info
->
fix
.
visual
==
FB_VISUAL_DIRECTCOLOR
)
{
OUT_RING
(
chan
,
palette
[
image
->
bg_color
]
|
mask
);
OUT_RING
(
chan
,
palette
[
image
->
fg_color
]
|
mask
);
}
else
{
OUT_RING
(
chan
,
image
->
bg_color
);
OUT_RING
(
chan
,
image
->
fg_color
);
}
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0838
,
2
);
OUT_RING
(
chan
,
image
->
width
);
OUT_RING
(
chan
,
image
->
height
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0850
,
4
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
image
->
dx
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
image
->
dy
);
while
(
dwords
)
{
int
push
=
dwords
>
2047
?
2047
:
dwords
;
ret
=
RING_SPACE
(
chan
,
push
+
1
);
if
(
ret
)
return
ret
;
dwords
-=
push
;
BEGIN_NVC0
(
chan
,
6
,
NvSub2D
,
0x0860
,
push
);
OUT_RINGp
(
chan
,
data
,
push
);
data
+=
push
;
}
FIRE_RING
(
chan
);
return
0
;
}
int
nvc0_fbcon_accel_init
(
struct
fb_info
*
info
)
{
struct
nouveau_fbdev
*
nfbdev
=
info
->
par
;
struct
drm_device
*
dev
=
nfbdev
->
dev
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_channel
*
chan
=
dev_priv
->
channel
;
struct
nouveau_bo
*
nvbo
=
nfbdev
->
nouveau_fb
.
nvbo
;
int
ret
,
format
;
ret
=
nouveau_gpuobj_gr_new
(
chan
,
0x902d
,
0x902d
);
if
(
ret
)
return
ret
;
switch
(
info
->
var
.
bits_per_pixel
)
{
case
8
:
format
=
0xf3
;
break
;
case
15
:
format
=
0xf8
;
break
;
case
16
:
format
=
0xe8
;
break
;
case
32
:
switch
(
info
->
var
.
transp
.
length
)
{
case
0
:
/* depth 24 */
case
8
:
/* depth 32, just use 24.. */
format
=
0xe6
;
break
;
case
2
:
/* depth 30 */
format
=
0xd1
;
break
;
default:
return
-
EINVAL
;
}
break
;
default:
return
-
EINVAL
;
}
ret
=
RING_SPACE
(
chan
,
60
);
if
(
ret
)
{
WARN_ON
(
1
);
nouveau_fbcon_gpu_lockup
(
info
);
return
ret
;
}
printk
(
KERN_ERR
"fb vma 0x%010llx
\n
"
,
nvbo
->
vma
.
offset
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0000
,
1
);
OUT_RING
(
chan
,
0x0000902d
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0104
,
2
);
OUT_RING
(
chan
,
upper_32_bits
(
chan
->
notifier_bo
->
bo
.
offset
));
OUT_RING
(
chan
,
lower_32_bits
(
chan
->
notifier_bo
->
bo
.
offset
));
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0290
,
1
);
OUT_RING
(
chan
,
0
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0888
,
1
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x02ac
,
1
);
OUT_RING
(
chan
,
3
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x02a0
,
1
);
OUT_RING
(
chan
,
0x55
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x08c0
,
4
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0580
,
2
);
OUT_RING
(
chan
,
4
);
OUT_RING
(
chan
,
format
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x02e8
,
2
);
OUT_RING
(
chan
,
2
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0804
,
1
);
OUT_RING
(
chan
,
format
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0800
,
1
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0808
,
3
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x081c
,
1
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0840
,
4
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0200
,
10
);
OUT_RING
(
chan
,
format
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
info
->
fix
.
line_length
);
OUT_RING
(
chan
,
info
->
var
.
xres_virtual
);
OUT_RING
(
chan
,
info
->
var
.
yres_virtual
);
OUT_RING
(
chan
,
upper_32_bits
(
nvbo
->
vma
.
offset
));
OUT_RING
(
chan
,
lower_32_bits
(
nvbo
->
vma
.
offset
));
BEGIN_NVC0
(
chan
,
2
,
NvSub2D
,
0x0230
,
10
);
OUT_RING
(
chan
,
format
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
1
);
OUT_RING
(
chan
,
0
);
OUT_RING
(
chan
,
info
->
fix
.
line_length
);
OUT_RING
(
chan
,
info
->
var
.
xres_virtual
);
OUT_RING
(
chan
,
info
->
var
.
yres_virtual
);
OUT_RING
(
chan
,
upper_32_bits
(
nvbo
->
vma
.
offset
));
OUT_RING
(
chan
,
lower_32_bits
(
nvbo
->
vma
.
offset
));
FIRE_RING
(
chan
);
return
0
;
}
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