Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Allow compiling the virtio-gpu driver #119

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SYSDIR?=/usr/src/sys
.include "${SYSDIR}/conf/kern.opts.mk"

_VALID_KMODS= linuxkpi ttm drm dummygfx i915 amd radeon
_VALID_KMODS= linuxkpi ttm drm dummygfx i915 amd radeon virtio-gpu

SUPPORTED_ARCH= amd64 \
i386 \
Expand Down
18 changes: 16 additions & 2 deletions drivers/gpu/drm/drm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ int drm_gem_create_mmap_offset(struct drm_gem_object *obj)
}
EXPORT_SYMBOL(drm_gem_create_mmap_offset);

#ifdef __linux__
/*
* Move pages to appropriate lru and release the pagevec, decrementing the
* ref count of those pages.
Expand Down Expand Up @@ -557,13 +556,21 @@ static void drm_gem_check_release_pagevec(struct pagevec *pvec)
*/
struct page **drm_gem_get_pages(struct drm_gem_object *obj)
{
#ifdef __FreeBSD__
vm_object_t mapping;
#else
struct address_space *mapping;
#endif
struct page *p, **pages;
struct pagevec pvec;
int i, npages;

/* This is the shared memory object that backs the GEM resource */
#ifdef __FreeBSD__
mapping = obj->filp->f_shmem;
#else
mapping = obj->filp->f_mapping;
#endif

/* We already BUG_ON() for non-page-aligned sizes in
* drm_gem_object_init(), so we should never hit this unless
Expand Down Expand Up @@ -622,10 +629,18 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
bool dirty, bool accessed)
{
int i, npages;
#ifdef __FreeBSD__
vm_object_t mapping;
#else
struct address_space *mapping;
#endif
struct pagevec pvec;

#ifdef __FreeBSD__
mapping = obj->filp->f_shmem; // FIXME: is this right?
#else
mapping = file_inode(obj->filp)->i_mapping;
#endif
mapping_clear_unevictable(mapping);

/* We already BUG_ON() for non-page-aligned sizes in
Expand Down Expand Up @@ -657,7 +672,6 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
kvfree(pages);
}
EXPORT_SYMBOL(drm_gem_put_pages);
#endif

static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
struct drm_gem_object **objs)
Expand Down
Loading