Den 03.07.2019 10.33, skrev Thomas Zimmermann: > This patch replaces mgag200's framebuffer console with DRM's generic > implememtation. All respective code is being removed from the driver. > > The console is set up with a shadow buffer. The actual buffer object is > not permanently pinned in video ram, but just another buffer object that > the driver moves in and out of vram as necessary. The driver's function > mga_crtc_do_set_base() used to contain special handling for the framebuffer > console. With the new generic framebuffer, the driver does not need this > code an longer. > > Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> > --- <snip> > diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c > index b10f7265b5c4..6d943a008752 100644 > --- a/drivers/gpu/drm/mgag200/mgag200_main.c > +++ b/drivers/gpu/drm/mgag200/mgag200_main.c > @@ -14,8 +14,33 @@ > > #include "mgag200_drv.h" > > +static int mga_framebuffer_dirtyfb(struct drm_framebuffer *fb, > + struct drm_file *file_priv, > + unsigned int flags, > + unsigned int color, > + struct drm_clip_rect *clips, > + unsigned int num_clips) > +{ > + /* empty placeholder function to enable fbcon shadow buffer */ > + return 0; > +} > + > +static const struct drm_framebuffer_funcs mga_framebuffer_funcs = { > + .destroy = drm_gem_fb_destroy, > + .create_handle = drm_gem_fb_create_handle, > + .dirty = mga_framebuffer_dirtyfb, > +}; > + > +static struct drm_framebuffer * > +mga_mode_config_funcs_fb_create(struct drm_device *dev, struct drm_file *file, > + const struct drm_mode_fb_cmd2 *mode_cmd) > +{ > + return drm_gem_fb_create_with_funcs(dev, file, mode_cmd, > + &mga_framebuffer_funcs); > +} > + > static const struct drm_mode_config_funcs mga_mode_funcs = { > - .fb_create = drm_gem_fb_create > + .fb_create = mga_mode_config_funcs_fb_create > }; > > static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem) > @@ -162,7 +187,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) > if (IS_G200_SE(mdev) && mdev->mc.vram_size < (2048*1024)) > dev->mode_config.preferred_depth = 16; > else > - dev->mode_config.preferred_depth = 24; > + dev->mode_config.preferred_depth = 32; Please mention this change and the reason for it in the commit message. > dev->mode_config.prefer_shadow = 1; > > r = mgag200_modeset_init(mdev); > @@ -186,6 +211,13 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) > } > mdev->cursor.pixels_current = NULL; > > + r = drm_fbdev_generic_setup(mdev->dev, 0); > + if (r) { > + dev_err(&dev->pdev->dev, > + "drm_fbdev_generic_setup failed: %d\n", r); drm_fbdev_generic_setup() will print an error message on failure so you don't need to do it. Acked-by: Noralf Trønnes <noralf@xxxxxxxxxxx> > + goto err_modeset; > + } > + > return 0; > > err_modeset: > @@ -204,32 +236,7 @@ void mgag200_driver_unload(struct drm_device *dev) > if (mdev == NULL) > return; > mgag200_modeset_fini(mdev); > - mgag200_fbdev_fini(mdev); > drm_mode_config_cleanup(dev); > mgag200_mm_fini(mdev); > dev->dev_private = NULL; > } > - > -int mgag200_gem_create(struct drm_device *dev, > - u32 size, bool iskernel, > - struct drm_gem_object **obj) > -{ > - struct drm_gem_vram_object *gbo; > - int ret; > - > - *obj = NULL; > - > - size = roundup(size, PAGE_SIZE); > - if (size == 0) > - return -EINVAL; > - > - gbo = drm_gem_vram_create(dev, &dev->vram_mm->bdev, size, 0, false); > - if (IS_ERR(gbo)) { > - ret = PTR_ERR(gbo); > - if (ret != -ERESTARTSYS) > - DRM_ERROR("failed to allocate GEM object\n"); > - return ret; > - } > - *obj = &gbo->gem; > - return 0; > -} _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel