aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2016-11-04 03:20:35 -0400
committerBen Skeggs <bskeggs@redhat.com>2016-11-06 23:04:47 -0500
commit56182b8bd14bb8fe85d4d6e6bcbc9779ad538288 (patch)
tree26b833a7fc2d31da541ecd8dc062c9ea0e2256e2
parent616915ec7629af65532e2220792e3ec83ee3510b (diff)
drm/nouveau/kms: separate connector property attach from nouveau_connector
These will also be used by MST connectors. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c139
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.h1
2 files changed, 78 insertions, 62 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index a7b8f6853c7f..c08d5e6c3a05 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -271,6 +271,78 @@ nouveau_conn_reset(struct drm_connector *connector)
271 } 271 }
272} 272}
273 273
274void
275nouveau_conn_attach_properties(struct drm_connector *connector)
276{
277 struct drm_device *dev = connector->dev;
278 struct nouveau_conn_atom *armc = nouveau_conn_atom(connector->state);
279 struct nouveau_display *disp = nouveau_display(dev);
280
281 /* Init DVI-I specific properties. */
282 if (connector->connector_type == DRM_MODE_CONNECTOR_DVII)
283 drm_object_attach_property(&connector->base, dev->mode_config.
284 dvi_i_subconnector_property, 0);
285
286 /* Add overscan compensation options to digital outputs. */
287 if (disp->underscan_property &&
288 (connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
289 connector->connector_type == DRM_MODE_CONNECTOR_DVII ||
290 connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
291 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)) {
292 drm_object_attach_property(&connector->base,
293 disp->underscan_property,
294 UNDERSCAN_OFF);
295 drm_object_attach_property(&connector->base,
296 disp->underscan_hborder_property, 0);
297 drm_object_attach_property(&connector->base,
298 disp->underscan_vborder_property, 0);
299 }
300
301 /* Add hue and saturation options. */
302 if (disp->vibrant_hue_property)
303 drm_object_attach_property(&connector->base,
304 disp->vibrant_hue_property,
305 armc->procamp.vibrant_hue);
306 if (disp->color_vibrance_property)
307 drm_object_attach_property(&connector->base,
308 disp->color_vibrance_property,
309 armc->procamp.color_vibrance);
310
311 /* Scaling mode property. */
312 switch (connector->connector_type) {
313 case DRM_MODE_CONNECTOR_TV:
314 break;
315 case DRM_MODE_CONNECTOR_VGA:
316 if (disp->disp.oclass < NV50_DISP)
317 break; /* Can only scale on DFPs. */
318 /* Fall-through. */
319 default:
320 drm_object_attach_property(&connector->base, dev->mode_config.
321 scaling_mode_property,
322 armc->scaler.mode);
323 break;
324 }
325
326 /* Dithering properties. */
327 switch (connector->connector_type) {
328 case DRM_MODE_CONNECTOR_TV:
329 case DRM_MODE_CONNECTOR_VGA:
330 break;
331 default:
332 if (disp->dithering_mode) {
333 drm_object_attach_property(&connector->base,
334 disp->dithering_mode,
335 armc->dither.mode);
336 }
337 if (disp->dithering_depth) {
338 drm_object_attach_property(&connector->base,
339 disp->dithering_depth,
340 armc->dither.depth);
341 }
342 break;
343 }
344}
345
274MODULE_PARM_DESC(tv_disable, "Disable TV-out detection"); 346MODULE_PARM_DESC(tv_disable, "Disable TV-out detection");
275int nouveau_tv_disable = 0; 347int nouveau_tv_disable = 0;
276module_param_named(tv_disable, nouveau_tv_disable, int, 0400); 348module_param_named(tv_disable, nouveau_tv_disable, int, 0400);
@@ -1277,38 +1349,10 @@ nouveau_connector_create(struct drm_device *dev, int index)
1277 drm_connector_init(dev, connector, funcs, type); 1349 drm_connector_init(dev, connector, funcs, type);
1278 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs); 1350 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
1279 1351
1280 /* Init DVI-I specific properties */ 1352 connector->funcs->reset(connector);
1281 if (nv_connector->type == DCB_CONNECTOR_DVI_I) 1353 nouveau_conn_attach_properties(connector);
1282 drm_object_attach_property(&connector->base, dev->mode_config.dvi_i_subconnector_property, 0);
1283
1284 /* Add overscan compensation options to digital outputs */
1285 if (disp->underscan_property &&
1286 (type == DRM_MODE_CONNECTOR_DVID ||
1287 type == DRM_MODE_CONNECTOR_DVII ||
1288 type == DRM_MODE_CONNECTOR_HDMIA ||
1289 type == DRM_MODE_CONNECTOR_DisplayPort)) {
1290 drm_object_attach_property(&connector->base,
1291 disp->underscan_property,
1292 UNDERSCAN_OFF);
1293 drm_object_attach_property(&connector->base,
1294 disp->underscan_hborder_property,
1295 0);
1296 drm_object_attach_property(&connector->base,
1297 disp->underscan_vborder_property,
1298 0);
1299 }
1300
1301 /* Add hue and saturation options */
1302 if (disp->vibrant_hue_property)
1303 drm_object_attach_property(&connector->base,
1304 disp->vibrant_hue_property,
1305 90);
1306 if (disp->color_vibrance_property)
1307 drm_object_attach_property(&connector->base,
1308 disp->color_vibrance_property,
1309 150);
1310 1354
1311 /* default scaling mode */ 1355 /* Default scaling mode */
1312 switch (nv_connector->type) { 1356 switch (nv_connector->type) {
1313 case DCB_CONNECTOR_LVDS: 1357 case DCB_CONNECTOR_LVDS:
1314 case DCB_CONNECTOR_LVDS_SPWG: 1358 case DCB_CONNECTOR_LVDS_SPWG:
@@ -1325,23 +1369,6 @@ nouveau_connector_create(struct drm_device *dev, int index)
1325 break; 1369 break;
1326 } 1370 }
1327 1371
1328 /* scaling mode property */
1329 switch (nv_connector->type) {
1330 case DCB_CONNECTOR_TV_0:
1331 case DCB_CONNECTOR_TV_1:
1332 case DCB_CONNECTOR_TV_3:
1333 break;
1334 case DCB_CONNECTOR_VGA:
1335 if (disp->disp.oclass < NV50_DISP)
1336 break; /* can only scale on DFPs */
1337 /* fall-through */
1338 default:
1339 drm_object_attach_property(&connector->base, dev->mode_config.
1340 scaling_mode_property,
1341 nv_connector->scaling_mode);
1342 break;
1343 }
1344
1345 /* dithering properties */ 1372 /* dithering properties */
1346 switch (nv_connector->type) { 1373 switch (nv_connector->type) {
1347 case DCB_CONNECTOR_TV_0: 1374 case DCB_CONNECTOR_TV_0:
@@ -1350,20 +1377,8 @@ nouveau_connector_create(struct drm_device *dev, int index)
1350 case DCB_CONNECTOR_VGA: 1377 case DCB_CONNECTOR_VGA:
1351 break; 1378 break;
1352 default: 1379 default:
1353 if (disp->dithering_mode) { 1380 nv_connector->dithering_mode = DITHERING_MODE_AUTO;
1354 nv_connector->dithering_mode = DITHERING_MODE_AUTO; 1381 nv_connector->dithering_depth = DITHERING_DEPTH_AUTO;
1355 drm_object_attach_property(&connector->base,
1356 disp->dithering_mode,
1357 nv_connector->
1358 dithering_mode);
1359 }
1360 if (disp->dithering_depth) {
1361 nv_connector->dithering_depth = DITHERING_DEPTH_AUTO;
1362 drm_object_attach_property(&connector->base,
1363 disp->dithering_depth,
1364 nv_connector->
1365 dithering_depth);
1366 }
1367 break; 1382 break;
1368 } 1383 }
1369 1384
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h
index c366b3842fb2..ed1187efe708 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.h
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.h
@@ -141,6 +141,7 @@ struct nouveau_conn_atom {
141 } set; 141 } set;
142}; 142};
143 143
144void nouveau_conn_attach_properties(struct drm_connector *);
144void nouveau_conn_reset(struct drm_connector *); 145void nouveau_conn_reset(struct drm_connector *);
145struct drm_connector_state * 146struct drm_connector_state *
146nouveau_conn_atomic_duplicate_state(struct drm_connector *); 147nouveau_conn_atomic_duplicate_state(struct drm_connector *);