Subversion Repositories Kolibri OS

Rev

Rev 3031 | Rev 3480 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3031 Rev 3192
Line 389... Line 389...
389
 */
389
 */
390
void drm_crtc_cleanup(struct drm_crtc *crtc)
390
void drm_crtc_cleanup(struct drm_crtc *crtc)
391
{
391
{
392
	struct drm_device *dev = crtc->dev;
392
	struct drm_device *dev = crtc->dev;
Line 393... Line -...
393
 
-
 
394
	if (crtc->gamma_store) {
393
 
395
		kfree(crtc->gamma_store);
394
		kfree(crtc->gamma_store);
396
		crtc->gamma_store = NULL;
-
 
Line 397... Line 395...
397
	}
395
		crtc->gamma_store = NULL;
398
 
396
 
399
	drm_mode_object_put(dev, &crtc->base);
397
	drm_mode_object_put(dev, &crtc->base);
400
	list_del(&crtc->head);
398
	list_del(&crtc->head);
Line 474... Line 472...
474
		++drm_connector_enum_list[connector_type].count; /* TODO */
472
		++drm_connector_enum_list[connector_type].count; /* TODO */
475
	INIT_LIST_HEAD(&connector->user_modes);
473
	INIT_LIST_HEAD(&connector->user_modes);
476
	INIT_LIST_HEAD(&connector->probed_modes);
474
	INIT_LIST_HEAD(&connector->probed_modes);
477
	INIT_LIST_HEAD(&connector->modes);
475
	INIT_LIST_HEAD(&connector->modes);
478
	connector->edid_blob_ptr = NULL;
476
	connector->edid_blob_ptr = NULL;
-
 
477
	connector->status = connector_status_unknown;
Line 479... Line 478...
479
 
478
 
480
	list_add_tail(&connector->head, &dev->mode_config.connector_list);
479
	list_add_tail(&connector->head, &dev->mode_config.connector_list);
Line 481... Line 480...
481
	dev->mode_config.num_connector++;
480
	dev->mode_config.num_connector++;
482
 
481
 
483
	if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
482
	if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
484
	drm_connector_attach_property(connector,
483
		drm_object_attach_property(&connector->base,
Line 485... Line 484...
485
					      dev->mode_config.edid_property,
484
					      dev->mode_config.edid_property,
486
					      0);
485
					      0);
Line 487... Line 486...
487
 
486
 
488
	drm_connector_attach_property(connector,
487
	drm_object_attach_property(&connector->base,
Line 2197... Line 2196...
2197
		return -EINVAL;
2196
		return -EINVAL;
2198
	}
2197
	}
Line 2199... Line 2198...
2199
 
2198
 
2200
	for (i = 0; i < num_planes; i++) {
2199
	for (i = 0; i < num_planes; i++) {
-
 
2200
		unsigned int width = r->width / (i != 0 ? hsub : 1);
-
 
2201
		unsigned int height = r->height / (i != 0 ? vsub : 1);
Line 2201... Line 2202...
2201
		unsigned int width = r->width / (i != 0 ? hsub : 1);
2202
		unsigned int cpp = drm_format_plane_cpp(r->pixel_format, i);
2202
 
2203
 
2203
		if (!r->handles[i]) {
2204
		if (!r->handles[i]) {
2204
			DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i);
2205
			DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i);
Line -... Line 2206...
-
 
2206
			return -EINVAL;
-
 
2207
		}
-
 
2208
 
-
 
2209
		if ((uint64_t) width * cpp > UINT_MAX)
-
 
2210
			return -ERANGE;
-
 
2211
 
2205
			return -EINVAL;
2212
		if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX)
2206
		}
2213
			return -ERANGE;
2207
 
2214
 
2208
		if (r->pitches[i] < drm_format_plane_cpp(r->pixel_format, i) * width) {
2215
		if (r->pitches[i] < width * cpp) {
2209
			DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
2216
			DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
Line 2240... Line 2247...
2240
	int ret;
2247
	int ret;
Line 2241... Line 2248...
2241
 
2248
 
2242
	if (!drm_core_check_feature(dev, DRIVER_MODESET))
2249
	if (!drm_core_check_feature(dev, DRIVER_MODESET))
Line -... Line 2250...
-
 
2250
		return -EINVAL;
-
 
2251
 
-
 
2252
	if (r->flags & ~DRM_MODE_FB_INTERLACED) {
-
 
2253
		DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
-
 
2254
		return -EINVAL;
2243
		return -EINVAL;
2255
	}
2244
 
2256
 
2245
	if ((config->min_width > r->width) || (r->width > config->max_width)) {
2257
	if ((config->min_width > r->width) || (r->width > config->max_width)) {
2246
		DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n",
2258
		DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n",
2247
			  r->width, config->min_width, config->max_width);
2259
			  r->width, config->min_width, config->max_width);
Line 2837... Line 2849...
2837
	list_del(&property->head);
2849
	list_del(&property->head);
2838
	kfree(property);
2850
	kfree(property);
2839
}
2851
}
2840
EXPORT_SYMBOL(drm_property_destroy);
2852
EXPORT_SYMBOL(drm_property_destroy);
Line 2841... Line -...
2841
 
-
 
2842
void drm_connector_attach_property(struct drm_connector *connector,
-
 
2843
			       struct drm_property *property, uint64_t init_val)
-
 
2844
{
-
 
2845
	drm_object_attach_property(&connector->base, property, init_val);
-
 
2846
}
-
 
2847
EXPORT_SYMBOL(drm_connector_attach_property);
-
 
2848
 
-
 
2849
int drm_connector_property_set_value(struct drm_connector *connector,
-
 
2850
				  struct drm_property *property, uint64_t value)
-
 
2851
{
-
 
2852
	return drm_object_property_set_value(&connector->base, property, value);
-
 
2853
}
-
 
2854
EXPORT_SYMBOL(drm_connector_property_set_value);
-
 
2855
 
-
 
2856
int drm_connector_property_get_value(struct drm_connector *connector,
-
 
2857
				  struct drm_property *property, uint64_t *val)
-
 
2858
{
-
 
2859
	return drm_object_property_get_value(&connector->base, property, val);
-
 
2860
}
-
 
2861
EXPORT_SYMBOL(drm_connector_property_get_value);
-
 
2862
 
2853
 
2863
void drm_object_attach_property(struct drm_mode_object *obj,
2854
void drm_object_attach_property(struct drm_mode_object *obj,
2864
				struct drm_property *property,
2855
				struct drm_property *property,
2865
				uint64_t init_val)
2856
				uint64_t init_val)
2866
{
2857
{
Line 3098... Line 3089...
3098
		drm_property_destroy_blob(dev, connector->edid_blob_ptr);
3089
		drm_property_destroy_blob(dev, connector->edid_blob_ptr);
Line 3099... Line 3090...
3099
 
3090
 
3100
	/* Delete edid, when there is none. */
3091
	/* Delete edid, when there is none. */
3101
	if (!edid) {
3092
	if (!edid) {
3102
		connector->edid_blob_ptr = NULL;
3093
		connector->edid_blob_ptr = NULL;
3103
		ret = drm_connector_property_set_value(connector, dev->mode_config.edid_property, 0);
3094
		ret = drm_object_property_set_value(&connector->base, dev->mode_config.edid_property, 0);
3104
		return ret;
3095
		return ret;
Line 3105... Line 3096...
3105
	}
3096
	}
3106
 
3097
 
3107
	size = EDID_LENGTH * (1 + edid->extensions);
3098
	size = EDID_LENGTH * (1 + edid->extensions);
-
 
3099
	connector->edid_blob_ptr = drm_property_create_blob(connector->dev,
-
 
3100
							    size, edid);
Line 3108... Line 3101...
3108
	connector->edid_blob_ptr = drm_property_create_blob(connector->dev,
3101
	if (!connector->edid_blob_ptr)
3109
							    size, edid);
3102
		return -EINVAL;
3110
 
3103
 
Line 3111... Line 3104...
3111
	ret = drm_connector_property_set_value(connector,
3104
	ret = drm_object_property_set_value(&connector->base,
3112
					       dev->mode_config.edid_property,
3105
					       dev->mode_config.edid_property,
Line 3133... Line 3126...
3133
	} else if (connector->funcs->set_property)
3126
	} else if (connector->funcs->set_property)
3134
		ret = connector->funcs->set_property(connector, property, value);
3127
		ret = connector->funcs->set_property(connector, property, value);
Line 3135... Line 3128...
3135
 
3128
 
3136
	/* store the property value if successful */
3129
	/* store the property value if successful */
3137
	if (!ret)
3130
	if (!ret)
3138
		drm_connector_property_set_value(connector, property, value);
3131
		drm_object_property_set_value(&connector->base, property, value);
3139
	return ret;
3132
	return ret;
Line 3140... Line 3133...
3140
}
3133
}
3141
 
3134
 
Line 3451... Line 3444...
3451
 
3444
 
3452
	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
3445
	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
3453
		if (encoder->funcs->reset)
3446
		if (encoder->funcs->reset)
Line 3454... Line 3447...
3454
			encoder->funcs->reset(encoder);
3447
			encoder->funcs->reset(encoder);
-
 
3448
 
-
 
3449
	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
3455
 
3450
		connector->status = connector_status_unknown;
3456
	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
3451
 
3457
		if (connector->funcs->reset)
3452
		if (connector->funcs->reset)
-
 
3453
			connector->funcs->reset(connector);
3458
			connector->funcs->reset(connector);
3454
	}
3459
}
3455
}
3460
EXPORT_SYMBOL(drm_mode_config_reset);
3456
EXPORT_SYMBOL(drm_mode_config_reset);
3461
/*
3457
/*
3462
 * Just need to support RGB formats here for compat with code that doesn't
3458
 * Just need to support RGB formats here for compat with code that doesn't