Just a bit of cleanup from me (resubmitted). The important patch comes from Julia. Julia's patch conflicts with the following: 1363594270-22137-1-git-send-email-airlied@gmail.com
it fixes https://bugzilla.kernel.org/show_bug.cgi?id=46591
Christopher Harvey (3): drm/mgag200: Remove pointless call to drm_fb_get_bpp_depth drm/mgag200: Pass driver specific mga_device in driver functions drm/mgag200: Remove extra variable assigns
Julia Lemire (1): drm/mgag200: Bug fix: Modified pll algorithm for EH project
drivers/gpu/drm/mgag200/mgag200_fb.c | 3 --- drivers/gpu/drm/mgag200/mgag200_main.c | 2 -- drivers/gpu/drm/mgag200/mgag200_mode.c | 17 ++++++++--------- 3 files changed, 8 insertions(+), 14 deletions(-)
Signed-off-by: Christopher Harvey charvey@matrox.com --- drivers/gpu/drm/mgag200/mgag200_fb.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c index d2253f6..a5a1f34 100644 --- a/drivers/gpu/drm/mgag200/mgag200_fb.c +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c @@ -105,12 +105,9 @@ static int mgag200fb_create_object(struct mga_fbdev *afbdev, struct drm_gem_object **gobj_p) { struct drm_device *dev = afbdev->helper.dev; - u32 bpp, depth; u32 size; struct drm_gem_object *gobj; - int ret = 0; - drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
size = mode_cmd->pitches[0] * mode_cmd->height; ret = mgag200_gem_create(dev, size, true, &gobj);
Signed-off-by: Christopher Harvey charvey@matrox.com --- drivers/gpu/drm/mgag200/mgag200_mode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a274b99..6b5db83 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1261,9 +1261,8 @@ static const struct drm_crtc_helper_funcs mga_helper_funcs = { };
/* CRTC setup */ -static void mga_crtc_init(struct drm_device *dev) +static void mga_crtc_init(struct mga_device *mdev) { - struct mga_device *mdev = dev->dev_private; struct mga_crtc *mga_crtc; int i;
@@ -1274,7 +1273,7 @@ static void mga_crtc_init(struct drm_device *dev) if (mga_crtc == NULL) return;
- drm_crtc_init(dev, &mga_crtc->base, &mga_crtc_funcs); + drm_crtc_init(mdev->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; @@ -1529,7 +1528,7 @@ int mgag200_modeset_init(struct mga_device *mdev)
mdev->dev->mode_config.fb_base = mdev->mc.vram_base;
- mga_crtc_init(mdev->dev); + mga_crtc_init(mdev);
encoder = mga_encoder_init(mdev->dev); if (!encoder) {
These two variables are set again immediately in 'mgag200_modeset_init'
Signed-off-by: Christopher Harvey charvey@matrox.com --- drivers/gpu/drm/mgag200/mgag200_main.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 64297c7..b762bfb 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -234,8 +234,6 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
drm_mode_config_init(dev); dev->mode_config.funcs = (void *)&mga_mode_funcs; - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; dev->mode_config.preferred_depth = 24; dev->mode_config.prefer_shadow = 1;
While testing the mgag200 kms driver on the HP ProLiant Gen8, a bug was seen. Once the bootloader would load the selected kernel, the screen would go black. At first it was assumed that the mgag200 kms driver was hanging. But after setting up the grub serial output, it was seen that the driver was being loaded properly. After trying serval monitors, one finaly displayed the message "Frequency Out of Range". By comparing the kms pll algorithm with the previous mgag200 xorg driver pll algorithm, discrepencies were found. Once the kms pll algorithm was modified, the expected pll values were produced. This fix was tested on several monitors of varying native resolutions.
Signed-off-by: Julia Lemire jlemire@matrox.com --- drivers/gpu/drm/mgag200/mgag200_mode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 6b5db83..7337013 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) m = n = p = 0; vcomax = 800000; vcomin = 400000; - pllreffreq = 3333; + pllreffreq = 33333;
delta = 0xffffffff; permitteddelta = clock * 5 / 1000;
- for (testp = 16; testp > 0; testp--) { + for (testp = 16; testp > 0; testp >>= 1) { if (clock * testp > vcomax) continue; if (clock * testp < vcomin) continue;
for (testm = 1; testm < 33; testm++) { - for (testn = 1; testn < 257; testn++) { + for (testn = 17; testn < 257; testn++) { computed = (pllreffreq * testn) / (testm * testp); if (computed > clock) @@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) if (tmpdelta < delta) { delta = tmpdelta; n = testn - 1; - m = (testm - 1) | ((n >> 1) & 0x80); + m = (testm - 1); p = testp - 1; } if ((clock * testp) >= 600000) - p |= 80; + p |= 0x80; } } }
Just a bit of cleanup from me (resubmitted). The important patch comes from Julia. Julia's patch conflicts with the following: 1363594270-22137-1-git-send-email-airlied@gmail.com
Yeah I was going to leave the cleanups until -next opens, I'll push the fix though and get it to stable.
Dave.
dri-devel@lists.freedesktop.org