How to tell we're using the KMS (during suspend/resume) outside the graphics driver
Hi,
For at least two reasons it would be beneficial for some code outisde the graphics driver(s) to know if the KMS are used.
First, in the non-KMS (ie. UMS) case we probably wouldn't want to call acpi_video_resume(), because that has a potential to mess up with the GPU (it actually is known to do that on at least one system).
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Rafael
Quoted 9 lines · Rafael J. Wysocki
Hi,
For at least two reasons it would be beneficial for some code outisde the graphics driver(s) to know if the KMS are used.
First, in the non-KMS (ie. UMS) case we probably wouldn't want to call
acpi_video_resume(), because that has a potential to mess up with the GPU (it actually is known to do that on at least one system).
Quoted 6 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct pci_dev you can get the associated struct drm_device with pci_get_drvdata and then check the KMS feature: drm_core_check_feature(dev, DRIVER_MODESET). I'm note sure how to check that a device is graphic card though :|
Luca
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
Quoted 9 lines · Rafael J. Wysocki
Hi,
For at least two reasons it would be beneficial for some code outisde the graphics driver(s) to know if the KMS are used.
First, in the non-KMS (ie. UMS) case we probably wouldn't want to call
acpi_video_resume(), because that has a potential to mess up with the GPU (it actually is known to do that on at least one system).
Quoted 6 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct pci_dev you can get the associated struct drm_device with pci_get_drvdata and then check the KMS feature: drm_core_check_feature(dev, DRIVER_MODESET). I'm note sure how to check that a device is graphic card though :|
Luca
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 13 lines · Luca Tettamanti
Quoted 12 lines · Rafael J. Wysocki
Hi,
For at least two reasons it would be beneficial for some code outisde the graphics driver(s) to know if the KMS are used.
First, in the non-KMS (ie. UMS) case we probably wouldn't want to call
acpi_video_resume(), because that has a potential to mess up with the GPU (it actually is known to do that on at least one system).Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
Quoted 7 lines
Quoted 3 lines
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
Rafael
Quoted 13 lines · Luca Tettamanti
Quoted 12 lines · Rafael J. Wysocki
Hi,
For at least two reasons it would be beneficial for some code outisde the graphics driver(s) to know if the KMS are used.
First, in the non-KMS (ie. UMS) case we probably wouldn't want to call
acpi_video_resume(), because that has a potential to mess up with the GPU (it actually is known to do that on at least one system).Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
Quoted 7 lines
Quoted 3 lines
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
Rafael
2010/3/9 Rafael J. Wysocki <[email protected]>:
Quoted 4 lines · Luca Tettamanti
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
Can we use the same way userspace (DDX) uses to check for KMS? Some IOCTL I guess?
Signature · 13 lines
Rafał ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel
2010/3/9 Rafael J. Wysocki <[email protected]>:
Quoted 4 lines · Luca Tettamanti
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
Can we use the same way userspace (DDX) uses to check for KMS? Some IOCTL I guess?
Signature · 5 lines
Rafał _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
....
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
....
Quoted 12 lines · James Simmons
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Quoted 8 lines
Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((
pdev->class>> 8) ==PCI_CLASS_DISPLAY_VGA)....
I'm not sure if searching through all PCI devices really is an option.
Thanks anyway.
Rafael
Quoted 12 lines · James Simmons
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).
Quoted 8 lines
Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((
pdev->class>> 8) ==PCI_CLASS_DISPLAY_VGA)....
I'm not sure if searching through all PCI devices really is an option.
Thanks anyway.
Rafael
Quoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · James Simmons
Quoted 14 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).Yeah, I know that.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((
pdev->class>> 8) ==PCI_CLASS_DISPLAY_VGA)....I'm not sure if searching through all PCI devices really is an option.
Why not? The VGA arbitration code tracks a list of VGA class devices, so could easily be queried. It looks like it might need a bit more work for PCI hotplug, but it should already have all of the infrastructure you need for getting at the pdev for the suspend/resume case.
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · James Simmons
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((
pdev->class>> 8) ==PCI_CLASS_DISPLAY_VGA)
....
Quoted 8 lines
Quoted 2 lines
I'm not sure if searching through all PCI devices really is an option.
Why not? The VGA arbitration code tracks a list of VGA class devices, so could easily be queried. It looks like it might need a bit more work for PCI hotplug, but it should already have all of the infrastructure you need for getting at the pdev for the suspend/resume case.
It would be better to add interface that can be used to query if a graphic device supports KMS. This should support multi-gpu setups at least. I don't think anything prevents running mixed system where secundary gpu is driven by UMS code in X.
Are you sure that all vga class devices have private device data that matches private drm_device structure?
Quoted 23 lines · Paul Mundt
Quoted 22 lines · Rafael J. Wysocki
Quoted 20 lines · James Simmons
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Second, in the KMS case, we'd be able to skip the kernel VT switch, because the KMS driver uses its own framebuffer anyway.
So, is there any reasonable way to check that from the outside of the graphics driver? It should be general enough to cover the cases when there are two graphics adapters with different drivers in the system and so forth.
Inside the kernel? If you have a struct
pci_devyou can get the associated structdrm_devicewithpci_get_drvdataand then check the KMS feature:drm_core_check_feature(dev, DRIVER_MODESET).Quoted 5 lines
Yeah, I know that.
Quoted 1 line
I'm note sure how to check that a device is graphic card though :|
Well, that's the "outside of the graphics driver" part of my question. :-)
if ((
pdev->class>> 8) ==PCI_CLASS_DISPLAY_VGA)
....
Quoted 8 lines
Quoted 2 lines
I'm not sure if searching through all PCI devices really is an option.
Why not? The VGA arbitration code tracks a list of VGA class devices, so could easily be queried. It looks like it might need a bit more work for PCI hotplug, but it should already have all of the infrastructure you need for getting at the pdev for the suspend/resume case.
It would be better to add interface that can be used to query if a graphic device supports KMS. This should support multi-gpu setups at least. I don't think anything prevents running mixed system where secundary gpu is driven by UMS code in X.
Are you sure that all vga class devices have private device data that matches private drm_device structure?
As far as the ACPI video driver goes, acpi_get_physical_pci_device() will give you something to work with. For the console-switching case, I think the most reasonable plan is probably to add a flag to the console drivers to indicate whether or not they support reprogramming the hardware themselves, and then walk all active console drivers. There'd need to be a way for fb drivers to tell fbcon that they can handle it.
Signature · 1 line
Matthew Garrett | [email protected]
As far as the ACPI video driver goes, acpi_get_physical_pci_device() will give you something to work with. For the console-switching case, I think the most reasonable plan is probably to add a flag to the console drivers to indicate whether or not they support reprogramming the hardware themselves, and then walk all active console drivers. There'd need to be a way for fb drivers to tell fbcon that they can handle it.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 2 lines · Matthew Garrett
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.
Hmm. Did you mean acpi_get_physical_device()?
Which acpi_device should I call that for?
Quoted 5 lines
For the console-switching case, I think the most reasonable plan is probably to add a flag to the console drivers to indicate whether or not they support reprogramming the hardware themselves, and then walk all active console drivers. There'd need to be a way for fb drivers to tell fbcon that they can handle it.
Yes, that sounds reasonable.
Rafael
Quoted 2 lines · Matthew Garrett
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.
Hmm. Did you mean acpi_get_physical_device()?
Which acpi_device should I call that for?
Quoted 5 lines
For the console-switching case, I think the most reasonable plan is probably to add a flag to the console drivers to indicate whether or not they support reprogramming the hardware themselves, and then walk all active console drivers. There'd need to be a way for fb drivers to tell fbcon that they can handle it.
Yes, that sounds reasonable.
Rafael
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.Hmm. Did you mean
acpi_get_physical_device()?
Ah, no, acpi_get_pci_dev.
Quoted 1 line
Which
acpi_deviceshould I call that for?
The video one. acpi_video_bus_check does something very similar to check whether the device actually exists.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.Hmm. Did you mean
acpi_get_physical_device()?
Ah, no, acpi_get_pci_dev.
Quoted 1 line
Which
acpi_deviceshould I call that for?
The video one. acpi_video_bus_check does something very similar to check whether the device actually exists.
Signature · 1 line
Matthew Garrett | [email protected]
2010/3/10 Matthew Garrett <[email protected]>:
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Matthew Garrett
Quoted 2 lines
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.Hmm. Did you mean
acpi_get_physical_device()?Ah, no,
acpi_get_pci_dev.
So, AFAIU acpi_get_pci_dev will give me pointer to struct pci_dev of video card, yes?
There is some path I could use then:
struct pci_dev {
.....
struct pci_driver *driver; /* which driver has allocated this device */
.....
}struct pci_driver {
.....
struct device_driver driver;
.....
}Finally, struct device_driver is defined in device.h. Should I add flag bool is_kms
to this struct then?
AFAIK we can not do anything with struct driver_private *p... Or is there unified struct for video card drivers? We could then add flag is_kms to some struct pointed by struct driver_private *p.
Signature · 1 line
Rafał
2010/3/10 Matthew Garrett <[email protected]>:
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Matthew Garrett
Quoted 2 lines
As far as the ACPI video driver goes,
acpi_get_physical_pci_device()will give you something to work with.Hmm. Did you mean
acpi_get_physical_device()?Ah, no,
acpi_get_pci_dev.
So, AFAIU acpi_get_pci_dev will give me pointer to struct pci_dev of video card, yes?
There is some path I could use then:
struct pci_dev {
.....
struct pci_driver *driver; /* which driver has allocated this device */
.....
}struct pci_driver {
.....
struct device_driver driver;
.....
}Finally, struct device_driver is defined in device.h. Should I add flag bool is_kms
to this struct then?
AFAIK we can not do anything with struct driver_private *p... Or is there unified struct for video card drivers? We could then add flag is_kms to some struct pointed by struct driver_private *p.
Signature · 5 lines
Rafał _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm