Subversion Repositories Kolibri OS

Rev

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

Rev 1986 Rev 2997
Line 25... Line 25...
25
 */
25
 */
26
#include 
26
#include 
27
#include 
27
#include 
28
#include 
28
#include 
Line 29... Line 29...
29
 
29
 
30
#include "drmP.h"
-
 
31
#include "drm.h"
30
#include 
32
#include "drm_crtc.h"
31
#include 
33
#include "drm_crtc_helper.h"
32
#include 
34
#include "radeon_drm.h"
33
#include 
Line 35... Line 34...
35
#include "radeon.h"
34
#include "radeon.h"
Line 36... Line -...
36
 
-
 
37
#include "drm_fb_helper.h"
-
 
Line 38... Line 35...
38
 
35
 
39
#include 
36
#include 
40
#include "radeon_object.h"
37
 
Line 41... Line 38...
41
 
38
 
42
int radeonfb_create_object(struct radeon_fbdev *rfbdev,
39
int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
43
                     struct drm_mode_fb_cmd *mode_cmd,
40
                     struct drm_mode_fb_cmd2 *mode_cmd,
Line 53... Line 50...
53
	struct list_head fbdev_list;
50
	struct list_head fbdev_list;
54
	struct radeon_device		*rdev;
51
	struct radeon_device		*rdev;
55
};
52
};
Line 56... Line 53...
56
 
53
 
57
static struct fb_ops radeonfb_ops = {
54
static struct fb_ops radeonfb_ops = {
58
//   .owner = THIS_MODULE,
55
	.owner = THIS_MODULE,
59
	.fb_check_var = drm_fb_helper_check_var,
56
	.fb_check_var = drm_fb_helper_check_var,
60
	.fb_set_par = drm_fb_helper_set_par,
57
	.fb_set_par = drm_fb_helper_set_par,
61
//	.fb_fillrect = cfb_fillrect,
58
//	.fb_fillrect = cfb_fillrect,
62
//	.fb_copyarea = cfb_copyarea,
59
//	.fb_copyarea = cfb_copyarea,
Line 96... Line 93...
96
			   struct drm_fb_helper_surface_size *sizes)
93
			   struct drm_fb_helper_surface_size *sizes)
97
{
94
{
98
	struct radeon_device *rdev = rfbdev->rdev;
95
	struct radeon_device *rdev = rfbdev->rdev;
99
	struct fb_info *info;
96
	struct fb_info *info;
100
	struct drm_framebuffer *fb = NULL;
97
	struct drm_framebuffer *fb = NULL;
101
	struct drm_mode_fb_cmd mode_cmd;
98
	struct drm_mode_fb_cmd2 mode_cmd;
102
	struct drm_gem_object *gobj = NULL;
99
	struct drm_gem_object *gobj = NULL;
103
	struct radeon_bo *rbo = NULL;
100
	struct radeon_bo *rbo = NULL;
104
	struct device *device = &rdev->pdev->dev;
101
	struct device *device = &rdev->pdev->dev;
105
	int ret;
102
	int ret;
106
	unsigned long tmp;
103
	unsigned long tmp;
Line 112... Line 109...
112
 
109
 
113
	/* avivo can't scanout real 24bpp */
110
	/* avivo can't scanout real 24bpp */
114
	if ((sizes->surface_bpp == 24) && ASIC_IS_AVIVO(rdev))
111
	if ((sizes->surface_bpp == 24) && ASIC_IS_AVIVO(rdev))
Line 115... Line 112...
115
		sizes->surface_bpp = 32;
112
		sizes->surface_bpp = 32;
116
 
113
 
-
 
114
	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
-
 
115
							  sizes->surface_depth);
-
 
116
 
-
 
117
	ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj);
-
 
118
	if (ret) {
-
 
119
		DRM_ERROR("failed to create fbcon object %d\n", ret);
Line 117... Line -...
117
	mode_cmd.bpp = sizes->surface_bpp;
-
 
118
	mode_cmd.depth = sizes->surface_depth;
120
		return ret;
Line 119... Line 121...
119
 
121
	}
120
    ret = radeonfb_create_object(rfbdev, &mode_cmd, &gobj);
122
 
121
	rbo = gem_to_radeon_bo(gobj);
123
	rbo = gem_to_radeon_bo(gobj);
-
 
124
 
122
 
125
	/* okay we have an object now allocate the framebuffer */
123
	/* okay we have an object now allocate the framebuffer */
126
	info = framebuffer_alloc(0, device);
124
	info = framebuffer_alloc(0, device);
127
	if (info == NULL) {
Line 125... Line 128...
125
	if (info == NULL) {
128
        dbgprintf("framebuffer_alloc\n");
Line 126... Line 129...
126
		ret = -ENOMEM;
129
		ret = -ENOMEM;
-
 
130
		goto out_unref;
-
 
131
	}
-
 
132
 
-
 
133
	info->par = rfbdev;
Line 127... Line 134...
127
		goto out_unref;
134
 
Line 128... Line 135...
128
	}
135
	ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
129
 
136
	if (ret) {
Line 139... Line 146...
139
 
146
 
Line 140... Line 147...
140
//   memset_io(rbo->kptr, 0x0, radeon_bo_size(rbo));
147
//   memset_io(rbo->kptr, 0x0, radeon_bo_size(rbo));
Line 141... Line 148...
141
 
148
 
Line 142... Line 149...
142
	strcpy(info->fix.id, "radeondrmfb");
149
	strcpy(info->fix.id, "radeondrmfb");
143
 
150
 
Line 144... Line 151...
144
	drm_fb_helper_fill_fix(info, fb->pitch, fb->depth);
151
	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
Line 161... Line 168...
161
		goto out_unref;
168
		goto out_unref;
162
	}
169
	}
163
	info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
170
	info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
164
	info->apertures->ranges[0].size = rdev->mc.aper_size;
171
	info->apertures->ranges[0].size = rdev->mc.aper_size;
Line 165... Line -...
165
 
-
 
166
//   info->pixmap.size = 64*1024;
-
 
167
//   info->pixmap.buf_align = 8;
-
 
168
//   info->pixmap.access_align = 32;
172
 
169
//   info->pixmap.flags = FB_PIXMAP_SYSTEM;
-
 
Line 170... Line 173...
170
//   info->pixmap.scan_align = 1;
173
	/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
171
 
174
 
172
	if (info->screen_base == NULL) {
175
//   if (info->screen_base == NULL) {
173
		ret = -ENOSPC;
176
//       ret = -ENOSPC;
174
		goto out_unref;
177
//       goto out_unref;
175
	}
178
//   }
176
	DRM_INFO("fb mappable at 0x%lX\n",  info->fix.smem_start);
179
	DRM_INFO("fb mappable at 0x%lX\n",  info->fix.smem_start);
177
	DRM_INFO("vram apper at 0x%lX\n",  (unsigned long)rdev->mc.aper_base);
180
	DRM_INFO("vram apper at 0x%lX\n",  (unsigned long)rdev->mc.aper_base);
178
	DRM_INFO("size %lu\n", (unsigned long)radeon_bo_size(rbo));
181
	DRM_INFO("size %lu\n", (unsigned long)radeon_bo_size(rbo));
Line 179... Line 182...
179
	DRM_INFO("fb depth is %d\n", fb->depth);
182
	DRM_INFO("fb depth is %d\n", fb->depth);
Line 180... Line 183...
180
	DRM_INFO("   pitch is %d\n", fb->pitch);
183
	DRM_INFO("   pitch is %d\n", fb->pitches[0]);