View | Details | Raw Unified | Return to bug 1101822
Collapse All | Expand All

(-)file_not_specified_in_diff (-25 / +35 lines)
Line  Link Here
--
1
drivers/gpu/drm/cirrus/cirrus_drv.h   |    2 -
drivers/gpu/drm/cirrus/cirrus_drv.h   |    2 -
2
drivers/gpu/drm/cirrus/cirrus_fbdev.c |   49 ++++++++++++++++++++--------------
1
drivers/gpu/drm/cirrus/cirrus_fbdev.c |   49 ++++++++++++++++++++--------------
3
drivers/gpu/drm/cirrus/cirrus_mode.c  |    2 -
2
drivers/gpu/drm/cirrus/cirrus_mode.c  |    2 -
4
3 files changed, 32 insertions(+), 21 deletions(-)
3
3 files changed, 32 insertions(+), 21 deletions(-)
5
-- a/drivers/gpu/drm/cirrus/cirrus_drv.h
4
++ b/drivers/gpu/drm/cirrus/cirrus_drv.h
Lines 152-158 struct cirrus_device { Link Here
152
152
153
struct cirrus_fbdev {
153
struct cirrus_fbdev {
154
	struct drm_fb_helper helper;
154
	struct drm_fb_helper helper;
155
	struct cirrus_framebuffer gfb;
155
	struct cirrus_framebuffer *gfb;
156
	struct list_head fbdev_list;
156
	struct list_head fbdev_list;
157
	void *sysram;
157
	void *sysram;
158
	int size;
158
	int size;
159
-- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
159
++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
Lines 24-37 static void cirrus_dirty_update(struct c Link Here
24
	struct drm_gem_object *obj;
24
	struct drm_gem_object *obj;
25
	struct cirrus_bo *bo;
25
	struct cirrus_bo *bo;
26
	int src_offset, dst_offset;
26
	int src_offset, dst_offset;
27
	int bpp = (afbdev->gfb.base.bits_per_pixel + 7)/8;
27
	int bpp = (afbdev->gfb->base.bits_per_pixel + 7)/8;
28
	int ret = -EBUSY;
28
	int ret = -EBUSY;
29
	bool unmap = false;
29
	bool unmap = false;
30
	bool store_for_later = false;
30
	bool store_for_later = false;
31
	int x2, y2;
31
	int x2, y2;
32
	unsigned long flags;
32
	unsigned long flags;
33
33
34
	obj = afbdev->gfb.obj;
34
	obj = afbdev->gfb->obj;
35
	bo = gem_to_cirrus_bo(obj);
35
	bo = gem_to_cirrus_bo(obj);
36
36
37
	/*
37
	/*
Lines 84-90 static void cirrus_dirty_update(struct c Link Here
84
	}
84
	}
85
	for (i = y; i < y + height; i++) {
85
	for (i = y; i < y + height; i++) {
86
		/* assume equal stride for now */
86
		/* assume equal stride for now */
87
		src_offset = dst_offset = i * afbdev->gfb.base.pitches[0] + (x * bpp);
87
		src_offset = dst_offset = i * afbdev->gfb->base.pitches[0] + (x * bpp);
88
		memcpy_toio(bo->kmap.virtual + src_offset, afbdev->sysram + src_offset, width * bpp);
88
		memcpy_toio(bo->kmap.virtual + src_offset, afbdev->sysram + src_offset, width * bpp);
89
89
90
	}
90
	}
Lines 167-173 static int cirrusfb_create(struct drm_fb Link Here
167
		container_of(helper, struct cirrus_fbdev, helper);
167
		container_of(helper, struct cirrus_fbdev, helper);
168
	struct cirrus_device *cdev = gfbdev->helper.dev->dev_private;
168
	struct cirrus_device *cdev = gfbdev->helper.dev->dev_private;
169
	struct fb_info *info;
169
	struct fb_info *info;
170
	struct drm_framebuffer *fb;
170
	struct cirrus_framebuffer *fb;
171
	struct drm_mode_fb_cmd2 mode_cmd;
171
	struct drm_mode_fb_cmd2 mode_cmd;
172
	void *sysram;
172
	void *sysram;
173
	struct drm_gem_object *gobj = NULL;
173
	struct drm_gem_object *gobj = NULL;
Lines 194-226 static int cirrusfb_create(struct drm_fb Link Here
194
		return -ENOMEM;
194
		return -ENOMEM;
195
195
196
	info = drm_fb_helper_alloc_fbi(helper);
196
	info = drm_fb_helper_alloc_fbi(helper);
197
	if (IS_ERR(info))
197
	if (IS_ERR(info)) {
198
		return PTR_ERR(info);
198
		ret = PTR_ERR(info);
199
		goto err_vfree;
200
	}
199
201
200
	info->par = gfbdev;
202
	info->par = gfbdev;
201
203
202
	ret = cirrus_framebuffer_init(cdev->dev, &gfbdev->gfb, &mode_cmd, gobj);
204
	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
205
	if (!fb) {
206
		ret = -ENOMEM;
207
		goto err_drm_gem_object_put_unlocked;
208
	}
209
210
	ret = cirrus_framebuffer_init(cdev->dev, fb, &mode_cmd, gobj);
203
	if (ret)
211
	if (ret)
204
		return ret;
212
		goto err_kfree;
205
213
206
	gfbdev->sysram = sysram;
214
	gfbdev->sysram = sysram;
207
	gfbdev->size = size;
215
	gfbdev->size = size;
208
216
	gfbdev->gfb = fb;
209
	fb = &gfbdev->gfb.base;
210
	if (!fb) {
211
		DRM_INFO("fb is NULL\n");
212
		return -EINVAL;
213
	}
214
217
215
	/* setup helper */
218
	/* setup helper */
216
	gfbdev->helper.fb = fb;
219
	gfbdev->helper.fb = &fb->base;
217
220
218
	strcpy(info->fix.id, "cirrusdrmfb");
221
	strcpy(info->fix.id, "cirrusdrmfb");
219
222
220
	info->flags = FBINFO_DEFAULT;
223
	info->flags = FBINFO_DEFAULT;
221
	info->fbops = &cirrusfb_ops;
224
	info->fbops = &cirrusfb_ops;
222
225
223
	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
226
	drm_fb_helper_fill_fix(info, fb->base.pitches[0], fb->base.depth);
224
	drm_fb_helper_fill_var(info, &gfbdev->helper, sizes->fb_width,
227
	drm_fb_helper_fill_var(info, &gfbdev->helper, sizes->fb_width,
225
			       sizes->fb_height);
228
			       sizes->fb_height);
226
229
Lines 240-255 static int cirrusfb_create(struct drm_fb Link Here
240
	DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start);
243
	DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start);
241
	DRM_INFO("vram aper at 0x%lX\n", (unsigned long)info->fix.smem_start);
244
	DRM_INFO("vram aper at 0x%lX\n", (unsigned long)info->fix.smem_start);
242
	DRM_INFO("size %lu\n", (unsigned long)info->fix.smem_len);
245
	DRM_INFO("size %lu\n", (unsigned long)info->fix.smem_len);
243
	DRM_INFO("fb depth is %d\n", fb->depth);
246
	DRM_INFO("fb depth is %d\n", fb->base.depth);
244
	DRM_INFO("   pitch is %d\n", fb->pitches[0]);
247
	DRM_INFO("   pitch is %d\n", fb->base.pitches[0]);
245
248
246
	return 0;
249
	return 0;
250
251
err_kfree:
252
	kfree(fb);
253
err_drm_gem_object_put_unlocked:
254
	drm_gem_object_unreference_unlocked(gobj);
255
err_vfree:
256
	vfree(sysram);
257
	return ret;
247
}
258
}
248
259
249
static int cirrus_fbdev_destroy(struct drm_device *dev,
260
static int cirrus_fbdev_destroy(struct drm_device *dev,
250
				struct cirrus_fbdev *gfbdev)
261
				struct cirrus_fbdev *gfbdev)
251
{
262
{
252
	struct cirrus_framebuffer *gfb = &gfbdev->gfb;
263
	struct cirrus_framebuffer *gfb = gfbdev->gfb;
253
264
254
	drm_fb_helper_unregister_fbi(&gfbdev->helper);
265
	drm_fb_helper_unregister_fbi(&gfbdev->helper);
255
	drm_fb_helper_release_fbi(&gfbdev->helper);
266
	drm_fb_helper_release_fbi(&gfbdev->helper);
256
-- a/drivers/gpu/drm/cirrus/cirrus_mode.c
267
++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
Lines 164-170 static int cirrus_crtc_do_set_base(struc Link Here
164
		return ret;
164
		return ret;
165
	}
165
	}
166
166
167
	if (&cdev->mode_info.gfbdev->gfb == cirrus_fb) {
167
	if (cdev->mode_info.gfbdev->gfb == cirrus_fb) {
168
		/* if pushing console in kmap it */
168
		/* if pushing console in kmap it */
169
		ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
169
		ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
170
		if (ret)
170
		if (ret)

Return to bug 1101822