Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'drm-misc-next-2016-11-29' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Big thing is that drm-misc is now officially a group maintainer/committer
model thing, with MAINTAINERS suitably updated. Otherwise just the usual
pile of misc things all over, nothing that stands out this time around.

* tag 'drm-misc-next-2016-11-29' of git://anongit.freedesktop.org/git/drm-misc: (33 commits)
drm: Introduce drm_framebuffer_assign()
drm/bridge: adv7511: Enable the audio data and clock pads on adv7533
drm/bridge: adv7511: Add Audio support
drm/edid: Consider alternate cea timings to be the same VIC
drm/atomic: Constify drm_atomic_crtc_needs_modeset()
drm: bridge: dw-hdmi: add ASoC dependency
drm: Fix shift operations for drm_fb_helper::drm_target_preferred()
drm: Avoid NULL dereference for DRM_LEGACY debug message
drm: Use u64_to_user_ptr() helper for blob ioctls
drm: Fix conflicting macro parameter in drm_mm_for_each_node_in_range()
drm: Fixup kernel doc for driver->gem_create_object
drm/hisilicon/hibmc: mark PM functions __maybe_unused
drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR()
drm: bridge: add DesignWare HDMI I2S audio support
drm: Check against color expansion in drm_mm_reserve_node()
drm: Define drm_mm_for_each_node_in_range()
drm/doc: Fix links in drm_property.c
MAINTAINERS: Add link to drm-misc documentation
vgaarb: use valid dev pointer in vgaarb_info()
drm/atomic: Unconfuse the old_state mess in commmit_tail
...

+939 -225
+2
Documentation/devicetree/bindings/display/bridge/dumb-vga-dac.txt
··· 16 16 - Video port 0 for RGB input 17 17 - Video port 1 for VGA output 18 18 19 + Optional properties: 20 + - vdd-supply: Power supply for DAC 19 21 20 22 Example 21 23 -------
+3
Documentation/gpu/drm-kms-helpers.rst
··· 63 63 .. kernel-doc:: drivers/gpu/drm/drm_atomic_helper.c 64 64 :doc: atomic state reset and initialization 65 65 66 + Helper Functions Reference 67 + -------------------------- 68 + 66 69 .. kernel-doc:: include/drm/drm_atomic_helper.h 67 70 :internal: 68 71
+12
Documentation/gpu/drm-kms.rst
··· 260 260 .. kernel-doc:: drivers/gpu/drm/drm_property.c 261 261 :export: 262 262 263 + Standard Connector Properties 264 + ----------------------------- 265 + 266 + .. kernel-doc:: drivers/gpu/drm/drm_connector.c 267 + :doc: standard connector properties 268 + 263 269 Plane Composition Properties 264 270 ---------------------------- 265 271 ··· 292 286 293 287 .. kernel-doc:: drivers/gpu/drm/drm_connector.c 294 288 :doc: Tile group 289 + 290 + Explicit Fencing Properties 291 + --------------------------- 292 + 293 + .. kernel-doc:: drivers/gpu/drm/drm_atomic.c 294 + :doc: explicit fencing properties 295 295 296 296 Existing KMS Properties 297 297 -----------------------
+21 -2
MAINTAINERS
··· 3911 3911 F: include/linux/reservation.h 3912 3912 F: include/linux/*fence.h 3913 3913 F: Documentation/dma-buf-sharing.txt 3914 - T: git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git 3914 + T: git git://anongit.freedesktop.org/drm/drm-misc 3915 3915 3916 3916 SYNC FILE FRAMEWORK 3917 3917 M: Sumit Semwal <sumit.semwal@linaro.org> ··· 3924 3924 F: include/linux/sync_file.h 3925 3925 F: include/uapi/linux/sync_file.h 3926 3926 F: Documentation/sync_file.txt 3927 - T: git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git 3927 + T: git git://anongit.freedesktop.org/drm/drm-misc 3928 3928 3929 3929 DMA GENERIC OFFLOAD ENGINE SUBSYSTEM 3930 3930 M: Vinod Koul <vinod.koul@intel.com> ··· 4022 4022 F: include/drm/ 4023 4023 F: include/uapi/drm/ 4024 4024 4025 + DRM DRIVERS AND MISC GPU PATCHES 4026 + M: Daniel Vetter <daniel.vetter@intel.com> 4027 + M: Jani Nikula <jani.nikula@linux.intel.com> 4028 + M: Sean Paul <seanpaul@chromium.org> 4029 + W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html 4030 + S: Maintained 4031 + T: git git://anongit.freedesktop.org/drm/drm-misc 4032 + F: Documentation/gpu/ 4033 + F: drivers/gpu/vga/ 4034 + F: drivers/gpu/drm/* 4035 + F: include/drm/drm* 4036 + F: include/uapi/drm/drm* 4037 + 4025 4038 DRM DRIVER FOR AST SERVER GRAPHICS CHIPS 4026 4039 M: Dave Airlie <airlied@redhat.com> 4027 4040 S: Odd Fixes 4028 4041 F: drivers/gpu/drm/ast/ 4042 + 4043 + DRM DRIVERS FOR BRIDGE CHIPS 4044 + M: Archit Taneja <architt@codeaurora.org> 4045 + S: Maintained 4046 + T: git git://anongit.freedesktop.org/drm/drm-misc 4047 + F: drivers/gpu/drm/bridge/ 4029 4048 4030 4049 DRM DRIVER FOR BOCHS VIRTUAL GPU 4031 4050 M: Gerd Hoffmann <kraxel@redhat.com>
+1 -2
drivers/dma-buf/sync_file.c
··· 308 308 309 309 poll_wait(file, &sync_file->wq, wait); 310 310 311 - if (!poll_does_not_wait(wait) && 312 - !test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { 311 + if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { 313 312 if (dma_fence_add_callback(sync_file->fence, &sync_file->cb, 314 313 fence_check_cb_func) < 0) 315 314 wake_up_all(&sync_file->wq);
+9
drivers/gpu/drm/bridge/Kconfig
··· 39 39 Designware HDMI block. This is used in conjunction with 40 40 the i.MX6 HDMI driver. 41 41 42 + config DRM_DW_HDMI_I2S_AUDIO 43 + tristate "Synopsis Designware I2S Audio interface" 44 + depends on SND_SOC 45 + depends on DRM_DW_HDMI 46 + select SND_SOC_HDMI_CODEC 47 + help 48 + Support the I2S Audio interface which is part of the Synopsis 49 + Designware HDMI block. 50 + 42 51 config DRM_NXP_PTN3460 43 52 tristate "NXP PTN3460 DP/LVDS bridge" 44 53 depends on OF
+1
drivers/gpu/drm/bridge/Makefile
··· 4 4 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o 5 5 obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o 6 6 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o 7 + obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o 7 8 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o 8 9 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o 9 10 obj-$(CONFIG_DRM_SIL_SII8620) += sil-sii8620.o
+8
drivers/gpu/drm/bridge/adv7511/Kconfig
··· 6 6 help 7 7 Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders. 8 8 9 + config DRM_I2C_ADV7511_AUDIO 10 + bool "ADV7511 HDMI Audio driver" 11 + depends on DRM_I2C_ADV7511 && SND_SOC 12 + select SND_SOC_HDMI_CODEC 13 + help 14 + Support the ADV7511 HDMI Audio interface. This is used in 15 + conjunction with the AV7511 HDMI driver. 16 + 9 17 config DRM_I2C_ADV7533 10 18 bool "ADV7533 encoder" 11 19 depends on DRM_I2C_ADV7511
+1
drivers/gpu/drm/bridge/adv7511/Makefile
··· 1 1 adv7511-y := adv7511_drv.o 2 + adv7511-$(CONFIG_DRM_I2C_ADV7511_AUDIO) += adv7511_audio.o 2 3 adv7511-$(CONFIG_DRM_I2C_ADV7533) += adv7533.o 3 4 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o
+16
drivers/gpu/drm/bridge/adv7511/adv7511.h
··· 309 309 struct drm_display_mode curr_mode; 310 310 311 311 unsigned int f_tmds; 312 + unsigned int f_audio; 313 + unsigned int audio_source; 312 314 313 315 unsigned int current_edid_segment; 314 316 uint8_t edid_buf[256]; ··· 336 334 bool use_timing_gen; 337 335 338 336 enum adv7511_type type; 337 + struct platform_device *audio_pdev; 339 338 }; 340 339 341 340 #ifdef CONFIG_DRM_I2C_ADV7533 ··· 391 388 return -ENODEV; 392 389 } 393 390 #endif 391 + 392 + #ifdef CONFIG_DRM_I2C_ADV7511_AUDIO 393 + int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511); 394 + void adv7511_audio_exit(struct adv7511 *adv7511); 395 + #else /*CONFIG_DRM_I2C_ADV7511_AUDIO */ 396 + static inline int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511) 397 + { 398 + return 0; 399 + } 400 + static inline void adv7511_audio_exit(struct adv7511 *adv7511) 401 + { 402 + } 403 + #endif /* CONFIG_DRM_I2C_ADV7511_AUDIO */ 394 404 395 405 #endif /* __DRM_I2C_ADV7511_H__ */
+213
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
··· 1 + /* 2 + * Analog Devices ADV7511 HDMI transmitter driver 3 + * 4 + * Copyright 2012 Analog Devices Inc. 5 + * Copyright (c) 2016, Linaro Limited 6 + * 7 + * Licensed under the GPL-2. 8 + */ 9 + 10 + #include <sound/core.h> 11 + #include <sound/hdmi-codec.h> 12 + #include <sound/pcm.h> 13 + #include <sound/soc.h> 14 + 15 + #include "adv7511.h" 16 + 17 + static void adv7511_calc_cts_n(unsigned int f_tmds, unsigned int fs, 18 + unsigned int *cts, unsigned int *n) 19 + { 20 + switch (fs) { 21 + case 32000: 22 + *n = 4096; 23 + break; 24 + case 44100: 25 + *n = 6272; 26 + break; 27 + case 48000: 28 + *n = 6144; 29 + break; 30 + } 31 + 32 + *cts = ((f_tmds * *n) / (128 * fs)) * 1000; 33 + } 34 + 35 + static int adv7511_update_cts_n(struct adv7511 *adv7511) 36 + { 37 + unsigned int cts = 0; 38 + unsigned int n = 0; 39 + 40 + adv7511_calc_cts_n(adv7511->f_tmds, adv7511->f_audio, &cts, &n); 41 + 42 + regmap_write(adv7511->regmap, ADV7511_REG_N0, (n >> 16) & 0xf); 43 + regmap_write(adv7511->regmap, ADV7511_REG_N1, (n >> 8) & 0xff); 44 + regmap_write(adv7511->regmap, ADV7511_REG_N2, n & 0xff); 45 + 46 + regmap_write(adv7511->regmap, ADV7511_REG_CTS_MANUAL0, 47 + (cts >> 16) & 0xf); 48 + regmap_write(adv7511->regmap, ADV7511_REG_CTS_MANUAL1, 49 + (cts >> 8) & 0xff); 50 + regmap_write(adv7511->regmap, ADV7511_REG_CTS_MANUAL2, 51 + cts & 0xff); 52 + 53 + return 0; 54 + } 55 + 56 + int adv7511_hdmi_hw_params(struct device *dev, void *data, 57 + struct hdmi_codec_daifmt *fmt, 58 + struct hdmi_codec_params *hparms) 59 + { 60 + struct adv7511 *adv7511 = dev_get_drvdata(dev); 61 + unsigned int audio_source, i2s_format = 0; 62 + unsigned int invert_clock; 63 + unsigned int rate; 64 + unsigned int len; 65 + 66 + switch (hparms->sample_rate) { 67 + case 32000: 68 + rate = ADV7511_SAMPLE_FREQ_32000; 69 + break; 70 + case 44100: 71 + rate = ADV7511_SAMPLE_FREQ_44100; 72 + break; 73 + case 48000: 74 + rate = ADV7511_SAMPLE_FREQ_48000; 75 + break; 76 + case 88200: 77 + rate = ADV7511_SAMPLE_FREQ_88200; 78 + break; 79 + case 96000: 80 + rate = ADV7511_SAMPLE_FREQ_96000; 81 + break; 82 + case 176400: 83 + rate = ADV7511_SAMPLE_FREQ_176400; 84 + break; 85 + case 192000: 86 + rate = ADV7511_SAMPLE_FREQ_192000; 87 + break; 88 + default: 89 + return -EINVAL; 90 + } 91 + 92 + switch (hparms->sample_width) { 93 + case 16: 94 + len = ADV7511_I2S_SAMPLE_LEN_16; 95 + break; 96 + case 18: 97 + len = ADV7511_I2S_SAMPLE_LEN_18; 98 + break; 99 + case 20: 100 + len = ADV7511_I2S_SAMPLE_LEN_20; 101 + break; 102 + case 24: 103 + len = ADV7511_I2S_SAMPLE_LEN_24; 104 + break; 105 + default: 106 + return -EINVAL; 107 + } 108 + 109 + switch (fmt->fmt) { 110 + case HDMI_I2S: 111 + audio_source = ADV7511_AUDIO_SOURCE_I2S; 112 + i2s_format = ADV7511_I2S_FORMAT_I2S; 113 + break; 114 + case HDMI_RIGHT_J: 115 + audio_source = ADV7511_AUDIO_SOURCE_I2S; 116 + i2s_format = ADV7511_I2S_FORMAT_RIGHT_J; 117 + break; 118 + case HDMI_LEFT_J: 119 + audio_source = ADV7511_AUDIO_SOURCE_I2S; 120 + i2s_format = ADV7511_I2S_FORMAT_LEFT_J; 121 + break; 122 + default: 123 + return -EINVAL; 124 + } 125 + 126 + invert_clock = fmt->bit_clk_inv; 127 + 128 + regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_SOURCE, 0x70, 129 + audio_source << 4); 130 + regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG, BIT(6), 131 + invert_clock << 6); 132 + regmap_update_bits(adv7511->regmap, ADV7511_REG_I2S_CONFIG, 0x03, 133 + i2s_format); 134 + 135 + adv7511->audio_source = audio_source; 136 + 137 + adv7511->f_audio = hparms->sample_rate; 138 + 139 + adv7511_update_cts_n(adv7511); 140 + 141 + regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CFG3, 142 + ADV7511_AUDIO_CFG3_LEN_MASK, len); 143 + regmap_update_bits(adv7511->regmap, ADV7511_REG_I2C_FREQ_ID_CFG, 144 + ADV7511_I2C_FREQ_ID_CFG_RATE_MASK, rate << 4); 145 + regmap_write(adv7511->regmap, 0x73, 0x1); 146 + 147 + return 0; 148 + } 149 + 150 + static int audio_startup(struct device *dev, void *data) 151 + { 152 + struct adv7511 *adv7511 = dev_get_drvdata(dev); 153 + 154 + regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG, 155 + BIT(7), 0); 156 + 157 + /* hide Audio infoframe updates */ 158 + regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE, 159 + BIT(5), BIT(5)); 160 + /* enable N/CTS, enable Audio sample packets */ 161 + regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE1, 162 + BIT(5), BIT(5)); 163 + /* enable N/CTS */ 164 + regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE1, 165 + BIT(6), BIT(6)); 166 + /* not copyrighted */ 167 + regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CFG1, 168 + BIT(5), BIT(5)); 169 + /* enable audio infoframes */ 170 + regmap_update_bits(adv7511->regmap, ADV7511_REG_PACKET_ENABLE1, 171 + BIT(3), BIT(3)); 172 + /* AV mute disable */ 173 + regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(0), 174 + BIT(7) | BIT(6), BIT(7)); 175 + /* use Audio infoframe updated info */ 176 + regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(1), 177 + BIT(5), 0); 178 + return 0; 179 + } 180 + 181 + static void audio_shutdown(struct device *dev, void *data) 182 + { 183 + } 184 + 185 + static const struct hdmi_codec_ops adv7511_codec_ops = { 186 + .hw_params = adv7511_hdmi_hw_params, 187 + .audio_shutdown = audio_shutdown, 188 + .audio_startup = audio_startup, 189 + }; 190 + 191 + static struct hdmi_codec_pdata codec_data = { 192 + .ops = &adv7511_codec_ops, 193 + .max_i2s_channels = 2, 194 + .i2s = 1, 195 + }; 196 + 197 + int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511) 198 + { 199 + adv7511->audio_pdev = platform_device_register_data(dev, 200 + HDMI_CODEC_DRV_NAME, 201 + PLATFORM_DEVID_AUTO, 202 + &codec_data, 203 + sizeof(codec_data)); 204 + return PTR_ERR_OR_ZERO(adv7511->audio_pdev); 205 + } 206 + 207 + void adv7511_audio_exit(struct adv7511 *adv7511) 208 + { 209 + if (adv7511->audio_pdev) { 210 + platform_device_unregister(adv7511->audio_pdev); 211 + adv7511->audio_pdev = NULL; 212 + } 213 + }
+4
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
··· 1037 1037 goto err_unregister_cec; 1038 1038 } 1039 1039 1040 + adv7511_audio_init(dev, adv7511); 1041 + 1040 1042 return 0; 1041 1043 1042 1044 err_unregister_cec: ··· 1059 1057 } 1060 1058 1061 1059 drm_bridge_remove(&adv7511->bridge); 1060 + 1061 + adv7511_audio_exit(adv7511); 1062 1062 1063 1063 i2c_unregister_device(adv7511->i2c_edid); 1064 1064
+1
drivers/gpu/drm/bridge/adv7511/adv7533.c
··· 29 29 { 0x17, 0xd0 }, 30 30 { 0x24, 0x20 }, 31 31 { 0x57, 0x11 }, 32 + { 0x05, 0xc8 }, 32 33 }; 33 34 34 35 static const struct regmap_config adv7533_cec_regmap_config = {
+33
drivers/gpu/drm/bridge/dumb-vga-dac.c
··· 12 12 13 13 #include <linux/module.h> 14 14 #include <linux/of_graph.h> 15 + #include <linux/regulator/consumer.h> 15 16 16 17 #include <drm/drmP.h> 17 18 #include <drm/drm_atomic_helper.h> ··· 24 23 struct drm_connector connector; 25 24 26 25 struct i2c_adapter *ddc; 26 + struct regulator *vdd; 27 27 }; 28 28 29 29 static inline struct dumb_vga * ··· 126 124 return 0; 127 125 } 128 126 127 + static void dumb_vga_enable(struct drm_bridge *bridge) 128 + { 129 + struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge); 130 + int ret = 0; 131 + 132 + if (vga->vdd) 133 + ret = regulator_enable(vga->vdd); 134 + 135 + if (ret) 136 + DRM_ERROR("Failed to enable vdd regulator: %d\n", ret); 137 + } 138 + 139 + static void dumb_vga_disable(struct drm_bridge *bridge) 140 + { 141 + struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge); 142 + 143 + if (vga->vdd) 144 + regulator_disable(vga->vdd); 145 + } 146 + 129 147 static const struct drm_bridge_funcs dumb_vga_bridge_funcs = { 130 148 .attach = dumb_vga_attach, 149 + .enable = dumb_vga_enable, 150 + .disable = dumb_vga_disable, 131 151 }; 132 152 133 153 static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev) ··· 192 168 if (!vga) 193 169 return -ENOMEM; 194 170 platform_set_drvdata(pdev, vga); 171 + 172 + vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); 173 + if (IS_ERR(vga->vdd)) { 174 + ret = PTR_ERR(vga->vdd); 175 + if (ret == -EPROBE_DEFER) 176 + return -EPROBE_DEFER; 177 + vga->vdd = NULL; 178 + dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret); 179 + } 195 180 196 181 vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev); 197 182 if (IS_ERR(vga->ddc)) {
+7
drivers/gpu/drm/bridge/dw-hdmi-audio.h
··· 11 11 u8 *eld; 12 12 }; 13 13 14 + struct dw_hdmi_i2s_audio_data { 15 + struct dw_hdmi *hdmi; 16 + 17 + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); 18 + u8 (*read)(struct dw_hdmi *hdmi, int offset); 19 + }; 20 + 14 21 #endif
+141
drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
··· 1 + /* 2 + * dw-hdmi-i2s-audio.c 3 + * 4 + * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + #include <drm/bridge/dw_hdmi.h> 11 + 12 + #include <sound/hdmi-codec.h> 13 + 14 + #include "dw-hdmi.h" 15 + #include "dw-hdmi-audio.h" 16 + 17 + #define DRIVER_NAME "dw-hdmi-i2s-audio" 18 + 19 + static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio, 20 + u8 val, int offset) 21 + { 22 + struct dw_hdmi *hdmi = audio->hdmi; 23 + 24 + audio->write(hdmi, val, offset); 25 + } 26 + 27 + static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset) 28 + { 29 + struct dw_hdmi *hdmi = audio->hdmi; 30 + 31 + return audio->read(hdmi, offset); 32 + } 33 + 34 + static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, 35 + struct hdmi_codec_daifmt *fmt, 36 + struct hdmi_codec_params *hparms) 37 + { 38 + struct dw_hdmi_i2s_audio_data *audio = data; 39 + struct dw_hdmi *hdmi = audio->hdmi; 40 + u8 conf0 = 0; 41 + u8 conf1 = 0; 42 + u8 inputclkfs = 0; 43 + 44 + /* it cares I2S only */ 45 + if ((fmt->fmt != HDMI_I2S) || 46 + (fmt->bit_clk_master | fmt->frame_clk_master)) { 47 + dev_err(dev, "unsupported format/settings\n"); 48 + return -EINVAL; 49 + } 50 + 51 + inputclkfs = HDMI_AUD_INPUTCLKFS_64FS; 52 + conf0 = HDMI_AUD_CONF0_I2S_ALL_ENABLE; 53 + 54 + switch (hparms->sample_width) { 55 + case 16: 56 + conf1 = HDMI_AUD_CONF1_WIDTH_16; 57 + break; 58 + case 24: 59 + case 32: 60 + conf1 = HDMI_AUD_CONF1_WIDTH_24; 61 + break; 62 + } 63 + 64 + dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate); 65 + 66 + hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS); 67 + hdmi_write(audio, conf0, HDMI_AUD_CONF0); 68 + hdmi_write(audio, conf1, HDMI_AUD_CONF1); 69 + 70 + dw_hdmi_audio_enable(hdmi); 71 + 72 + return 0; 73 + } 74 + 75 + static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data) 76 + { 77 + struct dw_hdmi_i2s_audio_data *audio = data; 78 + struct dw_hdmi *hdmi = audio->hdmi; 79 + 80 + dw_hdmi_audio_disable(hdmi); 81 + 82 + hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0); 83 + } 84 + 85 + static struct hdmi_codec_ops dw_hdmi_i2s_ops = { 86 + .hw_params = dw_hdmi_i2s_hw_params, 87 + .audio_shutdown = dw_hdmi_i2s_audio_shutdown, 88 + }; 89 + 90 + static int snd_dw_hdmi_probe(struct platform_device *pdev) 91 + { 92 + struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data; 93 + struct platform_device_info pdevinfo; 94 + struct hdmi_codec_pdata pdata; 95 + struct platform_device *platform; 96 + 97 + pdata.ops = &dw_hdmi_i2s_ops; 98 + pdata.i2s = 1; 99 + pdata.max_i2s_channels = 6; 100 + pdata.data = audio; 101 + 102 + memset(&pdevinfo, 0, sizeof(pdevinfo)); 103 + pdevinfo.parent = pdev->dev.parent; 104 + pdevinfo.id = PLATFORM_DEVID_AUTO; 105 + pdevinfo.name = HDMI_CODEC_DRV_NAME; 106 + pdevinfo.data = &pdata; 107 + pdevinfo.size_data = sizeof(pdata); 108 + pdevinfo.dma_mask = DMA_BIT_MASK(32); 109 + 110 + platform = platform_device_register_full(&pdevinfo); 111 + if (IS_ERR(platform)) 112 + return PTR_ERR(platform); 113 + 114 + dev_set_drvdata(&pdev->dev, platform); 115 + 116 + return 0; 117 + } 118 + 119 + static int snd_dw_hdmi_remove(struct platform_device *pdev) 120 + { 121 + struct platform_device *platform = dev_get_drvdata(&pdev->dev); 122 + 123 + platform_device_unregister(platform); 124 + 125 + return 0; 126 + } 127 + 128 + static struct platform_driver snd_dw_hdmi_driver = { 129 + .probe = snd_dw_hdmi_probe, 130 + .remove = snd_dw_hdmi_remove, 131 + .driver = { 132 + .name = DRIVER_NAME, 133 + .owner = THIS_MODULE, 134 + }, 135 + }; 136 + module_platform_driver(snd_dw_hdmi_driver); 137 + 138 + MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); 139 + MODULE_DESCRIPTION("Synopsis Designware HDMI I2S ALSA SoC interface"); 140 + MODULE_LICENSE("GPL v2"); 141 + MODULE_ALIAS("platform:" DRIVER_NAME);
+20 -2
drivers/gpu/drm/bridge/dw-hdmi.c
··· 1871 1871 struct device_node *np = dev->of_node; 1872 1872 struct platform_device_info pdevinfo; 1873 1873 struct device_node *ddc_node; 1874 - struct dw_hdmi_audio_data audio; 1875 1874 struct dw_hdmi *hdmi; 1876 1875 int ret; 1877 1876 u32 val = 1; 1877 + u8 config0; 1878 + u8 config1; 1878 1879 1879 1880 hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); 1880 1881 if (!hdmi) ··· 2012 2011 pdevinfo.parent = dev; 2013 2012 pdevinfo.id = PLATFORM_DEVID_AUTO; 2014 2013 2015 - if (hdmi_readb(hdmi, HDMI_CONFIG1_ID) & HDMI_CONFIG1_AHB) { 2014 + config0 = hdmi_readb(hdmi, HDMI_CONFIG0_ID); 2015 + config1 = hdmi_readb(hdmi, HDMI_CONFIG1_ID); 2016 + 2017 + if (config1 & HDMI_CONFIG1_AHB) { 2018 + struct dw_hdmi_audio_data audio; 2019 + 2016 2020 audio.phys = iores->start; 2017 2021 audio.base = hdmi->regs; 2018 2022 audio.irq = irq; ··· 2025 2019 audio.eld = hdmi->connector.eld; 2026 2020 2027 2021 pdevinfo.name = "dw-hdmi-ahb-audio"; 2022 + pdevinfo.data = &audio; 2023 + pdevinfo.size_data = sizeof(audio); 2024 + pdevinfo.dma_mask = DMA_BIT_MASK(32); 2025 + hdmi->audio = platform_device_register_full(&pdevinfo); 2026 + } else if (config0 & HDMI_CONFIG0_I2S) { 2027 + struct dw_hdmi_i2s_audio_data audio; 2028 + 2029 + audio.hdmi = hdmi; 2030 + audio.write = hdmi_writeb; 2031 + audio.read = hdmi_readb; 2032 + 2033 + pdevinfo.name = "dw-hdmi-i2s-audio"; 2028 2034 pdevinfo.data = &audio; 2029 2035 pdevinfo.size_data = sizeof(audio); 2030 2036 pdevinfo.dma_mask = DMA_BIT_MASK(32);
+20
drivers/gpu/drm/bridge/dw-hdmi.h
··· 545 545 #define HDMI_I2CM_FS_SCL_LCNT_0_ADDR 0x7E12 546 546 547 547 enum { 548 + /* CONFIG0_ID field values */ 549 + HDMI_CONFIG0_I2S = 0x10, 550 + 548 551 /* CONFIG1_ID field values */ 549 552 HDMI_CONFIG1_AHB = 0x01, 550 553 ··· 894 891 HDMI_PHY_I2CM_CTLINT_ADDR_ARBITRATION_POL = 0x08, 895 892 HDMI_PHY_I2CM_CTLINT_ADDR_ARBITRATION_MASK = 0x04, 896 893 894 + /* AUD_CONF0 field values */ 895 + HDMI_AUD_CONF0_SW_RESET = 0x80, 896 + HDMI_AUD_CONF0_I2S_ALL_ENABLE = 0x2F, 897 + 898 + /* AUD_CONF1 field values */ 899 + HDMI_AUD_CONF1_MODE_I2S = 0x00, 900 + HDMI_AUD_CONF1_MODE_RIGHT_J = 0x02, 901 + HDMI_AUD_CONF1_MODE_LEFT_J = 0x04, 902 + HDMI_AUD_CONF1_WIDTH_16 = 0x10, 903 + HDMI_AUD_CONF1_WIDTH_24 = 0x18, 904 + 897 905 /* AUD_CTS3 field values */ 898 906 HDMI_AUD_CTS3_N_SHIFT_OFFSET = 5, 899 907 HDMI_AUD_CTS3_N_SHIFT_MASK = 0xe0, ··· 918 904 from our part. Can't set it, will read as 0. */ 919 905 HDMI_AUD_CTS3_CTS_MANUAL = 0x10, 920 906 HDMI_AUD_CTS3_AUDCTS19_16_MASK = 0x0f, 907 + 908 + /* HDMI_AUD_INPUTCLKFS field values */ 909 + HDMI_AUD_INPUTCLKFS_128FS = 0, 910 + HDMI_AUD_INPUTCLKFS_256FS = 1, 911 + HDMI_AUD_INPUTCLKFS_512FS = 2, 912 + HDMI_AUD_INPUTCLKFS_64FS = 4, 921 913 922 914 /* AHB_DMA_CONF0 field values */ 923 915 HDMI_AHB_DMA_CONF0_SW_FIFO_RST_OFFSET = 7,
+62 -7
drivers/gpu/drm/drm_atomic.c
··· 965 965 966 966 drm_printf(p, "\t\tformat=%s\n", 967 967 drm_get_format_name(fb->pixel_format, &format_name)); 968 + drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier); 968 969 drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height); 969 970 drm_printf(p, "\t\tlayers:\n"); 970 971 for (i = 0; i < n; i++) { 971 972 drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, fb->pitches[i]); 972 973 drm_printf(p, "\t\t\toffset[%d]=%u\n", i, fb->offsets[i]); 973 - drm_printf(p, "\t\t\tmodifier[%d]=0x%llx\n", i, fb->modifier[i]); 974 974 } 975 975 } 976 976 drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest)); ··· 1246 1246 drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, 1247 1247 struct drm_framebuffer *fb) 1248 1248 { 1249 - if (plane_state->fb) 1250 - drm_framebuffer_unreference(plane_state->fb); 1251 - if (fb) 1252 - drm_framebuffer_reference(fb); 1253 - plane_state->fb = fb; 1254 - 1255 1249 if (fb) 1256 1250 DRM_DEBUG_ATOMIC("Set [FB:%d] for plane state %p\n", 1257 1251 fb->base.id, plane_state); 1258 1252 else 1259 1253 DRM_DEBUG_ATOMIC("Set [NOFB] for plane state %p\n", 1260 1254 plane_state); 1255 + 1256 + drm_framebuffer_assign(&plane_state->fb, fb); 1261 1257 } 1262 1258 EXPORT_SYMBOL(drm_atomic_set_fb_for_plane); 1263 1259 ··· 1682 1686 ARRAY_SIZE(drm_atomic_debugfs_list), 1683 1687 minor->debugfs_root, minor); 1684 1688 } 1689 + 1690 + int drm_atomic_debugfs_cleanup(struct drm_minor *minor) 1691 + { 1692 + return drm_debugfs_remove_files(drm_atomic_debugfs_list, 1693 + ARRAY_SIZE(drm_atomic_debugfs_list), 1694 + minor); 1695 + } 1685 1696 #endif 1686 1697 1687 1698 /* ··· 1811 1808 } 1812 1809 } 1813 1810 EXPORT_SYMBOL(drm_atomic_clean_old_fb); 1811 + 1812 + /** 1813 + * DOC: explicit fencing properties 1814 + * 1815 + * Explicit fencing allows userspace to control the buffer synchronization 1816 + * between devices. A Fence or a group of fences are transfered to/from 1817 + * userspace using Sync File fds and there are two DRM properties for that. 1818 + * IN_FENCE_FD on each DRM Plane to send fences to the kernel and 1819 + * OUT_FENCE_PTR on each DRM CRTC to receive fences from the kernel. 1820 + * 1821 + * As a contrast, with implicit fencing the kernel keeps track of any 1822 + * ongoing rendering, and automatically ensures that the atomic update waits 1823 + * for any pending rendering to complete. For shared buffers represented with 1824 + * a struct &dma_buf this is tracked in &reservation_object structures. 1825 + * Implicit syncing is how Linux traditionally worked (e.g. DRI2/3 on X.org), 1826 + * whereas explicit fencing is what Android wants. 1827 + * 1828 + * "IN_FENCE_FD”: 1829 + * Use this property to pass a fence that DRM should wait on before 1830 + * proceeding with the Atomic Commit request and show the framebuffer for 1831 + * the plane on the screen. The fence can be either a normal fence or a 1832 + * merged one, the sync_file framework will handle both cases and use a 1833 + * fence_array if a merged fence is received. Passing -1 here means no 1834 + * fences to wait on. 1835 + * 1836 + * If the Atomic Commit request has the DRM_MODE_ATOMIC_TEST_ONLY flag 1837 + * it will only check if the Sync File is a valid one. 1838 + * 1839 + * On the driver side the fence is stored on the @fence parameter of 1840 + * struct &drm_plane_state. Drivers which also support implicit fencing 1841 + * should set the implicit fence using drm_atomic_set_fence_for_plane(), 1842 + * to make sure there's consistent behaviour between drivers in precedence 1843 + * of implicit vs. explicit fencing. 1844 + * 1845 + * "OUT_FENCE_PTR”: 1846 + * Use this property to pass a file descriptor pointer to DRM. Once the 1847 + * Atomic Commit request call returns OUT_FENCE_PTR will be filled with 1848 + * the file descriptor number of a Sync File. This Sync File contains the 1849 + * CRTC fence that will be signaled when all framebuffers present on the 1850 + * Atomic Commit * request for that given CRTC are scanned out on the 1851 + * screen. 1852 + * 1853 + * The Atomic Commit request fails if a invalid pointer is passed. If the 1854 + * Atomic Commit request fails for any other reason the out fence fd 1855 + * returned will be -1. On a Atomic Commit with the 1856 + * DRM_MODE_ATOMIC_TEST_ONLY flag the out fence will also be set to -1. 1857 + * 1858 + * Note that out-fences don't have a special interface to drivers and are 1859 + * internally represented by a struct &drm_pending_vblank_event in struct 1860 + * &drm_crtc_state, which is also used by the nonblocking atomic commit 1861 + * helpers and for the DRM event handling for existing userspace. 1862 + */ 1814 1863 1815 1864 static struct dma_fence *get_crtc_fence(struct drm_crtc *crtc) 1816 1865 {
+43 -35
drivers/gpu/drm/drm_atomic_helper.c
··· 1006 1006 * drm_atomic_helper_wait_for_fences - wait for fences stashed in plane state 1007 1007 * @dev: DRM device 1008 1008 * @state: atomic state object with old state structures 1009 - * @pre_swap: if true, do an interruptible wait 1009 + * @pre_swap: If true, do an interruptible wait, and @state is the new state. 1010 + * Otherwise @state is the old state. 1010 1011 * 1011 1012 * For implicit sync, driver should fish the exclusive fence out from the 1012 1013 * incoming fb's and stash it in the drm_plane_state. This is called after 1013 1014 * drm_atomic_helper_swap_state() so it uses the current plane state (and 1014 1015 * just uses the atomic state to find the changed planes) 1016 + * 1017 + * Note that @pre_swap is needed since the point where we block for fences moves 1018 + * around depending upon whether an atomic commit is blocking or 1019 + * non-blocking. For async commit all waiting needs to happen after 1020 + * drm_atomic_helper_swap_state() is called, but for synchronous commits we want 1021 + * to wait **before** we do anything that can't be easily rolled back. That is 1022 + * before we call drm_atomic_helper_swap_state(). 1015 1023 * 1016 1024 * Returns zero if success or < 0 if dma_fence_wait() fails. 1017 1025 */ ··· 1155 1147 1156 1148 /** 1157 1149 * drm_atomic_helper_commit_tail - commit atomic update to hardware 1158 - * @state: new modeset state to be committed 1150 + * @old_state: atomic state object with old state structures 1159 1151 * 1160 1152 * This is the default implemenation for the ->atomic_commit_tail() hook of the 1161 1153 * &drm_mode_config_helper_funcs vtable. ··· 1166 1158 * 1167 1159 * For drivers supporting runtime PM the recommended sequence is instead :: 1168 1160 * 1169 - * drm_atomic_helper_commit_modeset_disables(dev, state); 1161 + * drm_atomic_helper_commit_modeset_disables(dev, old_state); 1170 1162 * 1171 - * drm_atomic_helper_commit_modeset_enables(dev, state); 1163 + * drm_atomic_helper_commit_modeset_enables(dev, old_state); 1172 1164 * 1173 - * drm_atomic_helper_commit_planes(dev, state, 1165 + * drm_atomic_helper_commit_planes(dev, old_state, 1174 1166 * DRM_PLANE_COMMIT_ACTIVE_ONLY); 1175 1167 * 1176 1168 * for committing the atomic update to hardware. See the kerneldoc entries for 1177 1169 * these three functions for more details. 1178 1170 */ 1179 - void drm_atomic_helper_commit_tail(struct drm_atomic_state *state) 1171 + void drm_atomic_helper_commit_tail(struct drm_atomic_state *old_state) 1180 1172 { 1181 - struct drm_device *dev = state->dev; 1173 + struct drm_device *dev = old_state->dev; 1182 1174 1183 - drm_atomic_helper_commit_modeset_disables(dev, state); 1175 + drm_atomic_helper_commit_modeset_disables(dev, old_state); 1184 1176 1185 - drm_atomic_helper_commit_planes(dev, state, 0); 1177 + drm_atomic_helper_commit_planes(dev, old_state, 0); 1186 1178 1187 - drm_atomic_helper_commit_modeset_enables(dev, state); 1179 + drm_atomic_helper_commit_modeset_enables(dev, old_state); 1188 1180 1189 - drm_atomic_helper_commit_hw_done(state); 1181 + drm_atomic_helper_commit_hw_done(old_state); 1190 1182 1191 - drm_atomic_helper_wait_for_vblanks(dev, state); 1183 + drm_atomic_helper_wait_for_vblanks(dev, old_state); 1192 1184 1193 - drm_atomic_helper_cleanup_planes(dev, state); 1185 + drm_atomic_helper_cleanup_planes(dev, old_state); 1194 1186 } 1195 1187 EXPORT_SYMBOL(drm_atomic_helper_commit_tail); 1196 1188 1197 - static void commit_tail(struct drm_atomic_state *state) 1189 + static void commit_tail(struct drm_atomic_state *old_state) 1198 1190 { 1199 - struct drm_device *dev = state->dev; 1191 + struct drm_device *dev = old_state->dev; 1200 1192 struct drm_mode_config_helper_funcs *funcs; 1201 1193 1202 1194 funcs = dev->mode_config.helper_private; 1203 1195 1204 - drm_atomic_helper_wait_for_fences(dev, state, false); 1196 + drm_atomic_helper_wait_for_fences(dev, old_state, false); 1205 1197 1206 - drm_atomic_helper_wait_for_dependencies(state); 1198 + drm_atomic_helper_wait_for_dependencies(old_state); 1207 1199 1208 1200 if (funcs && funcs->atomic_commit_tail) 1209 - funcs->atomic_commit_tail(state); 1201 + funcs->atomic_commit_tail(old_state); 1210 1202 else 1211 - drm_atomic_helper_commit_tail(state); 1203 + drm_atomic_helper_commit_tail(old_state); 1212 1204 1213 - drm_atomic_helper_commit_cleanup_done(state); 1205 + drm_atomic_helper_commit_cleanup_done(old_state); 1214 1206 1215 - drm_atomic_state_put(state); 1207 + drm_atomic_state_put(old_state); 1216 1208 } 1217 1209 1218 1210 static void commit_work(struct work_struct *work) ··· 1506 1498 1507 1499 /** 1508 1500 * drm_atomic_helper_wait_for_dependencies - wait for required preceeding commits 1509 - * @state: new modeset state to be committed 1501 + * @old_state: atomic state object with old state structures 1510 1502 * 1511 1503 * This function waits for all preceeding commits that touch the same CRTC as 1512 - * @state to both be committed to the hardware (as signalled by 1504 + * @old_state to both be committed to the hardware (as signalled by 1513 1505 * drm_atomic_helper_commit_hw_done) and executed by the hardware (as signalled 1514 1506 * by calling drm_crtc_vblank_send_event on the event member of 1515 1507 * &drm_crtc_state). ··· 1517 1509 * This is part of the atomic helper support for nonblocking commits, see 1518 1510 * drm_atomic_helper_setup_commit() for an overview. 1519 1511 */ 1520 - void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state) 1512 + void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *old_state) 1521 1513 { 1522 1514 struct drm_crtc *crtc; 1523 1515 struct drm_crtc_state *crtc_state; ··· 1525 1517 int i; 1526 1518 long ret; 1527 1519 1528 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 1520 + for_each_crtc_in_state(old_state, crtc, crtc_state, i) { 1529 1521 spin_lock(&crtc->commit_lock); 1530 1522 commit = preceeding_commit(crtc); 1531 1523 if (commit) ··· 1556 1548 1557 1549 /** 1558 1550 * drm_atomic_helper_commit_hw_done - setup possible nonblocking commit 1559 - * @state: new modeset state to be committed 1551 + * @old_state: atomic state object with old state structures 1560 1552 * 1561 1553 * This function is used to signal completion of the hardware commit step. After 1562 1554 * this step the driver is not allowed to read or change any permanent software ··· 1569 1561 * This is part of the atomic helper support for nonblocking commits, see 1570 1562 * drm_atomic_helper_setup_commit() for an overview. 1571 1563 */ 1572 - void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state) 1564 + void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state) 1573 1565 { 1574 1566 struct drm_crtc *crtc; 1575 1567 struct drm_crtc_state *crtc_state; 1576 1568 struct drm_crtc_commit *commit; 1577 1569 int i; 1578 1570 1579 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 1580 - commit = state->crtcs[i].commit; 1571 + for_each_crtc_in_state(old_state, crtc, crtc_state, i) { 1572 + commit = old_state->crtcs[i].commit; 1581 1573 if (!commit) 1582 1574 continue; 1583 1575 ··· 1592 1584 1593 1585 /** 1594 1586 * drm_atomic_helper_commit_cleanup_done - signal completion of commit 1595 - * @state: new modeset state to be committed 1587 + * @old_state: atomic state object with old state structures 1596 1588 * 1597 - * This signals completion of the atomic update @state, including any cleanup 1598 - * work. If used, it must be called right before calling 1589 + * This signals completion of the atomic update @old_state, including any 1590 + * cleanup work. If used, it must be called right before calling 1599 1591 * drm_atomic_state_put(). 1600 1592 * 1601 1593 * This is part of the atomic helper support for nonblocking commits, see 1602 1594 * drm_atomic_helper_setup_commit() for an overview. 1603 1595 */ 1604 - void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *state) 1596 + void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state) 1605 1597 { 1606 1598 struct drm_crtc *crtc; 1607 1599 struct drm_crtc_state *crtc_state; ··· 1609 1601 int i; 1610 1602 long ret; 1611 1603 1612 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 1613 - commit = state->crtcs[i].commit; 1604 + for_each_crtc_in_state(old_state, crtc, crtc_state, i) { 1605 + commit = old_state->crtcs[i].commit; 1614 1606 if (WARN_ON(!commit)) 1615 1607 continue; 1616 1608
+44
drivers/gpu/drm/drm_connector.c
··· 588 588 DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, 589 589 drm_tv_subconnector_enum_list) 590 590 591 + /** 592 + * DOC: standard connector properties 593 + * 594 + * DRM connectors have a few standardized properties: 595 + * 596 + * EDID: 597 + * Blob property which contains the current EDID read from the sink. This 598 + * is useful to parse sink identification information like vendor, model 599 + * and serial. Drivers should update this property by calling 600 + * drm_mode_connector_update_edid_property(), usually after having parsed 601 + * the EDID using drm_add_edid_modes(). Userspace cannot change this 602 + * property. 603 + * DPMS: 604 + * Legacy property for setting the power state of the connector. For atomic 605 + * drivers this is only provided for backwards compatibility with existing 606 + * drivers, it remaps to controlling the "ACTIVE" property on the CRTC the 607 + * connector is linked to. Drivers should never set this property directly, 608 + * it is handled by the DRM core by calling the ->dpms() callback in 609 + * &drm_connector_funcs. Atomic drivers should implement this hook using 610 + * drm_atomic_helper_connector_dpms(). This is the only property standard 611 + * connector property that userspace can change. 612 + * PATH: 613 + * Connector path property to identify how this sink is physically 614 + * connected. Used by DP MST. This should be set by calling 615 + * drm_mode_connector_set_path_property(), in the case of DP MST with the 616 + * path property the MST manager created. Userspace cannot change this 617 + * property. 618 + * TILE: 619 + * Connector tile group property to indicate how a set of DRM connector 620 + * compose together into one logical screen. This is used by both high-res 621 + * external screens (often only using a single cable, but exposing multiple 622 + * DP MST sinks), or high-res integrated panels (like dual-link DSI) which 623 + * are not gen-locked. Note that for tiled panels which are genlocked, like 624 + * dual-link LVDS or dual-link DSI, the driver should try to not expose the 625 + * tiling and virtualize both &drm_crtc and &drm_plane if needed. Drivers 626 + * should update this value using drm_mode_connector_set_tile_property(). 627 + * Userspace cannot change this property. 628 + * 629 + * Connectors also have one standardized atomic property: 630 + * 631 + * CRTC_ID: 632 + * Mode object ID of the &drm_crtc this connector should be connected to. 633 + */ 634 + 591 635 int drm_connector_create_standard_properties(struct drm_device *dev) 592 636 { 593 637 struct drm_property *prop;
+9
drivers/gpu/drm/drm_debugfs.c
··· 228 228 int drm_debugfs_cleanup(struct drm_minor *minor) 229 229 { 230 230 struct drm_device *dev = minor->dev; 231 + int ret; 231 232 232 233 if (!minor->debugfs_root) 233 234 return 0; 234 235 235 236 if (dev->driver->debugfs_cleanup) 236 237 dev->driver->debugfs_cleanup(minor); 238 + 239 + if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { 240 + ret = drm_atomic_debugfs_cleanup(minor); 241 + if (ret) { 242 + DRM_ERROR("DRM: Failed to remove atomic debugfs entries\n"); 243 + return ret; 244 + } 245 + } 237 246 238 247 drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor); 239 248
-6
drivers/gpu/drm/drm_drv.c
··· 497 497 goto err_free; 498 498 } 499 499 500 - if (drm_core_check_feature(dev, DRIVER_MODESET)) { 501 - ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL); 502 - if (ret) 503 - goto err_minors; 504 - } 505 - 506 500 if (drm_core_check_feature(dev, DRIVER_RENDER)) { 507 501 ret = drm_minor_alloc(dev, DRM_MINOR_RENDER); 508 502 if (ret)
+54 -12
drivers/gpu/drm/drm_edid.c
··· 2613 2613 return clock; 2614 2614 } 2615 2615 2616 + static bool 2617 + cea_mode_alternate_timings(u8 vic, struct drm_display_mode *mode) 2618 + { 2619 + /* 2620 + * For certain VICs the spec allows the vertical 2621 + * front porch to vary by one or two lines. 2622 + * 2623 + * cea_modes[] stores the variant with the shortest 2624 + * vertical front porch. We can adjust the mode to 2625 + * get the other variants by simply increasing the 2626 + * vertical front porch length. 2627 + */ 2628 + BUILD_BUG_ON(edid_cea_modes[8].vtotal != 262 || 2629 + edid_cea_modes[9].vtotal != 262 || 2630 + edid_cea_modes[12].vtotal != 262 || 2631 + edid_cea_modes[13].vtotal != 262 || 2632 + edid_cea_modes[23].vtotal != 312 || 2633 + edid_cea_modes[24].vtotal != 312 || 2634 + edid_cea_modes[27].vtotal != 312 || 2635 + edid_cea_modes[28].vtotal != 312); 2636 + 2637 + if (((vic == 8 || vic == 9 || 2638 + vic == 12 || vic == 13) && mode->vtotal < 263) || 2639 + ((vic == 23 || vic == 24 || 2640 + vic == 27 || vic == 28) && mode->vtotal < 314)) { 2641 + mode->vsync_start++; 2642 + mode->vsync_end++; 2643 + mode->vtotal++; 2644 + 2645 + return true; 2646 + } 2647 + 2648 + return false; 2649 + } 2650 + 2616 2651 static u8 drm_match_cea_mode_clock_tolerance(const struct drm_display_mode *to_match, 2617 2652 unsigned int clock_tolerance) 2618 2653 { ··· 2657 2622 return 0; 2658 2623 2659 2624 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 2660 - const struct drm_display_mode *cea_mode = &edid_cea_modes[vic]; 2625 + struct drm_display_mode cea_mode = edid_cea_modes[vic]; 2661 2626 unsigned int clock1, clock2; 2662 2627 2663 2628 /* Check both 60Hz and 59.94Hz */ 2664 - clock1 = cea_mode->clock; 2665 - clock2 = cea_mode_alternate_clock(cea_mode); 2629 + clock1 = cea_mode.clock; 2630 + clock2 = cea_mode_alternate_clock(&cea_mode); 2666 2631 2667 2632 if (abs(to_match->clock - clock1) > clock_tolerance && 2668 2633 abs(to_match->clock - clock2) > clock_tolerance) 2669 2634 continue; 2670 2635 2671 - if (drm_mode_equal_no_clocks(to_match, cea_mode)) 2672 - return vic; 2636 + do { 2637 + if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode)) 2638 + return vic; 2639 + } while (cea_mode_alternate_timings(vic, &cea_mode)); 2673 2640 } 2674 2641 2675 2642 return 0; ··· 2692 2655 return 0; 2693 2656 2694 2657 for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 2695 - const struct drm_display_mode *cea_mode = &edid_cea_modes[vic]; 2658 + struct drm_display_mode cea_mode = edid_cea_modes[vic]; 2696 2659 unsigned int clock1, clock2; 2697 2660 2698 2661 /* Check both 60Hz and 59.94Hz */ 2699 - clock1 = cea_mode->clock; 2700 - clock2 = cea_mode_alternate_clock(cea_mode); 2662 + clock1 = cea_mode.clock; 2663 + clock2 = cea_mode_alternate_clock(&cea_mode); 2701 2664 2702 - if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) || 2703 - KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) && 2704 - drm_mode_equal_no_clocks_no_stereo(to_match, cea_mode)) 2705 - return vic; 2665 + if (KHZ2PICOS(to_match->clock) != KHZ2PICOS(clock1) && 2666 + KHZ2PICOS(to_match->clock) != KHZ2PICOS(clock2)) 2667 + continue; 2668 + 2669 + do { 2670 + if (drm_mode_equal_no_clocks_no_stereo(to_match, &cea_mode)) 2671 + return vic; 2672 + } while (cea_mode_alternate_timings(vic, &cea_mode)); 2706 2673 } 2674 + 2707 2675 return 0; 2708 2676 } 2709 2677 EXPORT_SYMBOL(drm_match_cea_mode);
+7 -6
drivers/gpu/drm/drm_fb_helper.c
··· 1959 1959 bool *enabled, int width, int height) 1960 1960 { 1961 1961 struct drm_fb_helper_connector *fb_helper_conn; 1962 - int i; 1963 - uint64_t conn_configured = 0, mask; 1962 + const u64 mask = BIT_ULL(fb_helper->connector_count) - 1; 1963 + u64 conn_configured = 0; 1964 1964 int tile_pass = 0; 1965 - mask = (1 << fb_helper->connector_count) - 1; 1965 + int i; 1966 + 1966 1967 retry: 1967 1968 for (i = 0; i < fb_helper->connector_count; i++) { 1968 1969 fb_helper_conn = fb_helper->connector_info[i]; 1969 1970 1970 - if (conn_configured & (1 << i)) 1971 + if (conn_configured & BIT_ULL(i)) 1971 1972 continue; 1972 1973 1973 1974 if (enabled[i] == false) { 1974 - conn_configured |= (1 << i); 1975 + conn_configured |= BIT_ULL(i); 1975 1976 continue; 1976 1977 } 1977 1978 ··· 2013 2012 } 2014 2013 DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name : 2015 2014 "none"); 2016 - conn_configured |= (1 << i); 2015 + conn_configured |= BIT_ULL(i); 2017 2016 } 2018 2017 2019 2018 if ((conn_configured & mask) != mask) {
+7
drivers/gpu/drm/drm_framebuffer.c
··· 177 177 return -EINVAL; 178 178 } 179 179 180 + if (r->flags & DRM_MODE_FB_MODIFIERS && 181 + r->modifier[i] != r->modifier[0]) { 182 + DRM_DEBUG_KMS("bad fb modifier %llu for plane %d\n", 183 + r->modifier[i], i); 184 + return -EINVAL; 185 + } 186 + 180 187 /* modifier specific checks: */ 181 188 switch (r->modifier[i]) { 182 189 case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
+2 -1
drivers/gpu/drm/drm_lock.c
··· 176 176 177 177 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", 178 178 lock->context, task_pid_nr(current), 179 - master->lock.hw_lock->lock, lock->flags); 179 + master->lock.hw_lock ? master->lock.hw_lock->lock : -1, 180 + lock->flags); 180 181 181 182 add_wait_queue(&master->lock.lock_queue, &entry); 182 183 spin_lock_bh(&master->lock.spinlock);
+10 -12
drivers/gpu/drm/drm_mm.c
··· 174 174 START, LAST, static inline, drm_mm_interval_tree) 175 175 176 176 struct drm_mm_node * 177 - drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last) 177 + __drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last) 178 178 { 179 179 return drm_mm_interval_tree_iter_first(&mm->interval_tree, 180 180 start, last); 181 181 } 182 - EXPORT_SYMBOL(drm_mm_interval_first); 183 - 184 - struct drm_mm_node * 185 - drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last) 186 - { 187 - return drm_mm_interval_tree_iter_next(node, start, last); 188 - } 189 - EXPORT_SYMBOL(drm_mm_interval_next); 182 + EXPORT_SYMBOL(__drm_mm_interval_first); 190 183 191 184 static void drm_mm_interval_tree_add_node(struct drm_mm_node *hole_node, 192 185 struct drm_mm_node *node) ··· 306 313 u64 end = node->start + node->size; 307 314 struct drm_mm_node *hole; 308 315 u64 hole_start, hole_end; 316 + u64 adj_start, adj_end; 309 317 310 318 if (WARN_ON(node->size == 0)) 311 319 return -EINVAL; ··· 328 334 if (!hole->hole_follows) 329 335 return -ENOSPC; 330 336 331 - hole_start = __drm_mm_hole_node_start(hole); 332 - hole_end = __drm_mm_hole_node_end(hole); 333 - if (hole_start > node->start || hole_end < end) 337 + adj_start = hole_start = __drm_mm_hole_node_start(hole); 338 + adj_end = hole_end = __drm_mm_hole_node_end(hole); 339 + 340 + if (mm->color_adjust) 341 + mm->color_adjust(hole, node->color, &adj_start, &adj_end); 342 + 343 + if (adj_start > node->start || adj_end < end) 334 344 return -ENOSPC; 335 345 336 346 node->mm = mm;
+4 -3
drivers/gpu/drm/drm_modeset_helper.c
··· 38 38 * Some userspace presumes that the first connected connector is the main 39 39 * display, where it's supposed to display e.g. the login screen. For 40 40 * laptops, this should be the main panel. Use this function to sort all 41 - * (eDP/LVDS) panels to the front of the connector list, instead of 41 + * (eDP/LVDS/DSI) panels to the front of the connector list, instead of 42 42 * painstakingly trying to initialize them in the right order. 43 43 */ 44 44 void drm_helper_move_panel_connectors_to_head(struct drm_device *dev) ··· 51 51 list_for_each_entry_safe(connector, tmp, 52 52 &dev->mode_config.connector_list, head) { 53 53 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS || 54 - connector->connector_type == DRM_MODE_CONNECTOR_eDP) 54 + connector->connector_type == DRM_MODE_CONNECTOR_eDP || 55 + connector->connector_type == DRM_MODE_CONNECTOR_DSI) 55 56 list_move_tail(&connector->head, &panel_list); 56 57 } 57 58 ··· 94 93 for (i = 0; i < 4; i++) { 95 94 fb->pitches[i] = mode_cmd->pitches[i]; 96 95 fb->offsets[i] = mode_cmd->offsets[i]; 97 - fb->modifier[i] = mode_cmd->modifier[i]; 98 96 } 97 + fb->modifier = mode_cmd->modifier[0]; 99 98 fb->pixel_format = mode_cmd->pixel_format; 100 99 fb->flags = mode_cmd->flags; 101 100 }
+27 -27
drivers/gpu/drm/drm_property.c
··· 65 65 * @num_values: number of pre-defined values 66 66 * 67 67 * This creates a new generic drm property which can then be attached to a drm 68 - * object with drm_object_attach_property. The returned property object must be 69 - * freed with drm_property_destroy(), which is done automatically when calling 70 - * drm_mode_config_cleanup(). 68 + * object with drm_object_attach_property(). The returned property object must 69 + * be freed with drm_property_destroy(), which is done automatically when 70 + * calling drm_mode_config_cleanup(). 71 71 * 72 72 * Returns: 73 73 * A pointer to the newly created property on success, NULL on failure. ··· 125 125 * @num_values: number of pre-defined values 126 126 * 127 127 * This creates a new generic drm property which can then be attached to a drm 128 - * object with drm_object_attach_property. The returned property object must be 129 - * freed with drm_property_destroy(), which is done automatically when calling 130 - * drm_mode_config_cleanup(). 128 + * object with drm_object_attach_property(). The returned property object must 129 + * be freed with drm_property_destroy(), which is done automatically when 130 + * calling drm_mode_config_cleanup(). 131 131 * 132 132 * Userspace is only allowed to set one of the predefined values for enumeration 133 133 * properties. ··· 173 173 * @supported_bits: bitmask of all supported enumeration values 174 174 * 175 175 * This creates a new bitmask drm property which can then be attached to a drm 176 - * object with drm_object_attach_property. The returned property object must be 177 - * freed with drm_property_destroy(), which is done automatically when calling 178 - * drm_mode_config_cleanup(). 176 + * object with drm_object_attach_property(). The returned property object must 177 + * be freed with drm_property_destroy(), which is done automatically when 178 + * calling drm_mode_config_cleanup(). 179 179 * 180 180 * Compared to plain enumeration properties userspace is allowed to set any 181 181 * or'ed together combination of the predefined property bitflag values ··· 245 245 * @max: maximum value of the property 246 246 * 247 247 * This creates a new generic drm property which can then be attached to a drm 248 - * object with drm_object_attach_property. The returned property object must be 249 - * freed with drm_property_destroy(), which is done automatically when calling 250 - * drm_mode_config_cleanup(). 248 + * object with drm_object_attach_property(). The returned property object must 249 + * be freed with drm_property_destroy(), which is done automatically when 250 + * calling drm_mode_config_cleanup(). 251 251 * 252 252 * Userspace is allowed to set any unsigned integer value in the (min, max) 253 253 * range inclusive. ··· 273 273 * @max: maximum value of the property 274 274 * 275 275 * This creates a new generic drm property which can then be attached to a drm 276 - * object with drm_object_attach_property. The returned property object must be 277 - * freed with drm_property_destroy(), which is done automatically when calling 278 - * drm_mode_config_cleanup(). 276 + * object with drm_object_attach_property(). The returned property object must 277 + * be freed with drm_property_destroy(), which is done automatically when 278 + * calling drm_mode_config_cleanup(). 279 279 * 280 280 * Userspace is allowed to set any signed integer value in the (min, max) 281 281 * range inclusive. ··· 300 300 * @type: object type from DRM_MODE_OBJECT_* defines 301 301 * 302 302 * This creates a new generic drm property which can then be attached to a drm 303 - * object with drm_object_attach_property. The returned property object must be 304 - * freed with drm_property_destroy(), which is done automatically when calling 305 - * drm_mode_config_cleanup(). 303 + * object with drm_object_attach_property(). The returned property object must 304 + * be freed with drm_property_destroy(), which is done automatically when 305 + * calling drm_mode_config_cleanup(). 306 306 * 307 307 * Userspace is only allowed to set this to any property value of the given 308 308 * @type. Only useful for atomic properties, which is enforced. ··· 338 338 * @name: name of the property 339 339 * 340 340 * This creates a new generic drm property which can then be attached to a drm 341 - * object with drm_object_attach_property. The returned property object must be 342 - * freed with drm_property_destroy(), which is done automatically when calling 343 - * drm_mode_config_cleanup(). 341 + * object with drm_object_attach_property(). The returned property object must 342 + * be freed with drm_property_destroy(), which is done automatically when 343 + * calling drm_mode_config_cleanup(). 344 344 * 345 345 * This is implemented as a ranged property with only {0, 1} as valid values. 346 346 * ··· 729 729 struct drm_mode_get_blob *out_resp = data; 730 730 struct drm_property_blob *blob; 731 731 int ret = 0; 732 - void __user *blob_ptr; 733 732 734 733 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 735 734 return -EINVAL; ··· 738 739 return -ENOENT; 739 740 740 741 if (out_resp->length == blob->length) { 741 - blob_ptr = (void __user *)(unsigned long)out_resp->data; 742 - if (copy_to_user(blob_ptr, blob->data, blob->length)) { 742 + if (copy_to_user(u64_to_user_ptr(out_resp->data), 743 + blob->data, 744 + blob->length)) { 743 745 ret = -EFAULT; 744 746 goto unref; 745 747 } ··· 757 757 { 758 758 struct drm_mode_create_blob *out_resp = data; 759 759 struct drm_property_blob *blob; 760 - void __user *blob_ptr; 761 760 int ret = 0; 762 761 763 762 if (!drm_core_check_feature(dev, DRIVER_MODESET)) ··· 766 767 if (IS_ERR(blob)) 767 768 return PTR_ERR(blob); 768 769 769 - blob_ptr = (void __user *)(unsigned long)out_resp->data; 770 - if (copy_from_user(blob->data, blob_ptr, out_resp->length)) { 770 + if (copy_from_user(blob->data, 771 + u64_to_user_ptr(out_resp->data), 772 + out_resp->length)) { 771 773 ret = -EFAULT; 772 774 goto out_blob; 773 775 }
+4 -4
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
··· 94 94 .irq_handler = hibmc_drm_interrupt, 95 95 }; 96 96 97 - static int hibmc_pm_suspend(struct device *dev) 97 + static int __maybe_unused hibmc_pm_suspend(struct device *dev) 98 98 { 99 99 struct pci_dev *pdev = to_pci_dev(dev); 100 100 struct drm_device *drm_dev = pci_get_drvdata(pdev); ··· 112 112 return 0; 113 113 } 114 114 115 - static int hibmc_pm_resume(struct device *dev) 115 + static int __maybe_unused hibmc_pm_resume(struct device *dev) 116 116 { 117 117 struct pci_dev *pdev = to_pci_dev(dev); 118 118 struct drm_device *drm_dev = pci_get_drvdata(pdev); ··· 377 377 int ret; 378 378 379 379 dev = drm_dev_alloc(&hibmc_driver, &pdev->dev); 380 - if (!dev) { 380 + if (IS_ERR(dev)) { 381 381 DRM_ERROR("failed to allocate drm_device\n"); 382 - return -ENOMEM; 382 + return PTR_ERR(dev); 383 383 } 384 384 385 385 dev->pdev = pdev;
+2 -2
drivers/gpu/drm/i915/i915_debugfs.c
··· 1896 1896 fbdev_fb->base.height, 1897 1897 fbdev_fb->base.depth, 1898 1898 fbdev_fb->base.bits_per_pixel, 1899 - fbdev_fb->base.modifier[0], 1899 + fbdev_fb->base.modifier, 1900 1900 drm_framebuffer_read_refcount(&fbdev_fb->base)); 1901 1901 describe_obj(m, fbdev_fb->obj); 1902 1902 seq_putc(m, '\n'); ··· 1914 1914 fb->base.height, 1915 1915 fb->base.depth, 1916 1916 fb->base.bits_per_pixel, 1917 - fb->base.modifier[0], 1917 + fb->base.modifier, 1918 1918 drm_framebuffer_read_refcount(&fb->base)); 1919 1919 describe_obj(m, fb->obj); 1920 1920 seq_putc(m, '\n');
+2 -2
drivers/gpu/drm/i915/intel_atomic_plane.c
··· 144 144 if (state->fb && drm_rotation_90_or_270(state->rotation)) { 145 145 struct drm_format_name_buf format_name; 146 146 147 - if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || 148 - state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) { 147 + if (state->fb->modifier != I915_FORMAT_MOD_Y_TILED && 148 + state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) { 149 149 DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n"); 150 150 return -EINVAL; 151 151 }
+36 -36
drivers/gpu/drm/i915/intel_display.c
··· 2189 2189 2190 2190 WARN_ON(!mutex_is_locked(&dev->struct_mutex)); 2191 2191 2192 - alignment = intel_surf_alignment(dev_priv, fb->modifier[0]); 2192 + alignment = intel_surf_alignment(dev_priv, fb->modifier); 2193 2193 2194 2194 intel_fill_fb_ggtt_view(&view, fb, rotation); 2195 2195 ··· 2350 2350 2351 2351 WARN_ON(new_offset > old_offset); 2352 2352 2353 - if (fb->modifier[plane] != DRM_FORMAT_MOD_NONE) { 2353 + if (fb->modifier != DRM_FORMAT_MOD_NONE) { 2354 2354 unsigned int tile_size, tile_width, tile_height; 2355 2355 unsigned int pitch_tiles; 2356 2356 2357 2357 tile_size = intel_tile_size(dev_priv); 2358 2358 intel_tile_dims(dev_priv, &tile_width, &tile_height, 2359 - fb->modifier[plane], cpp); 2359 + fb->modifier, cpp); 2360 2360 2361 2361 if (drm_rotation_90_or_270(rotation)) { 2362 2362 pitch_tiles = pitch / tile_height; ··· 2399 2399 unsigned int rotation, 2400 2400 u32 alignment) 2401 2401 { 2402 - uint64_t fb_modifier = fb->modifier[plane]; 2402 + uint64_t fb_modifier = fb->modifier; 2403 2403 unsigned int cpp = drm_format_plane_cpp(fb->pixel_format, plane); 2404 2404 u32 offset, offset_aligned; 2405 2405 ··· 2458 2458 if (fb->pixel_format == DRM_FORMAT_NV12 && plane == 1) 2459 2459 alignment = 4096; 2460 2460 else 2461 - alignment = intel_surf_alignment(dev_priv, fb->modifier[plane]); 2461 + alignment = intel_surf_alignment(dev_priv, fb->modifier); 2462 2462 2463 2463 return _intel_compute_tile_offset(dev_priv, x, y, fb, plane, pitch, 2464 2464 rotation, alignment); ··· 2540 2540 DRM_ROTATE_0, tile_size); 2541 2541 offset /= tile_size; 2542 2542 2543 - if (fb->modifier[i] != DRM_FORMAT_MOD_NONE) { 2543 + if (fb->modifier != DRM_FORMAT_MOD_NONE) { 2544 2544 unsigned int tile_width, tile_height; 2545 2545 unsigned int pitch_tiles; 2546 2546 struct drm_rect r; 2547 2547 2548 2548 intel_tile_dims(dev_priv, &tile_width, &tile_height, 2549 - fb->modifier[i], cpp); 2549 + fb->modifier, cpp); 2550 2550 2551 2551 rot_info->plane[i].offset = offset; 2552 2552 rot_info->plane[i].stride = DIV_ROUND_UP(fb->pitches[i], tile_width * cpp); ··· 2705 2705 mode_cmd.width = fb->width; 2706 2706 mode_cmd.height = fb->height; 2707 2707 mode_cmd.pitches[0] = fb->pitches[0]; 2708 - mode_cmd.modifier[0] = fb->modifier[0]; 2708 + mode_cmd.modifier[0] = fb->modifier; 2709 2709 mode_cmd.flags = DRM_MODE_FB_MODIFIERS; 2710 2710 2711 2711 if (intel_framebuffer_init(dev, to_intel_framebuffer(fb), ··· 2835 2835 { 2836 2836 int cpp = drm_format_plane_cpp(fb->pixel_format, plane); 2837 2837 2838 - switch (fb->modifier[plane]) { 2838 + switch (fb->modifier) { 2839 2839 case DRM_FORMAT_MOD_NONE: 2840 2840 case I915_FORMAT_MOD_X_TILED: 2841 2841 switch (cpp) { ··· 2866 2866 } 2867 2867 break; 2868 2868 default: 2869 - MISSING_CASE(fb->modifier[plane]); 2869 + MISSING_CASE(fb->modifier); 2870 2870 } 2871 2871 2872 2872 return 2048; ··· 2894 2894 intel_add_fb_offsets(&x, &y, plane_state, 0); 2895 2895 offset = intel_compute_tile_offset(&x, &y, plane_state, 0); 2896 2896 2897 - alignment = intel_surf_alignment(dev_priv, fb->modifier[0]); 2897 + alignment = intel_surf_alignment(dev_priv, fb->modifier); 2898 2898 2899 2899 /* 2900 2900 * AUX surface offset is specified as the distance from the ··· 2911 2911 * 2912 2912 * TODO: linear and Y-tiled seem fine, Yf untested, 2913 2913 */ 2914 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) { 2914 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) { 2915 2915 int cpp = drm_format_plane_cpp(fb->pixel_format, 0); 2916 2916 2917 2917 while ((x + w) * cpp > fb->pitches[0]) { ··· 3059 3059 } 3060 3060 3061 3061 if (INTEL_GEN(dev_priv) >= 4 && 3062 - fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 3062 + fb->modifier == I915_FORMAT_MOD_X_TILED) 3063 3063 dspcntr |= DISPPLANE_TILED; 3064 3064 3065 3065 if (rotation & DRM_ROTATE_180) ··· 3170 3170 BUG(); 3171 3171 } 3172 3172 3173 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 3173 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 3174 3174 dspcntr |= DISPPLANE_TILED; 3175 3175 3176 3176 if (rotation & DRM_ROTATE_180) ··· 3280 3280 if (drm_rotation_90_or_270(rotation)) { 3281 3281 int cpp = drm_format_plane_cpp(fb->pixel_format, plane); 3282 3282 3283 - stride /= intel_tile_height(dev_priv, fb->modifier[0], cpp); 3283 + stride /= intel_tile_height(dev_priv, fb->modifier, cpp); 3284 3284 } else { 3285 - stride /= intel_fb_stride_alignment(dev_priv, fb->modifier[0], 3285 + stride /= intel_fb_stride_alignment(dev_priv, fb->modifier, 3286 3286 fb->pixel_format); 3287 3287 } 3288 3288 ··· 3398 3398 PLANE_CTL_PIPE_CSC_ENABLE; 3399 3399 3400 3400 plane_ctl |= skl_plane_ctl_format(fb->pixel_format); 3401 - plane_ctl |= skl_plane_ctl_tiling(fb->modifier[0]); 3401 + plane_ctl |= skl_plane_ctl_tiling(fb->modifier); 3402 3402 plane_ctl |= PLANE_CTL_PLANE_GAMMA_DISABLE; 3403 3403 plane_ctl |= skl_plane_ctl_rotation(rotation); 3404 3404 ··· 8707 8707 if (INTEL_GEN(dev_priv) >= 4) { 8708 8708 if (val & DISPPLANE_TILED) { 8709 8709 plane_config->tiling = I915_TILING_X; 8710 - fb->modifier[0] = I915_FORMAT_MOD_X_TILED; 8710 + fb->modifier = I915_FORMAT_MOD_X_TILED; 8711 8711 } 8712 8712 } 8713 8713 ··· 8736 8736 8737 8737 aligned_height = intel_fb_align_height(dev, fb->height, 8738 8738 fb->pixel_format, 8739 - fb->modifier[0]); 8739 + fb->modifier); 8740 8740 8741 8741 plane_config->size = fb->pitches[0] * aligned_height; 8742 8742 ··· 9748 9748 tiling = val & PLANE_CTL_TILED_MASK; 9749 9749 switch (tiling) { 9750 9750 case PLANE_CTL_TILED_LINEAR: 9751 - fb->modifier[0] = DRM_FORMAT_MOD_NONE; 9751 + fb->modifier = DRM_FORMAT_MOD_NONE; 9752 9752 break; 9753 9753 case PLANE_CTL_TILED_X: 9754 9754 plane_config->tiling = I915_TILING_X; 9755 - fb->modifier[0] = I915_FORMAT_MOD_X_TILED; 9755 + fb->modifier = I915_FORMAT_MOD_X_TILED; 9756 9756 break; 9757 9757 case PLANE_CTL_TILED_Y: 9758 - fb->modifier[0] = I915_FORMAT_MOD_Y_TILED; 9758 + fb->modifier = I915_FORMAT_MOD_Y_TILED; 9759 9759 break; 9760 9760 case PLANE_CTL_TILED_YF: 9761 - fb->modifier[0] = I915_FORMAT_MOD_Yf_TILED; 9761 + fb->modifier = I915_FORMAT_MOD_Yf_TILED; 9762 9762 break; 9763 9763 default: 9764 9764 MISSING_CASE(tiling); ··· 9775 9775 fb->width = ((val >> 0) & 0x1fff) + 1; 9776 9776 9777 9777 val = I915_READ(PLANE_STRIDE(pipe, 0)); 9778 - stride_mult = intel_fb_stride_alignment(dev_priv, fb->modifier[0], 9778 + stride_mult = intel_fb_stride_alignment(dev_priv, fb->modifier, 9779 9779 fb->pixel_format); 9780 9780 fb->pitches[0] = (val & 0x3ff) * stride_mult; 9781 9781 9782 9782 aligned_height = intel_fb_align_height(dev, fb->height, 9783 9783 fb->pixel_format, 9784 - fb->modifier[0]); 9784 + fb->modifier); 9785 9785 9786 9786 plane_config->size = fb->pitches[0] * aligned_height; 9787 9787 ··· 9849 9849 if (INTEL_GEN(dev_priv) >= 4) { 9850 9850 if (val & DISPPLANE_TILED) { 9851 9851 plane_config->tiling = I915_TILING_X; 9852 - fb->modifier[0] = I915_FORMAT_MOD_X_TILED; 9852 + fb->modifier = I915_FORMAT_MOD_X_TILED; 9853 9853 } 9854 9854 } 9855 9855 ··· 9878 9878 9879 9879 aligned_height = intel_fb_align_height(dev, fb->height, 9880 9880 fb->pixel_format, 9881 - fb->modifier[0]); 9881 + fb->modifier); 9882 9882 9883 9883 plane_config->size = fb->pitches[0] * aligned_height; 9884 9884 ··· 11784 11784 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); 11785 11785 intel_ring_emit(ring, fb->pitches[0]); 11786 11786 intel_ring_emit(ring, intel_crtc->flip_work->gtt_offset | 11787 - intel_fb_modifier_to_tiling(fb->modifier[0])); 11787 + intel_fb_modifier_to_tiling(fb->modifier)); 11788 11788 11789 11789 /* XXX Enabling the panel-fitter across page-flip is so far 11790 11790 * untested on non-native modes, so ignore it for now. ··· 11817 11817 intel_ring_emit(ring, MI_DISPLAY_FLIP | 11818 11818 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); 11819 11819 intel_ring_emit(ring, fb->pitches[0] | 11820 - intel_fb_modifier_to_tiling(fb->modifier[0])); 11820 + intel_fb_modifier_to_tiling(fb->modifier)); 11821 11821 intel_ring_emit(ring, intel_crtc->flip_work->gtt_offset); 11822 11822 11823 11823 /* Contrary to the suggestions in the documentation, ··· 11923 11923 11924 11924 intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); 11925 11925 intel_ring_emit(ring, fb->pitches[0] | 11926 - intel_fb_modifier_to_tiling(fb->modifier[0])); 11926 + intel_fb_modifier_to_tiling(fb->modifier)); 11927 11927 intel_ring_emit(ring, intel_crtc->flip_work->gtt_offset); 11928 11928 intel_ring_emit(ring, (MI_NOOP)); 11929 11929 ··· 11969 11969 11970 11970 ctl = I915_READ(PLANE_CTL(pipe, 0)); 11971 11971 ctl &= ~PLANE_CTL_TILED_MASK; 11972 - switch (fb->modifier[0]) { 11972 + switch (fb->modifier) { 11973 11973 case DRM_FORMAT_MOD_NONE: 11974 11974 break; 11975 11975 case I915_FORMAT_MOD_X_TILED: ··· 11982 11982 ctl |= PLANE_CTL_TILED_YF; 11983 11983 break; 11984 11984 default: 11985 - MISSING_CASE(fb->modifier[0]); 11985 + MISSING_CASE(fb->modifier); 11986 11986 } 11987 11987 11988 11988 /* ··· 12007 12007 12008 12008 dspcntr = I915_READ(reg); 12009 12009 12010 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 12010 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 12011 12011 dspcntr |= DISPPLANE_TILED; 12012 12012 else 12013 12013 dspcntr &= ~DISPPLANE_TILED; ··· 12223 12223 12224 12224 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { 12225 12225 engine = dev_priv->engine[BCS]; 12226 - if (fb->modifier[0] != old_fb->modifier[0]) 12226 + if (fb->modifier != old_fb->modifier) 12227 12227 /* vlv: DISPLAY_FLIP fails to change tiling */ 12228 12228 engine = NULL; 12229 12229 } else if (IS_IVYBRIDGE(dev_priv) || IS_HASWELL(dev_priv)) { ··· 12379 12379 if (!cur->base.fb || !new->base.fb) 12380 12380 return false; 12381 12381 12382 - if (cur->base.fb->modifier[0] != new->base.fb->modifier[0] || 12382 + if (cur->base.fb->modifier != new->base.fb->modifier || 12383 12383 cur->base.rotation != new->base.rotation || 12384 12384 drm_rect_width(&new->base.src) != drm_rect_width(&cur->base.src) || 12385 12385 drm_rect_height(&new->base.src) != drm_rect_height(&cur->base.src) || ··· 15106 15106 return -ENOMEM; 15107 15107 } 15108 15108 15109 - if (fb->modifier[0] != DRM_FORMAT_MOD_NONE) { 15109 + if (fb->modifier != DRM_FORMAT_MOD_NONE) { 15110 15110 DRM_DEBUG_KMS("cursor cannot be tiled\n"); 15111 15111 return -EINVAL; 15112 15112 }
+1 -1
drivers/gpu/drm/i915/intel_fbdev.c
··· 633 633 cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; 634 634 cur_size = intel_fb_align_height(dev, cur_size, 635 635 fb->base.pixel_format, 636 - fb->base.modifier[0]); 636 + fb->base.modifier); 637 637 cur_size *= fb->base.pitches[0]; 638 638 DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", 639 639 pipe_name(intel_crtc->pipe),
+11 -11
drivers/gpu/drm/i915/intel_pm.c
··· 3067 3067 latency = dev_priv->wm.skl_latency[level]; 3068 3068 3069 3069 if (skl_needs_memory_bw_wa(intel_state) && 3070 - plane->base.state->fb->modifier[0] == 3070 + plane->base.state->fb->modifier == 3071 3071 I915_FORMAT_MOD_X_TILED) 3072 3072 latency += 15; 3073 3073 ··· 3327 3327 return 0; 3328 3328 3329 3329 /* For Non Y-tile return 8-blocks */ 3330 - if (fb->modifier[0] != I915_FORMAT_MOD_Y_TILED && 3331 - fb->modifier[0] != I915_FORMAT_MOD_Yf_TILED) 3330 + if (fb->modifier != I915_FORMAT_MOD_Y_TILED && 3331 + fb->modifier != I915_FORMAT_MOD_Yf_TILED) 3332 3332 return 8; 3333 3333 3334 3334 src_w = drm_rect_width(&intel_pstate->base.src) >> 16; ··· 3597 3597 return 0; 3598 3598 } 3599 3599 3600 - if (apply_memory_bw_wa && fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 3600 + if (apply_memory_bw_wa && fb->modifier == I915_FORMAT_MOD_X_TILED) 3601 3601 latency += 15; 3602 3602 3603 3603 width = drm_rect_width(&intel_pstate->base.src) >> 16; ··· 3636 3636 y_min_scanlines *= 2; 3637 3637 3638 3638 plane_bytes_per_line = width * cpp; 3639 - if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || 3640 - fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) { 3639 + if (fb->modifier == I915_FORMAT_MOD_Y_TILED || 3640 + fb->modifier == I915_FORMAT_MOD_Yf_TILED) { 3641 3641 plane_blocks_per_line = 3642 3642 DIV_ROUND_UP(plane_bytes_per_line * y_min_scanlines, 512); 3643 3643 plane_blocks_per_line /= y_min_scanlines; 3644 - } else if (fb->modifier[0] == DRM_FORMAT_MOD_NONE) { 3644 + } else if (fb->modifier == DRM_FORMAT_MOD_NONE) { 3645 3645 plane_blocks_per_line = DIV_ROUND_UP(plane_bytes_per_line, 512) 3646 3646 + 1; 3647 3647 } else { ··· 3656 3656 3657 3657 y_tile_minimum = plane_blocks_per_line * y_min_scanlines; 3658 3658 3659 - if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || 3660 - fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) { 3659 + if (fb->modifier == I915_FORMAT_MOD_Y_TILED || 3660 + fb->modifier == I915_FORMAT_MOD_Yf_TILED) { 3661 3661 selected_result = max(method2, y_tile_minimum); 3662 3662 } else { 3663 3663 if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) && ··· 3673 3673 res_lines = DIV_ROUND_UP(selected_result, plane_blocks_per_line); 3674 3674 3675 3675 if (level >= 1 && level <= 7) { 3676 - if (fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || 3677 - fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) { 3676 + if (fb->modifier == I915_FORMAT_MOD_Y_TILED || 3677 + fb->modifier == I915_FORMAT_MOD_Yf_TILED) { 3678 3678 res_blocks += y_tile_minimum; 3679 3679 res_lines += y_min_scanlines; 3680 3680 } else {
+7 -7
drivers/gpu/drm/i915/intel_sprite.c
··· 224 224 PLANE_CTL_PIPE_CSC_ENABLE; 225 225 226 226 plane_ctl |= skl_plane_ctl_format(fb->pixel_format); 227 - plane_ctl |= skl_plane_ctl_tiling(fb->modifier[0]); 227 + plane_ctl |= skl_plane_ctl_tiling(fb->modifier); 228 228 229 229 plane_ctl |= skl_plane_ctl_rotation(rotation); 230 230 ··· 406 406 */ 407 407 sprctl |= SP_GAMMA_ENABLE; 408 408 409 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 409 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 410 410 sprctl |= SP_TILED; 411 411 412 412 if (rotation & DRM_ROTATE_180) ··· 448 448 I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]); 449 449 I915_WRITE(SPPOS(pipe, plane), (crtc_y << 16) | crtc_x); 450 450 451 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 451 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 452 452 I915_WRITE(SPTILEOFF(pipe, plane), (y << 16) | x); 453 453 else 454 454 I915_WRITE(SPLINOFF(pipe, plane), linear_offset); ··· 531 531 */ 532 532 sprctl |= SPRITE_GAMMA_ENABLE; 533 533 534 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 534 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 535 535 sprctl |= SPRITE_TILED; 536 536 537 537 if (rotation & DRM_ROTATE_180) ··· 584 584 * register */ 585 585 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 586 586 I915_WRITE(SPROFFSET(pipe), (y << 16) | x); 587 - else if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 587 + else if (fb->modifier == I915_FORMAT_MOD_X_TILED) 588 588 I915_WRITE(SPRTILEOFF(pipe), (y << 16) | x); 589 589 else 590 590 I915_WRITE(SPRLINOFF(pipe), linear_offset); ··· 669 669 */ 670 670 dvscntr |= DVS_GAMMA_ENABLE; 671 671 672 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 672 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 673 673 dvscntr |= DVS_TILED; 674 674 675 675 if (rotation & DRM_ROTATE_180) ··· 712 712 I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]); 713 713 I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x); 714 714 715 - if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) 715 + if (fb->modifier == I915_FORMAT_MOD_X_TILED) 716 716 I915_WRITE(DVSTILEOFF(pipe), (y << 16) | x); 717 717 else 718 718 I915_WRITE(DVSLINOFF(pipe), linear_offset);
+1 -1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
··· 40 40 { 41 41 bool is_tile = false; 42 42 43 - if (fb->modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) 43 + if (fb->modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) 44 44 is_tile = true; 45 45 46 46 if (fb->pixel_format == DRM_FORMAT_NV12 && is_tile)
+34 -31
drivers/gpu/vga/vgaarb.c
··· 31 31 32 32 #define pr_fmt(fmt) "vgaarb: " fmt 33 33 34 + #define vgaarb_dbg(dev, fmt, arg...) dev_dbg(dev, "vgaarb: " fmt, ##arg) 35 + #define vgaarb_info(dev, fmt, arg...) dev_info(dev, "vgaarb: " fmt, ##arg) 36 + #define vgaarb_err(dev, fmt, arg...) dev_err(dev, "vgaarb: " fmt, ##arg) 37 + 34 38 #include <linux/module.h> 35 39 #include <linux/kernel.h> 36 40 #include <linux/pci.h> ··· 192 188 static struct vga_device *__vga_tryget(struct vga_device *vgadev, 193 189 unsigned int rsrc) 194 190 { 191 + struct device *dev = &vgadev->pdev->dev; 195 192 unsigned int wants, legacy_wants, match; 196 193 struct vga_device *conflict; 197 194 unsigned int pci_bits; ··· 208 203 (vgadev->decodes & VGA_RSRC_LEGACY_MEM)) 209 204 rsrc |= VGA_RSRC_LEGACY_MEM; 210 205 211 - pr_debug("%s: %d\n", __func__, rsrc); 212 - pr_debug("%s: owns: %d\n", __func__, vgadev->owns); 206 + vgaarb_dbg(dev, "%s: %d\n", __func__, rsrc); 207 + vgaarb_dbg(dev, "%s: owns: %d\n", __func__, vgadev->owns); 213 208 214 209 /* Check what resources we need to acquire */ 215 210 wants = rsrc & ~vgadev->owns; ··· 341 336 342 337 static void __vga_put(struct vga_device *vgadev, unsigned int rsrc) 343 338 { 339 + struct device *dev = &vgadev->pdev->dev; 344 340 unsigned int old_locks = vgadev->locks; 345 341 346 - pr_debug("%s\n", __func__); 342 + vgaarb_dbg(dev, "%s\n", __func__); 347 343 348 344 /* Update our counters, and account for equivalent legacy resources 349 345 * if we decode them ··· 617 611 /* Allocate structure */ 618 612 vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); 619 613 if (vgadev == NULL) { 620 - pr_err("failed to allocate pci device\n"); 614 + vgaarb_err(&pdev->dev, "failed to allocate VGA arbiter data\n"); 621 615 /* 622 616 * What to do on allocation failure ? For now, let's just do 623 617 * nothing, I'm not sure there is anything saner to be done. ··· 669 663 */ 670 664 if (vga_default == NULL && 671 665 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) { 672 - pr_info("setting as boot device: PCI:%s\n", pci_name(pdev)); 666 + vgaarb_info(&pdev->dev, "setting as boot VGA device\n"); 673 667 vga_set_default_device(pdev); 674 668 } 675 669 ··· 678 672 /* Add to the list */ 679 673 list_add(&vgadev->list, &vga_list); 680 674 vga_count++; 681 - pr_info("device added: PCI:%s,decodes=%s,owns=%s,locks=%s\n", 682 - pci_name(pdev), 675 + vgaarb_info(&pdev->dev, "VGA device added: decodes=%s,owns=%s,locks=%s\n", 683 676 vga_iostate_to_str(vgadev->decodes), 684 677 vga_iostate_to_str(vgadev->owns), 685 678 vga_iostate_to_str(vgadev->locks)); ··· 730 725 static inline void vga_update_device_decodes(struct vga_device *vgadev, 731 726 int new_decodes) 732 727 { 728 + struct device *dev = &vgadev->pdev->dev; 733 729 int old_decodes, decodes_removed, decodes_unlocked; 734 730 735 731 old_decodes = vgadev->decodes; ··· 738 732 decodes_unlocked = vgadev->locks & decodes_removed; 739 733 vgadev->decodes = new_decodes; 740 734 741 - pr_info("device changed decodes: PCI:%s,olddecodes=%s,decodes=%s:owns=%s\n", 742 - pci_name(vgadev->pdev), 735 + vgaarb_info(dev, "changed VGA decodes: olddecodes=%s,decodes=%s:owns=%s\n", 743 736 vga_iostate_to_str(old_decodes), 744 737 vga_iostate_to_str(vgadev->decodes), 745 738 vga_iostate_to_str(vgadev->owns)); ··· 759 754 if (!(old_decodes & VGA_RSRC_LEGACY_MASK) && 760 755 new_decodes & VGA_RSRC_LEGACY_MASK) 761 756 vga_decode_count++; 762 - pr_debug("decoding count now is: %d\n", vga_decode_count); 757 + vgaarb_dbg(dev, "decoding count now is: %d\n", vga_decode_count); 763 758 } 764 759 765 760 static void __vga_set_legacy_decoding(struct pci_dev *pdev, ··· 1189 1184 ret_val = -EPROTO; 1190 1185 goto done; 1191 1186 } 1192 - pr_debug("%s ==> %x:%x:%x.%x\n", curr_pos, 1193 - domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); 1194 - 1195 1187 pdev = pci_get_domain_bus_and_slot(domain, bus, devfn); 1196 - pr_debug("pdev %p\n", pdev); 1197 1188 if (!pdev) { 1198 - pr_err("invalid PCI address %x:%x:%x\n", 1199 - domain, bus, devfn); 1189 + pr_debug("invalid PCI address %04x:%02x:%02x.%x\n", 1190 + domain, bus, PCI_SLOT(devfn), 1191 + PCI_FUNC(devfn)); 1200 1192 ret_val = -ENODEV; 1201 1193 goto done; 1202 1194 } 1195 + 1196 + pr_debug("%s ==> %04x:%02x:%02x.%x pdev %p\n", curr_pos, 1197 + domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), 1198 + pdev); 1203 1199 } 1204 1200 1205 1201 vgadev = vgadev_find(pdev); 1206 1202 pr_debug("vgadev %p\n", vgadev); 1207 1203 if (vgadev == NULL) { 1208 1204 if (pdev) { 1209 - pr_err("this pci device is not a vga device\n"); 1205 + vgaarb_dbg(&pdev->dev, "not a VGA device\n"); 1210 1206 pci_dev_put(pdev); 1211 1207 } 1212 1208 ··· 1227 1221 } 1228 1222 } 1229 1223 if (i == MAX_USER_CARDS) { 1230 - pr_err("maximum user cards (%d) number reached!\n", 1224 + vgaarb_dbg(&pdev->dev, "maximum user cards (%d) number reached, ignoring this one!\n", 1231 1225 MAX_USER_CARDS); 1232 1226 pci_dev_put(pdev); 1233 1227 /* XXX: which value to return? */ ··· 1316 1310 uc = &priv->cards[i]; 1317 1311 if (uc->pdev == NULL) 1318 1312 continue; 1319 - pr_debug("uc->io_cnt == %d, uc->mem_cnt == %d\n", 1320 - uc->io_cnt, uc->mem_cnt); 1313 + vgaarb_dbg(&uc->pdev->dev, "uc->io_cnt == %d, uc->mem_cnt == %d\n", 1314 + uc->io_cnt, uc->mem_cnt); 1321 1315 while (uc->io_cnt--) 1322 1316 vga_put(uc->pdev, VGA_RSRC_LEGACY_IO); 1323 1317 while (uc->mem_cnt--) ··· 1370 1364 struct pci_dev *pdev = to_pci_dev(dev); 1371 1365 bool notify = false; 1372 1366 1373 - pr_debug("%s\n", __func__); 1367 + vgaarb_dbg(dev, "%s\n", __func__); 1374 1368 1375 1369 /* For now we're only intereted in devices added and removed. I didn't 1376 1370 * test this thing here, so someone needs to double check for the ··· 1422 1416 PCI_ANY_ID, pdev)) != NULL) 1423 1417 vga_arbiter_add_pci_device(pdev); 1424 1418 1425 - pr_info("loaded\n"); 1426 - 1427 1419 list_for_each_entry(vgadev, &vga_list, list) { 1420 + struct device *dev = &vgadev->pdev->dev; 1428 1421 #if defined(CONFIG_X86) || defined(CONFIG_IA64) 1429 1422 /* 1430 1423 * Override vga_arbiter_add_pci_device()'s I/O based detection ··· 1456 1451 continue; 1457 1452 1458 1453 if (!vga_default_device()) 1459 - pr_info("setting as boot device: PCI:%s\n", 1460 - pci_name(vgadev->pdev)); 1454 + vgaarb_info(dev, "setting as boot device\n"); 1461 1455 else if (vgadev->pdev != vga_default_device()) 1462 - pr_info("overriding boot device: PCI:%s\n", 1463 - pci_name(vgadev->pdev)); 1456 + vgaarb_info(dev, "overriding boot device\n"); 1464 1457 vga_set_default_device(vgadev->pdev); 1465 1458 } 1466 1459 #endif 1467 1460 if (vgadev->bridge_has_one_vga) 1468 - pr_info("bridge control possible %s\n", 1469 - pci_name(vgadev->pdev)); 1461 + vgaarb_info(dev, "bridge control possible\n"); 1470 1462 else 1471 - pr_info("no bridge control possible %s\n", 1472 - pci_name(vgadev->pdev)); 1463 + vgaarb_info(dev, "no bridge control possible\n"); 1473 1464 } 1465 + 1466 + pr_info("loaded\n"); 1474 1467 return rc; 1475 1468 } 1476 1469 subsys_initcall(vga_arb_device_init);
+2 -1
include/drm/drm_atomic.h
··· 372 372 #ifdef CONFIG_DEBUG_FS 373 373 struct drm_minor; 374 374 int drm_atomic_debugfs_init(struct drm_minor *minor); 375 + int drm_atomic_debugfs_cleanup(struct drm_minor *minor); 375 376 #endif 376 377 377 378 #define for_each_connector_in_state(__state, connector, connector_state, __i) \ ··· 418 417 * should clear mode_changed during its ->atomic_check. 419 418 */ 420 419 static inline bool 421 - drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state) 420 + drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) 422 421 { 423 422 return state->mode_changed || state->active_changed || 424 423 state->connectors_changed;
+2
include/drm/drm_drv.h
··· 291 291 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 292 292 293 293 /** 294 + * @gem_create_object: constructor for gem objects 295 + * 294 296 * Hook for allocating the GEM object struct, for use by core 295 297 * helpers. 296 298 */
+20 -2
include/drm/drm_framebuffer.h
··· 149 149 */ 150 150 unsigned int offsets[4]; 151 151 /** 152 - * @modifier: Data layout modifier, per buffer. This is used to describe 152 + * @modifier: Data layout modifier. This is used to describe 153 153 * tiling, or also special layouts (like compression) of auxiliary 154 154 * buffers. For userspace created object this is copied from 155 155 * drm_mode_fb_cmd2. 156 156 */ 157 - uint64_t modifier[4]; 157 + uint64_t modifier; 158 158 /** 159 159 * @width: Logical width of the visible area of the framebuffer, in 160 160 * pixels. ··· 251 251 } 252 252 253 253 /** 254 + * drm_framebuffer_assign - store a reference to the fb 255 + * @p: location to store framebuffer 256 + * @fb: new framebuffer (maybe NULL) 257 + * 258 + * This functions sets the location to store a reference to the framebuffer, 259 + * unreferencing the framebuffer that was previously stored in that location. 260 + */ 261 + static inline void drm_framebuffer_assign(struct drm_framebuffer **p, 262 + struct drm_framebuffer *fb) 263 + { 264 + if (fb) 265 + drm_framebuffer_reference(fb); 266 + if (*p) 267 + drm_framebuffer_unreference(*p); 268 + *p = fb; 269 + } 270 + 271 + /* 254 272 * drm_for_each_fb - iterate over all framebuffers 255 273 * @fb: the loop cursor 256 274 * @dev: the DRM device
+19 -3
include/drm/drm_mm.h
··· 308 308 bool drm_mm_clean(struct drm_mm *mm); 309 309 310 310 struct drm_mm_node * 311 - drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last); 311 + __drm_mm_interval_first(struct drm_mm *mm, u64 start, u64 last); 312 312 313 - struct drm_mm_node * 314 - drm_mm_interval_next(struct drm_mm_node *node, u64 start, u64 last); 313 + /** 314 + * drm_mm_for_each_node_in_range - iterator to walk over a range of 315 + * allocated nodes 316 + * @node__: drm_mm_node structure to assign to in each iteration step 317 + * @mm__: drm_mm allocator to walk 318 + * @start__: starting offset, the first node will overlap this 319 + * @end__: ending offset, the last node will start before this (but may overlap) 320 + * 321 + * This iterator walks over all nodes in the range allocator that lie 322 + * between @start and @end. It is implemented similarly to list_for_each(), 323 + * but using the internal interval tree to accelerate the search for the 324 + * starting node, and so not safe against removal of elements. It assumes 325 + * that @end is within (or is the upper limit of) the drm_mm allocator. 326 + */ 327 + #define drm_mm_for_each_node_in_range(node__, mm__, start__, end__) \ 328 + for (node__ = __drm_mm_interval_first((mm__), (start__), (end__)-1); \ 329 + node__ && node__->start < (end__); \ 330 + node__ = list_next_entry(node__, node_list)) 315 331 316 332 void drm_mm_init_scan(struct drm_mm *mm, 317 333 u64 size,
+8 -4
include/drm/drm_modeset_helper_vtables.h
··· 999 999 * to implement blocking and nonblocking commits easily. It is not used 1000 1000 * by the atomic helpers 1001 1001 * 1002 - * This hook should first commit the given atomic state to the hardware. 1003 - * But drivers can add more waiting calls at the start of their 1004 - * implementation, e.g. to wait for driver-internal request for implicit 1005 - * syncing, before starting to commit the update to the hardware. 1002 + * This function is called when the new atomic state has already been 1003 + * swapped into the various state pointers. The passed in state 1004 + * therefore contains copies of the old/previous state. This hook should 1005 + * commit the new state into hardware. Note that the helpers have 1006 + * already waited for preceeding atomic commits and fences, but drivers 1007 + * can add more waiting calls at the start of their implementation, e.g. 1008 + * to wait for driver-internal request for implicit syncing, before 1009 + * starting to commit the update to the hardware. 1006 1010 * 1007 1011 * After the atomic update is committed to the hardware this hook needs 1008 1012 * to call drm_atomic_helper_commit_hw_done(). Then wait for the upate
+8 -5
include/uapi/drm/drm_mode.h
··· 408 408 * offsets[1]. Note that offsets[0] will generally 409 409 * be 0 (but this is not required). 410 410 * 411 - * To accommodate tiled, compressed, etc formats, a per-plane 411 + * To accommodate tiled, compressed, etc formats, a 412 412 * modifier can be specified. The default value of zero 413 413 * indicates "native" format as specified by the fourcc. 414 - * Vendor specific modifier token. This allows, for example, 415 - * different tiling/swizzling pattern on different planes. 416 - * See discussion above of DRM_FORMAT_MOD_xxx. 414 + * Vendor specific modifier token. Note that even though 415 + * it looks like we have a modifier per-plane, we in fact 416 + * do not. The modifier for each plane must be identical. 417 + * Thus all combinations of different data layouts for 418 + * multi plane formats must be enumerated as separate 419 + * modifiers. 417 420 */ 418 421 __u32 handles[4]; 419 422 __u32 pitches[4]; /* pitch for each plane */ 420 423 __u32 offsets[4]; /* offset of each plane */ 421 - __u64 modifier[4]; /* ie, tiling, compressed (per plane) */ 424 + __u64 modifier[4]; /* ie, tiling, compress */ 422 425 }; 423 426 424 427 #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01