Skip to content

Commit a4bd815

Browse files
deepak-rawatthomashvmw
authored andcommitted
drm/vmwgfx: Don't impose STDU limits on framebuffer size
If framebuffers are larger, we create bounce surfaces that are within STDU limits. Signed-off-by: Deepak Rawat <drawat@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
1 parent 140b4e6 commit a4bd815

File tree

2 files changed

+14
-35
lines changed

2 files changed

+14
-35
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,31 +1600,6 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
16001600

16011601
dev_priv->active_display_unit = vmw_du_screen_target;
16021602

1603-
if (dev_priv->capabilities & SVGA_CAP_3D) {
1604-
/*
1605-
* For 3D VMs, display (scanout) buffer size is the smaller of
1606-
* max texture and max STDU
1607-
*/
1608-
uint32_t max_width, max_height;
1609-
1610-
max_width = min(dev_priv->texture_max_width,
1611-
dev_priv->stdu_max_width);
1612-
max_height = min(dev_priv->texture_max_height,
1613-
dev_priv->stdu_max_height);
1614-
1615-
dev->mode_config.max_width = max_width;
1616-
dev->mode_config.max_height = max_height;
1617-
} else {
1618-
/*
1619-
* Given various display aspect ratios, there's no way to
1620-
* estimate these using prim_bb_mem. So just set these to
1621-
* something arbitrarily large and we will reject any layout
1622-
* that doesn't fit prim_bb_mem later
1623-
*/
1624-
dev->mode_config.max_width = 8192;
1625-
dev->mode_config.max_height = 8192;
1626-
}
1627-
16281603
vmw_kms_create_implicit_placement_property(dev_priv, false);
16291604

16301605
for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) {

drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,22 +1404,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
14041404
*srf_out = NULL;
14051405

14061406
if (for_scanout) {
1407-
uint32_t max_width, max_height;
1408-
14091407
if (!svga3dsurface_is_screen_target_format(format)) {
14101408
DRM_ERROR("Invalid Screen Target surface format.");
14111409
return -EINVAL;
14121410
}
14131411

1414-
max_width = min(dev_priv->texture_max_width,
1415-
dev_priv->stdu_max_width);
1416-
max_height = min(dev_priv->texture_max_height,
1417-
dev_priv->stdu_max_height);
1418-
1419-
if (size.width > max_width || size.height > max_height) {
1412+
if (size.width > dev_priv->texture_max_width ||
1413+
size.height > dev_priv->texture_max_height) {
14201414
DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u",
14211415
size.width, size.height,
1422-
max_width, max_height);
1416+
dev_priv->texture_max_width,
1417+
dev_priv->texture_max_height);
14231418
return -EINVAL;
14241419
}
14251420
} else {
@@ -1495,8 +1490,17 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
14951490
if (srf->flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
14961491
srf->res.backup_size += sizeof(SVGA3dDXSOState);
14971492

1493+
/*
1494+
* Don't set SVGA3D_SURFACE_SCREENTARGET flag for a scanout surface with
1495+
* size greater than STDU max width/height. This is really a workaround
1496+
* to support creation of big framebuffer requested by some user-space
1497+
* for whole topology. That big framebuffer won't really be used for
1498+
* binding with screen target as during prepare_fb a separate surface is
1499+
* created so it's safe to ignore SVGA3D_SURFACE_SCREENTARGET flag.
1500+
*/
14981501
if (dev_priv->active_display_unit == vmw_du_screen_target &&
1499-
for_scanout)
1502+
for_scanout && size.width <= dev_priv->stdu_max_width &&
1503+
size.height <= dev_priv->stdu_max_height)
15001504
srf->flags |= SVGA3D_SURFACE_SCREENTARGET;
15011505

15021506
/*

0 commit comments

Comments
 (0)