diff mbox

[3/5] nouveau: Add interface to detect optimus support

Message ID 1347251515-10136-4-git-send-email-airlied@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Airlie Sept. 10, 2012, 4:31 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

This is required for later patches.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_acpi.c | 4 ++++
 drivers/gpu/drm/nouveau/nouveau_acpi.h | 2 ++
 2 files changed, 6 insertions(+)

Comments

Peter Wu Sept. 10, 2012, 4:25 p.m. UTC | #1
Hi Dave,

> +bool nouveau_is_optimus(void) {
> +	return nouveau_dsm_priv.optimus_detected;
> +}
This will only work for new Optimus laptops, not the older ones such as your 
Lenovo T410s or on a Dell Vostro 3500 with a GT 310M. Is that intended? If 
not, check for those models too:

	return nouveau_dsm_priv.optimus_detected || 
          nouveau_dsm_priv.dsm_detected;

Regards,
Peter
Dave Airlie Sept. 10, 2012, 8:24 p.m. UTC | #2
On Tue, Sep 11, 2012 at 2:25 AM, Lekensteyn <lekensteyn@gmail.com> wrote:
> Hi Dave,
>
>> +bool nouveau_is_optimus(void) {
>> +     return nouveau_dsm_priv.optimus_detected;
>> +}
> This will only work for new Optimus laptops, not the older ones such as your
> Lenovo T410s or on a Dell Vostro 3500 with a GT 310M. Is that intended? If
> not, check for those models too:
>

Works fine on my T410s from what I can see, though yes I understand
the older ones probably won't work

I'm still not 100% sure how best to deal with the older ones.

Dave.
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index e7369c8..b92833e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -35,6 +35,10 @@  static struct nouveau_dsm_priv {
 	acpi_handle rom_handle;
 } nouveau_dsm_priv;
 
+bool nouveau_is_optimus(void) {
+	return nouveau_dsm_priv.optimus_detected;
+}
+
 #define NOUVEAU_DSM_HAS_MUX 0x1
 #define NOUVEAU_DSM_HAS_OPT 0x2
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.h b/drivers/gpu/drm/nouveau/nouveau_acpi.h
index 08af677..c70b4d1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.h
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.h
@@ -4,6 +4,7 @@ 
 #define ROM_BIOS_PAGE 4096
 
 #if defined(CONFIG_ACPI)
+bool nouveau_is_optimus(void);
 void nouveau_register_dsm_handler(void);
 void nouveau_unregister_dsm_handler(void);
 void nouveau_switcheroo_optimus_dsm(void);
@@ -11,6 +12,7 @@  int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len);
 bool nouveau_acpi_rom_supported(struct pci_dev *pdev);
 void *nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
 #else
+static inline bool nouveau_is_optimus(void) { return false; };
 static inline void nouveau_register_dsm_handler(void) {}
 static inline void nouveau_unregister_dsm_handler(void) {}
 static inline void nouveau_switcheroo_optimus_dsm(void) {}