[PATCH 1/1] drm/mgag200: Fix to always set HiPri for G200e4
From: Mathieu Larouche - Changed the HiPri value for G200e4 to always be 0. - Added Bandwith limitation to block resolution above 1920x1200x60Hz --- drivers/gpu/drm/mgag200/mgag200_mode.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 6b21cb2..292e8eb 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1133,7 +1133,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, if (IS_G200_SE(mdev)) { - if (mdev->unique_rev_id >= 0x02) { + if (mdev->unique_rev_id >= 0x04) { + WREG8(MGAREG_CRTCEXT_INDEX, 0x06); + WREG8(MGAREG_CRTCEXT_DATA, 0); + } else if (mdev->unique_rev_id >= 0x02) { u8 hi_pri_lvl; u32 bpp; u32 mb; @@ -1598,6 +1601,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector, if (mga_vga_calculate_mode_bandwidth(mode, bpp) > (30100 * 1024)) return MODE_BANDWIDTH; + } else { + if (mga_vga_calculate_mode_bandwidth(mode, bpp) + > (55000 * 1024)) + return MODE_BANDWIDTH; } } else if (mdev->type == G200_WB) { if (mode->hdisplay > 1280) -- 1.8.3.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/1] drm/mgag200: Fix to always set HiPri for G200e4 V2
From: Mathieu Larouche - Changed the HiPri value for G200e4 to always be 0. - Added Bandwith limitation to block resolution above 1920x1200x60Hz Signed-off-by: Mathieu Larouche --- drivers/gpu/drm/mgag200/mgag200_mode.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 6b21cb2..292e8eb 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1133,7 +1133,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, if (IS_G200_SE(mdev)) { - if (mdev->unique_rev_id >= 0x02) { + if (mdev->unique_rev_id >= 0x04) { + WREG8(MGAREG_CRTCEXT_INDEX, 0x06); + WREG8(MGAREG_CRTCEXT_DATA, 0); + } else if (mdev->unique_rev_id >= 0x02) { u8 hi_pri_lvl; u32 bpp; u32 mb; @@ -1598,6 +1601,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector, if (mga_vga_calculate_mode_bandwidth(mode, bpp) > (30100 * 1024)) return MODE_BANDWIDTH; + } else { + if (mga_vga_calculate_mode_bandwidth(mode, bpp) + > (55000 * 1024)) + return MODE_BANDWIDTH; } } else if (mdev->type == G200_WB) { if (mode->hdisplay > 1280) -- 1.8.3.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/1] drm/mgag200: Expose version string
I would like to know if anyone had the time to look at this patch and when I could expect to have it accepted. Thank you, Mathieu On 18/08/2017 4:24 PM, mathieu.larou...@matrox.com wrote: From: Mathieu Larouche OEMs started distributing this module out of the box so adding the version in modinfo output for this module may be a good idea. Signed-off-by: Mathieu Larouche --- drivers/gpu/drm/mgag200/mgag200_drv.c | 3 +++ drivers/gpu/drm/mgag200/mgag200_drv.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 9ac0078..ad3f193 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -134,3 +134,6 @@ static void __exit mgag200_exit(void) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(__stringify(DRIVER_MAJOR) "." + __stringify(DRIVER_MINOR) "." + __stringify(DRIVER_PATCHLEVEL)); diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index c88b6ec..df4833b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -37,7 +37,7 @@ #define DRIVER_DATE "20110418" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 +#define DRIVER_MINOR 1 #define DRIVER_PATCHLEVEL 0 #define MGAG200FB_CONN_LIMIT 1 -- Mathieu Larouche Ing./Eng. Software Designer Matrox Graphics Inc. Phone : 514 822-6000 x7905 Email : mathieu.larou...@matrox.com CONFIDENTIAL & WITHOUT PREJUDICE This e-mail and any files transmitted with it, is confidential, may be protected under NDA and/or privileged and shall be treated as such. The e-mail and its attachments are intended only for use of the individual(s) or entity(ies) indicated above. Any other person is hereby advised that it strictly forbidden to disclose, distribute or reproduce this message. If you have received this e-mail in error, please advise me by return e-mail or by telephone at 514-822-6000, immediately and destroy the message and its contents immediately. Thank You. CONFIDENTIEL- SANS PRÉJUDICE Ce courriel et tout document qui y est joint, est confidentiel, peut être privilégié et protégé par entente de confidentialité et est à l'usage exclusif du destinataire. Toute autre personne est par les présentes avisée qu'il lui est strictement interdit de le diffuser, le distribuer ou le reproduire. Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par téléphone au (514) 822-6000 et détruire ce message et toute copie de celui-ci immédiatement. Merci. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: mgag200: Wrong looking code in mga_probe_vram
On 11/10/2017 5:27 AM, Michal Srb wrote: Hi, While reading the mgag200 driver I noticed something that looks wrong. In mgag200_main.c mga_probe_vram function: orig1 = ioread8(mem + offset); orig2 = ioread8(mem + offset + 0x100); ... iowrite16(orig1, mem + offset); iowrite16(orig2, mem + offset + 0x100); I do not understand how exactly the probing works, but ioread8 followed by iowrite16 does not look correct. The corresponding function in xf86-video-mga UMS driver is MGACountRam. It does the equivalent of read 16, write 16. So in case you can confirm that the kernel driver is correct, it would probably mean the user space driver is wrong. Thanks, Michal Srb Hi, I agree with you, there's an issue there. The first two lines should be ioread16(). The goal of this routine is to detect the amount of memory available since it varies in some products. Basically, it stores the initial value, write a value and read it back, then it restores the initial value. In this case, only half of the value will be restored. Mathieu ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/1] drm/mgag200: Expose version string
From: Mathieu Larouche OEMs started distributing this module out of the box so adding the version in modinfo output for this module may be a good idea. Signed-off-by: Mathieu Larouche --- drivers/gpu/drm/mgag200/mgag200_drv.c | 3 +++ drivers/gpu/drm/mgag200/mgag200_drv.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 9ac0078..ad3f193 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -134,3 +134,6 @@ static void __exit mgag200_exit(void) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +MODULE_VERSION(__stringify(DRIVER_MAJOR) "." + __stringify(DRIVER_MINOR) "." + __stringify(DRIVER_PATCHLEVEL)); diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index c88b6ec..df4833b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -37,7 +37,7 @@ #define DRIVER_DATE"20110418" #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 +#define DRIVER_MINOR 1 #define DRIVER_PATCHLEVEL 0 #define MGAG200FB_CONN_LIMIT 1 -- 1.8.3.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 00/14] mgag200 fixes
On 18/07/2017 10:43 AM, Takashi Iwai wrote: Hi, this is a summer cleanup sale, a patchset containing various fixes for mgag200 driver taken from openSUSE / SUSE kernels. They have been in our kernels for ages, so at least they are supposed to be stable. Most of patches came from Egbert, and one PM patch from me that is a resubmission of the once-post-and-lost patch. thanks, Takashi === Egbert Eich (13): drm/mgag200: Add doublescan and interlace support drm/mgag200: Add additional limits for certain G200 variants drm/mgag200: Fix memleak in error path in mgag200_bo_create() drm/mgag200: Free container instead of member in mga_user_framebuffer_destroy() drm/mgag200: Initialize data needed to map fbdev memory drm/mgag200: Simplify function mgag200_ttm_placement() drm/mgag200: Add support for MATROX PCI device IDs 0x520 and 0x521 drm/mgag200: Cleanup cursor BOs properly drm/mgag200: Add missing drm_connector_unregister() drm/mgag200: Don't use crtc_* parameters for validation drm/mgag200: Consolidate depth/bpp handling drm/mgag200: Add command line option to specify preferred depth drm/mgag200: Add mode validation debugging code Takashi Iwai (1): drm/mgag200: Implement basic PM support drivers/gpu/drm/mgag200/mgag200_drv.c | 54 +++ drivers/gpu/drm/mgag200/mgag200_drv.h | 22 +++-- drivers/gpu/drm/mgag200/mgag200_fb.c | 14 +-- drivers/gpu/drm/mgag200/mgag200_main.c | 146 +++-- drivers/gpu/drm/mgag200/mgag200_mode.c | 166 ++--- drivers/gpu/drm/mgag200/mgag200_ttm.c | 11 ++- 6 files changed, 357 insertions(+), 56 deletions(-) Patches were tested against G200eW3, G200e4 & G200eH3 and it's working fine and we haven't seen any issues. There's one thing though, the patch "[PATCH 01/14] drm/mgag200: Add doublescan and interlace support" may cause problems as doublescan and interlace aren't tested and aren't officially supported on the G200 server line products. So, I'm wondering if it shouldn't be kept disabled for them. -- Mathieu Larouche Ing./Eng. Software Designer Matrox Graphics Inc. Phone : 514 822-6000 x7905 Email : mathieu.larou...@matrox.com ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.
On 05/04/2013 10:51 AM, Christopher Harvey wrote: This change properly enables the "requester" in G200ER cards that is responsible for getting pixels out of memory and clocking them out to the screen. Signed-off-by: Christopher Harvey Signed-off-by: Mathieu Larouche --- drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 7337013..f988965 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, int i; unsigned char misc = 0; unsigned char ext_vga[6]; - unsigned char ext_vga_index24; - unsigned char dac_index90 = 0; u8 bppshift; static unsigned char dacvalue[] = { @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, option2 = 0xb000; break; case G200_ER: - dac_index90 = 0; break; } @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, WREG_DAC(i, dacvalue[i]); } - if (mdev->type == G200_ER) { - WREG_DAC(0x90, dac_index90); - } - + if (mdev->type == G200_ER) + WREG_DAC(0x90, 0); if (option) pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, if (mdev->type == G200_WB) ext_vga[1] |= 0x88; - ext_vga_index24 = 0x05; - /* Set pixel clocks */ misc = 0x2d; WREG8(MGA_MISC_OUT, misc); @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, } if (mdev->type == G200_ER) - WREG_ECRT(24, ext_vga_index24); + WREG_ECRT(0x24, 0x5); if (mdev->type == G200_EV) { WREG_ECRT(6, 0); -- Mathieu Larouche Ing./Eng. Software Designer Matrox Graphics Inc. Phone : 514 822-6000 x7905 Email : mathieu.larou...@matrox.com ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/3] drm/mgag200: Index 24 in extended CRTC registers is 24 in hex, not decimal.
On 05/04/2013 10:51 AM, Christopher Harvey wrote: > This change properly enables the "requester" in G200ER cards that is > responsible for getting pixels out of memory and clocking them out to > the screen. > > Signed-off-by: Christopher Harvey Signed-off-by: Mathieu Larouche > --- > drivers/gpu/drm/mgag200/mgag200_mode.c | 13 +++-- > 1 file changed, 3 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c > b/drivers/gpu/drm/mgag200/mgag200_mode.c > index 7337013..f988965 100644 > --- a/drivers/gpu/drm/mgag200/mgag200_mode.c > +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c > @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, > int i; > unsigned char misc = 0; > unsigned char ext_vga[6]; > - unsigned char ext_vga_index24; > - unsigned char dac_index90 = 0; > u8 bppshift; > > static unsigned char dacvalue[] = { > @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, > option2 = 0xb000; > break; > case G200_ER: > - dac_index90 = 0; > break; > } > > @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, > WREG_DAC(i, dacvalue[i]); > } > > - if (mdev->type == G200_ER) { > - WREG_DAC(0x90, dac_index90); > - } > - > + if (mdev->type == G200_ER) > + WREG_DAC(0x90, 0); > > if (option) > pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option); > @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, > if (mdev->type == G200_WB) > ext_vga[1] |= 0x88; > > - ext_vga_index24 = 0x05; > - > /* Set pixel clocks */ > misc = 0x2d; > WREG8(MGA_MISC_OUT, misc); > @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, > } > > if (mdev->type == G200_ER) > - WREG_ECRT(24, ext_vga_index24); > + WREG_ECRT(0x24, 0x5); > > if (mdev->type == G200_EV) { > WREG_ECRT(6, 0); -- Mathieu Larouche Ing./Eng. Software Designer Matrox Graphics Inc. Phone : 514 822-6000 x7905 Email : mathieu.larouche at matrox.com
drm/mgag200: don't use uninitialized variables in mga_g200se_set_plls()
On 19/10/2015 6:29 AM, Jan Beulich wrote: > I can only guess that instead of testm/testn (which are either > uninitialized or have pre-determined values at the end of the preceding > loops) n and m were meant to be used by commit e829d7ef9f > ("drm/mgag200: Add support for a new rev of G200e"). In any event the > compiler is right in warning that testm/testn are possibly uninitalized > at this point, i.e. some change is needed no matter what. > > Signed-off-by: Jan Beulich > Cc: Mathieu Larouche > --- > drivers/gpu/drm/mgag200/mgag200_mode.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- 4.3-rc6/drivers/gpu/drm/mgag200/mgag200_mode.c > +++ 4.3-rc6-mgag200-uninit/drivers/gpu/drm/mgag200/mgag200_mode.c > @@ -194,7 +194,7 @@ static int mga_g200se_set_plls(struct mg > } > } > > - fvv = pllreffreq * testn / testm; > + fvv = pllreffreq * n / m; > fvv = (fvv - 80) / 5; > > if (fvv > 15) > > > > If you are using n/m instead of testn/testm, you need to add 1 to the variables to keep consistency. However, you have the same issue where m/n could be used without being initialized. So, I propose to keep testm, testn & testp and initialized them with the default value. Signed-off-by: Mathieu Larouche --- drivers/gpu/drm/mgag200/mgag200_mode.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index c99d3fe..055799c 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -123,6 +123,9 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock) vcomax = 32; vcomin = 16; pllreffreq = 25000; + testm = 1; + testn = 17; + testp = 8; delta = 0x; permitteddelta = clock * 5 / 1000; @@ -157,6 +160,9 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock) vcomax= 160; vcomin= 80; pllreffreq= 25000; + testm = 1; + testn = 50; + testp = 16; if (clock < 25000) clock = 25000;
drm/mgag200: don't use uninitialized variables in mga_g200se_set_plls()
On 20/10/2015 11:00 AM, Jan Beulich wrote: On 20.10.15 at 16:47, wrote: >> On 19/10/2015 6:29 AM, Jan Beulich wrote: >>> --- 4.3-rc6/drivers/gpu/drm/mgag200/mgag200_mode.c >>> +++ 4.3-rc6-mgag200-uninit/drivers/gpu/drm/mgag200/mgag200_mode.c >>> @@ -194,7 +194,7 @@ static int mga_g200se_set_plls(struct mg >>> } >>> } >>> >>> - fvv = pllreffreq * testn / testm; >>> + fvv = pllreffreq * n / m; >>> fvv = (fvv - 80) / 5; >>> >>> if (fvv > 15) >>> >> If you are using n/m instead of testn/testm, you need to >> add 1 to the variables to keep consistency. However, you >> have the same issue where m/n could be used without being >> initialized. So, I propose to keep testm, testn & testp >> and initialized them with the default value. > That makes them initialized, but since testn and testm are used > as loop variables I don't see how initializing them to default > values helps overcome the other half of the problem described > (them having a constant, pre-determined value at the end of > the loops: testn=257, testm=33). As to testp - it is always > initialized anyway (so long as P_ARRAY_SIZE is not zero). And > in the if() branch initialization isn't needed either, since the > variables aren't being used after the loops. > > Jan > > Sorry, I missed that part in your initial comment and you are right, there's an issue there. So, your proposed patch totally make sense, you only need to add 1 to m/n.