OpenCloudOS-Kernel/drivers/gpu/drm
Ville Syrjälä f0f59a00a1 drm/i915: Type safe register read/write
Make I915_READ and I915_WRITE more type safe by wrapping the register
offset in a struct. This should eliminate most of the fumbles we've had
with misplaced parens.

This only takes care of normal mmio registers. We could extend the idea
to other register types and define each with its own struct. That way
you wouldn't be able to accidentally pass the wrong thing to a specific
register access function.

The gpio_reg setup is probably the ugliest thing left. But I figure I'd
just leave it for now, and wait for some divine inspiration to strike
before making it nice.

As for the generated code, it's actually a bit better sometimes. Eg.
looking at i915_irq_handler(), we can see the following change:
  lea    0x70024(%rdx,%rax,1),%r9d
  mov    $0x1,%edx
- movslq %r9d,%r9
- mov    %r9,%rsi
- mov    %r9,-0x58(%rbp)
- callq  *0xd8(%rbx)
+ mov    %r9d,%esi
+ mov    %r9d,-0x48(%rbp)
 callq  *0xd8(%rbx)

So previously gcc thought the register offset might be signed and
decided to sign extend it, just in case. The rest appears to be
mostly just minor shuffling of instructions.

v2: i915_mmio_reg_{offset,equal,valid}() helpers added
    s/_REG/_MMIO/ in the register defines
    mo more switch statements left to worry about
    ring_emit stuff got sorted in a prep patch
    cmd parser, lrc context and w/a batch buildup also in prep patch
    vgpu stuff cleaned up and moved to a prep patch
    all other unrelated changes split out
v3: Rebased due to BXT DSI/BLC, MOCS, etc.
v4: Rebased due to churn, s/i915_mmio_reg_t/i915_reg_t/

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1447853606-2751-1-git-send-email-ville.syrjala@linux.intel.com
2015-11-18 15:39:11 +02:00
..
amd Merge tag 'topic/drm-misc-2015-09-25' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-09-30 08:35:45 +10:00
armada drm/armada: Use new drm_fb_helper functions 2015-08-06 14:12:56 +02:00
ast drm/ast: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:36:55 +02:00
atmel-hlcdc drm/atomic: Make prepare_fb/cleanup_fb only take state, v3. 2015-09-08 13:45:54 +02:00
bochs drm/bochs: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:04 +02:00
bridge Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-08-27 13:01:57 +10:00
cirrus drm/cirrus: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:27 +02:00
exynos Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
fsl-dcu Merge tag 'topic/drm-misc-2015-09-25' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-09-30 08:35:45 +10:00
gma500 drm/gma500: Remove DP_LINK_STATUS_SIZE redefinition 2015-09-24 20:14:25 +02:00
i2c Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
i810
i915 drm/i915: Type safe register read/write 2015-11-18 15:39:11 +02:00
imx Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-08-27 13:01:57 +10:00
mga
mgag200 drm/mgag200: Fix driver_load error handling 2015-09-24 08:10:44 +10:00
msm Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
nouveau drm: Stop using linedur_ns and pixeldur_ns for vblank timestamps 2015-09-24 20:14:21 +02:00
omapdrm drm: Spell vga_switcheroo consistently 2015-09-24 20:14:19 +02:00
panel drm/panel: Add support for LG LG4573 480x800 4.3" panel 2015-08-14 21:35:35 +02:00
qxl drm/qxl: only report first monitor as connected if we have no state 2015-09-24 08:08:17 +10:00
r128
radeon Merge tag 'topic/drm-misc-2015-09-25' of git://anongit.freedesktop.org/drm-intel into drm-next 2015-09-30 08:35:45 +10:00
rcar-du drm/atomic-helper: Add option to update planes only on active crtc 2015-09-08 13:49:08 +02:00
rockchip drm/rockchip: vop: support plane scale 2015-08-26 14:16:26 +08:00
savage
shmobile
sis
sti drm/atomic-helper: Add option to update planes only on active crtc 2015-09-08 13:49:08 +02:00
tdfx
tegra drm/tegra: Handle I2C_WRITE_STATUS_UPDATE for address only writes 2015-09-08 20:15:42 +02:00
tilcdc
ttm drm/ttm: Fix memory space allocation v2 2015-09-15 00:57:01 -07:00
udl drm/udl: Use new drm_fb_helper functions 2015-08-06 14:13:00 +02:00
vgem mm: mark most vm_operations_struct const 2015-09-10 13:29:01 -07:00
via treewide: fix typos in comment blocks 2015-08-07 14:46:24 +02:00
virtio drm/virtio: Use new drm_fb_helper functions 2015-08-06 14:13:07 +02:00
vmwgfx Merge tag 'vmwgfx-fixes-4.3-150924' of git://people.freedesktop.org/~thomash/linux into drm-fixes 2015-09-24 18:36:04 +10:00
Kconfig Merge branch 'drm-next-fsl-dcu' of https://github.com/Jianwei-Wang/linux-drm-fsl-dcu into drm-next 2015-08-20 14:11:17 +10:00
Makefile drm/layerscape: Add Freescale DCU DRM driver 2015-08-19 22:23:04 -04:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic.c drm: drm_atomic_crtc_get_property should be static 2015-09-24 20:14:26 +02:00
drm_atomic_helper.c Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
drm_auth.c
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_context.c
drm_crtc.c drm/core: Preserve the fb id on close. 2015-09-24 20:14:24 +02:00
drm_crtc_helper.c
drm_crtc_internal.h
drm_debugfs.c
drm_dma.c
drm_dp_helper.c Linux 4.3-rc2 2015-09-24 17:18:41 +02:00
drm_dp_mst_topology.c Linux 4.2-rc8 2015-08-24 16:36:42 +10:00
drm_drv.c drm: move drm_class into drm_sysfs.c 2015-09-09 15:05:17 +02:00
drm_edid.c drm: Make drm_av_sync_delay() 'mode' argument const 2015-09-09 14:53:54 +02:00
drm_edid_load.c drm: Constify generic_edid_names[] 2015-09-08 13:45:52 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb_cma_helper: Use new drm_fb_helper functions 2015-08-06 14:13:00 +02:00
drm_fb_helper.c drm/fbdev: Update legacy plane->fb refcounting for atomic restore 2015-09-24 20:14:20 +02:00
drm_flip_work.c
drm_fops.c
drm_gem.c drm/gem: Be more friendly with locking checks 2015-08-10 13:35:49 +02:00
drm_gem_cma_helper.c drm/cma-helper: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:36 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h drm: move drm_class into drm_sysfs.c 2015-09-09 15:05:17 +02:00
drm_ioc32.c
drm_ioctl.c drm: Allow also control clients to check the drm version 2015-09-24 00:24:24 -07:00
drm_irq.c drm/irq: Add drm_crtc_vblank_count_and_time() 2015-09-24 20:27:17 +02:00
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c
drm_mm.c drm/mm: Do DRM_MM_CREATE_TOP adj_start calculation after color_adjust 2015-09-08 13:45:47 +02:00
drm_modes.c
drm_modeset_lock.c drm/atomic: Make sure lock is held in trylock contexts. 2015-09-08 13:45:53 +02:00
drm_of.c
drm_panel.c
drm_pci.c
drm_plane_helper.c drm/atomic: Make prepare_fb/cleanup_fb only take state, v3. 2015-09-08 13:45:54 +02:00
drm_platform.c
drm_prime.c
drm_probe_helper.c
drm_rect.c
drm_scatter.c
drm_sysfs.c drm: move drm_class into drm_sysfs.c 2015-09-09 15:05:17 +02:00
drm_trace.h
drm_trace_points.c
drm_vm.c
drm_vma_manager.c