drivers/gpu/drm/vmwgfx/vmwgfx_so.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_so.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_so.h
Extension
.h
Size
5723 bytes
Lines
173
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef VMW_SO_H
#define VMW_SO_H

enum vmw_view_type {
	vmw_view_sr,
	vmw_view_rt,
	vmw_view_ds,
	vmw_view_ua,
	vmw_view_max,
};

enum vmw_so_type {
	vmw_so_el,
	vmw_so_bs,
	vmw_so_ds,
	vmw_so_rs,
	vmw_so_ss,
	vmw_so_so,
	vmw_so_max,
};

/**
 * union vmw_view_destroy - view destruction command body
 *
 * @rtv: RenderTarget view destruction command body
 * @srv: ShaderResource view destruction command body
 * @dsv: DepthStencil view destruction command body
 * @view_id: A single u32 view id.
 *
 * The assumption here is that all union members are really represented by a
 * single u32 in the command stream. If that's not the case,
 * the size of this union will not equal the size of an u32, and the
 * assumption is invalid, and we detect that at compile time in the
 * vmw_so_build_asserts() function.
 */
union vmw_view_destroy {
	struct SVGA3dCmdDXDestroyRenderTargetView rtv;
	struct SVGA3dCmdDXDestroyShaderResourceView srv;
	struct SVGA3dCmdDXDestroyDepthStencilView dsv;
	struct SVGA3dCmdDXDestroyUAView uav;
	u32 view_id;
};

/* Map enum vmw_view_type to view destroy command ids*/
extern const u32 vmw_view_destroy_cmds[];

/* Map enum vmw_view_type to SVGACOTableType */
extern const SVGACOTableType vmw_view_cotables[];

/* Map enum vmw_so_type to SVGACOTableType */
extern const SVGACOTableType vmw_so_cotables[];

/*
 * vmw_view_cmd_to_type - Return the view type for a create or destroy command
 *
 * @id: The SVGA3D command id.
 *
 * For a given view create or destroy command id, return the corresponding
 * enum vmw_view_type. If the command is unknown, return vmw_view_max.
 * The validity of the simplified calculation is verified in the
 * vmw_so_build_asserts() function.
 */
static inline enum vmw_view_type vmw_view_cmd_to_type(u32 id)
{
	u32 tmp = (id - SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW) / 2;

	if (id == SVGA_3D_CMD_DX_DEFINE_UA_VIEW ||
	    id == SVGA_3D_CMD_DX_DESTROY_UA_VIEW)
		return vmw_view_ua;

	if (id == SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2)
		return vmw_view_ds;

	if (tmp > (u32)vmw_view_ds)
		return vmw_view_max;

	return (enum vmw_view_type) tmp;
}

/*
 * vmw_so_cmd_to_type - Return the state object type for a
 * create or destroy command
 *
 * @id: The SVGA3D command id.
 *
 * For a given state object create or destroy command id,
 * return the corresponding enum vmw_so_type. If the command is uknown,
 * return vmw_so_max. We should perhaps optimize this function using
 * a similar strategy as vmw_view_cmd_to_type().
 */

Annotation

Implementation Notes