Commit 9830e44f authored by Dave Airlie's avatar Dave Airlie

Merge tag 'vmwgfx-fixes-3.14-2014-02-18' of...

Merge tag 'vmwgfx-fixes-3.14-2014-02-18' of git://people.freedesktop.org/~thomash/linux into drm-fixes

Pull request of 2014-02-18.

Nothing special. The biggest change is adding a couple of command defines and
packing the command data correctly.

* tag 'vmwgfx-fixes-3.14-2014-02-18' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Fix command defines and checks
  drm/vmwgfx: Fix possible integer overflow
  drm/vmwgfx: Remove stray const
  drm/vmwgfx: unlock on error path in vmw_execbuf_process()
  drm/vmwgfx: Get maximum mob size from register SVGA_REG_MOB_MAX_SIZE
  drm/vmwgfx: Fix a couple of sparse warnings and errors
parents 560591f1 36e952c1
...@@ -1223,9 +1223,19 @@ typedef enum { ...@@ -1223,9 +1223,19 @@ typedef enum {
#define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129 #define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129
#define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130 #define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130
#define SVGA_3D_CMD_GB_SCREEN_DMA 1131
#define SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH 1132
#define SVGA_3D_CMD_GB_MOB_FENCE 1133
#define SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134
#define SVGA_3D_CMD_DEFINE_GB_MOB64 1135 #define SVGA_3D_CMD_DEFINE_GB_MOB64 1135
#define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136 #define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136
#define SVGA_3D_CMD_NOP_ERROR 1137
#define SVGA_3D_CMD_RESERVED1 1138
#define SVGA_3D_CMD_RESERVED2 1139
#define SVGA_3D_CMD_RESERVED3 1140
#define SVGA_3D_CMD_RESERVED4 1141
#define SVGA_3D_CMD_RESERVED5 1142
#define SVGA_3D_CMD_MAX 1142 #define SVGA_3D_CMD_MAX 1142
#define SVGA_3D_CMD_FUTURE_MAX 3000 #define SVGA_3D_CMD_FUTURE_MAX 3000
...@@ -1973,8 +1983,7 @@ struct { ...@@ -1973,8 +1983,7 @@ struct {
uint32 sizeInBytes; uint32 sizeInBytes;
uint32 validSizeInBytes; uint32 validSizeInBytes;
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
} } __packed
__attribute__((__packed__))
SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */
typedef typedef
...@@ -1984,15 +1993,13 @@ struct { ...@@ -1984,15 +1993,13 @@ struct {
uint32 sizeInBytes; uint32 sizeInBytes;
uint32 validSizeInBytes; uint32 validSizeInBytes;
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
} } __packed
__attribute__((__packed__))
SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */
typedef typedef
struct { struct {
SVGAOTableType type; SVGAOTableType type;
} } __packed
__attribute__((__packed__))
SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */ SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */
/* /*
...@@ -2005,8 +2012,7 @@ struct SVGA3dCmdDefineGBMob { ...@@ -2005,8 +2012,7 @@ struct SVGA3dCmdDefineGBMob {
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
PPN base; PPN base;
uint32 sizeInBytes; uint32 sizeInBytes;
} } __packed
__attribute__((__packed__))
SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */
...@@ -2017,8 +2023,7 @@ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ ...@@ -2017,8 +2023,7 @@ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */
typedef typedef
struct SVGA3dCmdDestroyGBMob { struct SVGA3dCmdDestroyGBMob {
SVGAMobId mobid; SVGAMobId mobid;
} } __packed
__attribute__((__packed__))
SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */ SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */
/* /*
...@@ -2031,8 +2036,7 @@ struct SVGA3dCmdRedefineGBMob { ...@@ -2031,8 +2036,7 @@ struct SVGA3dCmdRedefineGBMob {
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
PPN base; PPN base;
uint32 sizeInBytes; uint32 sizeInBytes;
} } __packed
__attribute__((__packed__))
SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */ SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */
/* /*
...@@ -2045,8 +2049,7 @@ struct SVGA3dCmdDefineGBMob64 { ...@@ -2045,8 +2049,7 @@ struct SVGA3dCmdDefineGBMob64 {
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
PPN64 base; PPN64 base;
uint32 sizeInBytes; uint32 sizeInBytes;
} } __packed
__attribute__((__packed__))
SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */ SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */
/* /*
...@@ -2059,8 +2062,7 @@ struct SVGA3dCmdRedefineGBMob64 { ...@@ -2059,8 +2062,7 @@ struct SVGA3dCmdRedefineGBMob64 {
SVGAMobFormat ptDepth; SVGAMobFormat ptDepth;
PPN64 base; PPN64 base;
uint32 sizeInBytes; uint32 sizeInBytes;
} } __packed
__attribute__((__packed__))
SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
/* /*
...@@ -2070,8 +2072,7 @@ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ ...@@ -2070,8 +2072,7 @@ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
typedef typedef
struct SVGA3dCmdUpdateGBMobMapping { struct SVGA3dCmdUpdateGBMobMapping {
SVGAMobId mobid; SVGAMobId mobid;
} } __packed
__attribute__((__packed__))
SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */ SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */
/* /*
...@@ -2087,7 +2088,8 @@ struct SVGA3dCmdDefineGBSurface { ...@@ -2087,7 +2088,8 @@ struct SVGA3dCmdDefineGBSurface {
uint32 multisampleCount; uint32 multisampleCount;
SVGA3dTextureFilter autogenFilter; SVGA3dTextureFilter autogenFilter;
SVGA3dSize size; SVGA3dSize size;
} SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */ } __packed
SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */
/* /*
* Destroy a guest-backed surface. * Destroy a guest-backed surface.
...@@ -2096,7 +2098,8 @@ struct SVGA3dCmdDefineGBSurface { ...@@ -2096,7 +2098,8 @@ struct SVGA3dCmdDefineGBSurface {
typedef typedef
struct SVGA3dCmdDestroyGBSurface { struct SVGA3dCmdDestroyGBSurface {
uint32 sid; uint32 sid;
} SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */ } __packed
SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */
/* /*
* Bind a guest-backed surface to an object. * Bind a guest-backed surface to an object.
...@@ -2106,7 +2109,8 @@ typedef ...@@ -2106,7 +2109,8 @@ typedef
struct SVGA3dCmdBindGBSurface { struct SVGA3dCmdBindGBSurface {
uint32 sid; uint32 sid;
SVGAMobId mobid; SVGAMobId mobid;
} SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */ } __packed
SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */
/* /*
* Conditionally bind a mob to a guest backed surface if testMobid * Conditionally bind a mob to a guest backed surface if testMobid
...@@ -2123,7 +2127,7 @@ struct{ ...@@ -2123,7 +2127,7 @@ struct{
SVGAMobId testMobid; SVGAMobId testMobid;
SVGAMobId mobid; SVGAMobId mobid;
uint32 flags; uint32 flags;
} } __packed
SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */
/* /*
...@@ -2135,7 +2139,8 @@ typedef ...@@ -2135,7 +2139,8 @@ typedef
struct SVGA3dCmdUpdateGBImage { struct SVGA3dCmdUpdateGBImage {
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
SVGA3dBox box; SVGA3dBox box;
} SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */ } __packed
SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */
/* /*
* Update an entire guest-backed surface. * Update an entire guest-backed surface.
...@@ -2145,7 +2150,8 @@ struct SVGA3dCmdUpdateGBImage { ...@@ -2145,7 +2150,8 @@ struct SVGA3dCmdUpdateGBImage {
typedef typedef
struct SVGA3dCmdUpdateGBSurface { struct SVGA3dCmdUpdateGBSurface {
uint32 sid; uint32 sid;
} SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */ } __packed
SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */
/* /*
* Readback an image in a guest-backed surface. * Readback an image in a guest-backed surface.
...@@ -2155,7 +2161,8 @@ struct SVGA3dCmdUpdateGBSurface { ...@@ -2155,7 +2161,8 @@ struct SVGA3dCmdUpdateGBSurface {
typedef typedef
struct SVGA3dCmdReadbackGBImage { struct SVGA3dCmdReadbackGBImage {
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
} SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/ } __packed
SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/
/* /*
* Readback an entire guest-backed surface. * Readback an entire guest-backed surface.
...@@ -2165,7 +2172,8 @@ struct SVGA3dCmdReadbackGBImage { ...@@ -2165,7 +2172,8 @@ struct SVGA3dCmdReadbackGBImage {
typedef typedef
struct SVGA3dCmdReadbackGBSurface { struct SVGA3dCmdReadbackGBSurface {
uint32 sid; uint32 sid;
} SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */ } __packed
SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */
/* /*
* Readback a sub rect of an image in a guest-backed surface. After * Readback a sub rect of an image in a guest-backed surface. After
...@@ -2179,7 +2187,7 @@ struct SVGA3dCmdReadbackGBImagePartial { ...@@ -2179,7 +2187,7 @@ struct SVGA3dCmdReadbackGBImagePartial {
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
SVGA3dBox box; SVGA3dBox box;
uint32 invertBox; uint32 invertBox;
} } __packed
SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
/* /*
...@@ -2190,7 +2198,8 @@ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ ...@@ -2190,7 +2198,8 @@ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
typedef typedef
struct SVGA3dCmdInvalidateGBImage { struct SVGA3dCmdInvalidateGBImage {
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
} SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */ } __packed
SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */
/* /*
* Invalidate an entire guest-backed surface. * Invalidate an entire guest-backed surface.
...@@ -2200,7 +2209,8 @@ struct SVGA3dCmdInvalidateGBImage { ...@@ -2200,7 +2209,8 @@ struct SVGA3dCmdInvalidateGBImage {
typedef typedef
struct SVGA3dCmdInvalidateGBSurface { struct SVGA3dCmdInvalidateGBSurface {
uint32 sid; uint32 sid;
} SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */ } __packed
SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */
/* /*
* Invalidate a sub rect of an image in a guest-backed surface. After * Invalidate a sub rect of an image in a guest-backed surface. After
...@@ -2214,7 +2224,7 @@ struct SVGA3dCmdInvalidateGBImagePartial { ...@@ -2214,7 +2224,7 @@ struct SVGA3dCmdInvalidateGBImagePartial {
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
SVGA3dBox box; SVGA3dBox box;
uint32 invertBox; uint32 invertBox;
} } __packed
SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
/* /*
...@@ -2224,7 +2234,8 @@ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ ...@@ -2224,7 +2234,8 @@ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
typedef typedef
struct SVGA3dCmdDefineGBContext { struct SVGA3dCmdDefineGBContext {
uint32 cid; uint32 cid;
} SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */ } __packed
SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */
/* /*
* Destroy a guest-backed context. * Destroy a guest-backed context.
...@@ -2233,7 +2244,8 @@ struct SVGA3dCmdDefineGBContext { ...@@ -2233,7 +2244,8 @@ struct SVGA3dCmdDefineGBContext {
typedef typedef
struct SVGA3dCmdDestroyGBContext { struct SVGA3dCmdDestroyGBContext {
uint32 cid; uint32 cid;
} SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */ } __packed
SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */
/* /*
* Bind a guest-backed context. * Bind a guest-backed context.
...@@ -2252,7 +2264,8 @@ struct SVGA3dCmdBindGBContext { ...@@ -2252,7 +2264,8 @@ struct SVGA3dCmdBindGBContext {
uint32 cid; uint32 cid;
SVGAMobId mobid; SVGAMobId mobid;
uint32 validContents; uint32 validContents;
} SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */ } __packed
SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */
/* /*
* Readback a guest-backed context. * Readback a guest-backed context.
...@@ -2262,7 +2275,8 @@ struct SVGA3dCmdBindGBContext { ...@@ -2262,7 +2275,8 @@ struct SVGA3dCmdBindGBContext {
typedef typedef
struct SVGA3dCmdReadbackGBContext { struct SVGA3dCmdReadbackGBContext {
uint32 cid; uint32 cid;
} SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */ } __packed
SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */
/* /*
* Invalidate a guest-backed context. * Invalidate a guest-backed context.
...@@ -2270,7 +2284,8 @@ struct SVGA3dCmdReadbackGBContext { ...@@ -2270,7 +2284,8 @@ struct SVGA3dCmdReadbackGBContext {
typedef typedef
struct SVGA3dCmdInvalidateGBContext { struct SVGA3dCmdInvalidateGBContext {
uint32 cid; uint32 cid;
} SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */ } __packed
SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */
/* /*
* Define a guest-backed shader. * Define a guest-backed shader.
...@@ -2281,7 +2296,8 @@ struct SVGA3dCmdDefineGBShader { ...@@ -2281,7 +2296,8 @@ struct SVGA3dCmdDefineGBShader {
uint32 shid; uint32 shid;
SVGA3dShaderType type; SVGA3dShaderType type;
uint32 sizeInBytes; uint32 sizeInBytes;
} SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */ } __packed
SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */
/* /*
* Bind a guest-backed shader. * Bind a guest-backed shader.
...@@ -2291,7 +2307,8 @@ typedef struct SVGA3dCmdBindGBShader { ...@@ -2291,7 +2307,8 @@ typedef struct SVGA3dCmdBindGBShader {
uint32 shid; uint32 shid;
SVGAMobId mobid; SVGAMobId mobid;
uint32 offsetInBytes; uint32 offsetInBytes;
} SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */ } __packed
SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */
/* /*
* Destroy a guest-backed shader. * Destroy a guest-backed shader.
...@@ -2299,7 +2316,8 @@ typedef struct SVGA3dCmdBindGBShader { ...@@ -2299,7 +2316,8 @@ typedef struct SVGA3dCmdBindGBShader {
typedef struct SVGA3dCmdDestroyGBShader { typedef struct SVGA3dCmdDestroyGBShader {
uint32 shid; uint32 shid;
} SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ } __packed
SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */
typedef typedef
struct { struct {
...@@ -2314,14 +2332,16 @@ struct { ...@@ -2314,14 +2332,16 @@ struct {
* Note that FLOAT and INT constants are 4-dwords in length, while * Note that FLOAT and INT constants are 4-dwords in length, while
* BOOL constants are 1-dword in length. * BOOL constants are 1-dword in length.
*/ */
} SVGA3dCmdSetGBShaderConstInline; } __packed
SVGA3dCmdSetGBShaderConstInline;
/* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */
typedef typedef
struct { struct {
uint32 cid; uint32 cid;
SVGA3dQueryType type; SVGA3dQueryType type;
} SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ } __packed
SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */
typedef typedef
struct { struct {
...@@ -2329,7 +2349,8 @@ struct { ...@@ -2329,7 +2349,8 @@ struct {
SVGA3dQueryType type; SVGA3dQueryType type;
SVGAMobId mobid; SVGAMobId mobid;
uint32 offset; uint32 offset;
} SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */ } __packed
SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */
/* /*
...@@ -2346,21 +2367,22 @@ struct { ...@@ -2346,21 +2367,22 @@ struct {
SVGA3dQueryType type; SVGA3dQueryType type;
SVGAMobId mobid; SVGAMobId mobid;
uint32 offset; uint32 offset;
} SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */ } __packed
SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */
typedef typedef
struct { struct {
SVGAMobId mobid; SVGAMobId mobid;
uint32 fbOffset; uint32 fbOffset;
uint32 initalized; uint32 initalized;
} } __packed
SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */
typedef typedef
struct { struct {
SVGAMobId mobid; SVGAMobId mobid;
uint32 gartOffset; uint32 gartOffset;
} } __packed
SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */
...@@ -2368,7 +2390,7 @@ typedef ...@@ -2368,7 +2390,7 @@ typedef
struct { struct {
uint32 gartOffset; uint32 gartOffset;
uint32 numPages; uint32 numPages;
} } __packed
SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */ SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */
...@@ -2385,27 +2407,27 @@ struct { ...@@ -2385,27 +2407,27 @@ struct {
int32 xRoot; int32 xRoot;
int32 yRoot; int32 yRoot;
uint32 flags; uint32 flags;
} } __packed
SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */
typedef typedef
struct { struct {
uint32 stid; uint32 stid;
} } __packed
SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */
typedef typedef
struct { struct {
uint32 stid; uint32 stid;
SVGA3dSurfaceImageId image; SVGA3dSurfaceImageId image;
} } __packed
SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */
typedef typedef
struct { struct {
uint32 stid; uint32 stid;
SVGA3dBox box; SVGA3dBox box;
} } __packed
SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */ SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */
/* /*
......
...@@ -38,8 +38,11 @@ ...@@ -38,8 +38,11 @@
#define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) #define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y))
#define max_t(type, x, y) ((x) > (y) ? (x) : (y)) #define max_t(type, x, y) ((x) > (y) ? (x) : (y))
#define min_t(type, x, y) ((x) < (y) ? (x) : (y))
#define surf_size_struct SVGA3dSize #define surf_size_struct SVGA3dSize
#define u32 uint32 #define u32 uint32
#define u64 uint64_t
#define U32_MAX ((u32)~0U)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
...@@ -704,8 +707,8 @@ static const struct svga3d_surface_desc svga3d_surface_descs[] = { ...@@ -704,8 +707,8 @@ static const struct svga3d_surface_desc svga3d_surface_descs[] = {
static inline u32 clamped_umul32(u32 a, u32 b) static inline u32 clamped_umul32(u32 a, u32 b)
{ {
uint64_t tmp = (uint64_t) a*b; u64 tmp = (u64) a*b;
return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp; return (tmp > (u64) U32_MAX) ? U32_MAX : tmp;
} }
static inline const struct svga3d_surface_desc * static inline const struct svga3d_surface_desc *
...@@ -834,7 +837,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, ...@@ -834,7 +837,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format,
bool cubemap) bool cubemap)
{ {
const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format); const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
u32 total_size = 0; u64 total_size = 0;
u32 mip; u32 mip;
for (mip = 0; mip < num_mip_levels; mip++) { for (mip = 0; mip < num_mip_levels; mip++) {
...@@ -847,7 +850,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, ...@@ -847,7 +850,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format,
if (cubemap) if (cubemap)
total_size *= SVGA3D_MAX_SURFACE_FACES; total_size *= SVGA3D_MAX_SURFACE_FACES;
return total_size; return (u32) min_t(u64, total_size, (u64) U32_MAX);
} }
......
...@@ -169,10 +169,17 @@ enum { ...@@ -169,10 +169,17 @@ enum {
SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */
SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */ SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */
SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */
SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */
SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */
SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */ SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */
SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */ SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */
SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */ SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */
SVGA_REG_TOP = 53, /* Must be 1 more than the last register */ SVGA_REG_CMD_PREPEND_LOW = 53,
SVGA_REG_CMD_PREPEND_HIGH = 54,
SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,
SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,
SVGA_REG_MOB_MAX_SIZE = 57,
SVGA_REG_TOP = 58, /* Must be 1 more than the last register */
SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
/* Next 768 (== 256*3) registers exist for colormap */ /* Next 768 (== 256*3) registers exist for colormap */
......
...@@ -551,8 +551,7 @@ static int vmw_context_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind) ...@@ -551,8 +551,7 @@ static int vmw_context_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind)
cmd->header.size = sizeof(cmd->body); cmd->header.size = sizeof(cmd->body);
cmd->body.cid = bi->ctx->id; cmd->body.cid = bi->ctx->id;
cmd->body.type = bi->i1.shader_type; cmd->body.type = bi->i1.shader_type;
cmd->body.shid = cmd->body.shid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_fifo_commit(dev_priv, sizeof(*cmd));
return 0; return 0;
...@@ -585,8 +584,7 @@ static int vmw_context_scrub_render_target(struct vmw_ctx_bindinfo *bi, ...@@ -585,8 +584,7 @@ static int vmw_context_scrub_render_target(struct vmw_ctx_bindinfo *bi,
cmd->header.size = sizeof(cmd->body); cmd->header.size = sizeof(cmd->body);
cmd->body.cid = bi->ctx->id; cmd->body.cid = bi->ctx->id;
cmd->body.type = bi->i1.rt_type; cmd->body.type = bi->i1.rt_type;
cmd->body.target.sid = cmd->body.target.sid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
cmd->body.target.face = 0; cmd->body.target.face = 0;
cmd->body.target.mipmap = 0; cmd->body.target.mipmap = 0;
vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_fifo_commit(dev_priv, sizeof(*cmd));
...@@ -628,8 +626,7 @@ static int vmw_context_scrub_texture(struct vmw_ctx_bindinfo *bi, ...@@ -628,8 +626,7 @@ static int vmw_context_scrub_texture(struct vmw_ctx_bindinfo *bi,
cmd->body.c.cid = bi->ctx->id; cmd->body.c.cid = bi->ctx->id;
cmd->body.s1.stage = bi->i1.texture_stage; cmd->body.s1.stage = bi->i1.texture_stage;
cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE; cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE;
cmd->body.s1.value = cmd->body.s1.value = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID);
vmw_fifo_commit(dev_priv, sizeof(*cmd)); vmw_fifo_commit(dev_priv, sizeof(*cmd));
return 0; return 0;
......
...@@ -667,6 +667,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -667,6 +667,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv->memory_size = 512*1024*1024; dev_priv->memory_size = 512*1024*1024;
} }
dev_priv->max_mob_pages = 0; dev_priv->max_mob_pages = 0;
dev_priv->max_mob_size = 0;
if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) {
uint64_t mem_size = uint64_t mem_size =
vmw_read(dev_priv, vmw_read(dev_priv,
...@@ -676,6 +677,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -676,6 +677,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv->prim_bb_mem = dev_priv->prim_bb_mem =
vmw_read(dev_priv, vmw_read(dev_priv,
SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM); SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM);
dev_priv->max_mob_size =
vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE);
} else } else
dev_priv->prim_bb_mem = dev_priv->vram_size; dev_priv->prim_bb_mem = dev_priv->vram_size;
......
...@@ -386,6 +386,7 @@ struct vmw_private { ...@@ -386,6 +386,7 @@ struct vmw_private {
uint32_t max_gmr_ids; uint32_t max_gmr_ids;
uint32_t max_gmr_pages; uint32_t max_gmr_pages;
uint32_t max_mob_pages; uint32_t max_mob_pages;
uint32_t max_mob_size;
uint32_t memory_size; uint32_t memory_size;
bool has_gmr; bool has_gmr;
bool has_mob; bool has_mob;
......
...@@ -602,7 +602,7 @@ static int vmw_cmd_cid_check(struct vmw_private *dev_priv, ...@@ -602,7 +602,7 @@ static int vmw_cmd_cid_check(struct vmw_private *dev_priv,
{ {
struct vmw_cid_cmd { struct vmw_cid_cmd {
SVGA3dCmdHeader header; SVGA3dCmdHeader header;
__le32 cid; uint32_t cid;
} *cmd; } *cmd;
cmd = container_of(header, struct vmw_cid_cmd, header); cmd = container_of(header, struct vmw_cid_cmd, header);
...@@ -1835,7 +1835,7 @@ static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv, ...@@ -1835,7 +1835,7 @@ static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv,
return 0; return 0;
} }
static const struct vmw_cmd_entry const vmw_cmd_entries[SVGA_3D_CMD_MAX] = { static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = {
VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DEFINE, &vmw_cmd_invalid, VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DEFINE, &vmw_cmd_invalid,
false, false, false), false, false, false),
VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DESTROY, &vmw_cmd_invalid, VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DESTROY, &vmw_cmd_invalid,
...@@ -2032,6 +2032,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv, ...@@ -2032,6 +2032,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
goto out_invalid; goto out_invalid;
entry = &vmw_cmd_entries[cmd_id]; entry = &vmw_cmd_entries[cmd_id];
if (unlikely(!entry->func))
goto out_invalid;
if (unlikely(!entry->user_allow && !sw_context->kernel)) if (unlikely(!entry->user_allow && !sw_context->kernel))
goto out_privileged; goto out_privileged;
...@@ -2469,7 +2472,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, ...@@ -2469,7 +2472,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,
if (dev_priv->has_mob) { if (dev_priv->has_mob) {
ret = vmw_rebind_contexts(sw_context); ret = vmw_rebind_contexts(sw_context);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_err; goto out_unlock_binding;
} }
cmd = vmw_fifo_reserve(dev_priv, command_size); cmd = vmw_fifo_reserve(dev_priv, command_size);
......
...@@ -102,6 +102,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -102,6 +102,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
vmw_fp->gb_aware = true; vmw_fp->gb_aware = true;
param->value = dev_priv->max_mob_pages * PAGE_SIZE; param->value = dev_priv->max_mob_pages * PAGE_SIZE;
break; break;
case DRM_VMW_PARAM_MAX_MOB_SIZE:
param->value = dev_priv->max_mob_size;
break;
default: default:
DRM_ERROR("Illegal vmwgfx get param request: %d\n", DRM_ERROR("Illegal vmwgfx get param request: %d\n",
param->param); param->param);
......
...@@ -371,7 +371,7 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data, ...@@ -371,7 +371,7 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data,
TTM_REF_USAGE); TTM_REF_USAGE);
} }
int vmw_shader_alloc(struct vmw_private *dev_priv, static int vmw_shader_alloc(struct vmw_private *dev_priv,
struct vmw_dma_buffer *buffer, struct vmw_dma_buffer *buffer,
size_t shader_size, size_t shader_size,
size_t offset, size_t offset,
...@@ -779,6 +779,8 @@ vmw_compat_shader_man_create(struct vmw_private *dev_priv) ...@@ -779,6 +779,8 @@ vmw_compat_shader_man_create(struct vmw_private *dev_priv)
int ret; int ret;
man = kzalloc(sizeof(*man), GFP_KERNEL); man = kzalloc(sizeof(*man), GFP_KERNEL);
if (man == NULL)
return ERR_PTR(-ENOMEM);
man->dev_priv = dev_priv; man->dev_priv = dev_priv;
INIT_LIST_HEAD(&man->list); INIT_LIST_HEAD(&man->list);
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7 #define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
#define DRM_VMW_PARAM_3D_CAPS_SIZE 8 #define DRM_VMW_PARAM_3D_CAPS_SIZE 8
#define DRM_VMW_PARAM_MAX_MOB_MEMORY 9 #define DRM_VMW_PARAM_MAX_MOB_MEMORY 9
#define DRM_VMW_PARAM_MAX_MOB_SIZE 10
/** /**
* struct drm_vmw_getparam_arg * struct drm_vmw_getparam_arg
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment