Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vmwgfx_drv.h File Reference
#include "vmwgfx_reg.h"
#include <drm/drmP.h>
#include <drm/vmwgfx_drm.h>
#include <drm/drm_hashtab.h>
#include <linux/suspend.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_object.h>
#include <drm/ttm/ttm_lock.h>
#include <drm/ttm/ttm_execbuf_util.h>
#include <drm/ttm/ttm_module.h>
#include "vmwgfx_fence.h"

Go to the source code of this file.

Data Structures

struct  vmw_fpriv
 
struct  vmw_dma_buffer
 
struct  vmw_resource
 
struct  vmw_cursor_snooper
 
struct  vmw_surface
 
struct  vmw_marker_queue
 
struct  vmw_fifo_state
 
struct  vmw_relocation
 
struct  vmw_sw_context
 
struct  vmw_master
 
struct  vmw_vga_topology_state
 
struct  vmw_private
 

Macros

#define VMWGFX_DRIVER_DATE   "20120209"
 
#define VMWGFX_DRIVER_MAJOR   2
 
#define VMWGFX_DRIVER_MINOR   4
 
#define VMWGFX_DRIVER_PATCHLEVEL   0
 
#define VMWGFX_FILE_PAGE_OFFSET   0x00100000
 
#define VMWGFX_FIFO_STATIC_SIZE   (1024*1024)
 
#define VMWGFX_MAX_RELOCATIONS   2048
 
#define VMWGFX_MAX_VALIDATIONS   2048
 
#define VMWGFX_MAX_DISPLAYS   16
 
#define VMWGFX_CMD_BOUNCE_INIT_SIZE   32768
 
#define VMW_PL_GMR   TTM_PL_PRIV0
 
#define VMW_PL_FLAG_GMR   TTM_PL_FLAG_PRIV0
 
#define VMW_RES_CONTEXT   ttm_driver_type0
 
#define VMW_RES_SURFACE   ttm_driver_type1
 
#define VMW_RES_STREAM   ttm_driver_type2
 
#define VMW_RES_FENCE   ttm_driver_type3
 

Functions

int vmw_3d_resource_inc (struct vmw_private *dev_priv, bool unhide_svga)
 
void vmw_3d_resource_dec (struct vmw_private *dev_priv, bool hide_svga)
 
int vmw_gmr_bind (struct vmw_private *dev_priv, struct page *pages[], unsigned long num_pages, int gmr_id)
 
void vmw_gmr_unbind (struct vmw_private *dev_priv, int gmr_id)
 
struct vmw_resourcevmw_context_alloc (struct vmw_private *dev_priv)
 
void vmw_resource_unreference (struct vmw_resource **p_res)
 
struct vmw_resourcevmw_resource_reference (struct vmw_resource *res)
 
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)
 
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)
 
void vmw_surface_res_free (struct vmw_resource *res)
 
int vmw_surface_init (struct vmw_private *dev_priv, struct vmw_surface *srf, void(*res_free)(struct vmw_resource *res))
 
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)
 
int vmw_surface_validate (struct vmw_private *dev_priv, struct vmw_surface *srf)
 
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 interuptable, 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 id, struct vmw_dma_buffer **out)
 
int vmw_stream_claim_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_stream_unref_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)
 
void vmw_resource_unreserve (struct list_head *list)
 
int vmw_dmabuf_to_placement (struct vmw_private *vmw_priv, struct vmw_dma_buffer *bo, struct ttm_placement *placement, bool interruptible)
 
int vmw_dmabuf_to_vram (struct vmw_private *dev_priv, struct vmw_dma_buffer *buf, bool pin, bool interruptible)
 
int vmw_dmabuf_to_vram_or_gmr (struct vmw_private *dev_priv, struct vmw_dma_buffer *buf, bool pin, bool interruptible)
 
int vmw_dmabuf_to_start_of_vram (struct vmw_private *vmw_priv, struct vmw_dma_buffer *bo, bool pin, bool interruptible)
 
int vmw_dmabuf_unpin (struct vmw_private *vmw_priv, struct vmw_dma_buffer *bo, bool interruptible)
 
void vmw_bo_get_guest_ptr (const struct ttm_buffer_object *buf, SVGAGuestPtr *ptr)
 
void vmw_bo_pin (struct ttm_buffer_object *bo, bool pin)
 
int vmw_getparam_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_get_cap_3d_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_present_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_present_readback_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
unsigned int vmw_fops_poll (struct file *filp, struct poll_table_struct *wait)
 
ssize_t vmw_fops_read (struct file *filp, char __user *buffer, size_t count, loff_t *offset)
 
int vmw_fifo_init (struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 
void vmw_fifo_release (struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
 
voidvmw_fifo_reserve (struct vmw_private *dev_priv, uint32_t bytes)
 
void vmw_fifo_commit (struct vmw_private *dev_priv, uint32_t bytes)
 
int vmw_fifo_send_fence (struct vmw_private *dev_priv, uint32_t *seqno)
 
void vmw_fifo_ping_host (struct vmw_private *dev_priv, uint32_t reason)
 
bool vmw_fifo_have_3d (struct vmw_private *dev_priv)
 
bool vmw_fifo_have_pitchlock (struct vmw_private *dev_priv)
 
int vmw_fifo_emit_dummy_query (struct vmw_private *dev_priv, uint32_t cid)
 
int vmw_ttm_global_init (struct vmw_private *dev_priv)
 
void vmw_ttm_global_release (struct vmw_private *dev_priv)
 
int vmw_mmap (struct file *filp, struct vm_area_struct *vma)
 
int vmw_dma_quiescent (struct drm_device *dev)
 
int vmw_execbuf_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_execbuf_process (struct drm_file *file_priv, struct vmw_private *dev_priv, void __user *user_commands, void *kernel_commands, uint32_t command_size, uint64_t throttle_us, struct drm_vmw_fence_rep __user *user_fence_rep, struct vmw_fence_obj **out_fence)
 
void vmw_execbuf_release_pinned_bo (struct vmw_private *dev_priv, bool only_on_cid_match, uint32_t cid)
 
int vmw_execbuf_fence_commands (struct drm_file *file_priv, struct vmw_private *dev_priv, struct vmw_fence_obj **p_fence, uint32_t *p_handle)
 
void vmw_execbuf_copy_fence_user (struct vmw_private *dev_priv, struct vmw_fpriv *vmw_fp, int ret, struct drm_vmw_fence_rep __user *user_fence_rep, struct vmw_fence_obj *fence, uint32_t fence_handle)
 
irqreturn_t vmw_irq_handler (DRM_IRQ_ARGS)
 
int vmw_wait_seqno (struct vmw_private *dev_priv, bool lazy, uint32_t seqno, bool interruptible, unsigned long timeout)
 
void vmw_irq_preinstall (struct drm_device *dev)
 
int vmw_irq_postinstall (struct drm_device *dev)
 
void vmw_irq_uninstall (struct drm_device *dev)
 
bool vmw_seqno_passed (struct vmw_private *dev_priv, uint32_t seqno)
 
int vmw_fallback_wait (struct vmw_private *dev_priv, bool lazy, bool fifo_idle, uint32_t seqno, bool interruptible, unsigned long timeout)
 
void vmw_update_seqno (struct vmw_private *dev_priv, struct vmw_fifo_state *fifo_state)
 
void vmw_seqno_waiter_add (struct vmw_private *dev_priv)
 
void vmw_seqno_waiter_remove (struct vmw_private *dev_priv)
 
void vmw_goal_waiter_add (struct vmw_private *dev_priv)
 
void vmw_goal_waiter_remove (struct vmw_private *dev_priv)
 
void vmw_marker_queue_init (struct vmw_marker_queue *queue)
 
void vmw_marker_queue_takedown (struct vmw_marker_queue *queue)
 
int vmw_marker_push (struct vmw_marker_queue *queue, uint32_t seqno)
 
int vmw_marker_pull (struct vmw_marker_queue *queue, uint32_t signaled_seqno)
 
int vmw_wait_lag (struct vmw_private *dev_priv, struct vmw_marker_queue *queue, uint32_t us)
 
int vmw_fb_init (struct vmw_private *vmw_priv)
 
int vmw_fb_close (struct vmw_private *dev_priv)
 
int vmw_fb_off (struct vmw_private *vmw_priv)
 
int vmw_fb_on (struct vmw_private *vmw_priv)
 
int vmw_kms_init (struct vmw_private *dev_priv)
 
int vmw_kms_close (struct vmw_private *dev_priv)
 
int vmw_kms_save_vga (struct vmw_private *vmw_priv)
 
int vmw_kms_restore_vga (struct vmw_private *vmw_priv)
 
int vmw_kms_cursor_bypass_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
void vmw_kms_cursor_post_execbuf (struct vmw_private *dev_priv)
 
void vmw_kms_cursor_snoop (struct vmw_surface *srf, struct ttm_object_file *tfile, struct ttm_buffer_object *bo, SVGA3dCmdHeader *header)
 
int vmw_kms_write_svga (struct vmw_private *vmw_priv, unsigned width, unsigned height, unsigned pitch, unsigned bpp, unsigned depth)
 
void vmw_kms_idle_workqueues (struct vmw_master *vmaster)
 
bool vmw_kms_validate_mode_vram (struct vmw_private *dev_priv, uint32_t pitch, uint32_t height)
 
u32 vmw_get_vblank_counter (struct drm_device *dev, int crtc)
 
int vmw_enable_vblank (struct drm_device *dev, int crtc)
 
void vmw_disable_vblank (struct drm_device *dev, int crtc)
 
int vmw_kms_present (struct vmw_private *dev_priv, struct drm_file *file_priv, struct vmw_framebuffer *vfb, struct vmw_surface *surface, uint32_t sid, int32_t destX, int32_t destY, struct drm_vmw_rect *clips, uint32_t num_clips)
 
int vmw_kms_readback (struct vmw_private *dev_priv, struct drm_file *file_priv, struct vmw_framebuffer *vfb, struct drm_vmw_fence_rep __user *user_fence_rep, struct drm_vmw_rect *clips, uint32_t num_clips)
 
int vmw_kms_update_layout_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
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)
 
int vmw_overlay_init (struct vmw_private *dev_priv)
 
int vmw_overlay_close (struct vmw_private *dev_priv)
 
int vmw_overlay_ioctl (struct drm_device *dev, void *data, struct drm_file *file_priv)
 
int vmw_overlay_stop_all (struct vmw_private *dev_priv)
 
int vmw_overlay_resume_all (struct vmw_private *dev_priv)
 
int vmw_overlay_pause_all (struct vmw_private *dev_priv)
 
int vmw_overlay_claim (struct vmw_private *dev_priv, uint32_t *out)
 
int vmw_overlay_unref (struct vmw_private *dev_priv, uint32_t stream_id)
 
int vmw_overlay_num_overlays (struct vmw_private *dev_priv)
 
int vmw_overlay_num_free_overlays (struct vmw_private *dev_priv)
 

Variables

struct ttm_placement vmw_vram_placement
 
struct ttm_placement vmw_vram_ne_placement
 
struct ttm_placement vmw_vram_sys_placement
 
struct ttm_placement vmw_vram_gmr_placement
 
struct ttm_placement vmw_vram_gmr_ne_placement
 
struct ttm_placement vmw_sys_placement
 
struct ttm_placement vmw_evictable_placement
 
struct ttm_placement vmw_srf_placement
 
struct ttm_bo_driver vmw_bo_driver
 
struct ttm_mem_type_manager_func vmw_gmrid_manager_func
 

Macro Definition Documentation

#define VMW_PL_FLAG_GMR   TTM_PL_FLAG_PRIV0

Definition at line 55 of file vmwgfx_drv.h.

#define VMW_PL_GMR   TTM_PL_PRIV0

Definition at line 54 of file vmwgfx_drv.h.

#define VMW_RES_CONTEXT   ttm_driver_type0

Definition at line 57 of file vmwgfx_drv.h.

#define VMW_RES_FENCE   ttm_driver_type3

Definition at line 60 of file vmwgfx_drv.h.

#define VMW_RES_STREAM   ttm_driver_type2

Definition at line 59 of file vmwgfx_drv.h.

#define VMW_RES_SURFACE   ttm_driver_type1

Definition at line 58 of file vmwgfx_drv.h.

#define VMWGFX_CMD_BOUNCE_INIT_SIZE   32768

Definition at line 52 of file vmwgfx_drv.h.

#define VMWGFX_DRIVER_DATE   "20120209"

Definition at line 43 of file vmwgfx_drv.h.

#define VMWGFX_DRIVER_MAJOR   2

Definition at line 44 of file vmwgfx_drv.h.

#define VMWGFX_DRIVER_MINOR   4

Definition at line 45 of file vmwgfx_drv.h.

#define VMWGFX_DRIVER_PATCHLEVEL   0

Definition at line 46 of file vmwgfx_drv.h.

#define VMWGFX_FIFO_STATIC_SIZE   (1024*1024)

Definition at line 48 of file vmwgfx_drv.h.

#define VMWGFX_FILE_PAGE_OFFSET   0x00100000

Definition at line 47 of file vmwgfx_drv.h.

#define VMWGFX_MAX_DISPLAYS   16

Definition at line 51 of file vmwgfx_drv.h.

#define VMWGFX_MAX_RELOCATIONS   2048

Definition at line 49 of file vmwgfx_drv.h.

#define VMWGFX_MAX_VALIDATIONS   2048

Definition at line 50 of file vmwgfx_drv.h.

Function Documentation

void vmw_3d_resource_dec ( struct vmw_private dev_priv,
bool  hide_svga 
)

Decrease the 3d resource refcount. If the count reaches zero, disable the fifo, switching to vga mode. Note that the master holds a refcount as well, and may request an explicit switch to vga mode when it releases its refcount to account for the situation of an X server vt switch to VGA with 3d resources active.

Definition at line 373 of file vmwgfx_drv.c.

int vmw_3d_resource_inc ( struct vmw_private dev_priv,
bool  unhide_svga 
)

Increase the 3d resource refcount. If the count was prevously zero, initialize the fifo, switching to svga mode. Note that the master holds a ref as well, and may request an explicit switch to svga mode if fb is not running, using .

Definition at line 343 of file vmwgfx_drv.c.

void vmw_bo_get_guest_ptr ( const struct ttm_buffer_object bo,
SVGAGuestPtr ptr 
)

vmw_bo_get_guest_ptr - Get the guest ptr representing the current placement of a buffer.

: Pointer to a struct ttm_buffer_object. Must be pinned or reserved. : SVGAGuestPtr returning the result.

Definition at line 279 of file vmwgfx_dmabuf.c.

void vmw_bo_pin ( struct ttm_buffer_object bo,
bool  pin 
)

vmw_bo_pin - Pin or unpin a buffer object without moving it.

: The buffer object. Must be reserved, and present either in VRAM or GMR memory. : Whether to pin or unpin.

Definition at line 300 of file vmwgfx_dmabuf.c.

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.

void vmw_disable_vblank ( struct drm_device dev,
int  crtc 
)

Function called by DRM code called with vbl_lock held.

Definition at line 1632 of file vmwgfx_kms.c.

int vmw_dma_quiescent ( struct drm_device dev)
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  interuptable,
void(*)(struct ttm_buffer_object *bo)  bo_free 
)

Definition at line 1550 of file vmwgfx_resource.c.

int vmw_dmabuf_to_placement ( struct vmw_private dev_priv,
struct vmw_dma_buffer buf,
struct ttm_placement placement,
bool  interruptible 
)

DMA buffer helper routines - vmwgfx_dmabuf.c

vmw_dmabuf_to_placement - Validate a buffer to placement.

: Driver private. : DMA buffer to move. : Pin buffer if true. : Use interruptible wait.

May only be called by the current master since it assumes that the master lock is the current master's lock. This function takes the master's lock in write mode. Flushes and unpins the query bo to avoid failures.

Returns -ERESTARTSYS if interrupted by a signal.

Definition at line 50 of file vmwgfx_dmabuf.c.

int vmw_dmabuf_to_start_of_vram ( struct vmw_private dev_priv,
struct vmw_dma_buffer buf,
bool  pin,
bool  interruptible 
)

vmw_dmabuf_to_start_of_vram - Move a buffer to start of vram.

May only be called by the current master since it assumes that the master lock is the current master's lock. This function takes the master's lock in write mode. Flushes and unpins the query bo if == true to avoid failures.

: Driver private. : DMA buffer to move. : Pin buffer in vram if true. : Use interruptible wait.

Returns -ERESTARTSYS if interrupted by a signal.

Definition at line 197 of file vmwgfx_dmabuf.c.

int vmw_dmabuf_to_vram ( struct vmw_private dev_priv,
struct vmw_dma_buffer buf,
bool  pin,
bool  interruptible 
)

vmw_dmabuf_to_vram - Move a buffer to vram.

May only be called by the current master since it assumes that the master lock is the current master's lock. This function takes the master's lock in write mode.

: Driver private. : DMA buffer to move. : Pin buffer in vram if true. : Use interruptible wait.

Returns -ERESTARTSYS if interrupted by a signal.

Definition at line 165 of file vmwgfx_dmabuf.c.

int vmw_dmabuf_to_vram_or_gmr ( struct vmw_private dev_priv,
struct vmw_dma_buffer buf,
bool  pin,
bool  interruptible 
)

vmw_dmabuf_to_vram_or_gmr - Move a buffer to vram or gmr.

May only be called by the current master since it assumes that the master lock is the current master's lock. This function takes the master's lock in write mode. Flushes and unpins the query bo if == true to avoid failures.

: Driver private. : DMA buffer to move. : Pin buffer if true. : Use interruptible wait.

Returns -ERESTARTSYS if interrupted by a signal.

Put BO in VRAM if there is space, otherwise as a GMR. If there is no space in VRAM and GMR ids are all used up, start evicting GMRs to make room. If the DMA buffer can't be used as a GMR, this will return -ENOMEM.

If that failed, try VRAM again, this time evicting previous contents.

Definition at line 94 of file vmwgfx_dmabuf.c.

int vmw_dmabuf_unpin ( struct vmw_private dev_priv,
struct vmw_dma_buffer buf,
bool  interruptible 
)

vmw_dmabuf_upin - Unpin the buffer given buffer, does not move the buffer.

May only be called by the current master since it assumes that the master lock is the current master's lock. This function takes the master's lock in write mode.

: Driver private. : DMA buffer to unpin. : Use interruptible wait.

Returns -ERESTARTSYS if interrupted by a signal.

Definition at line 257 of file vmwgfx_dmabuf.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.

int vmw_enable_vblank ( struct drm_device dev,
int  crtc 
)

Function called by DRM code called with vbl_lock held.

Definition at line 1624 of file vmwgfx_kms.c.

void vmw_execbuf_copy_fence_user ( struct vmw_private dev_priv,
struct vmw_fpriv vmw_fp,
int  ret,
struct drm_vmw_fence_rep __user user_fence_rep,
struct vmw_fence_obj fence,
uint32_t  fence_handle 
)

vmw_execbuf_copy_fence_user - copy fence object information to user-space.

: Pointer to a vmw_private struct. : Pointer to the struct vmw_fpriv representing the calling file. : Return value from fence object creation. : User space address of a struct drm_vmw_fence_rep to which the information should be copied. : Pointer to the fenc object. : User-space fence handle.

This function copies fence information to user-space. If copying fails, The user-space struct drm_vmw_fence_rep::error member is hopefully left untouched, and if it's preloaded with an -EFAULT by user-space, the error will hopefully be detected. Also if copying fails, user-space will be unable to signal the fence object so we wait for it immediately, and then unreference the user-space reference.

Definition at line 1060 of file vmwgfx_execbuf.c.

int vmw_execbuf_fence_commands ( struct drm_file *  file_priv,
struct vmw_private dev_priv,
struct vmw_fence_obj **  p_fence,
uint32_t p_handle 
)

vmw_execbuf_fence_commands - create and submit a command stream fence

Creates a fence object and submits a command stream marker. If this fails for some reason, We sync the fifo and return NULL. It is then safe to fence buffers with a NULL pointer.

If is not NULL must also not be NULL. Creates a userspace handle if is not NULL, otherwise not.

Definition at line 1001 of file vmwgfx_execbuf.c.

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

Command submission - vmwgfx_execbuf.c

Definition at line 1342 of file vmwgfx_execbuf.c.

int vmw_execbuf_process ( struct drm_file *  file_priv,
struct vmw_private dev_priv,
void __user user_commands,
void kernel_commands,
uint32_t  command_size,
uint64_t  throttle_us,
struct drm_vmw_fence_rep __user user_fence_rep,
struct vmw_fence_obj **  out_fence 
)

Definition at line 1106 of file vmwgfx_execbuf.c.

void vmw_execbuf_release_pinned_bo ( struct vmw_private dev_priv,
bool  only_on_cid_match,
uint32_t  cid 
)

vmw_execbuf_release_pinned_bo - Flush queries and unpin the pinned query bo.

: The device private structure. : Only flush and unpin if the current active query cid matches . : Optional context id to match.

This function should be used to unpin the pinned query bo, or as a query barrier when we need to make sure that all queries have finished before the next fifo command. (For example on hardware context destructions where the hardware may otherwise leak unfinished queries).

This function does not return any failure codes, but make attempts to do safe unpinning in case of errors.

The function will synchronize on the previous query barrier, and will thus not finish until that barrier has executed.

Definition at line 1275 of file vmwgfx_execbuf.c.

int vmw_fallback_wait ( struct vmw_private dev_priv,
bool  lazy,
bool  fifo_idle,
uint32_t  seqno,
bool  interruptible,
unsigned long  timeout 
)

Block command submission while waiting for idle.

FIXME: Use schedule_hr_timeout here for newer kernels and lower CPU utilization.

Definition at line 116 of file vmwgfx_irq.c.

int vmw_fb_close ( struct vmw_private dev_priv)

Definition at line 554 of file vmwgfx_fb.c.

int vmw_fb_init ( struct vmw_private vmw_priv)

Kernel framebuffer - vmwgfx_fb.c

Definition at line 407 of file vmwgfx_fb.c.

int vmw_fb_off ( struct vmw_private vmw_priv)

Definition at line 581 of file vmwgfx_fb.c.

int vmw_fb_on ( struct vmw_private vmw_priv)

Definition at line 607 of file vmwgfx_fb.c.

void vmw_fifo_commit ( struct vmw_private dev_priv,
uint32_t  bytes 
)

Definition at line 422 of file vmwgfx_fifo.c.

int vmw_fifo_emit_dummy_query ( struct vmw_private dev_priv,
uint32_t  cid 
)

vmw_fifo_emit_dummy_query - emits a dummy query to the fifo.

: The device private structure. : The hardware context id used for the query.

This function is used to emit a dummy occlusion query with no primitives rendered between query begin and query end. It's used to provide a query barrier, in order to know that when this query is finished, all preceding queries are also finished.

A Query results structure should have been initialized at the start of the dev_priv->dummy_query_bo buffer object. And that buffer object must also be either reserved or pinned when this function is called.

Returns -ENOMEM on failure to reserve fifo space.

Definition at line 530 of file vmwgfx_fifo.c.

bool vmw_fifo_have_3d ( struct vmw_private dev_priv)

Definition at line 32 of file vmwgfx_fifo.c.

bool vmw_fifo_have_pitchlock ( struct vmw_private dev_priv)

Definition at line 64 of file vmwgfx_fifo.c.

int vmw_fifo_init ( struct vmw_private dev_priv,
struct vmw_fifo_state fifo 
)

Fifo utilities - vmwgfx_fifo.c

Definition at line 79 of file vmwgfx_fifo.c.

void vmw_fifo_ping_host ( struct vmw_private dev_priv,
uint32_t  reason 
)

Definition at line 146 of file vmwgfx_fifo.c.

void vmw_fifo_release ( struct vmw_private dev_priv,
struct vmw_fifo_state fifo 
)

Definition at line 160 of file vmwgfx_fifo.c.

void* vmw_fifo_reserve ( struct vmw_private dev_priv,
uint32_t  bytes 
)

Reserve number of bytes in the fifo.

This function will return NULL (error) on two conditions: If it timeouts waiting for fifo space, or if is larger than the available fifo space.

Returns: Pointer to the fifo, or null on error (possible hardware hang).

Definition at line 298 of file vmwgfx_fifo.c.

int vmw_fifo_send_fence ( struct vmw_private dev_priv,
uint32_t seqno 
)

Definition at line 468 of file vmwgfx_fifo.c.

unsigned int vmw_fops_poll ( struct file filp,
struct poll_table_struct wait 
)

vmw_fops_poll - wrapper around the drm_poll function

: See the linux fops poll documentation. : See the linux fops poll documentation.

Wrapper around the drm_poll function that makes sure the device is processing the fifo if drm_poll decides to wait.

Definition at line 300 of file vmwgfx_ioctl.c.

ssize_t vmw_fops_read ( struct file filp,
char __user buffer,
size_t  count,
loff_t *  offset 
)

vmw_fops_read - wrapper around the drm_read function

: See the linux fops read documentation. : See the linux fops read documentation. : See the linux fops read documentation. offset: See the linux fops read documentation.

Wrapper around the drm_read function that makes sure the device is processing the fifo if drm_read decides to wait.

Definition at line 322 of file vmwgfx_ioctl.c.

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

Definition at line 81 of file vmwgfx_ioctl.c.

u32 vmw_get_vblank_counter ( struct drm_device dev,
int  crtc 
)

Function called by DRM code called with vbl_lock held.

Definition at line 1616 of file vmwgfx_kms.c.

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

Misc Ioctl functionality - vmwgfx_ioctl.c

Definition at line 32 of file vmwgfx_ioctl.c.

int vmw_gmr_bind ( struct vmw_private dev_priv,
struct page pages[],
unsigned long  num_pages,
int  gmr_id 
)

GMR utilities - vmwgfx_gmr.c

Definition at line 236 of file vmwgfx_gmr.c.

void vmw_gmr_unbind ( struct vmw_private dev_priv,
int  gmr_id 
)

Definition at line 267 of file vmwgfx_gmr.c.

void vmw_goal_waiter_add ( struct vmw_private dev_priv)

Definition at line 216 of file vmwgfx_irq.c.

void vmw_goal_waiter_remove ( struct vmw_private dev_priv)

Definition at line 232 of file vmwgfx_irq.c.

irqreturn_t vmw_irq_handler ( DRM_IRQ_ARGS  )

IRQs and wating - vmwgfx_irq.c

Definition at line 33 of file vmwgfx_irq.c.

int vmw_irq_postinstall ( struct drm_device dev)

Definition at line 305 of file vmwgfx_irq.c.

void vmw_irq_preinstall ( struct drm_device dev)

Definition at line 292 of file vmwgfx_irq.c.

void vmw_irq_uninstall ( struct drm_device dev)

Definition at line 310 of file vmwgfx_irq.c.

int vmw_kms_close ( struct vmw_private dev_priv)

Definition at line 1447 of file vmwgfx_kms.c.

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

Definition at line 1462 of file vmwgfx_kms.c.

void vmw_kms_cursor_post_execbuf ( struct vmw_private dev_priv)

Definition at line 349 of file vmwgfx_kms.c.

void vmw_kms_cursor_snoop ( struct vmw_surface srf,
struct ttm_object_file tfile,
struct ttm_buffer_object bo,
SVGA3dCmdHeader header 
)

Definition at line 254 of file vmwgfx_kms.c.

void vmw_kms_idle_workqueues ( struct vmw_master vmaster)
int vmw_kms_init ( struct vmw_private dev_priv)

Kernel modesetting - vmwgfx_kms.c

Definition at line 1427 of file vmwgfx_kms.c.

int vmw_kms_present ( struct vmw_private dev_priv,
struct drm_file *  file_priv,
struct vmw_framebuffer vfb,
struct vmw_surface surface,
uint32_t  sid,
int32_t  destX,
int32_t  destY,
struct drm_vmw_rect clips,
uint32_t  num_clips 
)

Definition at line 1184 of file vmwgfx_kms.c.

int vmw_kms_readback ( struct vmw_private dev_priv,
struct drm_file *  file_priv,
struct vmw_framebuffer vfb,
struct drm_vmw_fence_rep __user user_fence_rep,
struct drm_vmw_rect clips,
uint32_t  num_clips 
)

Definition at line 1320 of file vmwgfx_kms.c.

int vmw_kms_restore_vga ( struct vmw_private vmw_priv)

Definition at line 1573 of file vmwgfx_kms.c.

int vmw_kms_save_vga ( struct vmw_private vmw_priv)

Definition at line 1524 of file vmwgfx_kms.c.

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

Definition at line 1979 of file vmwgfx_kms.c.

bool vmw_kms_validate_mode_vram ( struct vmw_private dev_priv,
uint32_t  pitch,
uint32_t  height 
)

Definition at line 1605 of file vmwgfx_kms.c.

int vmw_kms_write_svga ( struct vmw_private vmw_priv,
unsigned  width,
unsigned  height,
unsigned  pitch,
unsigned  bpp,
unsigned  depth 
)

Definition at line 1503 of file vmwgfx_kms.c.

int vmw_marker_pull ( struct vmw_marker_queue queue,
uint32_t  signaled_seqno 
)

Definition at line 73 of file vmwgfx_marker.c.

int vmw_marker_push ( struct vmw_marker_queue queue,
uint32_t  seqno 
)

Definition at line 56 of file vmwgfx_marker.c.

void vmw_marker_queue_init ( struct vmw_marker_queue queue)

Rudimentary fence-like objects currently used only for throttling - vmwgfx_marker.c

Definition at line 37 of file vmwgfx_marker.c.

void vmw_marker_queue_takedown ( struct vmw_marker_queue queue)

Definition at line 45 of file vmwgfx_marker.c.

int vmw_mmap ( struct file filp,
struct vm_area_struct vma 
)

Definition at line 31 of file vmwgfx_ttm_glue.c.

int vmw_overlay_claim ( struct vmw_private dev_priv,
uint32_t out 
)

Definition at line 520 of file vmwgfx_overlay.c.

int vmw_overlay_close ( struct vmw_private dev_priv)

Definition at line 594 of file vmwgfx_overlay.c.

int vmw_overlay_init ( struct vmw_private dev_priv)

Overlay control - vmwgfx_overlay.c

Definition at line 564 of file vmwgfx_overlay.c.

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

Definition at line 452 of file vmwgfx_overlay.c.

int vmw_overlay_num_free_overlays ( struct vmw_private dev_priv)

Definition at line 501 of file vmwgfx_overlay.c.

int vmw_overlay_num_overlays ( struct vmw_private dev_priv)

Definition at line 493 of file vmwgfx_overlay.c.

int vmw_overlay_pause_all ( struct vmw_private dev_priv)

Pauses all active streams.

Used by the kms code when moving a new scanout buffer to vram.

Takes the overlay lock.

Definition at line 429 of file vmwgfx_overlay.c.

int vmw_overlay_resume_all ( struct vmw_private dev_priv)

Try to resume all paused streams.

Used by the kms code after moving a new scanout buffer to vram.

Takes the overlay lock.

Definition at line 395 of file vmwgfx_overlay.c.

int vmw_overlay_stop_all ( struct vmw_private dev_priv)

Stop all streams.

Used by the fb code when starting.

Takes the overlay lock.

Definition at line 364 of file vmwgfx_overlay.c.

int vmw_overlay_unref ( struct vmw_private dev_priv,
uint32_t  stream_id 
)

Definition at line 545 of file vmwgfx_overlay.c.

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

Definition at line 123 of file vmwgfx_ioctl.c.

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

Definition at line 208 of file vmwgfx_ioctl.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.

bool vmw_seqno_passed ( struct vmw_private dev_priv,
uint32_t  seqno 
)

Then check if the seqno is higher than what we've actually emitted. Then the fence is stale and signaled.

Definition at line 87 of file vmwgfx_irq.c.

void vmw_seqno_waiter_add ( struct vmw_private dev_priv)

Definition at line 185 of file vmwgfx_irq.c.

void vmw_seqno_waiter_remove ( struct vmw_private dev_priv)

Definition at line 201 of file vmwgfx_irq.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_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_ttm_global_init ( struct vmw_private dev_priv)

TTM glue - vmwgfx_ttm_glue.c

Definition at line 57 of file vmwgfx_ttm_glue.c.

void vmw_ttm_global_release ( struct vmw_private dev_priv)

Definition at line 94 of file vmwgfx_ttm_glue.c.

void vmw_update_seqno ( struct vmw_private dev_priv,
struct vmw_fifo_state fifo_state 
)

Definition at line 74 of file vmwgfx_irq.c.

int vmw_user_dmabuf_lookup ( struct ttm_object_file tfile,
uint32_t  id,
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.

int vmw_wait_lag ( struct vmw_private dev_priv,
struct vmw_marker_queue queue,
uint32_t  us 
)

Definition at line 144 of file vmwgfx_marker.c.

int vmw_wait_seqno ( struct vmw_private dev_priv,
bool  lazy,
uint32_t  seqno,
bool  interruptible,
unsigned long  timeout 
)

Definition at line 246 of file vmwgfx_irq.c.

Variable Documentation

struct ttm_bo_driver vmw_bo_driver

Definition at line 338 of file vmwgfx_buffer.c.

struct ttm_placement vmw_evictable_placement

Definition at line 125 of file vmwgfx_buffer.c.

struct ttm_mem_type_manager_func vmw_gmrid_manager_func

GMR Id manager

Definition at line 155 of file vmwgfx_gmrid_manager.c.

struct ttm_placement vmw_srf_placement

Definition at line 134 of file vmwgfx_buffer.c.

struct ttm_placement vmw_sys_placement

Definition at line 110 of file vmwgfx_buffer.c.

struct ttm_placement vmw_vram_gmr_ne_placement

Definition at line 83 of file vmwgfx_buffer.c.

struct ttm_placement vmw_vram_gmr_placement

Definition at line 69 of file vmwgfx_buffer.c.

struct ttm_placement vmw_vram_ne_placement

Definition at line 101 of file vmwgfx_buffer.c.

struct ttm_placement vmw_vram_placement

TTM buffer object driver - vmwgfx_buffer.c

Definition at line 50 of file vmwgfx_buffer.c.

struct ttm_placement vmw_vram_sys_placement

Definition at line 92 of file vmwgfx_buffer.c.