Prepare mgag200 for simple KMS and managed init
Subsystems (3)
Thomas Zimmermann
maintainerv2 cover Prepare mgag200 for simple KMS and managed init
(was: drm/mgag200: Embed DRM device in struct mga_device)
This is v2 of the patchset for embedding the DRM device instance in struct mga_device. Following Sam's suggestion I only picked the first three patches of v1. On top of that I added 3 patches from mgag200's simple-KMS patchset. The patch set prepares mgag200 for simple KMS and managed initialization, but also makes sense on its own.
All patches have been reviewed and/or acked already. If no one objects, I'll soon merge them into drm-misc-next.
v2:
* removed patches 4 and 5, added 3 patches from simple-KMS patchset
* improved commit messages
* to_mga_device() is now a function
* fixed error mesage for mgag200_vga_connector_init()
Thomas Zimmermann (6):
drm/mgag200: Convert struct drm_device to struct mga_device with
helper
drm/mgag200: Remove several references to struct mga_device.dev drm/mgag200: Integrate init function into load function drm/mgag200: Use managed mode-config initialization drm/mgag200: Remove unused fields from struct mga_device drm/mgag200: Embed connector instance in struct mga_device
drivers/gpu/drm/mgag200/mgag200_cursor.c | 4 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +- drivers/gpu/drm/mgag200/mgag200_drv.h | 15 ++- drivers/gpu/drm/mgag200/mgag200_i2c.c | 10 +- drivers/gpu/drm/mgag200/mgag200_main.c | 115 ++++++-------------- drivers/gpu/drm/mgag200/mgag200_mode.c | 127 ++++++++++++++--------- 6 files changed, 125 insertions(+), 148 deletions(-)
--
2.26.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 1/6 drm/mgag200: Convert struct drm_device to struct mga_device with helper
Mgag200 uses dev_private to look up struct mga_device for instances of struct drm_device. Use of dev_private is deprecated, so hide it in the helper function to_mga_device().
v2:
* make to_mga_device() a function (Sam)
--- drivers/gpu/drm/mgag200/mgag200_cursor.c | 4 ++-- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +- drivers/gpu/drm/mgag200/mgag200_drv.h | 5 +++++ drivers/gpu/drm/mgag200/mgag200_i2c.c | 10 +++++----- drivers/gpu/drm/mgag200/mgag200_main.c | 4 ++-- drivers/gpu/drm/mgag200/mgag200_mode.c | 18 +++++++++--------- 6 files changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +2 -2
@@ -260,7 +260,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, uint32_t handle, uint32_t width, uint32_t height) { struct drm_device *dev = crtc->dev; -struct mga_device *mdev = (struct mga_device *)dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);struct drm_gem_object *obj;struct drm_gem_vram_object *gbo =NULL ;int ret;
@@ -307,7 +307,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,int mgag200_crtc_cursor_move (struct drm_crtc *crtc,int x,int y) { -struct mga_device *mdev = (struct mga_device *)crtc->dev->dev_private; +struct mga_device *mdev =to_mga_device (crtc->dev);/* Our origin is at (64,64) */ x +=64 ;
drivers/gpu/drm/mgag200/mgag200_drv.c +1 -1
@@ -120,7 +120,7 @@ int mgag200_driver_dumb_create(struct drm_file *file,struct drm_device *dev, struct drm_mode_create_dumb *args) { - struct mga_device *mdev = dev->dev_private; + struct mga_device *mdev = to_mga_device(dev);unsigned long pg_align;if (WARN_ONCE (!dev->vram_mm,"VRAM MM not initialized" ))
drivers/gpu/drm/mgag200/mgag200_drv.h +5 -0
@@ -182,6 +182,11 @@ struct mga_device {struct drm_encoder encoder; }; +static inline struct mga_device *to_mga_device (struct drm_device *dev) +{ +return dev->dev_private; +} +static inline enum mga_type mgag200_type_from_driver_data (kernel_ulong_t driver_data) {
drivers/gpu/drm/mgag200/mgag200_i2c.c +5 -5
@@ -61,34 +61,34 @@ static inline void mga_i2c_set(struct mga_device *mdev, int mask, int state)static void mga_gpio_setsda (void *data,int state) {struct mga_i2c_chan *i2c = data; -struct mga_device *mdev = i2c->dev->dev_private; +struct mga_device *mdev =to_mga_device (i2c->dev);mga_i2c_set (mdev, i2c->data, state); }static void mga_gpio_setscl (void *data,int state) {struct mga_i2c_chan *i2c = data; -struct mga_device *mdev = i2c->dev->dev_private; +struct mga_device *mdev =to_mga_device (i2c->dev);mga_i2c_set (mdev, i2c->clock, state); }static int mga_gpio_getsda (void *data) {struct mga_i2c_chan *i2c = data; -struct mga_device *mdev = i2c->dev->dev_private; +struct mga_device *mdev =to_mga_device (i2c->dev);return (mga_i2c_read_gpio (mdev) & i2c->data) ?1 :0 ; }static int mga_gpio_getscl (void *data) {struct mga_i2c_chan *i2c = data; -struct mga_device *mdev = i2c->dev->dev_private; +struct mga_device *mdev =to_mga_device (i2c->dev);return (mga_i2c_read_gpio (mdev) & i2c->clock) ?1 :0 ; }struct mga_i2c_chan *mgag200_i2c_create (struct drm_device *dev) { -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);struct mga_i2c_chan *i2c;int ret;int data, clock;
drivers/gpu/drm/mgag200/mgag200_main.c +2 -2
@@ -92,7 +92,7 @@ static int mga_vram_init(struct mga_device *mdev)static int mgag200_device_init (struct drm_device *dev,uint32_t flags) { -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);int ret, option; mdev->flags =mgag200_flags_from_driver_data (flags);
@@ -195,7 +195,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)void mgag200_driver_unload (struct drm_device *dev) { -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);if (mdev ==NULL )return ;
drivers/gpu/drm/mgag200/mgag200_mode.c +9 -9
@@ -28,7 +28,7 @@static void mga_crtc_load_lut (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);struct drm_framebuffer *fb = crtc->primary->fb;u16 *r_ptr, *g_ptr, *b_ptr;int i;
@@ -728,7 +728,7 @@ static int mga_crtc_set_plls(struct mga_device *mdev, long clock)static void mga_g200wb_prepare (struct drm_crtc *crtc) { -struct mga_device *mdev = crtc->dev->dev_private; +struct mga_device *mdev =to_mga_device (crtc->dev);u8 tmp;int iter_max;
@@ -783,7 +783,7 @@ static void mga_g200wb_prepare(struct drm_crtc *crtc)static void mga_g200wb_commit (struct drm_crtc *crtc) {u8 tmp; -struct mga_device *mdev = crtc->dev->dev_private; +struct mga_device *mdev =to_mga_device (crtc->dev);/* 1- The first step is to ensure that the vrsten and hrsten are set */ WREG8 (MGAREG_CRTCEXT_INDEX ,1 );
@@ -833,7 +833,7 @@ static void mga_g200wb_commit(struct drm_crtc *crtc)*/ static void mga_set_start_address (struct drm_crtc *crtc,unsigned offset) { -struct mga_device *mdev = crtc->dev->dev_private; +struct mga_device *mdev =to_mga_device (crtc->dev);u32 addr;int count;u8 crtcext0;
@@ -902,7 +902,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb) { struct drm_device *dev = crtc->dev; -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);const struct drm_framebuffer *fb = crtc->primary->fb;int hdisplay, hsyncstart, hsyncend, htotal;int vdisplay, vsyncstart, vsyncend, vtotal;
@@ -1263,7 +1263,7 @@ static int mga_resume(struct drm_crtc *crtc)static void mga_crtc_dpms (struct drm_crtc *crtc,int mode) {struct drm_device *dev = crtc->dev; -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);u8 seq1 =0 , crtcext1 =0 ;switch (mode) {
@@ -1317,7 +1317,7 @@ static void mga_crtc_dpms(struct drm_crtc *crtc, int mode)static void mga_crtc_prepare (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);u8 tmp;/* mga_resume(crtc);*/
@@ -1353,7 +1353,7 @@ static void mga_crtc_prepare(struct drm_crtc *crtc)static void mga_crtc_commit (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; -struct mga_device *mdev = dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;u8 tmp;
@@ -1495,7 +1495,7 @@ static enum drm_mode_status mga_vga_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) {struct drm_device *dev = connector->dev; -struct mga_device *mdev = (struct mga_device *)dev->dev_private; +struct mga_device *mdev =to_mga_device (dev);int bpp =32 ;if (IS_G200_SE (mdev)) {
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 2/6 drm/mgag200: Remove several references to struct mga_device.dev
In reply to Thomas ZimmermannDone in preparation of embedding the DRM device in struct mga_device. This patch makes the patch for embedding more readable.
v2:
* improved commit message (Daniel)
--- drivers/gpu/drm/mgag200/mgag200_main.c | 23 ++++++++++++----------- drivers/gpu/drm/mgag200/mgag200_mode.c | 17 +++++++++-------- 2 files changed, 21 insertions(+), 19 deletions(-)
drivers/gpu/drm/mgag200/mgag200_main.c +12 -11
@@ -66,25 +66,26 @@ static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)/* Map the framebuffer from the card and configure the core */ static int mga_vram_init (struct mga_device *mdev) { +struct drm_device *dev = mdev->dev;void __iomem *mem;/* BAR 0 is VRAM */ - mdev->mc.vram_base =pci_resource_start (mdev->dev->pdev,0 ); - mdev->mc.vram_window =pci_resource_len (mdev->dev->pdev,0 ); + mdev->mc.vram_base =pci_resource_start (dev->pdev,0 ); + mdev->mc.vram_window =pci_resource_len (dev->pdev,0 ); -if (!devm_request_mem_region (mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, -"mgadrmfb_vram" )) { +if (!devm_request_mem_region (dev->dev, mdev->mc.vram_base, + mdev->mc.vram_window,"mgadrmfb_vram" )) {DRM_ERROR ("can't reserve VRAM\n" );return -ENXIO ; } - mem =pci_iomap (mdev->dev->pdev,0 ,0 ); + mem =pci_iomap (dev->pdev,0 ,0 );if (!mem)return -ENOMEM ; mdev->mc.vram_size =mga_probe_vram (mdev, mem); -pci_iounmap (mdev->dev->pdev, mem); +pci_iounmap (dev->pdev, mem);return 0 ; }
@@ -105,12 +106,12 @@ static int mgag200_device_init(struct drm_device *dev, mdev->has_sdram = !(option & (1 <<14 ));/* BAR 0 is the framebuffer, BAR 1 contains registers */ - mdev->rmmio_base =pci_resource_start (mdev->dev->pdev,1 ); - mdev->rmmio_size =pci_resource_len (mdev->dev->pdev,1 ); + mdev->rmmio_base =pci_resource_start (dev->pdev,1 ); + mdev->rmmio_size =pci_resource_len (dev->pdev,1 ); -if (!devm_request_mem_region (mdev->dev->dev, mdev->rmmio_base, mdev->rmmio_size, -"mgadrmfb_mmio" )) { -DRM_ERROR ("can't reserve mmio registers\n" ); +if (!devm_request_mem_region (dev->dev, mdev->rmmio_base, + mdev->rmmio_size,"mgadrmfb_mmio" )) { +drm_err (dev,"can't reserve mmio registers\n" );return -ENOMEM ; }
drivers/gpu/drm/mgag200/mgag200_mode.c +9 -8
@@ -1433,6 +1433,7 @@ static const struct drm_crtc_helper_funcs mga_helper_funcs = {/* CRTC setup */ static void mga_crtc_init (struct mga_device *mdev) { +struct drm_device *dev = mdev->dev;struct mga_crtc *mga_crtc; mga_crtc = kzalloc(sizeof(struct mga_crtc) +
@@ -1442,7 +1443,7 @@ static void mga_crtc_init(struct mga_device *mdev)if (mga_crtc ==NULL )return ; -drm_crtc_init (mdev->dev, &mga_crtc->base, &mga_crtc_funcs); +drm_crtc_init (dev, &mga_crtc->base, &mga_crtc_funcs);drm_mode_crtc_set_gamma_size (&mga_crtc->base,MGAG200_LUT_SIZE ); mdev->mode_info.crtc = mga_crtc;
@@ -1617,30 +1618,30 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev)int mgag200_modeset_init (struct mga_device *mdev) { +struct drm_device *dev = mdev->dev;struct drm_encoder *encoder = &mdev->encoder;struct drm_connector *connector;int ret; mdev->mode_info.mode_config_initialized = true; - mdev->dev->mode_config.max_width =MGAG200_MAX_FB_WIDTH ; - mdev->dev->mode_config.max_height =MGAG200_MAX_FB_HEIGHT ; + dev->mode_config.max_width =MGAG200_MAX_FB_WIDTH ; + dev->mode_config.max_height =MGAG200_MAX_FB_HEIGHT ; - mdev->dev->mode_config.fb_base = mdev->mc.vram_base; + dev->mode_config.fb_base = mdev->mc.vram_base;mga_crtc_init (mdev); - ret =drm_simple_encoder_init (mdev->dev, encoder, -DRM_MODE_ENCODER_DAC ); + ret =drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_DAC );if (ret) { -drm_err (mdev->dev, +drm_err (dev,"drm_simple_encoder_init() failed, error %d\n" , ret);return ret; } encoder->possible_crtcs =0x1 ; - connector =mga_vga_init (mdev->dev); + connector =mga_vga_init (dev);if (!connector) {DRM_ERROR ("mga_vga_init failed\n" );return -1 ;
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 3/6 drm/mgag200: Integrate init function into load function
In reply to Thomas ZimmermannDone to simplify initialization code before embedding the DRM device instance in struct mga_device.
--- drivers/gpu/drm/mgag200/mgag200_main.c | 59 +++++++++----------------- 1 file changed, 19 insertions(+), 40 deletions(-)
drivers/gpu/drm/mgag200/mgag200_main.c +19 -40
@@ -90,12 +90,17 @@ static int mga_vram_init(struct mga_device *mdev)return 0 ; } -static int mgag200_device_init (struct drm_device *dev, -uint32_t flags) +int mgag200_driver_load (struct drm_device *dev,unsigned long flags) { -struct mga_device *mdev =to_mga_device (dev); +struct mga_device *mdev;int ret, option; + mdev =devm_kzalloc (dev->dev,sizeof (struct mga_device ),GFP_KERNEL ); +if (mdev ==NULL ) +return -ENOMEM ; + dev->dev_private = (void *)mdev; + mdev->dev = dev; + mdev->flags =mgag200_flags_from_driver_data (flags); mdev->type =mgag200_type_from_driver_data (flags);
@@ -122,8 +127,8 @@ static int mgag200_device_init(struct drm_device *dev,/* stash G200 SE model number for later use */ if (IS_G200_SE (mdev)) { mdev->unique_rev_id =RREG32 (0x1e24 ); -DRM_DEBUG ("G200 SE unique revision id is 0x%x\n" , - mdev->unique_rev_id); +drm_dbg (dev,"G200 SE unique revision id is 0x%x\n" , + mdev->unique_rev_id); } ret =mga_vram_init (mdev);
@@ -134,33 +139,9 @@ static int mgag200_device_init(struct drm_device *dev, mdev->bpp_shifts[1 ] =1 ; mdev->bpp_shifts[2 ] =0 ; mdev->bpp_shifts[3 ] =2 ; -return 0 ; -} - -/* -* Functions here will be called by the core once it's bound the driver to -* a PCI device -*/ - -int mgag200_driver_load (struct drm_device *dev,unsigned long flags) -{ -struct mga_device *mdev; -int r; - - mdev =devm_kzalloc (dev->dev,sizeof (struct mga_device ),GFP_KERNEL ); -if (mdev ==NULL ) -return -ENOMEM ; - dev->dev_private = (void *)mdev; - mdev->dev = dev; - - r =mgag200_device_init (dev, flags); -if (r) { -dev_err (&dev->pdev->dev,"Fatal error during GPU init: %d\n" , r); -return r; - } - r =mgag200_mm_init (mdev); -if (r) + ret =mgag200_mm_init (mdev); +if (ret) goto err_mm;drm_mode_config_init (dev);
@@ -171,16 +152,15 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) dev->mode_config.preferred_depth =32 ; dev->mode_config.prefer_shadow =1 ; - r =mgag200_modeset_init (mdev); -if (r) { -dev_err (&dev->pdev->dev,"Fatal error during modeset init: %d\n" , r); + ret =mgag200_modeset_init (mdev); +if (ret) { +drm_err (dev,"Fatal error during modeset init: %d\n" , ret); goto err_modeset; } - r =mgag200_cursor_init (mdev); -if (r) -dev_warn (&dev->pdev->dev, -"Could not initialize cursors. Not doing hardware cursors.\n" ); + ret =mgag200_cursor_init (mdev); +if (ret) +drm_err (dev,"Could not initialize cursors. Not doing hardware cursors.\n" );return 0 ;
@@ -190,8 +170,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)mgag200_mm_fini (mdev); err_mm: dev->dev_private =NULL ; - -return r; +return ret; }void mgag200_driver_unload (struct drm_device *dev)
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 4/6 drm/mgag200: Use managed mode-config initialization
In reply to Thomas ZimmermannMode configuration is now cleanued up automatically. While at it, move all mode-config code into mgag200_mode.c. Done in preparation of switching mgag200 to simple-KMS helpers.
v2:
* improve commit message (Sam)
* rebased during cherry pick
* also move bpp_shift initialization
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 1 - drivers/gpu/drm/mgag200/mgag200_main.c | 28 ++------------------- drivers/gpu/drm/mgag200/mgag200_mode.c | 34 ++++++++++++++++++++++---- 3 files changed, 31 insertions(+), 32 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +0 -1
@@ -201,7 +201,6 @@ mgag200_flags_from_driver_data(kernel_ulong_t driver_data)/* mgag200_mode.c */ int mgag200_modeset_init (struct mga_device *mdev); -void mgag200_modeset_fini (struct mga_device *mdev);/* mgag200_main.c */ int mgag200_driver_load (struct drm_device *dev,unsigned long flags);
drivers/gpu/drm/mgag200/mgag200_main.c +2 -26
@@ -10,15 +10,8 @@#include <linux/pci.h> -#include <drm/drm_crtc_helper.h> -#include <drm/drm_gem_framebuffer_helper.h> -#include "mgag200_drv.h" -static const struct drm_mode_config_funcs mga_mode_funcs = { - .fb_create = drm_gem_fb_create -}; -static int mga_probe_vram (struct mga_device *mdev,void __iomem *mem) {int offset;
@@ -135,27 +128,14 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)if (ret)return ret; - mdev->bpp_shifts[0 ] =0 ; - mdev->bpp_shifts[1 ] =1 ; - mdev->bpp_shifts[2 ] =0 ; - mdev->bpp_shifts[3 ] =2 ; - ret =mgag200_mm_init (mdev);if (ret) goto err_mm; -drm_mode_config_init (dev); - dev->mode_config.funcs = (void *)&mga_mode_funcs; -if (IS_G200_SE (mdev) && mdev->vram_fb_available < (2048 *1024 )) - dev->mode_config.preferred_depth =16 ; -else - dev->mode_config.preferred_depth =32 ; - dev->mode_config.prefer_shadow =1 ; - ret =mgag200_modeset_init (mdev);if (ret) {drm_err (dev,"Fatal error during modeset init: %d\n" , ret); - goto err_modeset; + goto err_mgag200_mm_fini; } ret =mgag200_cursor_init (mdev);
@@ -164,9 +144,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)return 0 ; -err_modeset: -drm_mode_config_cleanup (dev); -mgag200_cursor_fini (mdev); +err_mgag200_mm_fini:mgag200_mm_fini (mdev); err_mm: dev->dev_private =NULL ;
@@ -179,8 +157,6 @@ void mgag200_driver_unload(struct drm_device *dev)if (mdev ==NULL )return ; -mgag200_modeset_fini (mdev); -drm_mode_config_cleanup (dev);mgag200_cursor_fini (mdev);mgag200_mm_fini (mdev); dev->dev_private =NULL ;
drivers/gpu/drm/mgag200/mgag200_mode.c +29 -5
@@ -13,6 +13,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_fourcc.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h>
@@ -1615,6 +1616,17 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev)return connector; } +static const struct drm_mode_config_funcs mgag200_mode_config_funcs = { + .fb_create = drm_gem_fb_create +}; + +static unsigned int mgag200_preferred_depth (struct mga_device *mdev) +{ +if (IS_G200_SE (mdev) && mdev->vram_fb_available < (2048 *1024 )) +return 16 ; +else +return 32 ; +}int mgag200_modeset_init (struct mga_device *mdev) {
@@ -1623,13 +1635,30 @@ int mgag200_modeset_init(struct mga_device *mdev)struct drm_connector *connector;int ret; + mdev->bpp_shifts[0 ] =0 ; + mdev->bpp_shifts[1 ] =1 ; + mdev->bpp_shifts[2 ] =0 ; + mdev->bpp_shifts[3 ] =2 ; + + ret =drmm_mode_config_init (dev); +if (ret) { +drm_err (dev,"drmm_mode_config_init() failed, error %d\n" , + ret); +return ret; + } + mdev->mode_info.mode_config_initialized = true; dev->mode_config.max_width =MGAG200_MAX_FB_WIDTH ; dev->mode_config.max_height =MGAG200_MAX_FB_HEIGHT ; + dev->mode_config.preferred_depth =mgag200_preferred_depth (mdev); + dev->mode_config.prefer_shadow =1 ; + dev->mode_config.fb_base = mdev->mc.vram_base; + dev->mode_config.funcs = &mgag200_mode_config_funcs; +mga_crtc_init (mdev); ret =drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_DAC );
@@ -1651,8 +1680,3 @@ int mgag200_modeset_init(struct mga_device *mdev)return 0 ; } - -void mgag200_modeset_fini (struct mga_device *mdev) -{ - -}
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 5/6 drm/mgag200: Remove unused fields from struct mga_device
In reply to Thomas ZimmermannThe fields mode_info, num_crtcs and mode in struct mga_device serve no purpose. Remove them.
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 8 -------- drivers/gpu/drm/mgag200/mgag200_main.c | 3 --- drivers/gpu/drm/mgag200/mgag200_mode.c | 6 ------ 3 files changed, 17 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +0 -8
@@ -104,11 +104,6 @@ struct mga_crtc {bool enabled; }; -struct mga_mode_info { -bool mode_config_initialized; -struct mga_crtc *crtc; -}; -struct mga_i2c_chan {struct i2c_adapter adapter;struct drm_device *dev;
@@ -160,17 +155,14 @@ struct mga_device {void __iomem *rmmio;struct mga_mc mc; -struct mga_mode_info mode_info;struct mga_cursor cursor;size_t vram_fb_available;bool suspended; -int num_crtc;enum mga_type type;int has_sdram; -struct drm_display_mode mode;int bpp_shifts[4 ];
drivers/gpu/drm/mgag200/mgag200_main.c +0 -3
@@ -97,9 +97,6 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) mdev->flags =mgag200_flags_from_driver_data (flags); mdev->type =mgag200_type_from_driver_data (flags); -/* Hardcode the number of CRTCs to 1 */ - mdev->num_crtc =1 ; -pci_read_config_dword (dev->pdev,PCI_MGA_OPTION , &option); mdev->has_sdram = !(option & (1 <<14 ));
drivers/gpu/drm/mgag200/mgag200_mode.c +0 -6
@@ -1136,9 +1136,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,WREG8 (MGA_MISC_OUT , misc); -if (adjusted_mode) -memcpy (&mdev->mode, mode,sizeof (struct drm_display_mode )); -mga_crtc_do_set_base (crtc, old_fb, x, y,0 );/* reset tagfifo */
@@ -1447,7 +1444,6 @@ static void mga_crtc_init(struct mga_device *mdev)drm_crtc_init (dev, &mga_crtc->base, &mga_crtc_funcs);drm_mode_crtc_set_gamma_size (&mga_crtc->base,MGAG200_LUT_SIZE ); - mdev->mode_info.crtc = mga_crtc;drm_crtc_helper_add (&mga_crtc->base, &mga_helper_funcs); }
@@ -1647,8 +1643,6 @@ int mgag200_modeset_init(struct mga_device *mdev)return ret; } - mdev->mode_info.mode_config_initialized = true; - dev->mode_config.max_width =MGAG200_MAX_FB_WIDTH ; dev->mode_config.max_height =MGAG200_MAX_FB_HEIGHT ;
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerPATCH v2 6/6 drm/mgag200: Embed connector instance in struct mga_device
In reply to Thomas ZimmermannStoring the connector instance in struct mga_device avoids some dynamic memory allocation. On errors, the connector's initializer function now destroys the i2c structure. Done in preparation of converting mgag200 to simple-KMS helpers.
v2:
* improved commit message (Michael)
* fixed error message for mgag200_vga_connector_init() (Sam)
--- drivers/gpu/drm/mgag200/mgag200_drv.h | 1 + drivers/gpu/drm/mgag200/mgag200_mode.c | 56 +++++++++++++++----------- 2 files changed, 33 insertions(+), 24 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.h +1 -0
@@ -171,6 +171,7 @@ struct mga_device {/* SE model number stored in reg 0x1e24 */ u32 unique_rev_id; +struct mga_connector connector;struct drm_encoder encoder; };
drivers/gpu/drm/mgag200/mgag200_mode.c +32 -24
92 lines not on this page · raw message
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel