Re: [PATCH] Export shmem_file_setup and shmem_getpage for DRM-GEM

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <nickpiggin@...>
Cc: <keithp@...>, Christoph Hellwig <hch@...>, Eric Anholt <eric@...>, <linux-kernel@...>
Date: Monday, August 4, 2008 - 6:26 am

On Mon, 2008-08-04 at 19:02 +1000, Nick Piggin wrote:


What I may be able to do is create a file, then hand it to my driver and
close the fd. That would avoid any ulimit or low-fd issues.


It seems fairly ugly to map the object to user space just to get page
pointers; the expense of constructing that mapping will be entirely
wasted most of the time.

Would it be imprudent to use pagecache_write_begin/pagecache_write_end
here? For shmem, that appears to point at functions which will do what I
need. Of course, it will cause extra page-outs as each page will be
marked dirty, even if the GPU never writes them.=20

While shmem offers good semantics for graphics objects, it doesn't seem
like it is unique in any way, and it seems like it should be possible to
do this operation on any file system.


There are some unique aspects to this operation which don't really have
parallels in other environments.

I'm doing memory management for a co-processor which uses the same pages
as the CPU. So, I need to allocate many pages that are just handed to
the GPU and never used by the CPU at all. Most rendering buffers are of
this form -- if you ever need to access them from the CPU, you've done
something terribly wrong.

Then there are textures which are constructed by the CPU (usually) and
handed over to the GPU for the entire lifetime of the application. These
are numerous enough that we need to be able to page them to disk; the
kernel driver will fault them back in when the GPU needs them again.

On the other hand, there are command and vertex buffers which are
constructed in user space and passed to the GPU for execution. These
operate just like any bulk-data transfer, and, in fact, I'm using the
pwrite API to transmit this data. For these buffers, the entire key is
to make sure you respect the various caches to keep them from getting
trashed.

--=20
keith.packard@intel.com
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] PCI: Add pci_read_base() API, Eric Anholt, (Fri Aug 1, 2:58 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Keith Packard, (Mon Aug 4, 6:26 am)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:30 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 12:20 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:34 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 10:16 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 1:32 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Stephane Marchesin, (Wed Aug 6, 2:09 pm)
Re: [PATCH] Export shmem_file_setup and shmem_getpage for DR..., Christoph Hellwig, (Sun Aug 10, 9:23 pm)
Re: [PATCH] Export shmem_file_setup for DRM-GEM, Keith Packard, (Sun Aug 10, 11:03 pm)