21 drm_gem_object_unreference_unlocked(mga_fb->
obj);
26 static int mga_user_framebuffer_create_handle(
struct drm_framebuffer *fb,
27 struct drm_file *file_priv,
34 .destroy = mga_user_framebuffer_destroy,
35 .create_handle = mga_user_framebuffer_create_handle,
41 struct drm_gem_object *obj)
45 DRM_ERROR(
"drm_framebuffer_init failed: %d\n", ret);
55 struct drm_file *filp,
58 struct drm_gem_object *obj;
68 drm_gem_object_unreference_unlocked(obj);
74 drm_gem_object_unreference_unlocked(obj);
82 .fb_create = mgag200_user_framebuffer_create,
86 static void mga_vram_fini(
struct mga_device *mdev)
90 if (mdev->
mc.vram_base)
105 for (offset = 0x100000; offset < mdev->
mc.vram_window; offset += 0x4000) {
107 orig2 =
ioread8(mem + offset + 0x100);
118 if (test1 != 0xaa55) {
128 return offset - 65536;
132 static int mga_vram_init(
struct mga_device *mdev)
135 struct apertures_struct *aper = alloc_apertures(1);
141 aper->ranges[0].base = mdev->
mc.vram_base;
142 aper->ranges[0].size = mdev->
mc.vram_window;
149 DRM_ERROR(
"can't reserve VRAM\n");
153 mem = pci_iomap(mdev->
dev->pdev, 0, 0);
155 mdev->
mc.vram_size = mga_probe_vram(mdev, mem);
162 static int mgag200_device_init(
struct drm_device *dev,
182 DRM_ERROR(
"can't reserve mmio registers\n");
186 mdev->
rmmio = pci_iomap(dev->pdev, 1, 0);
194 ret = mga_vram_init(mdev);
227 dev->dev_private = (
void *)mdev;
230 r = mgag200_device_init(dev, flags);
232 dev_err(&dev->pdev->dev,
"Fatal error during GPU init: %d\n", r);
240 dev->mode_config.funcs = (
void *)&mga_mode_funcs;
241 dev->mode_config.min_width = 0;
242 dev->mode_config.min_height = 0;
243 dev->mode_config.preferred_depth = 24;
244 dev->mode_config.prefer_shadow = 1;
248 dev_err(&dev->pdev->dev,
"Fatal error during modeset init: %d\n", r);
267 dev->dev_private =
NULL;
273 struct drm_gem_object **obj)
287 DRM_ERROR(
"failed to allocate GEM object\n");
299 struct drm_gem_object *gobj;
311 drm_gem_object_unreference_unlocked(gobj);
358 return bo->
bo.addr_space_offset;
367 struct drm_gem_object *obj;
379 *offset = mgag200_bo_mmap_offset(bo);
381 drm_gem_object_unreference(obj);