@@ -236,8 +236,8 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
236
236
struct vmw_display_unit * du = vmw_crtc_to_du (crtc );
237
237
bool shown = du -> cursor_surface || du -> cursor_dmabuf ? true : false;
238
238
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 ;
241
241
242
242
/*
243
243
* 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,
663
663
break ;
664
664
case vmw_du_screen_object :
665
665
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 );
669
668
break ;
670
669
case vmw_du_legacy :
671
670
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,
1109
1108
return 0 ;
1110
1109
}
1111
1110
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
+
1112
1127
int vmw_kms_init (struct vmw_private * dev_priv )
1113
1128
{
1114
1129
struct drm_device * dev = dev_priv -> dev ;
@@ -1121,6 +1136,9 @@ int vmw_kms_init(struct vmw_private *dev_priv)
1121
1136
dev -> mode_config .max_width = dev_priv -> texture_max_width ;
1122
1137
dev -> mode_config .max_height = dev_priv -> texture_max_height ;
1123
1138
1139
+ drm_mode_create_suggested_offset_properties (dev );
1140
+ vmw_kms_create_hotplug_mode_update_property (dev_priv );
1141
+
1124
1142
ret = vmw_kms_stdu_init_display (dev_priv );
1125
1143
if (ret ) {
1126
1144
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,
1360
1378
du -> pref_active = true;
1361
1379
du -> gui_x = rects [du -> unit ].x ;
1362
1380
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 );
1363
1387
} else {
1364
1388
du -> pref_width = 800 ;
1365
1389
du -> pref_height = 600 ;
1366
1390
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 );
1367
1397
}
1368
1398
con -> status = vmw_du_connector_detect (con , true);
1369
1399
}
1370
1400
1371
1401
mutex_unlock (& dev -> mode_config .mutex );
1402
+ drm_sysfs_hotplug_event (dev );
1372
1403
1373
1404
return 0 ;
1374
1405
}
@@ -1591,6 +1622,12 @@ int vmw_du_connector_set_property(struct drm_connector *connector,
1591
1622
struct drm_property * property ,
1592
1623
uint64_t val )
1593
1624
{
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
+
1594
1631
return 0 ;
1595
1632
}
1596
1633
@@ -2096,3 +2133,119 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
2096
2133
2097
2134
return 0 ;
2098
2135
}
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
+ }
0 commit comments