Skip to content

Commit

Permalink
drm/vmwgfx: Add basic support for SVGA3
Browse files Browse the repository at this point in the history
SVGA3 is the next version of our PCI device. Some of the changes
include using MMIO for register accesses instead of ioports,
deprecating the FIFO MMIO and removing a lot of the old and
legacy functionality. SVGA3 doesn't support guest backed
objects right now so everything except 3D is working.

v2: Fixes all the static analyzer warnings

Signed-off-by: Zack Rusin <zackr@vmware.com>
Cc: Martin Krastev <krastevm@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210505191007.305872-1-zackr@vmware.com
  • Loading branch information
zackr committed May 11, 2021
1 parent 8211783 commit 2cd80db
Show file tree
Hide file tree
Showing 25 changed files with 405 additions and 310 deletions.
55 changes: 48 additions & 7 deletions drivers/gpu/drm/vmwgfx/device_include/svga_reg.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/**********************************************************
* Copyright 1998-2015 VMware, Inc.
* Copyright 1998-2021 VMware, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -98,6 +98,10 @@ typedef uint32 SVGAMobId;
#define SVGA_MAGIC 0x900000UL
#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver))

/* Version 3 has the control bar instead of the FIFO */
#define SVGA_VERSION_3 3
#define SVGA_ID_3 SVGA_MAKE_ID(SVGA_VERSION_3)

/* Version 2 let the address of the frame buffer be unsigned on Win32 */
#define SVGA_VERSION_2 2
#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2)
Expand Down Expand Up @@ -129,11 +133,12 @@ typedef uint32 SVGAMobId;
* Interrupts are only supported when the
* SVGA_CAP_IRQMASK capability is present.
*/
#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */
#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */
#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */
#define SVGA_IRQFLAG_COMMAND_BUFFER 0x8 /* Command buffer completed */
#define SVGA_IRQFLAG_ERROR 0x10 /* Error while processing commands */
#define SVGA_IRQFLAG_ANY_FENCE (1 << 0) /* Any fence was passed */
#define SVGA_IRQFLAG_FIFO_PROGRESS (1 << 1) /* Made forward progress in the FIFO */
#define SVGA_IRQFLAG_FENCE_GOAL (1 << 2) /* SVGA_FIFO_FENCE_GOAL reached */
#define SVGA_IRQFLAG_COMMAND_BUFFER (1 << 3) /* Command buffer completed */
#define SVGA_IRQFLAG_ERROR (1 << 4) /* Error while processing commands */
#define SVGA_IRQFLAG_MAX (1 << 5)

/*
* The byte-size is the size of the actual cursor data,
Expand Down Expand Up @@ -286,7 +291,32 @@ enum {
*/
SVGA_REG_GBOBJECT_MEM_SIZE_KB = 76,

SVGA_REG_TOP = 77, /* Must be 1 more than the last register */
/*
+ * These registers are for the addresses of the memory BARs for SVGA3
*/
SVGA_REG_REGS_START_HIGH32 = 77,
SVGA_REG_REGS_START_LOW32 = 78,
SVGA_REG_FB_START_HIGH32 = 79,
SVGA_REG_FB_START_LOW32 = 80,

/*
* A hint register that recommends which quality level the guest should
* currently use to define multisample surfaces.
*
* If the register is SVGA_REG_MSHINT_DISABLED,
* the guest is only allowed to use SVGA3D_MS_QUALITY_FULL.
*
* Otherwise, this is a live value that can change while the VM is
* powered on with the hint suggestion for which quality level the guest
* should be using. Guests are free to ignore the hint and use either
* RESOLVE or FULL quality.
*/
SVGA_REG_MSHINT = 81,

SVGA_REG_IRQ_STATUS = 82,
SVGA_REG_DIRTY_TRACKING = 83,

SVGA_REG_TOP = 84, /* Must be 1 more than the last register */

SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
/* Next 768 (== 256*3) registers exist for colormap */
Expand All @@ -310,6 +340,17 @@ typedef enum SVGARegGuestDriverId {
SVGA_REG_GUEST_DRIVER_ID_SUBMIT = MAX_UINT32,
} SVGARegGuestDriverId;

typedef enum SVGARegMSHint {
SVGA_REG_MSHINT_DISABLED = 0,
SVGA_REG_MSHINT_FULL = 1,
SVGA_REG_MSHINT_RESOLVED = 2,
} SVGARegMSHint;

typedef enum SVGARegDirtyTracking {
SVGA_REG_DIRTY_TRACKING_PER_IMAGE = 0,
SVGA_REG_DIRTY_TRACKING_PER_SURFACE = 1,
} SVGARegDirtyTracking;


/*
* Guest memory regions (GMRs):
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ static void vmw_collect_dirty_view_ids(struct vmw_ctx_binding_state *cbs,
}

/**
* vmw_binding_emit_set_sr - Issue delayed DX shader resource binding commands
* vmw_emit_set_sr - Issue delayed DX shader resource binding commands
*
* @cbs: Pointer to the context's struct vmw_ctx_binding_state
* @shader_slot: The shader slot of the binding.
Expand Down Expand Up @@ -832,7 +832,7 @@ static int vmw_emit_set_sr(struct vmw_ctx_binding_state *cbs,
}

/**
* vmw_binding_emit_set_rt - Issue delayed DX rendertarget binding commands
* vmw_emit_set_rt - Issue delayed DX rendertarget binding commands
*
* @cbs: Pointer to the context's struct vmw_ctx_binding_state
*/
Expand Down Expand Up @@ -1024,7 +1024,7 @@ static void vmw_collect_dirty_vbs(struct vmw_ctx_binding_state *cbs,
}

/**
* vmw_binding_emit_set_vb - Issue delayed vertex buffer binding commands
* vmw_emit_set_vb - Issue delayed vertex buffer binding commands
*
* @cbs: Pointer to the context's struct vmw_ctx_binding_state
*
Expand Down Expand Up @@ -1394,7 +1394,7 @@ struct list_head *vmw_binding_state_list(struct vmw_ctx_binding_state *cbs)
}

/**
* vmwgfx_binding_state_reset - clear a struct vmw_ctx_binding_state
* vmw_binding_state_reset - clear a struct vmw_ctx_binding_state
*
* @cbs: Pointer to the struct vmw_ctx_binding_state to be cleared
*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static int vmw_bo_cpu_blit_line(struct vmw_bo_blit_line_data *d,
}

/**
* ttm_bo_cpu_blit - in-kernel cpu blit.
* vmw_bo_cpu_blit - in-kernel cpu blit.
*
* @dst: Destination buffer object.
* @dst_offset: Destination offset of blit start in bytes.
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static void vmw_user_bo_release(struct ttm_base_object **p_base)


/**
* vmw_user_bo_ref_obj-release - TTM synccpu reference object release callback
* vmw_user_bo_ref_obj_release - TTM synccpu reference object release callback
* for vmw user buffer objects
*
* @base: Pointer to the TTM base object
Expand Down
Loading

0 comments on commit 2cd80db

Please sign in to comment.