All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] xorg/nouveau: blacklist all pre NV30 cards
@ 2011-05-16 19:51 Marcin Slusarz
  2011-05-16 22:20 ` [PATCH v2 " Marcin Slusarz
  0 siblings, 1 reply; 14+ messages in thread
From: Marcin Slusarz @ 2011-05-16 19:51 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Bail out early in probe, so other driver can take control of the card.
Doing it in screen_create would be too late.

PCIID list taken from xf86-video-nv, so it's probably complete.
---
 src/gallium/targets/xorg-nouveau/nouveau_xorg.c |  100 +++++++++++++++++++++--
 1 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index a25254a..6d3b8f2 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -43,11 +43,6 @@ static const struct pci_id_match nouveau_xorg_device_match[] = {
     {0, 0, 0},
 };
 
-static SymTabRec nouveau_xorg_chipsets[] = {
-    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
-    {-1, NULL}
-};
-
 static PciChipsets nouveau_xorg_pci_devices[] = {
     {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
     {-1, -1, NULL}
@@ -121,16 +116,107 @@ nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
 static void
 nouveau_xorg_identify(int flags)
 {
-    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel Drivers",
-		      nouveau_xorg_chipsets);
+    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for NV30+ NVIDIA chipsets\n");
 }
 
+/* List of cards we DO NOT SUPPORT. */
+static SymTabRec NVPreNV30Chipsets[] =
+{
+  { 0x12D20018, "RIVA 128" },
+
+  { 0x10DE0020, "RIVA TNT" },
+
+  { 0x10DE0028, "RIVA TNT2" },
+  { 0x10DE002A, "Unknown TNT2" },
+  { 0x10DE002C, "Vanta" },
+  { 0x10DE0029, "RIVA TNT2 Ultra" },
+  { 0x10DE002D, "RIVA TNT2 Model 64" },
+
+  { 0x10DE00A0, "Aladdin TNT2" },
+
+  { 0x10DE0100, "GeForce 256" },
+  { 0x10DE0101, "GeForce DDR" },
+  { 0x10DE0103, "Quadro" },
+
+  { 0x10DE0110, "GeForce2 MX/MX 400" },
+  { 0x10DE0111, "GeForce2 MX 100/200" },
+  { 0x10DE0112, "GeForce2 Go" },
+  { 0x10DE0113, "Quadro2 MXR/EX/Go" },
+
+  { 0x10DE01A0, "GeForce2 Integrated GPU" },
+
+  { 0x10DE0150, "GeForce2 GTS" },
+  { 0x10DE0151, "GeForce2 Ti" },
+  { 0x10DE0152, "GeForce2 Ultra" },
+  { 0x10DE0153, "Quadro2 Pro" },
+
+  { 0x10DE0170, "GeForce4 MX 460" },
+  { 0x10DE0171, "GeForce4 MX 440" },
+  { 0x10DE0172, "GeForce4 MX 420" },
+  { 0x10DE0173, "GeForce4 MX 440-SE" },
+  { 0x10DE0174, "GeForce4 440 Go" },
+  { 0x10DE0175, "GeForce4 420 Go" },
+  { 0x10DE0176, "GeForce4 420 Go 32M" },
+  { 0x10DE0177, "GeForce4 460 Go" },
+  { 0x10DE0178, "Quadro4 550 XGL" },
+  { 0x10DE0179, "GeForce4 MX (Mac) / 440 Go 64M" },
+  { 0x10DE017A, "Quadro NVS" },
+  { 0x10DE017C, "Quadro4 500 GoGL" },
+  { 0x10DE017D, "GeForce4 410 Go 16M" },
+
+  { 0x10DE0181, "GeForce4 MX 440 with AGP8X" },
+  { 0x10DE0182, "GeForce4 MX 440SE with AGP8X" },
+  { 0x10DE0183, "GeForce4 MX 420 with AGP8X" },
+  { 0x10DE0185, "GeForce4 MX 4000" },
+  { 0x10DE0186, "GeForce4 448 Go" },
+  { 0x10DE0187, "GeForce4 488 Go" },
+  { 0x10DE0188, "Quadro4 580 XGL" },
+  { 0x10DE0189, "GeForce4 MX with AGP8X (Mac)" },
+  { 0x10DE018A, "Quadro4 NVS 280 SD" },
+  { 0x10DE018B, "Quadro4 380 XGL" },
+  { 0x10DE018C, "Quadro NVS 50 PCI" },
+  { 0x10DE018D, "GeForce4 448 Go" },
+
+  { 0x10DE01F0, "GeForce4 MX Integrated GPU" },
+
+  { 0x10DE0200, "GeForce3" },
+  { 0x10DE0201, "GeForce3 Ti 200" },
+  { 0x10DE0202, "GeForce3 Ti 500" },
+  { 0x10DE0203, "Quadro DCC" },
+
+  { 0x10DE0250, "GeForce4 Ti 4600" },
+  { 0x10DE0251, "GeForce4 Ti 4400" },
+  { 0x10DE0253, "GeForce4 Ti 4200" },
+  { 0x10DE0258, "Quadro4 900 XGL" },
+  { 0x10DE0259, "Quadro4 750 XGL" },
+  { 0x10DE025B, "Quadro4 700 XGL" },
+
+  { 0x10DE0280, "GeForce4 Ti 4800" },
+  { 0x10DE0281, "GeForce4 Ti 4200 with AGP8X" },
+  { 0x10DE0282, "GeForce4 Ti 4800 SE" },
+  { 0x10DE0286, "GeForce4 4200 Go" },
+  { 0x10DE028C, "Quadro4 700 GoGL" },
+  { 0x10DE0288, "Quadro4 980 XGL" },
+  { 0x10DE0289, "Quadro4 780 XGL" },
+
+  {-1, NULL}
+};
+
+
 static Bool
 nouveau_xorg_pci_probe(DriverPtr driver,
 	  int entity_num, struct pci_device *device, intptr_t match_data)
 {
     ScrnInfoPtr scrn = NULL;
     EntityInfoPtr entity;
+    SymTabRec *cur;
+
+    int pciid = device->vendor_id << 16 | device->device_id;
+
+    for (cur = &NVPreNV30Chipsets[0]; cur->token != -1; cur++) {
+	if (cur->token == pciid)
+	    return FALSE;
+    }
 
     scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
 			       NULL, NULL, NULL, NULL, NULL);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-05-16 19:51 [PATCH 2/2] xorg/nouveau: blacklist all pre NV30 cards Marcin Slusarz
@ 2011-05-16 22:20 ` Marcin Slusarz
       [not found]   ` <20110516222014.GH5456-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Marcin Slusarz @ 2011-05-16 22:20 UTC (permalink / raw)
  To: nouveau; +Cc: mesa-dev

Bail out early in probe, so other driver can take control of the card.
Doing it in screen_create would be too late.
---
 src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index a25254a..5392e50 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -38,16 +38,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
 static const struct pci_id_match nouveau_xorg_device_match[] = {
     { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
       0x00030000, 0x00ffffff, 0 },
-    { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
-      0x00030000, 0x00ffffff, 0 },
     {0, 0, 0},
 };
 
-static SymTabRec nouveau_xorg_chipsets[] = {
-    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
-    {-1, NULL}
-};
-
 static PciChipsets nouveau_xorg_pci_devices[] = {
     {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
     {-1, -1, NULL}
@@ -121,16 +114,49 @@ nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
 static void
 nouveau_xorg_identify(int flags)
 {
-    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel Drivers",
-		      nouveau_xorg_chipsets);
+    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for NV30+ NVIDIA chipsets\n");
 }
 
+struct pcirange {
+	unsigned int low;
+	unsigned int high;
+};
+
+/* List of cards we DO NOT SUPPORT. */
+static struct pcirange NVPreNV30Chipsets[] =
+{
+  {0x0020, 0x002F}, /* NV04/05 */
+  {0x00A0, 0x00AF}, /* ? */
+  {0x0100, 0x010F}, /* NV10 */
+  {0x0110, 0x011F}, /* NV11 */
+  {0x01A0, 0x01AF}, /* NV1A */
+  {0x0150, 0x015F}, /* NV15 */
+  {0x0170, 0x017F}, /* NV17 */
+  {0x0180, 0x018F}, /* NV18 */
+  {0x01F0, 0x01FF}, /* NV1F */
+  {0x0200, 0x020F}, /* NV20 */
+  {0x02A0, 0x02AF}, /* NV2A */
+  {0x0250, 0x025F}, /* NV25 */
+  {0x0280, 0x028F}, /* NV28 */
+  {0, 0}
+};
+
+
 static Bool
 nouveau_xorg_pci_probe(DriverPtr driver,
 	  int entity_num, struct pci_device *device, intptr_t match_data)
 {
     ScrnInfoPtr scrn = NULL;
     EntityInfoPtr entity;
+    struct pcirange *cur;
+
+    if (device->vendor_id != 0x10DE)
+	return FALSE;
+
+    for (cur = &NVPreNV30Chipsets[0]; cur->low != 0; cur++) {
+	if (device->device_id >= cur->low && device->device_id <= cur->high)
+	    return FALSE;
+    }
 
     scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
 			       NULL, NULL, NULL, NULL, NULL);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
       [not found]   ` <20110516222014.GH5456-OI9uyE9O0yo@public.gmane.org>
@ 2011-06-05 19:06     ` Marcin Slusarz
  2011-06-05 19:10       ` [Nouveau] " Stéphane Marchesin
  2011-06-05 19:22       ` [PATCH v2 " Patrick Baggett
  0 siblings, 2 replies; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-05 19:06 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
> Bail out early in probe, so other driver can take control of the card.
> Doing it in screen_create would be too late.
> ---
>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
>  1 files changed, 35 insertions(+), 9 deletions(-)

ping

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Nouveau] [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:06     ` Marcin Slusarz
@ 2011-06-05 19:10       ` Stéphane Marchesin
  2011-06-05 19:15         ` Maarten Maathuis
  2011-06-05 19:22       ` [PATCH v2 " Patrick Baggett
  1 sibling, 1 reply; 14+ messages in thread
From: Stéphane Marchesin @ 2011-06-05 19:10 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: nouveau, mesa-dev

On Sun, Jun 5, 2011 at 12:06, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
>> Bail out early in probe, so other driver can take control of the card.
>> Doing it in screen_create would be too late.
>> ---
>>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
>>  1 files changed, 35 insertions(+), 9 deletions(-)
>
> ping
>

Why do you need a list of cards for that, as opposed to reading the reg?

Stéphane

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Nouveau] [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:10       ` [Nouveau] " Stéphane Marchesin
@ 2011-06-05 19:15         ` Maarten Maathuis
  2011-06-05 19:46           ` Marcin Slusarz
  0 siblings, 1 reply; 14+ messages in thread
From: Maarten Maathuis @ 2011-06-05 19:15 UTC (permalink / raw)
  To: Stéphane Marchesin; +Cc: nouveau, mesa-dev

2011/6/5 Stéphane Marchesin <stephane.marchesin@gmail.com>:
> On Sun, Jun 5, 2011 at 12:06, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
>> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
>>> Bail out early in probe, so other driver can take control of the card.
>>> Doing it in screen_create would be too late.
>>> ---
>>>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
>>>  1 files changed, 35 insertions(+), 9 deletions(-)
>>
>> ping
>>
>
> Why do you need a list of cards for that, as opposed to reading the reg?
>
> Stéphane
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

I agree with Stephane, checking register 0 should work fine. First
check for NV04/05, then for NV10-NV2F.

Maarten.

-- 
Far away from the primal instinct, the song seems to fade away, the
river get wider between your thoughts and the things we do and say.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:06     ` Marcin Slusarz
  2011-06-05 19:10       ` [Nouveau] " Stéphane Marchesin
@ 2011-06-05 19:22       ` Patrick Baggett
  2011-06-05 19:23         ` Maarten Maathuis
  2011-06-05 20:35         ` Marcin Slusarz
  1 sibling, 2 replies; 14+ messages in thread
From: Patrick Baggett @ 2011-06-05 19:22 UTC (permalink / raw)
  To: nouveau, mesa-dev


[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]

Wasn't nouveau targeted to provide HW acceleration for old cards like the
TNT2, or has that idea been killed?

Patrick

On Sun, Jun 5, 2011 at 2:06 PM, Marcin Slusarz <marcin.slusarz@gmail.com>wrote:

> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
> > Bail out early in probe, so other driver can take control of the card.
> > Doing it in screen_create would be too late.
> > ---
> >  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44
> ++++++++++++++++++-----
> >  1 files changed, 35 insertions(+), 9 deletions(-)
>
> ping
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

[-- Attachment #1.2: Type: text/html, Size: 1173 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:22       ` [PATCH v2 " Patrick Baggett
@ 2011-06-05 19:23         ` Maarten Maathuis
  2011-06-05 20:35         ` Marcin Slusarz
  1 sibling, 0 replies; 14+ messages in thread
From: Maarten Maathuis @ 2011-06-05 19:23 UTC (permalink / raw)
  To: Patrick Baggett; +Cc: nouveau, mesa-dev

On Sun, Jun 5, 2011 at 9:22 PM, Patrick Baggett
<baggett.patrick@gmail.com> wrote:
> Wasn't nouveau targeted to provide HW acceleration for old cards like the
> TNT2, or has that idea been killed?
> Patrick
>

NV04-NV2F support went into a "classic" driver.

> On Sun, Jun 5, 2011 at 2:06 PM, Marcin Slusarz <marcin.slusarz@gmail.com>
> wrote:
>>
>> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
>> > Bail out early in probe, so other driver can take control of the card.
>> > Doing it in screen_create would be too late.
>> > ---
>> >  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44
>> > ++++++++++++++++++-----
>> >  1 files changed, 35 insertions(+), 9 deletions(-)
>>
>> ping
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>



-- 
Far away from the primal instinct, the song seems to fade away, the
river get wider between your thoughts and the things we do and say.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Nouveau] [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:15         ` Maarten Maathuis
@ 2011-06-05 19:46           ` Marcin Slusarz
  2011-06-05 19:54             ` Maarten Maathuis
  0 siblings, 1 reply; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-05 19:46 UTC (permalink / raw)
  To: Maarten Maathuis; +Cc: mesa-dev, nouveau

On Sun, Jun 05, 2011 at 09:15:47PM +0200, Maarten Maathuis wrote:
> 2011/6/5 Stéphane Marchesin <stephane.marchesin@gmail.com>:
> > On Sun, Jun 5, 2011 at 12:06, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> >> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
> >>> Bail out early in probe, so other driver can take control of the card.
> >>> Doing it in screen_create would be too late.
> >>> ---
> >>>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
> >>>  1 files changed, 35 insertions(+), 9 deletions(-)
> >>
> >> ping
> >>
> >
> > Why do you need a list of cards for that, as opposed to reading the reg?
> >
> 
> I agree with Stephane, checking register 0 should work fine. First
> check for NV04/05, then for NV10-NV2F.
> 

I did it this way because I didn't have access to device file descriptor - it's created
somewhere near InitScreen and passed to nouveau_drm_screen_create - too late to 
exit gracefully (something which I believe is a bug, but I couldn't track it).

But now I see xf86-video-nouveau is in exactly the same situation - it opens fd
temporarily in PciProbe. I'll adapt its code to target/xorg-nouveau.

Marcin
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Nouveau] [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:46           ` Marcin Slusarz
@ 2011-06-05 19:54             ` Maarten Maathuis
  2011-06-05 20:31               ` [PATCH v3 " Marcin Slusarz
  0 siblings, 1 reply; 14+ messages in thread
From: Maarten Maathuis @ 2011-06-05 19:54 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: mesa-dev, nouveau

On Sun, Jun 5, 2011 at 9:46 PM, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> On Sun, Jun 05, 2011 at 09:15:47PM +0200, Maarten Maathuis wrote:
>> 2011/6/5 Stéphane Marchesin <stephane.marchesin@gmail.com>:
>> > On Sun, Jun 5, 2011 at 12:06, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
>> >> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
>> >>> Bail out early in probe, so other driver can take control of the card.
>> >>> Doing it in screen_create would be too late.
>> >>> ---
>> >>>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
>> >>>  1 files changed, 35 insertions(+), 9 deletions(-)
>> >>
>> >> ping
>> >>
>> >
>> > Why do you need a list of cards for that, as opposed to reading the reg?
>> >
>>
>> I agree with Stephane, checking register 0 should work fine. First
>> check for NV04/05, then for NV10-NV2F.
>>
>
> I did it this way because I didn't have access to device file descriptor - it's created
> somewhere near InitScreen and passed to nouveau_drm_screen_create - too late to
> exit gracefully (something which I believe is a bug, but I couldn't track it).
>
> But now I see xf86-video-nouveau is in exactly the same situation - it opens fd
> temporarily in PciProbe. I'll adapt its code to target/xorg-nouveau.

I was incorrect in saying that you should check registers yourself
(which would require root), but opening the device should give you the
chipset type.

>
> Marcin
>



-- 
Far away from the primal instinct, the song seems to fade away, the
river get wider between your thoughts and the things we do and say.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:54             ` Maarten Maathuis
@ 2011-06-05 20:31               ` Marcin Slusarz
       [not found]                 ` <20110605203159.GA26259-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-05 20:31 UTC (permalink / raw)
  To: Maarten Maathuis; +Cc: mesa-dev, nouveau

On Sun, Jun 05, 2011 at 09:54:31PM +0200, Maarten Maathuis wrote:
> On Sun, Jun 5, 2011 at 9:46 PM, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> > On Sun, Jun 05, 2011 at 09:15:47PM +0200, Maarten Maathuis wrote:
> >> 2011/6/5 Stéphane Marchesin <stephane.marchesin@gmail.com>:
> >> > On Sun, Jun 5, 2011 at 12:06, Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
> >> >> On Tue, May 17, 2011 at 12:20:14AM +0200, Marcin Slusarz wrote:
> >> >>> Bail out early in probe, so other driver can take control of the card.
> >> >>> Doing it in screen_create would be too late.
> >> >>> ---
> >> >>>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   44 ++++++++++++++++++-----
> >> >>>  1 files changed, 35 insertions(+), 9 deletions(-)
> >> >>
> >> >> ping
> >> >>
> >> >
> >> > Why do you need a list of cards for that, as opposed to reading the reg?
> >> >
> >>
> >> I agree with Stephane, checking register 0 should work fine. First
> >> check for NV04/05, then for NV10-NV2F.
> >>
> >
> > I did it this way because I didn't have access to device file descriptor - it's created
> > somewhere near InitScreen and passed to nouveau_drm_screen_create - too late to
> > exit gracefully (something which I believe is a bug, but I couldn't track it).
> >
> > But now I see xf86-video-nouveau is in exactly the same situation - it opens fd
> > temporarily in PciProbe. I'll adapt its code to target/xorg-nouveau.
> 
> I was incorrect in saying that you should check registers yourself
> (which would require root), but opening the device should give you the
> chipset type.
> 

Yeah. New patch below.
Thanks!

---
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Subject: [PATCH] xorg/nouveau: blacklist all pre NV30 cards

Bail out early in probe, so other driver (xf86-video-nouveau) can take control
of the card. Doing it in screen_create would be too late.
---
 src/gallium/targets/xorg-nouveau/Makefile       |    3 +
 src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   63 +++++++++++++++++++---
 2 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/src/gallium/targets/xorg-nouveau/Makefile b/src/gallium/targets/xorg-nouveau/Makefile
index 16ac954..755969c 100644
--- a/src/gallium/targets/xorg-nouveau/Makefile
+++ b/src/gallium/targets/xorg-nouveau/Makefile
@@ -23,4 +23,7 @@ DRIVER_PIPES = \
 DRIVER_LINKS = \
 	$(shell pkg-config --libs libdrm libdrm_nouveau)
 
+DRIVER_INCLUDES = \
+	$(shell pkg-config --cflags-only-I libdrm libdrm_nouveau xf86driproto)
+
 include ../Makefile.xorg
diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index a25254a..43470a1 100644
--- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -29,6 +29,9 @@
  */
 
 #include "../../state_trackers/xorg/xorg_winsys.h"
+#include <nouveau_drmif.h>
+#include <xorg/dri.h>
+#include <xf86drmMode.h>
 
 static void nouveau_xorg_identify(int flags);
 static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
@@ -38,16 +41,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
 static const struct pci_id_match nouveau_xorg_device_match[] = {
     { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
       0x00030000, 0x00ffffff, 0 },
-    { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
-      0x00030000, 0x00ffffff, 0 },
     {0, 0, 0},
 };
 
-static SymTabRec nouveau_xorg_chipsets[] = {
-    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
-    {-1, NULL}
-};
-
 static PciChipsets nouveau_xorg_pci_devices[] = {
     {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
     {-1, -1, NULL}
@@ -121,8 +117,7 @@ nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
 static void
 nouveau_xorg_identify(int flags)
 {
-    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel Drivers",
-		      nouveau_xorg_chipsets);
+    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for NV30+ NVIDIA chipsets\n");
 }
 
 static Bool
@@ -131,6 +126,56 @@ nouveau_xorg_pci_probe(DriverPtr driver,
 {
     ScrnInfoPtr scrn = NULL;
     EntityInfoPtr entity;
+    struct nouveau_device *dev = NULL;
+    char *busid;
+    int chipset, ret;
+
+    if (device->vendor_id != 0x10DE)
+	return FALSE;
+
+    if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
+	xf86DrvMsg(-1, X_ERROR, "[drm] No DRICreatePCIBusID symbol\n");
+	return FALSE;
+    }
+    busid = DRICreatePCIBusID(device);
+
+    ret = nouveau_device_open(&dev, busid);
+    if (ret) {
+	xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
+	free(busid);
+	return FALSE;
+    }
+
+    chipset = dev->chipset;
+    nouveau_device_close(&dev);
+
+    ret = drmCheckModesettingSupported(busid);
+    free(busid);
+    if (ret) {
+	xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
+	return FALSE;
+    }
+
+    switch (chipset & 0xf0) {
+    case 0x00:
+    case 0x10:
+    case 0x20:
+	xf86DrvMsg(-1, X_NOTICE, "Too old chipset: NV%02x\n", chipset);
+	return FALSE;
+    case 0x30:
+    case 0x40:
+    case 0x60:
+    case 0x50:
+    case 0x80:
+    case 0x90:
+    case 0xa0:
+    case 0xc0:
+	xf86DrvMsg(-1, X_INFO, "Detected chipset: NV%02x\n", chipset);
+	break;
+    default:
+	xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
+	return FALSE;
+    }
 
     scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
 			       NULL, NULL, NULL, NULL, NULL);
-- 
1.7.4.1


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 19:22       ` [PATCH v2 " Patrick Baggett
  2011-06-05 19:23         ` Maarten Maathuis
@ 2011-06-05 20:35         ` Marcin Slusarz
  1 sibling, 0 replies; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-05 20:35 UTC (permalink / raw)
  To: Patrick Baggett; +Cc: nouveau, mesa-dev

On Sun, Jun 05, 2011 at 02:22:19PM -0500, Patrick Baggett wrote:
>    Wasn't nouveau targeted to provide HW acceleration for old cards like
>    the TNT2, or has that idea been killed?
> 

This patch is for Gallium3D accelerated 2D xorg driver.
Nobody is killing support for old cards from xf86-video-nouveau.

Marcin

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 2/2] xorg/nouveau: blacklist all pre NV30 cards
       [not found]                 ` <20110605203159.GA26259-OI9uyE9O0yo@public.gmane.org>
@ 2011-06-05 21:43                   ` Marcin Kościelnicki
  2011-06-06  5:51                     ` [Nouveau] " Marcin Slusarz
  2011-06-19 22:28                   ` Marcin Slusarz
  1 sibling, 1 reply; 14+ messages in thread
From: Marcin Kościelnicki @ 2011-06-05 21:43 UTC (permalink / raw)
  To: Marcin Slusarz
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> ---
> From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Subject: [PATCH] xorg/nouveau: blacklist all pre NV30 cards
>
> Bail out early in probe, so other driver (xf86-video-nouveau) can
> take control
> of the card. Doing it in screen_create would be too late.
> ---
>  src/gallium/targets/xorg-nouveau/Makefile       |    3 +
>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   63
> +++++++++++++++++++---
>  2 files changed, 57 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/targets/xorg-nouveau/Makefile
> b/src/gallium/targets/xorg-nouveau/Makefile
> index 16ac954..755969c 100644
> --- a/src/gallium/targets/xorg-nouveau/Makefile
> +++ b/src/gallium/targets/xorg-nouveau/Makefile
> @@ -23,4 +23,7 @@ DRIVER_PIPES = \
>  DRIVER_LINKS = \
>  	$(shell pkg-config --libs libdrm libdrm_nouveau)
>
> +DRIVER_INCLUDES = \
> +	$(shell pkg-config --cflags-only-I libdrm libdrm_nouveau 
> xf86driproto)
> +
>  include ../Makefile.xorg
> diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> index a25254a..43470a1 100644
> --- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> +++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> @@ -29,6 +29,9 @@
>   */
>
>  #include "../../state_trackers/xorg/xorg_winsys.h"
> +#include <nouveau_drmif.h>
> +#include <xorg/dri.h>
> +#include <xf86drmMode.h>
>
>  static void nouveau_xorg_identify(int flags);
>  static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
> @@ -38,16 +41,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr
> driver, int entity_num,
>  static const struct pci_id_match nouveau_xorg_device_match[] = {
>      { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
>        0x00030000, 0x00ffffff, 0 },
> -    { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
> -      0x00030000, 0x00ffffff, 0 },
>      {0, 0, 0},
>  };
>
> -static SymTabRec nouveau_xorg_chipsets[] = {
> -    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
> -    {-1, NULL}
> -};
> -
>  static PciChipsets nouveau_xorg_pci_devices[] = {
>      {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
>      {-1, -1, NULL}
> @@ -121,8 +117,7 @@ nouveau_xorg_setup(pointer module, pointer opts,
> int *errmaj, int *errmin)
>  static void
>  nouveau_xorg_identify(int flags)
>  {
> -    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel 
> Drivers",
> -		      nouveau_xorg_chipsets);
> +    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for
> NV30+ NVIDIA chipsets\n");
>  }
>
>  static Bool
> @@ -131,6 +126,56 @@ nouveau_xorg_pci_probe(DriverPtr driver,
>  {
>      ScrnInfoPtr scrn = NULL;
>      EntityInfoPtr entity;
> +    struct nouveau_device *dev = NULL;
> +    char *busid;
> +    int chipset, ret;
> +
> +    if (device->vendor_id != 0x10DE)
> +	return FALSE;
> +
> +    if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] No DRICreatePCIBusID symbol\n");
> +	return FALSE;
> +    }
> +    busid = DRICreatePCIBusID(device);
> +
> +    ret = nouveau_device_open(&dev, busid);
> +    if (ret) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
> +	free(busid);
> +	return FALSE;
> +    }
> +
> +    chipset = dev->chipset;
> +    nouveau_device_close(&dev);
> +
> +    ret = drmCheckModesettingSupported(busid);
> +    free(busid);
> +    if (ret) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
> +	return FALSE;
> +    }
> +
> +    switch (chipset & 0xf0) {
> +    case 0x00:
> +    case 0x10:
> +    case 0x20:
> +	xf86DrvMsg(-1, X_NOTICE, "Too old chipset: NV%02x\n", chipset);
> +	return FALSE;
> +    case 0x30:
> +    case 0x40:
> +    case 0x60:
> +    case 0x50:
> +    case 0x80:
> +    case 0x90:
> +    case 0xa0:
> +    case 0xc0:
0xd0 should be added here, there's NVD9 already.
> +	xf86DrvMsg(-1, X_INFO, "Detected chipset: NV%02x\n", chipset);
> +	break;
> +    default:
> +	xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
> +	return FALSE;
> +    }
>
>      scrn = xf86ConfigPciEntity(scrn, 0, entity_num,
> nouveau_xorg_pci_devices,
>  			       NULL, NULL, NULL, NULL, NULL);

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Nouveau] [PATCH v3 2/2] xorg/nouveau: blacklist all pre NV30 cards
  2011-06-05 21:43                   ` Marcin Kościelnicki
@ 2011-06-06  5:51                     ` Marcin Slusarz
  0 siblings, 0 replies; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-06  5:51 UTC (permalink / raw)
  To: Marcin Kościelnicki; +Cc: mesa-dev, nouveau

On Sun, Jun 05, 2011 at 11:43:15PM +0200, Marcin Kościelnicki wrote:
> > ---
> > From: Marcin Slusarz <marcin.slusarz@gmail.com>
> > Subject: [PATCH] xorg/nouveau: blacklist all pre NV30 cards
> >
> > Bail out early in probe, so other driver (xf86-video-nouveau) can
> > take control
> > of the card. Doing it in screen_create would be too late.
> > ---
> >  src/gallium/targets/xorg-nouveau/Makefile       |    3 +
> >  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   63
> > +++++++++++++++++++---
> >  2 files changed, 57 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/gallium/targets/xorg-nouveau/Makefile
> > b/src/gallium/targets/xorg-nouveau/Makefile
> > index 16ac954..755969c 100644
> > --- a/src/gallium/targets/xorg-nouveau/Makefile
> > +++ b/src/gallium/targets/xorg-nouveau/Makefile
> > @@ -23,4 +23,7 @@ DRIVER_PIPES = \
> >  DRIVER_LINKS = \
> >  	$(shell pkg-config --libs libdrm libdrm_nouveau)
> >
> > +DRIVER_INCLUDES = \
> > +	$(shell pkg-config --cflags-only-I libdrm libdrm_nouveau 
> > xf86driproto)
> > +
> >  include ../Makefile.xorg
> > diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> > b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> > index a25254a..43470a1 100644
> > --- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> > +++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> > @@ -29,6 +29,9 @@
> >   */
> >
> >  #include "../../state_trackers/xorg/xorg_winsys.h"
> > +#include <nouveau_drmif.h>
> > +#include <xorg/dri.h>
> > +#include <xf86drmMode.h>
> >
> >  static void nouveau_xorg_identify(int flags);
> >  static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
> > @@ -38,16 +41,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr
> > driver, int entity_num,
> >  static const struct pci_id_match nouveau_xorg_device_match[] = {
> >      { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
> >        0x00030000, 0x00ffffff, 0 },
> > -    { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
> > -      0x00030000, 0x00ffffff, 0 },
> >      {0, 0, 0},
> >  };
> >
> > -static SymTabRec nouveau_xorg_chipsets[] = {
> > -    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
> > -    {-1, NULL}
> > -};
> > -
> >  static PciChipsets nouveau_xorg_pci_devices[] = {
> >      {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
> >      {-1, -1, NULL}
> > @@ -121,8 +117,7 @@ nouveau_xorg_setup(pointer module, pointer opts,
> > int *errmaj, int *errmin)
> >  static void
> >  nouveau_xorg_identify(int flags)
> >  {
> > -    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel 
> > Drivers",
> > -		      nouveau_xorg_chipsets);
> > +    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for
> > NV30+ NVIDIA chipsets\n");
> >  }
> >
> >  static Bool
> > @@ -131,6 +126,56 @@ nouveau_xorg_pci_probe(DriverPtr driver,
> >  {
> >      ScrnInfoPtr scrn = NULL;
> >      EntityInfoPtr entity;
> > +    struct nouveau_device *dev = NULL;
> > +    char *busid;
> > +    int chipset, ret;
> > +
> > +    if (device->vendor_id != 0x10DE)
> > +	return FALSE;
> > +
> > +    if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
> > +	xf86DrvMsg(-1, X_ERROR, "[drm] No DRICreatePCIBusID symbol\n");
> > +	return FALSE;
> > +    }
> > +    busid = DRICreatePCIBusID(device);
> > +
> > +    ret = nouveau_device_open(&dev, busid);
> > +    if (ret) {
> > +	xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
> > +	free(busid);
> > +	return FALSE;
> > +    }
> > +
> > +    chipset = dev->chipset;
> > +    nouveau_device_close(&dev);
> > +
> > +    ret = drmCheckModesettingSupported(busid);
> > +    free(busid);
> > +    if (ret) {
> > +	xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
> > +	return FALSE;
> > +    }
> > +
> > +    switch (chipset & 0xf0) {
> > +    case 0x00:
> > +    case 0x10:
> > +    case 0x20:
> > +	xf86DrvMsg(-1, X_NOTICE, "Too old chipset: NV%02x\n", chipset);
> > +	return FALSE;
> > +    case 0x30:
> > +    case 0x40:
> > +    case 0x60:
> > +    case 0x50:
> > +    case 0x80:
> > +    case 0x90:
> > +    case 0xa0:
> > +    case 0xc0:
> 0xd0 should be added here, there's NVD9 already.

There's no point in adding it now - mesa does not support it...
(see nouveau_drm_screen_create in src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c)

> > +	xf86DrvMsg(-1, X_INFO, "Detected chipset: NV%02x\n", chipset);
> > +	break;
> > +    default:
> > +	xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
> > +	return FALSE;
> > +    }
> >
> >      scrn = xf86ConfigPciEntity(scrn, 0, entity_num,
> > nouveau_xorg_pci_devices,
> >  			       NULL, NULL, NULL, NULL, NULL);
> 
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v3 2/2] xorg/nouveau: blacklist all pre NV30 cards
       [not found]                 ` <20110605203159.GA26259-OI9uyE9O0yo@public.gmane.org>
  2011-06-05 21:43                   ` Marcin Kościelnicki
@ 2011-06-19 22:28                   ` Marcin Slusarz
  1 sibling, 0 replies; 14+ messages in thread
From: Marcin Slusarz @ 2011-06-19 22:28 UTC (permalink / raw)
  To: Maarten Maathuis
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Sun, Jun 05, 2011 at 10:31:59PM +0200, Marcin Slusarz wrote:
> From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Subject: [PATCH] xorg/nouveau: blacklist all pre NV30 cards
> 
> Bail out early in probe, so other driver (xf86-video-nouveau) can take control
> of the card. Doing it in screen_create would be too late.
> ---
>  src/gallium/targets/xorg-nouveau/Makefile       |    3 +
>  src/gallium/targets/xorg-nouveau/nouveau_xorg.c |   63 +++++++++++++++++++---
>  2 files changed, 57 insertions(+), 9 deletions(-)
> 
> diff --git a/src/gallium/targets/xorg-nouveau/Makefile b/src/gallium/targets/xorg-nouveau/Makefile
> index 16ac954..755969c 100644
> --- a/src/gallium/targets/xorg-nouveau/Makefile
> +++ b/src/gallium/targets/xorg-nouveau/Makefile
> @@ -23,4 +23,7 @@ DRIVER_PIPES = \
>  DRIVER_LINKS = \
>  	$(shell pkg-config --libs libdrm libdrm_nouveau)
>  
> +DRIVER_INCLUDES = \
> +	$(shell pkg-config --cflags-only-I libdrm libdrm_nouveau xf86driproto)
> +
>  include ../Makefile.xorg
> diff --git a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> index a25254a..43470a1 100644
> --- a/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> +++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
> @@ -29,6 +29,9 @@
>   */
>  
>  #include "../../state_trackers/xorg/xorg_winsys.h"
> +#include <nouveau_drmif.h>
> +#include <xorg/dri.h>
> +#include <xf86drmMode.h>
>  
>  static void nouveau_xorg_identify(int flags);
>  static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
> @@ -38,16 +41,9 @@ static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
>  static const struct pci_id_match nouveau_xorg_device_match[] = {
>      { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
>        0x00030000, 0x00ffffff, 0 },
> -    { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
> -      0x00030000, 0x00ffffff, 0 },
>      {0, 0, 0},
>  };
>  
> -static SymTabRec nouveau_xorg_chipsets[] = {
> -    {PCI_MATCH_ANY, "NVIDIA Graphics Device"},
> -    {-1, NULL}
> -};
> -
>  static PciChipsets nouveau_xorg_pci_devices[] = {
>      {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL},
>      {-1, -1, NULL}
> @@ -121,8 +117,7 @@ nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin)
>  static void
>  nouveau_xorg_identify(int flags)
>  {
> -    xf86PrintChipsets("nouveau2", "Driver for Modesetting Kernel Drivers",
> -		      nouveau_xorg_chipsets);
> +    xf86DrvMsg(0, X_INFO, "nouveau2: Gallium3D based 2D driver for NV30+ NVIDIA chipsets\n");
>  }
>  
>  static Bool
> @@ -131,6 +126,56 @@ nouveau_xorg_pci_probe(DriverPtr driver,
>  {
>      ScrnInfoPtr scrn = NULL;
>      EntityInfoPtr entity;
> +    struct nouveau_device *dev = NULL;
> +    char *busid;
> +    int chipset, ret;
> +
> +    if (device->vendor_id != 0x10DE)
> +	return FALSE;
> +
> +    if (!xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] No DRICreatePCIBusID symbol\n");
> +	return FALSE;
> +    }
> +    busid = DRICreatePCIBusID(device);
> +
> +    ret = nouveau_device_open(&dev, busid);
> +    if (ret) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
> +	free(busid);
> +	return FALSE;
> +    }
> +
> +    chipset = dev->chipset;
> +    nouveau_device_close(&dev);
> +
> +    ret = drmCheckModesettingSupported(busid);
> +    free(busid);
> +    if (ret) {
> +	xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
> +	return FALSE;
> +    }
> +
> +    switch (chipset & 0xf0) {
> +    case 0x00:
> +    case 0x10:
> +    case 0x20:
> +	xf86DrvMsg(-1, X_NOTICE, "Too old chipset: NV%02x\n", chipset);
> +	return FALSE;
> +    case 0x30:
> +    case 0x40:
> +    case 0x60:
> +    case 0x50:
> +    case 0x80:
> +    case 0x90:
> +    case 0xa0:
> +    case 0xc0:
> +	xf86DrvMsg(-1, X_INFO, "Detected chipset: NV%02x\n", chipset);
> +	break;
> +    default:
> +	xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
> +	return FALSE;
> +    }
>  
>      scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices,
>  			       NULL, NULL, NULL, NULL, NULL);
> -- 


Can someone commit this patch?
 
Marcin

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-06-19 22:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-16 19:51 [PATCH 2/2] xorg/nouveau: blacklist all pre NV30 cards Marcin Slusarz
2011-05-16 22:20 ` [PATCH v2 " Marcin Slusarz
     [not found]   ` <20110516222014.GH5456-OI9uyE9O0yo@public.gmane.org>
2011-06-05 19:06     ` Marcin Slusarz
2011-06-05 19:10       ` [Nouveau] " Stéphane Marchesin
2011-06-05 19:15         ` Maarten Maathuis
2011-06-05 19:46           ` Marcin Slusarz
2011-06-05 19:54             ` Maarten Maathuis
2011-06-05 20:31               ` [PATCH v3 " Marcin Slusarz
     [not found]                 ` <20110605203159.GA26259-OI9uyE9O0yo@public.gmane.org>
2011-06-05 21:43                   ` Marcin Kościelnicki
2011-06-06  5:51                     ` [Nouveau] " Marcin Slusarz
2011-06-19 22:28                   ` Marcin Slusarz
2011-06-05 19:22       ` [PATCH v2 " Patrick Baggett
2011-06-05 19:23         ` Maarten Maathuis
2011-06-05 20:35         ` Marcin Slusarz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.