Skip to content

Commit 512a972

Browse files
committed
drm/vmwgfx: Cleanup kms setup without 3d
Do not validate format equality for the non 3d cases to allow xrgb to argb copies and make sure the dx binding flags are only used on dx compatible surfaces. Fixes basic 2d kms setup on configurations without 3d. There's little practical benefit to it because kms framebuffer coherence is disabled on configurations without 3d but with those changes the code actually makes sense. v2: Remove the now unused format variable Signed-off-by: Zack Rusin <[email protected]> Fixes: d6667f0 ("drm/vmwgfx: Fix handling of dumb buffers") Cc: Broadcom internal kernel review list <[email protected]> Cc: [email protected] Cc: <[email protected]> # v6.9+ Cc: Maaz Mombasawala <[email protected]> Cc: Martin Krastev <[email protected]> Reviewed-by: Martin Krastev <[email protected]> Reviewed-by: Maaz Mombasawala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 4809a01 commit 512a972

File tree

2 files changed

+6
-32
lines changed

2 files changed

+6
-32
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
12831283
{
12841284
struct drm_device *dev = &dev_priv->drm;
12851285
struct vmw_framebuffer_surface *vfbs;
1286-
enum SVGA3dSurfaceFormat format;
12871286
struct vmw_surface *surface;
12881287
int ret;
12891288

@@ -1320,34 +1319,6 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv,
13201319
return -EINVAL;
13211320
}
13221321

1323-
switch (mode_cmd->pixel_format) {
1324-
case DRM_FORMAT_ARGB8888:
1325-
format = SVGA3D_A8R8G8B8;
1326-
break;
1327-
case DRM_FORMAT_XRGB8888:
1328-
format = SVGA3D_X8R8G8B8;
1329-
break;
1330-
case DRM_FORMAT_RGB565:
1331-
format = SVGA3D_R5G6B5;
1332-
break;
1333-
case DRM_FORMAT_XRGB1555:
1334-
format = SVGA3D_A1R5G5B5;
1335-
break;
1336-
default:
1337-
DRM_ERROR("Invalid pixel format: %p4cc\n",
1338-
&mode_cmd->pixel_format);
1339-
return -EINVAL;
1340-
}
1341-
1342-
/*
1343-
* For DX, surface format validation is done when surface->scanout
1344-
* is set.
1345-
*/
1346-
if (!has_sm4_context(dev_priv) && format != surface->metadata.format) {
1347-
DRM_ERROR("Invalid surface format for requested mode.\n");
1348-
return -EINVAL;
1349-
}
1350-
13511322
vfbs = kzalloc(sizeof(*vfbs), GFP_KERNEL);
13521323
if (!vfbs) {
13531324
ret = -ENOMEM;

drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,9 +2276,12 @@ int vmw_dumb_create(struct drm_file *file_priv,
22762276
const struct SVGA3dSurfaceDesc *desc = vmw_surface_get_desc(format);
22772277
SVGA3dSurfaceAllFlags flags = SVGA3D_SURFACE_HINT_TEXTURE |
22782278
SVGA3D_SURFACE_HINT_RENDERTARGET |
2279-
SVGA3D_SURFACE_SCREENTARGET |
2280-
SVGA3D_SURFACE_BIND_SHADER_RESOURCE |
2281-
SVGA3D_SURFACE_BIND_RENDER_TARGET;
2279+
SVGA3D_SURFACE_SCREENTARGET;
2280+
2281+
if (vmw_surface_is_dx_screen_target_format(format)) {
2282+
flags |= SVGA3D_SURFACE_BIND_SHADER_RESOURCE |
2283+
SVGA3D_SURFACE_BIND_RENDER_TARGET;
2284+
}
22822285

22832286
/*
22842287
* Without mob support we're just going to use raw memory buffer

0 commit comments

Comments
 (0)