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
bfd83aca
Commit
bfd83aca
authored
Nov 12, 2010
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nv50: enable 4KiB pages for small vram allocations
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
4c136142
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
19 deletions
+25
-19
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/nouveau/nouveau_bo.c
+23
-18
drivers/gpu/drm/nouveau/nouveau_mem.c
drivers/gpu/drm/nouveau/nouveau_mem.c
+2
-1
No files found.
drivers/gpu/drm/nouveau/nouveau_bo.c
View file @
bfd83aca
...
@@ -54,39 +54,45 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
...
@@ -54,39 +54,45 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
}
}
static
void
static
void
nouveau_bo_fixup_align
(
struct
drm_device
*
dev
,
nouveau_bo_fixup_align
(
struct
nouveau_bo
*
nvbo
,
int
*
align
,
int
*
size
,
uint32_t
tile_mode
,
uint32_t
tile_flags
,
int
*
page_shift
)
int
*
align
,
int
*
size
)
{
{
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
drm_nouveau_private
*
dev_priv
=
nouveau_bdev
(
nvbo
->
bo
.
bdev
)
;
if
(
dev_priv
->
card_type
<
NV_50
)
{
if
(
dev_priv
->
card_type
<
NV_50
)
{
if
(
tile_mode
)
{
if
(
nvbo
->
tile_mode
)
{
if
(
dev_priv
->
chipset
>=
0x40
)
{
if
(
dev_priv
->
chipset
>=
0x40
)
{
*
align
=
65536
;
*
align
=
65536
;
*
size
=
roundup
(
*
size
,
64
*
tile_mode
);
*
size
=
roundup
(
*
size
,
64
*
nvbo
->
tile_mode
);
}
else
if
(
dev_priv
->
chipset
>=
0x30
)
{
}
else
if
(
dev_priv
->
chipset
>=
0x30
)
{
*
align
=
32768
;
*
align
=
32768
;
*
size
=
roundup
(
*
size
,
64
*
tile_mode
);
*
size
=
roundup
(
*
size
,
64
*
nvbo
->
tile_mode
);
}
else
if
(
dev_priv
->
chipset
>=
0x20
)
{
}
else
if
(
dev_priv
->
chipset
>=
0x20
)
{
*
align
=
16384
;
*
align
=
16384
;
*
size
=
roundup
(
*
size
,
64
*
tile_mode
);
*
size
=
roundup
(
*
size
,
64
*
nvbo
->
tile_mode
);
}
else
if
(
dev_priv
->
chipset
>=
0x10
)
{
}
else
if
(
dev_priv
->
chipset
>=
0x10
)
{
*
align
=
16384
;
*
align
=
16384
;
*
size
=
roundup
(
*
size
,
32
*
tile_mode
);
*
size
=
roundup
(
*
size
,
32
*
nvbo
->
tile_mode
);
}
}
}
}
}
else
{
if
(
likely
(
dev_priv
->
chan_vm
))
{
if
(
*
size
>
256
*
1024
)
*
page_shift
=
dev_priv
->
chan_vm
->
lpg_shift
;
else
*
page_shift
=
dev_priv
->
chan_vm
->
spg_shift
;
}
else
{
*
page_shift
=
12
;
}
*
size
=
roundup
(
*
size
,
(
1
<<
*
page_shift
));
*
align
=
max
((
1
<<
*
page_shift
),
*
align
);
}
}
/* ALIGN works only on powers of two. */
*
size
=
roundup
(
*
size
,
PAGE_SIZE
);
*
size
=
roundup
(
*
size
,
PAGE_SIZE
);
if
(
dev_priv
->
card_type
==
NV_50
)
{
*
size
=
roundup
(
*
size
,
65536
);
*
align
=
max
(
65536
,
*
align
);
}
}
}
int
int
...
@@ -97,7 +103,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
...
@@ -97,7 +103,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
{
{
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
drm_nouveau_private
*
dev_priv
=
dev
->
dev_private
;
struct
nouveau_bo
*
nvbo
;
struct
nouveau_bo
*
nvbo
;
int
ret
=
0
;
int
ret
=
0
,
page_shift
=
0
;
nvbo
=
kzalloc
(
sizeof
(
struct
nouveau_bo
),
GFP_KERNEL
);
nvbo
=
kzalloc
(
sizeof
(
struct
nouveau_bo
),
GFP_KERNEL
);
if
(
!
nvbo
)
if
(
!
nvbo
)
...
@@ -110,12 +116,11 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
...
@@ -110,12 +116,11 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
nvbo
->
tile_flags
=
tile_flags
;
nvbo
->
tile_flags
=
tile_flags
;
nvbo
->
bo
.
bdev
=
&
dev_priv
->
ttm
.
bdev
;
nvbo
->
bo
.
bdev
=
&
dev_priv
->
ttm
.
bdev
;
nouveau_bo_fixup_align
(
dev
,
tile_mode
,
nouveau_bo_tile_layout
(
nvbo
),
nouveau_bo_fixup_align
(
nvbo
,
&
align
,
&
size
,
&
page_shift
);
&
align
,
&
size
);
align
>>=
PAGE_SHIFT
;
align
>>=
PAGE_SHIFT
;
if
(
!
nvbo
->
no_vm
&&
dev_priv
->
chan_vm
)
{
if
(
!
nvbo
->
no_vm
&&
dev_priv
->
chan_vm
)
{
ret
=
nouveau_vm_get
(
dev_priv
->
chan_vm
,
size
,
16
,
ret
=
nouveau_vm_get
(
dev_priv
->
chan_vm
,
size
,
page_shift
,
NV_MEM_ACCESS_RW
,
&
nvbo
->
vma
);
NV_MEM_ACCESS_RW
,
&
nvbo
->
vma
);
if
(
ret
)
{
if
(
ret
)
{
kfree
(
nvbo
);
kfree
(
nvbo
);
...
...
drivers/gpu/drm/nouveau/nouveau_mem.c
View file @
bfd83aca
...
@@ -715,7 +715,8 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
...
@@ -715,7 +715,8 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
struct
nouveau_vram
*
vram
;
struct
nouveau_vram
*
vram
;
int
ret
;
int
ret
;
ret
=
nv50_vram_new
(
dev
,
mem
->
num_pages
<<
PAGE_SHIFT
,
65536
,
0
,
ret
=
nv50_vram_new
(
dev
,
mem
->
num_pages
<<
PAGE_SHIFT
,
mem
->
page_alignment
<<
PAGE_SHIFT
,
0
,
(
nvbo
->
tile_flags
>>
8
)
&
0x7f
,
&
vram
);
(
nvbo
->
tile_flags
>>
8
)
&
0x7f
,
&
vram
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
...
...
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