Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xcap
xcap-capability-linux
Commits
35916ace
Commit
35916ace
authored
May 31, 2012
by
Dave Airlie
Browse files
nouveau: add vmap support to nouveau prime support
Tested sharing to udl. Signed-off-by:
Dave Airlie
<
airlied@redhat.com
>
parent
e8aa1d1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
drivers/gpu/drm/nouveau/nouveau_drv.h
View file @
35916ace
...
...
@@ -123,6 +123,9 @@ struct nouveau_bo {
struct
drm_gem_object
*
gem
;
int
pin_refcnt
;
struct
ttm_bo_kmap_obj
dma_buf_vmap
;
int
vmapping_count
;
};
#define nouveau_bo_tile_layout(nvbo) \
...
...
drivers/gpu/drm/nouveau/nouveau_prime.c
View file @
35916ace
...
...
@@ -66,6 +66,43 @@ static int nouveau_gem_prime_mmap(struct dma_buf *dma_buf, struct vm_area_struct
return
-
EINVAL
;
}
static
void
*
nouveau_gem_prime_vmap
(
struct
dma_buf
*
dma_buf
)
{
struct
nouveau_bo
*
nvbo
=
dma_buf
->
priv
;
struct
drm_device
*
dev
=
nvbo
->
gem
->
dev
;
int
ret
;
mutex_lock
(
&
dev
->
struct_mutex
);
if
(
nvbo
->
vmapping_count
)
{
nvbo
->
vmapping_count
++
;
goto
out_unlock
;
}
ret
=
ttm_bo_kmap
(
&
nvbo
->
bo
,
0
,
nvbo
->
bo
.
num_pages
,
&
nvbo
->
dma_buf_vmap
);
if
(
ret
)
{
mutex_unlock
(
&
dev
->
struct_mutex
);
return
ERR_PTR
(
ret
);
}
nvbo
->
vmapping_count
=
1
;
out_unlock:
mutex_unlock
(
&
dev
->
struct_mutex
);
return
nvbo
->
dma_buf_vmap
.
virtual
;
}
static
void
nouveau_gem_prime_vunmap
(
struct
dma_buf
*
dma_buf
,
void
*
vaddr
)
{
struct
nouveau_bo
*
nvbo
=
dma_buf
->
priv
;
struct
drm_device
*
dev
=
nvbo
->
gem
->
dev
;
mutex_lock
(
&
dev
->
struct_mutex
);
nvbo
->
vmapping_count
--
;
if
(
nvbo
->
vmapping_count
==
0
)
{
ttm_bo_kunmap
(
&
nvbo
->
dma_buf_vmap
);
}
mutex_unlock
(
&
dev
->
struct_mutex
);
}
static
const
struct
dma_buf_ops
nouveau_dmabuf_ops
=
{
.
map_dma_buf
=
nouveau_gem_map_dma_buf
,
.
unmap_dma_buf
=
nouveau_gem_unmap_dma_buf
,
...
...
@@ -75,6 +112,8 @@ static const struct dma_buf_ops nouveau_dmabuf_ops = {
.
kunmap
=
nouveau_gem_kunmap
,
.
kunmap_atomic
=
nouveau_gem_kunmap_atomic
,
.
mmap
=
nouveau_gem_prime_mmap
,
.
vmap
=
nouveau_gem_prime_vmap
,
.
vunmap
=
nouveau_gem_prime_vunmap
,
};
static
int
...
...
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