From eca97b98bef484658637a729146f7fac38d69536 Mon Sep 17 00:00:00 2001 From: Mike Harsch Date: Sun, 29 Jul 2012 17:36:42 -0600 Subject: [PATCH] allow for changes to vga_switcheroo_register_client in v3.5 --- pscnv/kapitest.sh | 2 +- pscnv/kapitest/Makefile | 1 + pscnv/kapitest/switcheroo_ops.c | 14 ++++++++++++++ pscnv/nouveau_state.c | 13 ++++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 pscnv/kapitest/switcheroo_ops.c diff --git a/pscnv/kapitest.sh b/pscnv/kapitest.sh index 0a0e161..7e261d8 100755 --- a/pscnv/kapitest.sh +++ b/pscnv/kapitest.sh @@ -1,5 +1,5 @@ #!/bin/sh -TESTS="gamma_set_5 gamma_set_6 drm_ioctl_def drm_ioctl_def_drv drm_connector_detect_1 drm_connector_detect_2 map_ofs io_mapping_2 io_mapping_3 i2c_id switcheroo_reprobe getparam_bus_type drm_gem_object_handle_count drm_get_dev drm_init fb_info_apertures drm_driver_fops noop_llseek drm_mode_fb_cmd2 drm_fb_pitch" +TESTS="gamma_set_5 gamma_set_6 drm_ioctl_def drm_ioctl_def_drv drm_connector_detect_1 drm_connector_detect_2 map_ofs io_mapping_2 io_mapping_3 i2c_id switcheroo_reprobe getparam_bus_type drm_gem_object_handle_count drm_get_dev drm_init fb_info_apertures drm_driver_fops noop_llseek drm_mode_fb_cmd2 drm_fb_pitch switcheroo_ops" make -k -C $1 M=$PWD/kapitest clean 2> /dev/null 1> /dev/null make -k -C $1 M=$PWD/kapitest modules 2> /dev/null 1> /dev/null diff --git a/pscnv/kapitest/Makefile b/pscnv/kapitest/Makefile index caaedd0..effecbf 100644 --- a/pscnv/kapitest/Makefile +++ b/pscnv/kapitest/Makefile @@ -6,6 +6,7 @@ kapitest-y := fail.o \ io_mapping_2.o io_mapping_3.o \ i2c_id.o \ switcheroo_reprobe.o \ + switcheroo_ops.o \ getparam_bus_type.o \ drm_init.o \ drm_gem_object_handle_count.o \ diff --git a/pscnv/kapitest/switcheroo_ops.c b/pscnv/kapitest/switcheroo_ops.c new file mode 100644 index 0000000..f4671d7 --- /dev/null +++ b/pscnv/kapitest/switcheroo_ops.c @@ -0,0 +1,14 @@ +#include "drmP.h" +#include "drm.h" +#include + +void dummy(struct drm_device *dev) +{ + static const struct vga_switcheroo_client_ops foo_switcheroo_ops = { + .set_gpu_state = NULL, + .reprobe = NULL, + .can_switch = NULL, + }; + + vga_switcheroo_register_client(dev->pdev, &foo_switcheroo_ops); +} diff --git a/pscnv/nouveau_state.c b/pscnv/nouveau_state.c index 2c8d558..d66628b 100644 --- a/pscnv/nouveau_state.c +++ b/pscnv/nouveau_state.c @@ -202,7 +202,14 @@ static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev) spin_unlock(&dev->count_lock); return can_switch; } +#ifdef PSCNV_KAPI_SWITCHEROO_OPS +static const struct vga_switcheroo_client_ops nouveau_switcheroo_ops = { + .set_gpu_state = nouveau_switcheroo_set_state, + .reprobe = nouveau_switcheroo_reprobe, + .can_switch = nouveau_switcheroo_can_switch, +}; #endif +#endif /* __linux__ */ int nouveau_card_init(struct drm_device *dev) @@ -221,15 +228,19 @@ nouveau_card_init(struct drm_device *dev) #ifdef __linux__ vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode); +#ifdef PSCNV_KAPI_SWITCHEROO_OPS + vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops); +#else #ifdef PSCNV_KAPI_SWITCHEROO_REPROBE vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state, + nouveau_switcheroo_reprobe, nouveau_switcheroo_can_switch); #else vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state, - nouveau_switcheroo_reprobe, nouveau_switcheroo_can_switch); #endif #endif +#endif /* __linux__ */ dev_priv->init_state = NOUVEAU_CARD_INIT_FAILED; -- 2.11.4.GIT