Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
vmwgfx_resource.c File Reference
#include "vmwgfx_drv.h"
#include <drm/vmwgfx_drm.h>
#include <drm/ttm/ttm_object.h>
#include <drm/ttm/ttm_placement.h>
#include <drm/drmP.h>

Go to the source code of this file.

Data Structures

struct  vmw_user_context
 
struct  vmw_user_surface
 
struct  vmw_user_dma_buffer
 
struct  vmw_bo_user_rep
 
struct  vmw_stream
 
struct  vmw_user_stream
 
struct  vmw_surface_offset
 
struct  vmw_bpp
 
struct  vmw_surface_dma
 
struct  vmw_surface_define
 
struct  vmw_surface_destroy
 

Functions

struct vmw_resourcevmw_resource_reference (struct vmw_resource *res)
 
void vmw_resource_unreference (struct vmw_resource **p_res)
 
struct vmw_resourcevmw_resource_lookup (struct vmw_private *dev_priv, struct idr *idr, int id)
 
struct vmw_resourcevmw_context_alloc (struct vmw_private *dev_priv)
 
int vmw_context_destroy_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_context_define_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_context_check (struct vmw_private *dev_priv, struct ttm_object_file *tfile, int id, struct vmw_resource **p_res)
 
void vmw_surface_res_free (struct vmw_resource *res)
 
int vmw_surface_do_validate (struct vmw_private *dev_priv, struct vmw_surface *srf)
 
int vmw_surface_evict (struct vmw_private *dev_priv, struct vmw_surface *srf)
 
int vmw_surface_validate (struct vmw_private *dev_priv, struct vmw_surface *srf)
 
int vmw_surface_init (struct vmw_private *dev_priv, struct vmw_surface *srf, void(*res_free)(struct vmw_resource *res))
 
void vmw_resource_unreserve (struct list_head *list)
 
int vmw_user_lookup_handle (struct vmw_private *dev_priv, struct ttm_object_file *tfile, uint32_t handle, struct vmw_surface **out_surf, struct vmw_dma_buffer **out_buf)
 
int vmw_user_surface_lookup_handle (struct vmw_private *dev_priv, struct ttm_object_file *tfile, uint32_t handle, struct vmw_surface **out)
 
int vmw_surface_destroy_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_surface_define_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_surface_reference_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_surface_check (struct vmw_private *dev_priv, struct ttm_object_file *tfile, uint32_t handle, int *id)
 
void vmw_dmabuf_bo_free (struct ttm_buffer_object *bo)
 
int vmw_dmabuf_init (struct vmw_private *dev_priv, struct vmw_dma_buffer *vmw_bo, size_t size, struct ttm_placement *placement, bool interruptible, void(*bo_free)(struct ttm_buffer_object *bo))
 
int vmw_dmabuf_alloc_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_dmabuf_unref_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
uint32_t vmw_dmabuf_validate_node (struct ttm_buffer_object *bo, uint32_t cur_validate_node)
 
void vmw_dmabuf_validate_clear (struct ttm_buffer_object *bo)
 
int vmw_user_dmabuf_lookup (struct ttm_object_file *tfile, uint32_t handle, struct vmw_dma_buffer **out)
 
int vmw_stream_unref_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_stream_claim_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_user_stream_lookup (struct vmw_private *dev_priv, struct ttm_object_file *tfile, uint32_t *inout_id, struct vmw_resource **out)
 
int vmw_dumb_create (struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args)
 
int vmw_dumb_map_offset (struct drm_file *file_priv, struct drm_device *dev, uint32_t handle, uint64_t *offset)
 
int vmw_dumb_destroy (struct drm_file *file_priv, struct drm_device *dev, uint32_t handle)
 

Function Documentation

struct vmw_resource* vmw_context_alloc ( struct vmw_private dev_priv)
read

Resource utilities - vmwgfx_resource.c

Definition at line 332 of file vmwgfx_resource.c.

int vmw_context_check ( struct vmw_private dev_priv,
struct ttm_object_file tfile,
int  id,
struct vmw_resource **  p_res 
)

Definition at line 479 of file vmwgfx_resource.c.

int vmw_context_define_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 406 of file vmwgfx_resource.c.

int vmw_context_destroy_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 375 of file vmwgfx_resource.c.

int vmw_dmabuf_alloc_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1597 of file vmwgfx_resource.c.

void vmw_dmabuf_bo_free ( struct ttm_buffer_object bo)

Buffer management.

Definition at line 1543 of file vmwgfx_resource.c.

int vmw_dmabuf_init ( struct vmw_private dev_priv,
struct vmw_dma_buffer vmw_bo,
size_t  size,
struct ttm_placement placement,
bool  interruptible,
void(*)(struct ttm_buffer_object *bo)  bo_free 
)

Definition at line 1550 of file vmwgfx_resource.c.

int vmw_dmabuf_unref_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1649 of file vmwgfx_resource.c.

void vmw_dmabuf_validate_clear ( struct ttm_buffer_object bo)

Definition at line 1674 of file vmwgfx_resource.c.

uint32_t vmw_dmabuf_validate_node ( struct ttm_buffer_object bo,
uint32_t  cur_validate_node 
)

Definition at line 1660 of file vmwgfx_resource.c.

int vmw_dumb_create ( struct drm_file *  file_priv,
struct drm_device dev,
struct drm_mode_create_dumb args 
)

Definition at line 1922 of file vmwgfx_resource.c.

int vmw_dumb_destroy ( struct drm_file *  file_priv,
struct drm_device dev,
uint32_t  handle 
)

Definition at line 1986 of file vmwgfx_resource.c.

int vmw_dumb_map_offset ( struct drm_file *  file_priv,
struct drm_device dev,
uint32_t  handle,
uint64_t offset 
)

Definition at line 1969 of file vmwgfx_resource.c.

struct vmw_resource* vmw_resource_lookup ( struct vmw_private dev_priv,
struct idr idr,
int  id 
)
read

Definition at line 233 of file vmwgfx_resource.c.

struct vmw_resource* vmw_resource_reference ( struct vmw_resource res)
read

Definition at line 89 of file vmwgfx_resource.c.

void vmw_resource_unreference ( struct vmw_resource **  p_res)

Definition at line 141 of file vmwgfx_resource.c.

void vmw_resource_unreserve ( struct list_head list)

vmw_resource_unreserve - unreserve resources previously reserved for command submission.

: list of resources to unreserve.

Currently only surfaces are considered, and unreserving a surface means putting it back on the device's surface lru list, so that it can be evicted if necessary. This function traverses the resource list and checks whether resources are surfaces, and in that case puts them back on the device's surface LRU list.

Definition at line 1167 of file vmwgfx_resource.c.

int vmw_stream_claim_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1818 of file vmwgfx_resource.c.

int vmw_stream_unref_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1787 of file vmwgfx_resource.c.

int vmw_surface_check ( struct vmw_private dev_priv,
struct ttm_object_file tfile,
uint32_t  handle,
int id 
)

FIXME: May deadlock here when called from the command parsing code.

Definition at line 1510 of file vmwgfx_resource.c.

int vmw_surface_define_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

From this point, the generic resource management functions destroy the object on failure.

Definition at line 1277 of file vmwgfx_resource.c.

int vmw_surface_destroy_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1268 of file vmwgfx_resource.c.

int vmw_surface_do_validate ( struct vmw_private dev_priv,
struct vmw_surface srf 
)

vmw_surface_do_validate - make a surface available to the device.

: Pointer to a device private struct. : Pointer to a struct vmw_surface.

If the surface doesn't have a hw id, allocate one, and optionally DMA the backed up surface contents to the device.

Returns -EBUSY if there wasn't sufficient device resources to complete the validation. Retry after freeing up resources.

May return other errors if the kernel is out of guest resources.

Definition at line 812 of file vmwgfx_resource.c.

int vmw_surface_evict ( struct vmw_private dev_priv,
struct vmw_surface srf 
)

vmw_surface_evict - Evict a hw surface.

: Pointer to a device private struct. : Pointer to a struct vmw_surface

DMA the contents of a hw surface to a backup guest buffer object, and destroy the hw surface, releasing its id.

Definition at line 936 of file vmwgfx_resource.c.

int vmw_surface_init ( struct vmw_private dev_priv,
struct vmw_surface srf,
void(*)(struct vmw_resource *res res_free 
)

Definition at line 1111 of file vmwgfx_resource.c.

int vmw_surface_reference_ioctl ( struct drm_device dev,
void data,
struct drm_file *  file_priv 
)

Definition at line 1457 of file vmwgfx_resource.c.

void vmw_surface_res_free ( struct vmw_resource res)

Definition at line 785 of file vmwgfx_resource.c.

int vmw_surface_validate ( struct vmw_private dev_priv,
struct vmw_surface srf 
)

vmw_surface_validate - make a surface available to the device, evicting other surfaces if needed.

: Pointer to a device private struct. : Pointer to a struct vmw_surface.

Try to validate a surface and if it fails due to limited device resources, repeatedly try to evict other surfaces until the request can be acommodated.

May return errors if out of resources.

Definition at line 1050 of file vmwgfx_resource.c.

int vmw_user_dmabuf_lookup ( struct ttm_object_file tfile,
uint32_t  handle,
struct vmw_dma_buffer **  out 
)

Definition at line 1681 of file vmwgfx_resource.c.

int vmw_user_lookup_handle ( struct vmw_private dev_priv,
struct ttm_object_file tfile,
uint32_t  handle,
struct vmw_surface **  out_surf,
struct vmw_dma_buffer **  out_buf 
)

Helper function that looks either a surface or dmabuf.

The pointer this pointed at by out_surf and out_buf needs to be null.

Definition at line 1198 of file vmwgfx_resource.c.

int vmw_user_stream_lookup ( struct vmw_private dev_priv,
struct ttm_object_file tfile,
uint32_t inout_id,
struct vmw_resource **  out 
)

Definition at line 1890 of file vmwgfx_resource.c.

int vmw_user_surface_lookup_handle ( struct vmw_private dev_priv,
struct ttm_object_file tfile,
uint32_t  handle,
struct vmw_surface **  out 
)

Definition at line 1217 of file vmwgfx_resource.c.