Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from mharsch/master

enable building pscnv on 3.5 kernel
  • Loading branch information...
commit d0bdb2ff6a514c384556bacadcb4196dbc55e11c 2 parents 054a5f3 + 2e00cd4
cbergstrom authored
2  pscnv/kapitest.sh
View
@@ -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
1  pscnv/kapitest/Makefile
View
@@ -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 \
20 pscnv/kapitest/switcheroo_ops.c
View
@@ -0,0 +1,20 @@
+#include "drmP.h"
+#include "drm.h"
+#include <linux/vga_switcheroo.h>
+
+void dummy(struct drm_device *dev)
+{
+ /*
+ * kernel 3.5 added the vga_switcheroo_client_ops struct to replace
+ * the 3 separate args to vga_switcheroo_register_client() bringing
+ * the total arg count down to 2
+ */
+
+ 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);
+}
3  pscnv/kapitest/switcheroo_reprobe.c
View
@@ -4,5 +4,6 @@
void dummy(struct drm_device *dev)
{
- vga_switcheroo_register_client(dev->pdev, 0, 0);
+ /* reprobe arg was added in 2.6.38 for a total of 4 args */
+ vga_switcheroo_register_client(dev->pdev, 0, 0, 0);
}
13 pscnv/nouveau_state.c
View
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.