Skip to content

Commit 70a09f3

Browse files
committed
Merge tag 'vmwgfx-next-160316' of git://people.freedesktop.org/~thomash/linux into drm-next
Pull request of 2016-03-16 * tag 'vmwgfx-next-160316' of git://people.freedesktop.org/~thomash/linux: drm/vmwgfx: Bump driver minor drm/vmwgfx: Allow the UPDATE_LAYOUT ioctl from control nodes drm/vmwgfx: Send a hotplug event at master_set drm/vmwgfx: Default to explicit crtc placement for screen targets and screen objects drm/vmwgfx: Calculate the cursor position based on the crtc gui origin drm/vmwgfx: Add connector properties to switch between explicit and implicit placement drm/vmwgfx: Add suggested screen x and y connector properties drm/vmwgfx: Add implicit framebuffer checks to the screen target code drm/vmwgfx: Break out implicit fb code drm/vmwgfx: Rework screen target page flips v2 drm/vmwgfx: Fix screen object page flips for large framebuffers drm/vmwgfx: Fix a screen object framebuffer dirty corner case drm/vmwgfx: Add DXGenMips support
2 parents 189df01 + 5476aa4 commit 70a09f3

File tree

8 files changed

+496
-368
lines changed

8 files changed

+496
-368
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
195195
DRM_MASTER | DRM_AUTH),
196196
VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT,
197197
vmw_kms_update_layout_ioctl,
198-
DRM_MASTER),
198+
DRM_MASTER | DRM_CONTROL_ALLOW),
199199
VMW_IOCTL_DEF(VMW_CREATE_SHADER,
200200
vmw_shader_define_ioctl,
201201
DRM_AUTH | DRM_RENDER_ALLOW),
@@ -1204,6 +1204,7 @@ static int vmw_master_set(struct drm_device *dev,
12041204
}
12051205

12061206
dev_priv->active_master = vmaster;
1207+
drm_sysfs_hotplug_event(dev);
12071208

12081209
return 0;
12091210
}

drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
#include <drm/ttm/ttm_module.h>
4141
#include "vmwgfx_fence.h"
4242

43-
#define VMWGFX_DRIVER_DATE "20150810"
43+
#define VMWGFX_DRIVER_DATE "20160210"
4444
#define VMWGFX_DRIVER_MAJOR 2
45-
#define VMWGFX_DRIVER_MINOR 9
45+
#define VMWGFX_DRIVER_MINOR 10
4646
#define VMWGFX_DRIVER_PATCHLEVEL 0
4747
#define VMWGFX_FILE_PAGE_OFFSET 0x00100000
4848
#define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
@@ -407,8 +407,11 @@ struct vmw_private {
407407
void *fb_info;
408408
enum vmw_display_unit_type active_display_unit;
409409
struct vmw_legacy_display *ldu_priv;
410-
struct vmw_screen_object_display *sou_priv;
411410
struct vmw_overlay *overlay_priv;
411+
struct drm_property *hotplug_mode_update_property;
412+
struct drm_property *implicit_placement_property;
413+
unsigned num_implicit;
414+
struct vmw_framebuffer *implicit_fb;
412415

413416
/*
414417
* Context and surface management.

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,26 @@ static int vmw_cmd_dx_bind_shader(struct vmw_private *dev_priv,
30093009
return ret;
30103010
}
30113011

3012+
/**
3013+
* vmw_cmd_dx_genmips - Validate an SVGA_3D_CMD_DX_GENMIPS command
3014+
*
3015+
* @dev_priv: Pointer to a device private struct.
3016+
* @sw_context: The software context being used for this batch.
3017+
* @header: Pointer to the command header in the command stream.
3018+
*/
3019+
static int vmw_cmd_dx_genmips(struct vmw_private *dev_priv,
3020+
struct vmw_sw_context *sw_context,
3021+
SVGA3dCmdHeader *header)
3022+
{
3023+
struct {
3024+
SVGA3dCmdHeader header;
3025+
SVGA3dCmdDXGenMips body;
3026+
} *cmd = container_of(header, typeof(*cmd), header);
3027+
3028+
return vmw_view_id_val_add(sw_context, vmw_view_sr,
3029+
cmd->body.shaderResourceViewId);
3030+
}
3031+
30123032
static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv,
30133033
struct vmw_sw_context *sw_context,
30143034
void *buf, uint32_t *size)
@@ -3297,7 +3317,7 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = {
32973317
&vmw_cmd_dx_clear_depthstencil_view, true, false, true),
32983318
VMW_CMD_DEF(SVGA_3D_CMD_DX_PRED_COPY, &vmw_cmd_invalid,
32993319
true, false, true),
3300-
VMW_CMD_DEF(SVGA_3D_CMD_DX_GENMIPS, &vmw_cmd_invalid,
3320+
VMW_CMD_DEF(SVGA_3D_CMD_DX_GENMIPS, &vmw_cmd_dx_genmips,
33013321
true, false, true),
33023322
VMW_CMD_DEF(SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE,
33033323
&vmw_cmd_dx_check_subresource, true, false, true),

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

Lines changed: 158 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
236236
struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
237237
bool shown = du->cursor_surface || du->cursor_dmabuf ? true : false;
238238

239-
du->cursor_x = x + crtc->x;
240-
du->cursor_y = y + crtc->y;
239+
du->cursor_x = x + du->set_gui_x;
240+
du->cursor_y = y + du->set_gui_y;
241241

242242
/*
243243
* FIXME: Unclear whether there's any global state touched by the
@@ -663,9 +663,8 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
663663
break;
664664
case vmw_du_screen_object:
665665
ret = vmw_kms_sou_do_dmabuf_dirty(dev_priv, &vfbd->base,
666-
clips, num_clips, increment,
667-
true,
668-
NULL);
666+
clips, NULL, num_clips,
667+
increment, true, NULL);
669668
break;
670669
case vmw_du_legacy:
671670
ret = vmw_kms_ldu_do_dmabuf_dirty(dev_priv, &vfbd->base, 0, 0,
@@ -1109,6 +1108,22 @@ int vmw_kms_present(struct vmw_private *dev_priv,
11091108
return 0;
11101109
}
11111110

1111+
static void
1112+
vmw_kms_create_hotplug_mode_update_property(struct vmw_private *dev_priv)
1113+
{
1114+
if (dev_priv->hotplug_mode_update_property)
1115+
return;
1116+
1117+
dev_priv->hotplug_mode_update_property =
1118+
drm_property_create_range(dev_priv->dev,
1119+
DRM_MODE_PROP_IMMUTABLE,
1120+
"hotplug_mode_update", 0, 1);
1121+
1122+
if (!dev_priv->hotplug_mode_update_property)
1123+
return;
1124+
1125+
}
1126+
11121127
int vmw_kms_init(struct vmw_private *dev_priv)
11131128
{
11141129
struct drm_device *dev = dev_priv->dev;
@@ -1121,6 +1136,9 @@ int vmw_kms_init(struct vmw_private *dev_priv)
11211136
dev->mode_config.max_width = dev_priv->texture_max_width;
11221137
dev->mode_config.max_height = dev_priv->texture_max_height;
11231138

1139+
drm_mode_create_suggested_offset_properties(dev);
1140+
vmw_kms_create_hotplug_mode_update_property(dev_priv);
1141+
11241142
ret = vmw_kms_stdu_init_display(dev_priv);
11251143
if (ret) {
11261144
ret = vmw_kms_sou_init_display(dev_priv);
@@ -1360,15 +1378,28 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
13601378
du->pref_active = true;
13611379
du->gui_x = rects[du->unit].x;
13621380
du->gui_y = rects[du->unit].y;
1381+
drm_object_property_set_value
1382+
(&con->base, dev->mode_config.suggested_x_property,
1383+
du->gui_x);
1384+
drm_object_property_set_value
1385+
(&con->base, dev->mode_config.suggested_y_property,
1386+
du->gui_y);
13631387
} else {
13641388
du->pref_width = 800;
13651389
du->pref_height = 600;
13661390
du->pref_active = false;
1391+
drm_object_property_set_value
1392+
(&con->base, dev->mode_config.suggested_x_property,
1393+
0);
1394+
drm_object_property_set_value
1395+
(&con->base, dev->mode_config.suggested_y_property,
1396+
0);
13671397
}
13681398
con->status = vmw_du_connector_detect(con, true);
13691399
}
13701400

13711401
mutex_unlock(&dev->mode_config.mutex);
1402+
drm_sysfs_hotplug_event(dev);
13721403

13731404
return 0;
13741405
}
@@ -1591,6 +1622,12 @@ int vmw_du_connector_set_property(struct drm_connector *connector,
15911622
struct drm_property *property,
15921623
uint64_t val)
15931624
{
1625+
struct vmw_display_unit *du = vmw_connector_to_du(connector);
1626+
struct vmw_private *dev_priv = vmw_priv(connector->dev);
1627+
1628+
if (property == dev_priv->implicit_placement_property)
1629+
du->is_implicit = val;
1630+
15941631
return 0;
15951632
}
15961633

@@ -2096,3 +2133,119 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
20962133

20972134
return 0;
20982135
}
2136+
2137+
/**
2138+
* vmw_kms_del_active - unregister a crtc binding to the implicit framebuffer
2139+
*
2140+
* @dev_priv: Pointer to a device private struct.
2141+
* @du: The display unit of the crtc.
2142+
*/
2143+
void vmw_kms_del_active(struct vmw_private *dev_priv,
2144+
struct vmw_display_unit *du)
2145+
{
2146+
lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex);
2147+
2148+
if (du->active_implicit) {
2149+
if (--(dev_priv->num_implicit) == 0)
2150+
dev_priv->implicit_fb = NULL;
2151+
du->active_implicit = false;
2152+
}
2153+
}
2154+
2155+
/**
2156+
* vmw_kms_add_active - register a crtc binding to an implicit framebuffer
2157+
*
2158+
* @vmw_priv: Pointer to a device private struct.
2159+
* @du: The display unit of the crtc.
2160+
* @vfb: The implicit framebuffer
2161+
*
2162+
* Registers a binding to an implicit framebuffer.
2163+
*/
2164+
void vmw_kms_add_active(struct vmw_private *dev_priv,
2165+
struct vmw_display_unit *du,
2166+
struct vmw_framebuffer *vfb)
2167+
{
2168+
lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex);
2169+
2170+
WARN_ON_ONCE(!dev_priv->num_implicit && dev_priv->implicit_fb);
2171+
2172+
if (!du->active_implicit && du->is_implicit) {
2173+
dev_priv->implicit_fb = vfb;
2174+
du->active_implicit = true;
2175+
dev_priv->num_implicit++;
2176+
}
2177+
}
2178+
2179+
/**
2180+
* vmw_kms_screen_object_flippable - Check whether we can page-flip a crtc.
2181+
*
2182+
* @dev_priv: Pointer to device-private struct.
2183+
* @crtc: The crtc we want to flip.
2184+
*
2185+
* Returns true or false depending whether it's OK to flip this crtc
2186+
* based on the criterion that we must not have more than one implicit
2187+
* frame-buffer at any one time.
2188+
*/
2189+
bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv,
2190+
struct drm_crtc *crtc)
2191+
{
2192+
struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
2193+
2194+
lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex);
2195+
2196+
if (!du->is_implicit)
2197+
return true;
2198+
2199+
if (dev_priv->num_implicit != 1)
2200+
return false;
2201+
2202+
return true;
2203+
}
2204+
2205+
/**
2206+
* vmw_kms_update_implicit_fb - Update the implicit fb.
2207+
*
2208+
* @dev_priv: Pointer to device-private struct.
2209+
* @crtc: The crtc the new implicit frame-buffer is bound to.
2210+
*/
2211+
void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv,
2212+
struct drm_crtc *crtc)
2213+
{
2214+
struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
2215+
struct vmw_framebuffer *vfb;
2216+
2217+
lockdep_assert_held_once(&dev_priv->dev->mode_config.mutex);
2218+
2219+
if (!du->is_implicit)
2220+
return;
2221+
2222+
vfb = vmw_framebuffer_to_vfb(crtc->primary->fb);
2223+
WARN_ON_ONCE(dev_priv->num_implicit != 1 &&
2224+
dev_priv->implicit_fb != vfb);
2225+
2226+
dev_priv->implicit_fb = vfb;
2227+
}
2228+
2229+
/**
2230+
* vmw_kms_create_implicit_placement_proparty - Set up the implicit placement
2231+
* property.
2232+
*
2233+
* @dev_priv: Pointer to a device private struct.
2234+
* @immutable: Whether the property is immutable.
2235+
*
2236+
* Sets up the implicit placement property unless it's already set up.
2237+
*/
2238+
void
2239+
vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv,
2240+
bool immutable)
2241+
{
2242+
if (dev_priv->implicit_placement_property)
2243+
return;
2244+
2245+
dev_priv->implicit_placement_property =
2246+
drm_property_create_range(dev_priv->dev,
2247+
immutable ?
2248+
DRM_MODE_PROP_IMMUTABLE : 0,
2249+
"implicit_placement", 0, 1);
2250+
2251+
}

drivers/gpu/drm/vmwgfx/vmwgfx_kms.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ struct vmw_display_unit {
178178
int gui_x;
179179
int gui_y;
180180
bool is_implicit;
181+
bool active_implicit;
182+
int set_gui_x;
183+
int set_gui_y;
181184
};
182185

183186
#define vmw_crtc_to_du(x) \
@@ -254,6 +257,18 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
254257
struct drm_crtc **p_crtc,
255258
struct drm_display_mode **p_mode);
256259
void vmw_guess_mode_timing(struct drm_display_mode *mode);
260+
void vmw_kms_del_active(struct vmw_private *dev_priv,
261+
struct vmw_display_unit *du);
262+
void vmw_kms_add_active(struct vmw_private *dev_priv,
263+
struct vmw_display_unit *du,
264+
struct vmw_framebuffer *vfb);
265+
bool vmw_kms_crtc_flippable(struct vmw_private *dev_priv,
266+
struct drm_crtc *crtc);
267+
void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv,
268+
struct drm_crtc *crtc);
269+
void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv,
270+
bool immutable);
271+
257272

258273
/*
259274
* Legacy display unit functions - vmwgfx_ldu.c
@@ -287,6 +302,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
287302
int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv,
288303
struct vmw_framebuffer *framebuffer,
289304
struct drm_clip_rect *clips,
305+
struct drm_vmw_rect *vclips,
290306
unsigned num_clips, int increment,
291307
bool interruptible,
292308
struct vmw_fence_obj **out_fence);

drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set)
288288
crtc->y = set->y;
289289
crtc->mode = *mode;
290290
crtc->enabled = true;
291+
ldu->base.set_gui_x = set->x;
292+
ldu->base.set_gui_y = set->y;
291293

292294
vmw_ldu_add_active(dev_priv, ldu, vfb);
293295

@@ -375,8 +377,19 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit)
375377
drm_mode_crtc_set_gamma_size(crtc, 256);
376378

377379
drm_object_attach_property(&connector->base,
378-
dev->mode_config.dirty_info_property,
379-
1);
380+
dev->mode_config.dirty_info_property,
381+
1);
382+
drm_object_attach_property(&connector->base,
383+
dev_priv->hotplug_mode_update_property, 1);
384+
drm_object_attach_property(&connector->base,
385+
dev->mode_config.suggested_x_property, 0);
386+
drm_object_attach_property(&connector->base,
387+
dev->mode_config.suggested_y_property, 0);
388+
if (dev_priv->implicit_placement_property)
389+
drm_object_attach_property
390+
(&connector->base,
391+
dev_priv->implicit_placement_property,
392+
1);
380393

381394
return 0;
382395
}
@@ -412,6 +425,8 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv)
412425
if (ret != 0)
413426
goto err_vblank_cleanup;
414427

428+
vmw_kms_create_implicit_placement_property(dev_priv, true);
429+
415430
if (dev_priv->capabilities & SVGA_CAP_MULTIMON)
416431
for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i)
417432
vmw_ldu_init(dev_priv, i);

0 commit comments

Comments
 (0)