Skip to content

Commit 618cc15

Browse files
committed
Merge branch 'vmwgfx-fixes-4.19' of git://people.freedesktop.org/~thomash/linux into drm-fixes
A couple of modesetting fixes and a fix for a long-standing buffer-eviction problem cc'd stable. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thellstrom@vmware.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180920063935.35492-1-thellstrom@vmware.com
2 parents 8ca4fff + e71cf59 commit 618cc15

File tree

4 files changed

+45
-48
lines changed

4 files changed

+45
-48
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ int vmw_validate_single_buffer(struct vmw_private *dev_priv,
37293729
{
37303730
struct vmw_buffer_object *vbo =
37313731
container_of(bo, struct vmw_buffer_object, base);
3732-
struct ttm_operation_ctx ctx = { interruptible, true };
3732+
struct ttm_operation_ctx ctx = { interruptible, false };
37333733
int ret;
37343734

37353735
if (vbo->pin_count > 0)

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,21 +1512,19 @@ static int vmw_kms_check_display_memory(struct drm_device *dev,
15121512
struct drm_rect *rects)
15131513
{
15141514
struct vmw_private *dev_priv = vmw_priv(dev);
1515-
struct drm_mode_config *mode_config = &dev->mode_config;
15161515
struct drm_rect bounding_box = {0};
15171516
u64 total_pixels = 0, pixel_mem, bb_mem;
15181517
int i;
15191518

15201519
for (i = 0; i < num_rects; i++) {
15211520
/*
1522-
* Currently this check is limiting the topology within max
1523-
* texture/screentarget size. This should change in future when
1524-
* user-space support multiple fb with topology.
1521+
* For STDU only individual screen (screen target) is limited by
1522+
* SCREENTARGET_MAX_WIDTH/HEIGHT registers.
15251523
*/
1526-
if (rects[i].x1 < 0 || rects[i].y1 < 0 ||
1527-
rects[i].x2 > mode_config->max_width ||
1528-
rects[i].y2 > mode_config->max_height) {
1529-
DRM_ERROR("Invalid GUI layout.\n");
1524+
if (dev_priv->active_display_unit == vmw_du_screen_target &&
1525+
(drm_rect_width(&rects[i]) > dev_priv->stdu_max_width ||
1526+
drm_rect_height(&rects[i]) > dev_priv->stdu_max_height)) {
1527+
DRM_ERROR("Screen size not supported.\n");
15301528
return -EINVAL;
15311529
}
15321530

@@ -1615,7 +1613,7 @@ static int vmw_kms_check_topology(struct drm_device *dev,
16151613
struct drm_connector_state *conn_state;
16161614
struct vmw_connector_state *vmw_conn_state;
16171615

1618-
if (!new_crtc_state->enable && old_crtc_state->enable) {
1616+
if (!new_crtc_state->enable) {
16191617
rects[i].x1 = 0;
16201618
rects[i].y1 = 0;
16211619
rects[i].x2 = 0;
@@ -2216,12 +2214,16 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
22162214
if (dev_priv->assume_16bpp)
22172215
assumed_bpp = 2;
22182216

2217+
max_width = min(max_width, dev_priv->texture_max_width);
2218+
max_height = min(max_height, dev_priv->texture_max_height);
2219+
2220+
/*
2221+
* For STDU extra limit for a mode on SVGA_REG_SCREENTARGET_MAX_WIDTH/
2222+
* HEIGHT registers.
2223+
*/
22192224
if (dev_priv->active_display_unit == vmw_du_screen_target) {
22202225
max_width = min(max_width, dev_priv->stdu_max_width);
2221-
max_width = min(max_width, dev_priv->texture_max_width);
2222-
22232226
max_height = min(max_height, dev_priv->stdu_max_height);
2224-
max_height = min(max_height, dev_priv->texture_max_height);
22252227
}
22262228

22272229
/* Add preferred mode */
@@ -2376,6 +2378,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
23762378
struct drm_file *file_priv)
23772379
{
23782380
struct vmw_private *dev_priv = vmw_priv(dev);
2381+
struct drm_mode_config *mode_config = &dev->mode_config;
23792382
struct drm_vmw_update_layout_arg *arg =
23802383
(struct drm_vmw_update_layout_arg *)data;
23812384
void __user *user_rects;
@@ -2421,6 +2424,21 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
24212424
drm_rects[i].y1 = curr_rect.y;
24222425
drm_rects[i].x2 = curr_rect.x + curr_rect.w;
24232426
drm_rects[i].y2 = curr_rect.y + curr_rect.h;
2427+
2428+
/*
2429+
* Currently this check is limiting the topology within
2430+
* mode_config->max (which actually is max texture size
2431+
* supported by virtual device). This limit is here to address
2432+
* window managers that create a big framebuffer for whole
2433+
* topology.
2434+
*/
2435+
if (drm_rects[i].x1 < 0 || drm_rects[i].y1 < 0 ||
2436+
drm_rects[i].x2 > mode_config->max_width ||
2437+
drm_rects[i].y2 > mode_config->max_height) {
2438+
DRM_ERROR("Invalid GUI layout.\n");
2439+
ret = -EINVAL;
2440+
goto out_free;
2441+
}
24242442
}
24252443

24262444
ret = vmw_kms_check_display_memory(dev, arg->num_outputs, drm_rects);

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)