Subversion Repositories Kolibri OS

Rev

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

Rev 5271 Rev 6104
Line 190... Line 190...
190
	struct fb_info *info;
190
	struct fb_info *info;
191
	struct drm_framebuffer *fb = NULL;
191
	struct drm_framebuffer *fb = NULL;
192
	struct drm_mode_fb_cmd2 mode_cmd;
192
	struct drm_mode_fb_cmd2 mode_cmd;
193
	struct drm_gem_object *gobj = NULL;
193
	struct drm_gem_object *gobj = NULL;
194
	struct radeon_bo *rbo = NULL;
194
	struct radeon_bo *rbo = NULL;
195
	struct device *device = &rdev->pdev->dev;
-
 
196
	int ret;
195
	int ret;
197
	unsigned long tmp;
196
	unsigned long tmp;
Line 198... Line 197...
198
 
197
 
199
	mode_cmd.width = sizes->surface_width;
198
	mode_cmd.width = sizes->surface_width;
Line 213... Line 212...
213
	}
212
	}
Line 214... Line 213...
214
 
213
 
Line 215... Line 214...
215
	rbo = gem_to_radeon_bo(gobj);
214
	rbo = gem_to_radeon_bo(gobj);
216
 
215
 
217
	/* okay we have an object now allocate the framebuffer */
216
	/* okay we have an object now allocate the framebuffer */
218
	info = framebuffer_alloc(0, device);
217
	info = drm_fb_helper_alloc_fbi(helper);
219
	if (info == NULL) {
218
	if (IS_ERR(info)) {
220
		ret = -ENOMEM;
219
		ret = PTR_ERR(info);
Line 221... Line 220...
221
		goto out_unref;
220
		goto out_unref;
-
 
221
	}
Line 222... Line 222...
222
	}
222
 
223
 
223
	info->par = rfbdev;
224
	info->par = rfbdev;
224
	info->skip_vt_switch = true;
225
 
225
 
226
	ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
226
	ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
Line 227... Line 227...
227
	if (ret) {
227
	if (ret) {
Line 228... Line 228...
228
		DRM_ERROR("failed to initialize framebuffer %d\n", ret);
228
		DRM_ERROR("failed to initialize framebuffer %d\n", ret);
229
		goto out_unref;
229
		goto out_destroy_fbi;
230
	}
-
 
Line 231... Line 230...
231
 
230
	}
Line 232... Line 231...
232
	fb = &rfbdev->rfb.base;
231
 
Line 251... Line 250...
251
	info->screen_size = radeon_bo_size(rbo);
250
	info->screen_size = radeon_bo_size(rbo);
Line 252... Line 251...
252
 
251
 
Line 253... Line 252...
253
	drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
252
	drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
254
 
-
 
255
	/* setup aperture base/size for vesafb takeover */
-
 
256
	info->apertures = alloc_apertures(1);
-
 
257
	if (!info->apertures) {
-
 
258
		ret = -ENOMEM;
-
 
259
		goto out_unref;
253
 
260
	}
254
	/* setup aperture base/size for vesafb takeover */
Line 261... Line 255...
261
	info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
255
	info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
Line 273... Line 267...
273
    main_fb = fb;
267
    main_fb = fb;
274
    main_fb_obj = gobj;
268
    main_fb_obj = gobj;
Line 275... Line 269...
275
 
269
 
Line -... Line 270...
-
 
270
	return 0;
-
 
271
 
276
    return 0;
272
out_destroy_fbi:
277
 
273
//   drm_fb_helper_release_fbi(helper);
Line 278... Line 274...
278
out_unref:
274
out_unref:
279
	if (rbo) {
275
	if (rbo) {
Line 286... Line 282...
286
}
282
}
Line 287... Line 283...
287
 
283
 
288
 
284
 
289
static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev)
-
 
290
{
285
static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev)
Line 291... Line -...
291
	struct fb_info *info;
-
 
292
	struct radeon_framebuffer *rfb = &rfbdev->rfb;
-
 
293
 
-
 
294
	if (rfbdev->helper.fbdev) {
286
{
295
		info = rfbdev->helper.fbdev;
287
	struct radeon_framebuffer *rfb = &rfbdev->rfb;
296
 
-
 
Line 297... Line 288...
297
//       unregister_framebuffer(info);
288
 
298
//       framebuffer_release(info);
289
//	drm_fb_helper_unregister_fbi(&rfbdev->helper);
299
	}
290
//	drm_fb_helper_release_fbi(&rfbdev->helper);
300
 
291
 
Line 316... Line 307...
316
int radeon_fbdev_init(struct radeon_device *rdev)
307
int radeon_fbdev_init(struct radeon_device *rdev)
317
{
308
{
318
	struct radeon_fbdev *rfbdev;
309
	struct radeon_fbdev *rfbdev;
319
	int bpp_sel = 32;
310
	int bpp_sel = 32;
320
	int ret;
311
	int ret;
321
ENTER();
-
 
Line 322... Line 312...
322
 
312
 
323
	/* select 8 bpp console on RN50 or 16MB cards */
313
	/* select 8 bpp console on RN50 or 16MB cards */
324
	if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
314
	if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
Line 335... Line 325...
335
			      &radeon_fb_helper_funcs);
325
			      &radeon_fb_helper_funcs);
Line 336... Line 326...
336
 
326
 
337
	ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
327
	ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
338
				 rdev->num_crtc,
328
				 rdev->num_crtc,
339
				 RADEONFB_CONN_LIMIT);
329
				 RADEONFB_CONN_LIMIT);
340
	if (ret) {
-
 
341
		kfree(rfbdev);
330
	if (ret)
342
		return ret;
-
 
Line 343... Line 331...
343
	}
331
		goto free;
-
 
332
 
-
 
333
	ret = drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
Line 344... Line 334...
344
 
334
	if (ret)
345
	drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
335
		goto fini;
Line 346... Line 336...
346
 
336
 
347
	/* disable all the possible outputs/crtcs before entering KMS mode */
337
	/* disable all the possible outputs/crtcs before entering KMS mode */
-
 
338
	drm_helper_disable_unused_functions(rdev->ddev);
Line 348... Line 339...
348
	drm_helper_disable_unused_functions(rdev->ddev);
339
 
-
 
340
	ret = drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
-
 
341
	if (ret)
-
 
342
		goto fini;
-
 
343
 
-
 
344
	return 0;
-
 
345
 
349
 
346
fini:
Line 350... Line 347...
350
	drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
347
//   drm_fb_helper_fini(&rfbdev->helper);
351
LEAVE();
348
free:
352
 
349
	kfree(rfbdev);
Line 361... Line 358...
361
	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
358
	radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
362
	kfree(rdev->mode_info.rfbdev);
359
	kfree(rdev->mode_info.rfbdev);
363
	rdev->mode_info.rfbdev = NULL;
360
	rdev->mode_info.rfbdev = NULL;
364
}
361
}
Line 365... Line -...
365
 
-
 
366
 
-
 
367
int radeon_fbdev_total_size(struct radeon_device *rdev)
-
 
368
{
-
 
369
	struct radeon_bo *robj;
-
 
370
	int size = 0;
-
 
371
 
-
 
372
	robj = gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj);
-
 
373
	size += radeon_bo_size(robj);
-
 
374
	return size;
-
 
375
}
-
 
376
 
362
 
377
bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
363
bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
378
{
364
{
379
	if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
365
	if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
380
		return true;
366
		return true;
381
	return false;
367
	return false;
-
 
368
}
-
 
369
 
-
 
370
void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector)
-
 
371
{
-
 
372
	drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector);
-
 
373
}
-
 
374
 
-
 
375
void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector)
-
 
376
{
-
 
377
	drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);