aboutsummaryrefslogtreecommitdiff
path: root/util/i915tool/spatches
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-05-04 15:37:18 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-05-08 00:40:36 +0200
commit564e90f57185274130aba7b157a7dca1941dcfef (patch)
treef71985b7f878f83d7e5773675ca27a4a2da94cdf /util/i915tool/spatches
parent44a89b34f85492c48a19db1b9b2c2c44ab29c9ae (diff)
Add a tool to work on i915 hardware in user mode
This is the beginning of a tool that transforms the i9x5 code to user mode code. Consider this a very early stage although it does produce two programs. Requires spatch 1.0 or greater. To try it out, assuming you have an up-to-date spatch, sh transform make make broken Please don't fall to the temptation to auto-magicize this process. It's primitive for a reason. That said, suggestions welcome of course. Change-Id: I0188e36637b198b06c17f6d3c714d990e88bd57d Signed-off-by: Ronald G. Minnich <rminnich@chromium.org> Reviewed-on: http://review.coreboot.org/1003 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/i915tool/spatches')
-rw-r--r--util/i915tool/spatches/deldev.cocci29
-rw-r--r--util/i915tool/spatches/drm_crtc.cocci32
-rw-r--r--util/i915tool/spatches/fixcalls.cocci148
-rw-r--r--util/i915tool/spatches/fx.cocci10
-rw-r--r--util/i915tool/spatches/getdrmmodefn.cocci6
-rw-r--r--util/i915tool/spatches/getfn.cocci61
-rw-r--r--util/i915tool/spatches/i915_dma.c.cocci3
-rw-r--r--util/i915tool/spatches/i915_drv.c.cocci8
-rw-r--r--util/i915tool/spatches/i915_drv.cocci178
-rw-r--r--util/i915tool/spatches/intel_bios.cocci7
-rw-r--r--util/i915tool/spatches/intel_display.c.cocci507
-rw-r--r--util/i915tool/spatches/removeinclude.cocci6
-rw-r--r--util/i915tool/spatches/ringbuffer.cocci14
13 files changed, 1009 insertions, 0 deletions
diff --git a/util/i915tool/spatches/deldev.cocci b/util/i915tool/spatches/deldev.cocci
new file mode 100644
index 0000000000..504dae7230
--- /dev/null
+++ b/util/i915tool/spatches/deldev.cocci
@@ -0,0 +1,29 @@
+@@
+identifier dev;
+expression i;
+@@
+-struct drm_i915_private *dev = i;
++extern struct drm_device *i915; struct drm_i915_private *dev = i915->dev_private;
+@@
+identifier dev;
+expression i;
+@@
+-struct pci_dev *dev = i;
++extern struct drm_device *i915; struct pci_dev *dev = i915->pdev;
+@@
+@@
+-#include "i915_drm.h"
+@@
+@@
+-#include "drm.h"
+@@
+@@
+-#include "drmP.h"
+@@
+@@
+-#include "i915_trace.h"
+@@
+identifier d;
+@@
+-(d)->pci_device
++(d)->pdev->device_id
diff --git a/util/i915tool/spatches/drm_crtc.cocci b/util/i915tool/spatches/drm_crtc.cocci
new file mode 100644
index 0000000000..662f25316c
--- /dev/null
+++ b/util/i915tool/spatches/drm_crtc.cocci
@@ -0,0 +1,32 @@
+@@
+identifier s;
+identifier head;
+@@
+struct s {...
+- struct list_head head;
+...};
+@@
+@@
+-#include <...>
+@@
+@@
+(
+-struct drm_crtc_funcs{...};
+|
+-struct drm_crtc{...};
+|
+-struct drm_connector_funcs{...};
+|
+-struct drm_encoder_funcs{...};
+|
+-struct drm_encoder{...};
+|
+-struct drm_connector{...};
+|
+-struct drm_mode_config_funcs{...};
+|
+-struct drm_mode_config{...};
+|
+-struct drm_framebuffer_funcs{...};
+)
+
diff --git a/util/i915tool/spatches/fixcalls.cocci b/util/i915tool/spatches/fixcalls.cocci
new file mode 100644
index 0000000000..50e6458fd3
--- /dev/null
+++ b/util/i915tool/spatches/fixcalls.cocci
@@ -0,0 +1,148 @@
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-vga_get_uninterruptible(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-vga_put(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-intel_init_quirks(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-drm_mode_config_init(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-INIT_WORK(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-setup_timer(...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-DRM_DEBUG_KMS(
++fprintf(stderr,
+...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-DRM_ERROR(
++fprintf(stderr,
+...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-DRM_DEBUG(
++fprintf(stderr,
+...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-DRM_DEBUG_DRIVER(
++fprintf(stderr,
+...);
+...>}
+@@
+identifier f;
+type T;
+@@
+T f(...){<...
+-intel_init_display(...);
+...>}
+@ rulekz @
+identifier t;
+identifier f;
+expression E1, E2;
+type T;
+@@
+T f(...){<...
+t = kzalloc(E1, E2);
+...>}
+@@
+identifier rulekz.f;
+expression E1, E2;
+@@
+
+- kzalloc(E1
++ calloc(1, E1
+- ,E2
+ )
+@@
+identifier d;
+@@
+-static
+const struct pci_device_id d[] = {...};
+@@
+expression E1;
+@@
+-WARN(
++if (
+E1
+-,
++) fprintf(stderr,
+...);
+@@
+expression E1;
+@@
+-BUG_ON(
++assert(
+E1);
+@@
+@@
+-jiffies
++msecs()
+@@
+expression E1;
+@@
+-jiffies_to_msecs(
+E1
+-)
+@@
+expression E1;
+@@
+-msecs_to_jiffies(
+E1
+-)
+@@
+expression E1, E2;
+@@
+-time_after(
++(
+E1
+-,
++>
+E2)
diff --git a/util/i915tool/spatches/fx.cocci b/util/i915tool/spatches/fx.cocci
new file mode 100644
index 0000000000..e47ddcab69
--- /dev/null
+++ b/util/i915tool/spatches/fx.cocci
@@ -0,0 +1,10 @@
+@@
+identifier f;
+type T;
+@@
+T f(...){...
+-\(DRM_DEBUG_KMS|DRM_ERRRO\)(
++fprintf(stderr,
+...);
+...}
+
diff --git a/util/i915tool/spatches/getdrmmodefn.cocci b/util/i915tool/spatches/getdrmmodefn.cocci
new file mode 100644
index 0000000000..d5cd17edc6
--- /dev/null
+++ b/util/i915tool/spatches/getdrmmodefn.cocci
@@ -0,0 +1,6 @@
+@@
+@@
+- drm_mode_set_name(...) {...}
+@@
+@@
+- drm_mode_debug_printmodeline(...) {...}
diff --git a/util/i915tool/spatches/getfn.cocci b/util/i915tool/spatches/getfn.cocci
new file mode 100644
index 0000000000..8dea561187
--- /dev/null
+++ b/util/i915tool/spatches/getfn.cocci
@@ -0,0 +1,61 @@
+@@
+@@
+- get_blocksize(...) {...}
+@@
+@@
+- lvds_dvo_timing_equal_size(...) {...}
+@@
+@@
+- fill_detail_timing_data(...) {...}
+@@
+@@
+- intel_setup_bios(...) {...}
+@@
+@@
+- intel_parse_bios(...){...}
+@@
+@@
+- init_vbt_defaults(...){...}
+@@
+@@
+- parse_general_features(...){...}
+@@
+@@
+- parse_general_definitions(...){...}
+@@
+@@
+- parse_lfp_panel_data(...){...}
+@@
+@@
+- parse_sdvo_panel_data(...){...}
+@@
+@@
+- parse_sdvo_device_mapping(...){...}
+@@
+@@
+- parse_device_mapping(...){...}
+@@
+@@
+- parse_driver_features(...){...}
+@@
+@@
+- parse_edp(...){...}
+@@
+@@
+- find_section(...){...}
+@@
+@@
+- get_lvds_dvo_timing(...){...}
+@@
+@@
+- intel_bios_ssc_frequency(...){...}
+@@
+identifier d;
+type T;
+@@
+- static T d;
+@@
+expression S;
+identifier d;
+@@
+-#define d S
diff --git a/util/i915tool/spatches/i915_dma.c.cocci b/util/i915tool/spatches/i915_dma.c.cocci
new file mode 100644
index 0000000000..0ae2d55e8d
--- /dev/null
+++ b/util/i915tool/spatches/i915_dma.c.cocci
@@ -0,0 +1,3 @@
+@@
+@@
+- i915_driver_load(...) {...}
diff --git a/util/i915tool/spatches/i915_drv.c.cocci b/util/i915tool/spatches/i915_drv.c.cocci
new file mode 100644
index 0000000000..0d64d939af
--- /dev/null
+++ b/util/i915tool/spatches/i915_drv.c.cocci
@@ -0,0 +1,8 @@
+@inteldeviceinfo@
+identifier d;
+@@
+-const struct intel_device_info d = {...};
+@@
+identifier d;
+@@
+-static const struct pci_device_id d[] = {...};
diff --git a/util/i915tool/spatches/i915_drv.cocci b/util/i915tool/spatches/i915_drv.cocci
new file mode 100644
index 0000000000..633e270067
--- /dev/null
+++ b/util/i915tool/spatches/i915_drv.cocci
@@ -0,0 +1,178 @@
+@@
+identifier d;
+@@
+(
+-struct drm_i915_fence_reg{...};
+|
+-struct drm_i915_error_state{...};
+|
+-struct drm_i915_gem_object{...};
+|
+-struct drm_i915_display_funcs {...};
+|
+-struct drm_i915_gem_phys_object{...};
+|
+-struct mem_block{...};
+|
+-struct drm_i915_gem_request{...};
+|
+-struct drm_i915_file_private{...};
+|
+-struct drm_i915_master_private{...};
+|
+-struct intel_gmbus{...};
+|
+-struct work_struct d;
+|
+-struct mem_*d;
+|
+-struct timer_list d;
+|
+-struct intel_fbc_work *d;
+|
+-struct drm_i915_error_state *d;
+|
+-struct i2c_adapter d;
+|
+-struct i2c_adapter *d;
+|
+-struct intel_hw_status_page{...};
+|
+-struct intel_hw_status_page d;
+)
+@@
+@@
+-#include<...>
+@@
+identifier d;
+@@
+struct s {...
+- struct drm_i915_display_funcs d;
+...
+};
+@@
+identifier d;
+@@
+struct s {...
+-struct notifier_block d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-spinlock_t d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-atomic_t d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-drm_dma_handle_t *d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-drm_local_map_t d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-spinlock_t *d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-struct i2c_adapter d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-struct i2c_adapter *d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+(
+-struct inteL_gmbus {...} *d;
+|
+-struct drm_i915_gem_object *d;
+)
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-struct work_struct d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-struct resource d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-struct timer_list d;
+...
+};
+@@
+identifier s;
+identifier d;
+@@
+struct s {...
+-wait_queue_head_t d;
+...
+};
+@@
+identifier s;
+identifier d;
+constant c;
+@@
+struct s {...
+-struct intel_ring_buffer d[c];
+...
+};
+@@
+identifier s;
+identifier d;
+constant c;
+@@
+struct s {...
+-struct drm_i915_fence_reg d[c];
+...
+};
+
diff --git a/util/i915tool/spatches/intel_bios.cocci b/util/i915tool/spatches/intel_bios.cocci
new file mode 100644
index 0000000000..2e71363206
--- /dev/null
+++ b/util/i915tool/spatches/intel_bios.cocci
@@ -0,0 +1,7 @@
+@@
+@@
+-#include<...>
++#include "video.h"
+@@
+@@
+-#include"..."
diff --git a/util/i915tool/spatches/intel_display.c.cocci b/util/i915tool/spatches/intel_display.c.cocci
new file mode 100644
index 0000000000..d7d87d3a9f
--- /dev/null
+++ b/util/i915tool/spatches/intel_display.c.cocci
@@ -0,0 +1,507 @@
+@@
+@@
+-struct intel_limit {... };
+@@
+identifier d;
+@@
+- intel_limit_t d = {...};
+@@
+@@
+- intel_connector_attach_encoder(...){...}
+@@
+@@
+- intel_modeset_cleanup(...){...}
+@@
+@@
+- intel_modeset_gem_init(...){...}
+@@
+@@
+- intel_modeset_init(...){...}
+@@
+@@
+- i915_disable_vga(...){...}
+@@
+@@
+- intel_init_quirks(...){...}
+@@
+@@
+- quirk_ssc_force_disable(...){...}
+@@
+@@
+- quirk_pipea_force (...){...}
+@@
+@@
+- intel_init_display(...){...}
+@@
+@@
+- intel_init_clock_gating(...){...}
+@@
+@@
+- ironlake_enable_rc6(...){...}
+@@
+@@
+- ironlake_disable_rc6(...){...}
+@@
+@@
+- ironlake_teardown_rc6(...){...}
+@@
+@@
+- cpt_init_clock_gating(...){...}
+@@
+@@
+- ibx_init_clock_gating(...){...}
+@@
+@@
+- i830_init_clock_gating(...){...}
+@@
+@@
+- i85x_init_clock_gating(...){...}
+@@
+@@
+- gen3_init_clock_gating(...){...}
+@@
+@@
+- broadwater_init_clock_gating(...){...}
+@@
+@@
+- crestline_init_clock_gating(...){...}
+@@
+@@
+- g4x_init_clock_gating(...){...}
+@@
+@@
+- ivybridge_init_clock_gating(...){...}
+@@
+@@
+- gen6_init_clock_gating(...){...}
+@@
+@@
+- ironlake_init_clock_gating(...){...}
+@@
+@@
+- gen6_update_ring_freq(...){...}
+@@
+@@
+- gen6_enable_rps(...){...}
+@@
+@@
+- intel_init_emon(...){...}
+@@
+@@
+- gen6_disable_rps(...){...}
+@@
+@@
+- gen6_set_rps(...){...}
+@@
+@@
+- ironlake_disable_drps(...){...}
+@@
+@@
+- ironlake_enable_drps(...){...}
+@@
+@@
+- intel_user_framebuffer_destroy(...){...}
+@@
+@@
+- intel_setup_outputs(...){...}
+@@
+@@
+- intel_crtc_init(...){...}
+@@
+@@
+- intel_crtc_reset(...){...}
+@@
+@@
+- intel_prepare_page_flip(...){...}
+@@
+@@
+- intel_finish_page_flip_plane(...){...}
+@@
+@@
+- intel_finish_page_flip(...){...}
+@@
+@@
+- intel_unpin_work_fn(...){...}
+@@
+@@
+- intel_crtc_destroy(...){...}
+@@
+@@
+- intel_mark_busy(...){...}
+@@
+@@
+- intel_idle_update(...){...}
+@@
+@@
+- intel_decrease_pllclock(...){...}
+@@
+@@
+- intel_increase_pllclock(...){...}
+@@
+@@
+- intel_crtc_idle_timer(...){...}
+@@
+@@
+- intel_gpu_idle_timer(...){...}
+@@
+@@
+- ivb_update_cursor(...){...}
+@@
+@@
+- i9xx_update_cursor(...){...}
+@@
+@@
+- i845_update_cursor(...){...}
+@@
+@@
+- intel_crtc_load_lut(...){...}
+@@
+@@
+- ironlake_update_pch_refclk(...){...}
+@@
+@@
+- intel_update_watermarks(...){...}
+@@
+@@
+- sandybridge_update_wm(...){...}
+@@
+@@
+- ironlake_update_wm(...){...}
+@@
+@@
+- i830_update_wm(...){...}
+@@
+@@
+- i9xx_update_wm(...){...}
+@@
+@@
+- i965_update_wm(...){...}
+@@
+@@
+- g4x_update_wm(...){...}
+@@
+@@
+- pineview_update_wm(...){...}
+@@
+@@
+- pineview_disable_cxsr(...){...}
+@@
+@@
+- intel_encoder_destroy(...){...}
+@@
+@@
+- intel_encoder_commit (...){...}
+@@
+@@
+- intel_encoder_prepare (...){...}
+@@
+@@
+- ironlake_crtc_commit(...){...}
+@@
+@@
+- ironlake_crtc_prepare(...){...}
+@@
+@@
+- i9xx_crtc_commit(...){...}
+@@
+@@
+- i9xx_crtc_prepare(...){...}
+@@
+@@
+- intel_crtc_disable(...){...}
+@@
+@@
+- intel_crtc_dpms(...){...}
+@@
+@@
+- i9xx_crtc_dpms(...){...}
+@@
+@@
+- i9xx_crtc_disable(...){...}
+@@
+@@
+- i9xx_crtc_enable(...){...}
+@@
+@@
+- intel_crtc_dpms_overlay(...){...}
+@@
+@@
+- ironlake_crtc_dpms(...){...}
+@@
+@@
+- ironlake_crtc_disable(...){...}
+@@
+@@
+- ironlake_crtc_enable(...){...}
+@@
+@@
+- intel_cpt_verify_modeset(...){...}
+@@
+@@
+- ironlake_pch_enable(...){...}
+@@
+@@
+- intel_crtc_wait_for_pending_flips(...){...}
+@@
+@@
+- intel_clear_scanline_wait(...){...}
+@@
+@@
+- ironlake_fdi_disable(...){...}
+@@
+@@
+- cpt_phase_pointer_disable(...){...}
+@@
+@@
+- ironlake_fdi_pll_enable(...){...}
+@@
+@@
+- ivb_manual_fdi_link_train(...){...}
+@@
+@@
+- gen6_fdi_link_train(...){...}
+@@
+@@
+- ironlake_fdi_link_train(...){...}
+@@
+@@
+- cpt_phase_pointer_enable(...){...}
+@@
+@@
+- intel_fdi_normal_train(...){...}
+@@
+@@
+- ironlake_set_pll_edp(...){...}
+@@
+@@
+- intel_update_fbc(...){...}
+@@
+@@
+- intel_disable_fbc(...){...}
+@@
+@@
+- intel_enable_fbc(...){...}
+@@
+@@
+- intel_cancel_fbc_work(...){...}
+@@
+@@
+- intel_fbc_work_fn(...){...}
+@@
+@@
+- ironlake_disable_fbc(...){...}
+@@
+@@
+- ironlake_enable_fbc(...){...}
+@@
+@@
+- sandybridge_blit_fbc_update(...){...}
+@@
+@@
+- g4x_disable_fbc(...){...}
+@@
+@@
+- g4x_enable_fbc(...){...}
+@@
+@@
+- i8xx_enable_fbc(...){...}
+@@
+@@
+- i8xx_disable_fbc(...){...}
+@@
+@@
+- intel_disable_pll(...){...}
+@@
+@@
+- intel_enable_pll(...){...}
+@@
+@@
+- intel_clock(...){...}
+@@
+@@
+- pineview_clock(...){...}
+@@
+@@
+- intel_ironlake_limit(...){...}
+@@
+@@
+- intel_g4x_limit(...){...}
+@@
+@@
+- intel_limit(...){...}
+@@
+@@
+- intel_pipe_has_type(...){...}
+@@
+@@
+- intel_PLL_is_valid(...){...}
+@@
+@@
+- intel_find_best_PLL(...){...}
+@@
+@@
+- intel_g4x_find_best_PLL(...){...}
+@@
+@@
+- intel_find_pll_ironlake_dp(...){...}
+@@
+@@
+- intel_fbc_enabled(...){...}
+@@
+@@
+- intel_pin_and_fence_fb_obj(...){...}
+@@
+@@
+- i9xx_update_plane(...){...}
+@@
+@@
+- ironlake_update_plane(...){...}
+@@
+@@
+- intel_pipe_set_base_atomic(...){...}
+@@
+@@
+- intel_pipe_set_base(...){...}
+@@
+@@
+- intel_crtc_driving_pch(...){...}
+@@
+@@
+- intel_crtc_mode_fixup(...){...}
+@@
+@@
+- single_enabled_crtc(...){...}
+@@
+@@
+- g4x_compute_wm0(...){...}
+@@
+@@
+- g4x_compute_srwm(...){...}
+@@
+@@
+- ironlake_compute_srwm(...){...}
+@@
+@@
+- intel_panel_use_ssc(...){...}
+@@
+@@
+- intel_choose_pipe_bpp_dither(...){...}
+@@
+@@
+- i9xx_crtc_mode_set(...){...}
+@@
+@@
+- ironlake_crtc_mode_set(...){...}
+@@
+@@
+- intel_crtc_mode_set(...){...}
+@@
+@@
+- intel_crtc_update_cursor(...){...}
+@@
+@@
+- intel_crtc_cursor_set(...){...}
+@@
+@@
+- intel_crtc_cursor_move(...){...}
+@@
+@@
+- intel_crtc_fb_gamma_set(...){...}
+@@
+@@
+- intel_crtc_fb_gamma_get(...){...}
+@@
+@@
+- intel_crtc_gamma_set(...){...}
+@@
+@@
+- intel_framebuffer_create(...){...}
+@@
+@@
+- intel_framebuffer_size_for_mode(...){...}
+@@
+@@
+- intel_framebuffer_create_for_mode(...){...}
+@@
+@@
+- mode_fits_in_fbdev(...){...}
+@@
+@@
+- intel_get_load_detect_pipe(...){...}
+@@
+@@
+- intel_release_load_detect_pipe(...){...}
+@@
+@@
+- intel_crtc_clock_get(...){...}
+@@
+@@
+- intel_crtc_mode_get(...){...}
+@@
+@@
+- do_intel_finish_page_flip(...){...}
+@@
+@@
+- intel_gen2_queue_flip(...){...}
+@@
+@@
+- intel_gen3_queue_flip(...){...}
+@@
+@@
+- intel_gen4_queue_flip(...){...}
+@@
+@@
+- intel_gen6_queue_flip(...){...}
+@@
+@@
+- intel_gen7_queue_flip(...){...}
+@@
+@@
+- intel_default_queue_flip(...){...}
+@@
+@@
+- intel_crtc_page_flip(...){...}
+@@
+@@
+- intel_get_pipe_from_crtc_id(...){...}
+@@
+@@
+- intel_encoder_clones(...){...}
+@@
+@@
+- intel_user_framebuffer_create_handle(...){...}
+@@
+@@
+- intel_framebuffer_init(...){...}
+@@
+@@
+- intel_user_framebuffer_create(...){...}
+@@
+@@
+- intel_alloc_context_page(...){...}
+@@
+@@
+- ironlake_setup_rc6(...){...}
+@@
+@@
+- intel_best_encoder(...){...}
+@@
+identifier d;
+@@
+- struct drm_framebuffer_funcs d = {...};
+@@
+identifier d;
+@@
+- struct drm_mode_config_funcs d = {...};
+@@
+identifier d;
+@@
+-static struct drm_crtc_helper_funcs d = {...};
+@@
+identifier d;
+@@
+-static struct drm_crtc_funcs d = {...};
+@@
+identifier d;
+@@
+- struct intel_quirk d[] = {...};
diff --git a/util/i915tool/spatches/removeinclude.cocci b/util/i915tool/spatches/removeinclude.cocci
new file mode 100644
index 0000000000..ff1bfeaa21
--- /dev/null
+++ b/util/i915tool/spatches/removeinclude.cocci
@@ -0,0 +1,6 @@
+@@
+@@
+-#include<...>
+@@
+@@
+-#include"..."
diff --git a/util/i915tool/spatches/ringbuffer.cocci b/util/i915tool/spatches/ringbuffer.cocci
new file mode 100644
index 0000000000..68f0c98676
--- /dev/null
+++ b/util/i915tool/spatches/ringbuffer.cocci
@@ -0,0 +1,14 @@
+@@
+identifier d;
+type T;
+@@
+-T d(...){...}
+@@
+identifier d;
+type T;
+@@
+-T d(...);
+@@
+identifier d;
+@@
+-struct d{...};