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

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

Cross-subsystem Changes:

- device tree doc for the Mitsubishi AA070MC01 and Tianma TM070RVHG71
panels (Lukasz Majewski) and for a 2nd endpoint on stm32 (Philippe Cornu)

Core Changes:

The most important changes are:

- Add drm_driver .last_close and .output_poll_changed helpers to reduce
fbdev emulation footprint in drivers (Noralf)
- Fix plane clipping in core and for vmwgfx (Ville)

Then we have a bunch of of improvement for print and debug such as the
addition of a framebuffer debugfs file. ELD connector, HDMI and
improvements. And a bunch of misc improvements, clean ups and style
changes and doc updates

[airlied: drop eld bits from amdgpu_dm]

Driver Changes:

- sii8620: filter unsupported modes and add DVI mode support (Maciej Purski)
- rockchip: analogix_dp: Remove unnecessary init code (Jeffy Chen)
- virtio, cirrus: add fb create_handle support to enable screenshots(Lepton Wu)
- virtio: replace reference/unreference with get/put (Aastha Gupta)
- vc4, gma500: Convert timers to use timer_setup() (Kees Cook)
- vc4: Reject HDMI modes with too high of clocks (Eric)
- vc4: Add support for more pixel formats (Dave Stevenson)
- stm: dsi: Rename driver name to "stm32-display-dsi" (Philippe Cornu)
- stm: ltdc: add a 2nd endpoint (Philippe Cornu)
- via: use monotonic time for VIA_WAIT_IRQ (Arnd Bergmann)

* tag 'drm-misc-next-2017-11-30' of git://anongit.freedesktop.org/drm/drm-misc: (96 commits)
drm/bridge: tc358767: add copyright lines
MAINTAINERS: change maintainer for Rockchip drm drivers
drm/vblank: Fix vblank timestamp debugs
drm/via: use monotonic time for VIA_WAIT_IRQ
dma-buf: Fix ifnullfree.cocci warnings
drm/printer: Add drm_vprintf()
drm/edid: Allow HDMI infoframe without VIC or S3D
video/hdmi: Allow "empty" HDMI infoframes
dma-buf/fence: Fix lock inversion within dma-fence-array
drm/sti: Handle return value of platform_get_irq_byname
drm/vc4: Add support for NV21 and NV61.
drm/vc4: Use .pixel_order instead of custom .flip_cbcr
drm/vc4: Add support for DRM_FORMAT_RGB888 and DRM_FORMAT_BGR888
drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c
drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()
drm/vmwgfx: Try to fix plane clipping
drm/vmwgfx: Use drm_plane_helper_check_state()
drm/vmwgfx: Remove bogus crtc coords vs fb size check
gpu: gma500: remove unneeded DRIVER_LICENSE #define
drm: don't link DP aux i2c adapter to the hardware device node
...

+1325 -873
+7
Documentation/devicetree/bindings/display/panel/mitsubishi,aa070mc01.txt
··· 1 + Mitsubishi "AA070MC01 7.0" WVGA TFT LCD panel 2 + 3 + Required properties: 4 + - compatible: should be "mitsubishi,aa070mc01-ca1" 5 + 6 + This binding is compatible with the simple-panel binding, which is specified 7 + in simple-panel.txt in this directory.
+29
Documentation/devicetree/bindings/display/panel/tianma,tm070rvhg71.txt
··· 1 + Tianma Micro-electronics TM070RVHG71 7.0" WXGA TFT LCD panel 2 + 3 + Required properties: 4 + - compatible: should be "tianma,tm070rvhg71" 5 + - power-supply: single regulator to provide the supply voltage 6 + - backlight: phandle of the backlight device attached to the panel 7 + 8 + Required nodes: 9 + - port: LVDS port mapping to connect this display 10 + 11 + This panel needs single power supply voltage. Its backlight is conntrolled 12 + via PWM signal. 13 + 14 + Example: 15 + -------- 16 + 17 + Example device-tree definition when connected to iMX6Q based board 18 + 19 + panel: panel-lvds0 { 20 + compatible = "tianma,tm070rvhg71"; 21 + backlight = <&backlight_lvds>; 22 + power-supply = <&reg_lvds>; 23 + 24 + port { 25 + panel_in_lvds0: endpoint { 26 + remote-endpoint = <&lvds0_out>; 27 + }; 28 + }; 29 + };
+1
Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt
··· 7 7 Required properties: 8 8 - compatible: value should be one of the following 9 9 "rockchip,rk3036-vop"; 10 + "rockchip,rk3126-vop"; 10 11 "rockchip,rk3288-vop"; 11 12 "rockchip,rk3368-vop"; 12 13 "rockchip,rk3366-vop";
+5 -1
Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
··· 10 10 - "lcd" for the clock feeding the output pixel clock & IP clock. 11 11 - resets: reset to be used by the device (defined by use of RCC macro). 12 12 Required nodes: 13 - - Video port for RGB output. 13 + - Video port for DPI RGB output: ltdc has one video port with up to 2 14 + endpoints: 15 + - for external dpi rgb panel or bridge, using gpios. 16 + - for internal dpi input of the MIPI DSI host controller. 17 + Note: These 2 endpoints cannot be activated simultaneously. 14 18 15 19 * STMicroelectronics STM32 DSI controller specific extensions to Synopsys 16 20 DesignWare MIPI DSI host controller
+4
Documentation/gpu/todo.rst
··· 179 179 now have DRM_DEV_* variants of the drm print macros, so we can start to convert 180 180 those drivers back to using drm-formwatted specific log messages. 181 181 182 + Before you start this conversion please contact the relevant maintainers to make 183 + sure your work will be merged - not everyone agrees that the DRM dmesg macros 184 + are better. 185 + 182 186 Contact: Sean Paul, Maintainer of the driver you plan to convert 183 187 184 188 Core refactorings
+3 -1
MAINTAINERS
··· 4587 4587 DRM DRIVERS AND MISC GPU PATCHES 4588 4588 M: Daniel Vetter <daniel.vetter@intel.com> 4589 4589 M: Jani Nikula <jani.nikula@linux.intel.com> 4590 + M: Gustavo Padovan <gustavo@padovan.org> 4590 4591 M: Sean Paul <seanpaul@chromium.org> 4591 4592 W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html 4592 4593 S: Maintained ··· 4716 4715 F: Documentation/devicetree/bindings/display/renesas,du.txt 4717 4716 4718 4717 DRM DRIVERS FOR ROCKCHIP 4719 - M: Mark Yao <mark.yao@rock-chips.com> 4718 + M: Sandy Huang <hjc@rock-chips.com> 4719 + M: Heiko Stübner <heiko@sntech.de> 4720 4720 L: dri-devel@lists.freedesktop.org 4721 4721 S: Maintained 4722 4722 F: drivers/gpu/drm/rockchip/
+1
drivers/base/Kconfig
··· 245 245 bool 246 246 default n 247 247 select ANON_INODES 248 + select IRQ_WORK 248 249 help 249 250 This option enables the framework for buffer-sharing between 250 251 multiple drivers. A buffer is associated with a file using driver
+4 -5
drivers/dma-buf/dma-buf.c
··· 351 351 * 352 352 * 2. Userspace passes this file-descriptors to all drivers it wants this buffer 353 353 * to share with: First the filedescriptor is converted to a &dma_buf using 354 - * dma_buf_get(). The the buffer is attached to the device using 354 + * dma_buf_get(). Then the buffer is attached to the device using 355 355 * dma_buf_attach(). 356 356 * 357 357 * Up to this stage the exporter is still free to migrate or reallocate the 358 358 * backing storage. 359 359 * 360 - * 3. Once the buffer is attached to all devices userspace can inniate DMA 360 + * 3. Once the buffer is attached to all devices userspace can initiate DMA 361 361 * access to the shared buffer. In the kernel this is done by calling 362 362 * dma_buf_map_attachment() and dma_buf_unmap_attachment(). 363 363 * ··· 617 617 * Returns sg_table containing the scatterlist to be returned; returns ERR_PTR 618 618 * on error. May return -EINTR if it is interrupted by a signal. 619 619 * 620 - * A mapping must be unmapped again using dma_buf_map_attachment(). Note that 620 + * A mapping must be unmapped by using dma_buf_unmap_attachment(). Note that 621 621 * the underlying backing storage is pinned for as long as a mapping exists, 622 622 * therefore users/importers should not hold onto a mapping for undue amounts of 623 623 * time. ··· 1179 1179 1180 1180 static void dma_buf_uninit_debugfs(void) 1181 1181 { 1182 - if (dma_buf_debugfs_dir) 1183 - debugfs_remove_recursive(dma_buf_debugfs_dir); 1182 + debugfs_remove_recursive(dma_buf_debugfs_dir); 1184 1183 } 1185 1184 #else 1186 1185 static inline int dma_buf_init_debugfs(void)
+12 -2
drivers/dma-buf/dma-fence-array.c
··· 31 31 return "unbound"; 32 32 } 33 33 34 + static void irq_dma_fence_array_work(struct irq_work *wrk) 35 + { 36 + struct dma_fence_array *array = container_of(wrk, typeof(*array), work); 37 + 38 + dma_fence_signal(&array->base); 39 + dma_fence_put(&array->base); 40 + } 41 + 34 42 static void dma_fence_array_cb_func(struct dma_fence *f, 35 43 struct dma_fence_cb *cb) 36 44 { ··· 47 39 struct dma_fence_array *array = array_cb->array; 48 40 49 41 if (atomic_dec_and_test(&array->num_pending)) 50 - dma_fence_signal(&array->base); 51 - dma_fence_put(&array->base); 42 + irq_work_queue(&array->work); 43 + else 44 + dma_fence_put(&array->base); 52 45 } 53 46 54 47 static bool dma_fence_array_enable_signaling(struct dma_fence *fence) ··· 145 136 spin_lock_init(&array->lock); 146 137 dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock, 147 138 context, seqno); 139 + init_irq_work(&array->work, irq_dma_fence_array_work); 148 140 149 141 array->num_fences = num_fences; 150 142 atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
+37 -21
drivers/dma-buf/reservation.c
··· 104 104 struct reservation_object_list *fobj, 105 105 struct dma_fence *fence) 106 106 { 107 - u32 i; 107 + struct dma_fence *signaled = NULL; 108 + u32 i, signaled_idx; 108 109 109 110 dma_fence_get(fence); 110 111 ··· 127 126 dma_fence_put(old_fence); 128 127 return; 129 128 } 129 + 130 + if (!signaled && dma_fence_is_signaled(old_fence)) { 131 + signaled = old_fence; 132 + signaled_idx = i; 133 + } 130 134 } 131 135 132 136 /* 133 137 * memory barrier is added by write_seqcount_begin, 134 138 * fobj->shared_count is protected by this lock too 135 139 */ 136 - RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence); 137 - fobj->shared_count++; 140 + if (signaled) { 141 + RCU_INIT_POINTER(fobj->shared[signaled_idx], fence); 142 + } else { 143 + RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence); 144 + fobj->shared_count++; 145 + } 138 146 139 147 write_seqcount_end(&obj->seq); 140 148 preempt_enable(); 149 + 150 + dma_fence_put(signaled); 141 151 } 142 152 143 153 static void ··· 157 145 struct reservation_object_list *fobj, 158 146 struct dma_fence *fence) 159 147 { 160 - unsigned i; 161 - struct dma_fence *old_fence = NULL; 148 + unsigned i, j, k; 162 149 163 150 dma_fence_get(fence); 164 151 ··· 173 162 * references from the old struct are carried over to 174 163 * the new. 175 164 */ 176 - fobj->shared_count = old->shared_count; 177 - 178 - for (i = 0; i < old->shared_count; ++i) { 165 + for (i = 0, j = 0, k = fobj->shared_max; i < old->shared_count; ++i) { 179 166 struct dma_fence *check; 180 167 181 168 check = rcu_dereference_protected(old->shared[i], 182 169 reservation_object_held(obj)); 183 170 184 - if (!old_fence && check->context == fence->context) { 185 - old_fence = check; 186 - RCU_INIT_POINTER(fobj->shared[i], fence); 187 - } else 188 - RCU_INIT_POINTER(fobj->shared[i], check); 171 + if (check->context == fence->context || 172 + dma_fence_is_signaled(check)) 173 + RCU_INIT_POINTER(fobj->shared[--k], check); 174 + else 175 + RCU_INIT_POINTER(fobj->shared[j++], check); 189 176 } 190 - if (!old_fence) { 191 - RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence); 192 - fobj->shared_count++; 193 - } 177 + fobj->shared_count = j; 178 + RCU_INIT_POINTER(fobj->shared[fobj->shared_count], fence); 179 + fobj->shared_count++; 194 180 195 181 done: 196 182 preempt_disable(); ··· 200 192 write_seqcount_end(&obj->seq); 201 193 preempt_enable(); 202 194 203 - if (old) 204 - kfree_rcu(old, rcu); 195 + if (!old) 196 + return; 205 197 206 - dma_fence_put(old_fence); 198 + /* Drop the references to the signaled fences */ 199 + for (i = k; i < fobj->shared_max; ++i) { 200 + struct dma_fence *f; 201 + 202 + f = rcu_dereference_protected(fobj->shared[i], 203 + reservation_object_held(obj)); 204 + dma_fence_put(f); 205 + } 206 + kfree_rcu(old, rcu); 207 207 } 208 208 209 209 /** ··· 334 318 continue; 335 319 } 336 320 337 - dst_list->shared[dst_list->shared_count++] = fence; 321 + rcu_assign_pointer(dst_list->shared[dst_list->shared_count++], fence); 338 322 } 339 323 } else { 340 324 dst_list = NULL;
-1
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
··· 358 358 if (amdgpu_connector->edid) { 359 359 drm_mode_connector_update_edid_property(connector, amdgpu_connector->edid); 360 360 ret = drm_add_edid_modes(connector, amdgpu_connector->edid); 361 - drm_edid_to_eld(connector, amdgpu_connector->edid); 362 361 return ret; 363 362 } 364 363 drm_mode_connector_update_edid_property(connector, NULL);
-2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 3333 3333 amdgpu_dm_connector->num_modes = 3334 3334 drm_add_edid_modes(connector, edid); 3335 3335 3336 - drm_edid_to_eld(connector, edid); 3337 - 3338 3336 amdgpu_dm_get_native_mode(connector); 3339 3337 } else { 3340 3338 amdgpu_dm_connector->num_modes = 0;
+1 -6
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 177 177 static int dm_connector_update_modes(struct drm_connector *connector, 178 178 struct edid *edid) 179 179 { 180 - int ret; 181 - 182 - ret = drm_add_edid_modes(connector, edid); 183 - drm_edid_to_eld(connector, edid); 184 - 185 - return ret; 180 + return drm_add_edid_modes(connector, edid); 186 181 } 187 182 188 183 static int dm_dp_mst_get_modes(struct drm_connector *connector)
+1 -1
drivers/gpu/drm/arc/arcpgu_drv.c
··· 155 155 156 156 static struct drm_info_list arcpgu_debugfs_list[] = { 157 157 { "clocks", arcpgu_show_pxlclock, 0 }, 158 - { "fb", drm_fb_cma_debugfs_show, 0 }, 159 158 }; 160 159 161 160 static int arcpgu_debugfs_init(struct drm_minor *minor) ··· 179 180 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 180 181 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 181 182 .gem_free_object_unlocked = drm_gem_cma_free_object, 183 + .gem_print_info = drm_gem_cma_print_info, 182 184 .gem_vm_ops = &drm_gem_cma_vm_ops, 183 185 .gem_prime_export = drm_gem_prime_export, 184 186 .gem_prime_import = drm_gem_prime_import,
+4 -4
drivers/gpu/drm/arm/hdlcd_crtc.c
··· 252 252 clip.x2 = crtc_state->adjusted_mode.hdisplay; 253 253 clip.y2 = crtc_state->adjusted_mode.vdisplay; 254 254 255 - return drm_plane_helper_check_state(state, &clip, 256 - DRM_PLANE_HELPER_NO_SCALING, 257 - DRM_PLANE_HELPER_NO_SCALING, 258 - false, true); 255 + return drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 256 + DRM_PLANE_HELPER_NO_SCALING, 257 + DRM_PLANE_HELPER_NO_SCALING, 258 + false, true); 259 259 } 260 260 261 261 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
+1 -1
drivers/gpu/drm/arm/hdlcd_drv.c
··· 231 231 static struct drm_info_list hdlcd_debugfs_list[] = { 232 232 { "interrupt_count", hdlcd_show_underrun_count, 0 }, 233 233 { "clocks", hdlcd_show_pxlclock, 0 }, 234 - { "fb", drm_fb_cma_debugfs_show, 0 }, 235 234 }; 236 235 237 236 static int hdlcd_debugfs_init(struct drm_minor *minor) ··· 252 253 .irq_postinstall = hdlcd_irq_postinstall, 253 254 .irq_uninstall = hdlcd_irq_uninstall, 254 255 .gem_free_object_unlocked = drm_gem_cma_free_object, 256 + .gem_print_info = drm_gem_cma_print_info, 255 257 .gem_vm_ops = &drm_gem_cma_vm_ops, 256 258 .dumb_create = drm_gem_cma_dumb_create, 257 259 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
+2 -1
drivers/gpu/drm/arm/malidp_planes.c
··· 150 150 151 151 clip.x2 = crtc_state->adjusted_mode.hdisplay; 152 152 clip.y2 = crtc_state->adjusted_mode.vdisplay; 153 - ret = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, true, true); 153 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 154 + 0, INT_MAX, true, true); 154 155 if (ret) 155 156 return ret; 156 157
-2
drivers/gpu/drm/bridge/analogix-anx78xx.c
··· 977 977 } 978 978 979 979 num_modes = drm_add_edid_modes(connector, anx78xx->edid); 980 - /* Store the ELD */ 981 - drm_edid_to_eld(connector, anx78xx->edid); 982 980 983 981 unlock: 984 982 mutex_unlock(&anx78xx->lock);
+34 -19
drivers/gpu/drm/bridge/sil-sii8620.c
··· 1169 1169 sii8620_write_buf(ctx, REG_TPI_INFO_B0, buf, ret); 1170 1170 } 1171 1171 1172 - static void sii8620_start_hdmi(struct sii8620 *ctx) 1172 + static void sii8620_start_video(struct sii8620 *ctx) 1173 1173 { 1174 + if (!sii8620_is_mhl3(ctx)) 1175 + sii8620_stop_video(ctx); 1176 + 1177 + if (ctx->sink_type == SINK_DVI && !sii8620_is_mhl3(ctx)) { 1178 + sii8620_write(ctx, REG_RX_HDMI_CTRL2, 1179 + VAL_RX_HDMI_CTRL2_DEFVAL); 1180 + sii8620_write(ctx, REG_TPI_SC, 0); 1181 + return; 1182 + } 1183 + 1174 1184 sii8620_write_seq_static(ctx, 1175 1185 REG_RX_HDMI_CTRL2, VAL_RX_HDMI_CTRL2_DEFVAL 1176 1186 | BIT_RX_HDMI_CTRL2_USE_AV_MUTE, ··· 1237 1227 } 1238 1228 1239 1229 sii8620_set_infoframes(ctx); 1240 - } 1241 - 1242 - static void sii8620_start_video(struct sii8620 *ctx) 1243 - { 1244 - if (!sii8620_is_mhl3(ctx)) 1245 - sii8620_stop_video(ctx); 1246 - 1247 - switch (ctx->sink_type) { 1248 - case SINK_HDMI: 1249 - sii8620_start_hdmi(ctx); 1250 - break; 1251 - case SINK_DVI: 1252 - default: 1253 - break; 1254 - } 1255 1230 } 1256 1231 1257 1232 static void sii8620_disable_hpd(struct sii8620 *ctx) ··· 1940 1945 if (stat & BIT_INTR_SCDT_CHANGE) { 1941 1946 u8 cstat = sii8620_readb(ctx, REG_TMDS_CSTAT_P3); 1942 1947 1943 - if (cstat & BIT_TMDS_CSTAT_P3_SCDT) 1944 - sii8620_scdt_high(ctx); 1948 + if (cstat & BIT_TMDS_CSTAT_P3_SCDT) { 1949 + if (ctx->sink_type == SINK_HDMI) 1950 + /* enable infoframe interrupt */ 1951 + sii8620_scdt_high(ctx); 1952 + else 1953 + sii8620_start_video(ctx); 1954 + } 1945 1955 } 1946 1956 1947 1957 sii8620_write(ctx, REG_INTR5, stat); ··· 2191 2191 rc_unregister_device(ctx->rc_dev); 2192 2192 } 2193 2193 2194 + static enum drm_mode_status sii8620_mode_valid(struct drm_bridge *bridge, 2195 + const struct drm_display_mode *mode) 2196 + { 2197 + struct sii8620 *ctx = bridge_to_sii8620(bridge); 2198 + bool can_pack = ctx->devcap[MHL_DCAP_VID_LINK_MODE] & 2199 + MHL_DCAP_VID_LINK_PPIXEL; 2200 + unsigned int max_pclk = sii8620_is_mhl3(ctx) ? MHL3_MAX_LCLK : 2201 + MHL1_MAX_LCLK; 2202 + max_pclk /= can_pack ? 2 : 3; 2203 + 2204 + return (mode->clock > max_pclk) ? MODE_CLOCK_HIGH : MODE_OK; 2205 + } 2206 + 2194 2207 static bool sii8620_mode_fixup(struct drm_bridge *bridge, 2195 2208 const struct drm_display_mode *mode, 2196 2209 struct drm_display_mode *adjusted_mode) ··· 2233 2220 union hdmi_infoframe frm; 2234 2221 u8 mhl_vic[] = { 0, 95, 94, 93, 98 }; 2235 2222 2223 + /* FIXME: We need the connector here */ 2236 2224 drm_hdmi_vendor_infoframe_from_display_mode( 2237 - &frm.vendor.hdmi, adjusted_mode); 2225 + &frm.vendor.hdmi, NULL, adjusted_mode); 2238 2226 vic = frm.vendor.hdmi.vic; 2239 2227 if (vic >= ARRAY_SIZE(mhl_vic)) 2240 2228 vic = 0; ··· 2252 2238 .attach = sii8620_attach, 2253 2239 .detach = sii8620_detach, 2254 2240 .mode_fixup = sii8620_mode_fixup, 2241 + .mode_valid = sii8620_mode_valid, 2255 2242 }; 2256 2243 2257 2244 static int sii8620_probe(struct i2c_client *client,
+3 -3
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
··· 1438 1438 u8 buffer[10]; 1439 1439 ssize_t err; 1440 1440 1441 - err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, mode); 1441 + err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, 1442 + &hdmi->connector, 1443 + mode); 1442 1444 if (err < 0) 1443 1445 /* 1444 1446 * Going into that statement does not means vendor infoframe ··· 1913 1911 drm_mode_connector_update_edid_property(connector, edid); 1914 1912 cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); 1915 1913 ret = drm_add_edid_modes(connector, edid); 1916 - /* Store the ELD */ 1917 - drm_edid_to_eld(connector, edid); 1918 1914 kfree(edid); 1919 1915 } else { 1920 1916 dev_dbg(hdmi->dev, "failed to get edid\n");
+2
drivers/gpu/drm/bridge/tc358767.c
··· 6 6 * 7 7 * Copyright (C) 2016 Pengutronix, Philipp Zabel <p.zabel@pengutronix.de> 8 8 * 9 + * Copyright (C) 2016 Zodiac Inflight Innovations 10 + * 9 11 * Initially based on: drivers/gpu/drm/i2c/tda998x_drv.c 10 12 * 11 13 * Copyright (C) 2012 Texas Instruments
+9
drivers/gpu/drm/cirrus/cirrus_main.c
··· 13 13 14 14 #include "cirrus_drv.h" 15 15 16 + static int cirrus_create_handle(struct drm_framebuffer *fb, 17 + struct drm_file* file_priv, 18 + unsigned int* handle) 19 + { 20 + struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb); 21 + 22 + return drm_gem_handle_create(file_priv, cirrus_fb->obj, handle); 23 + } 16 24 17 25 static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb) 18 26 { ··· 32 24 } 33 25 34 26 static const struct drm_framebuffer_funcs cirrus_fb_funcs = { 27 + .create_handle = cirrus_create_handle, 35 28 .destroy = cirrus_user_framebuffer_destroy, 36 29 }; 37 30
+7 -18
drivers/gpu/drm/drm_atomic.c
··· 33 33 #include <linux/sync_file.h> 34 34 35 35 #include "drm_crtc_internal.h" 36 + #include "drm_internal.h" 36 37 37 38 void __drm_crtc_commit_free(struct kref *kref) 38 39 { ··· 908 907 state->src_h > fb_height || 909 908 state->src_y > fb_height - state->src_h) { 910 909 DRM_DEBUG_ATOMIC("Invalid source coordinates " 911 - "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n", 910 + "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n", 912 911 state->src_w >> 16, ((state->src_w & 0xffff) * 15625) >> 10, 913 912 state->src_h >> 16, ((state->src_h & 0xffff) * 15625) >> 10, 914 913 state->src_x >> 16, ((state->src_x & 0xffff) * 15625) >> 10, 915 - state->src_y >> 16, ((state->src_y & 0xffff) * 15625) >> 10); 914 + state->src_y >> 16, ((state->src_y & 0xffff) * 15625) >> 10, 915 + state->fb->width, state->fb->height); 916 916 return -ENOSPC; 917 917 } 918 918 ··· 936 934 drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name); 937 935 drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : "(null)"); 938 936 drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0); 939 - if (state->fb) { 940 - struct drm_framebuffer *fb = state->fb; 941 - int i, n = fb->format->num_planes; 942 - struct drm_format_name_buf format_name; 943 - 944 - drm_printf(p, "\t\tformat=%s\n", 945 - drm_get_format_name(fb->format->format, &format_name)); 946 - drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier); 947 - drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height); 948 - drm_printf(p, "\t\tlayers:\n"); 949 - for (i = 0; i < n; i++) { 950 - drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, fb->pitches[i]); 951 - drm_printf(p, "\t\t\toffset[%d]=%u\n", i, fb->offsets[i]); 952 - } 953 - } 937 + if (state->fb) 938 + drm_framebuffer_print_info(p, 2, state->fb); 954 939 drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest)); 955 940 drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src)); 956 941 drm_printf(p, "\trotation=%x\n", state->rotation); ··· 1797 1808 #endif 1798 1809 1799 1810 /* 1800 - * The big monstor ioctl 1811 + * The big monster ioctl 1801 1812 */ 1802 1813 1803 1814 static struct drm_pending_vblank_event *create_vblank_event(
+103 -9
drivers/gpu/drm/drm_atomic_helper.c
··· 696 696 EXPORT_SYMBOL(drm_atomic_helper_check_modeset); 697 697 698 698 /** 699 + * drm_atomic_helper_check_plane_state() - Check plane state for validity 700 + * @plane_state: plane state to check 701 + * @crtc_state: crtc state to check 702 + * @clip: integer clipping coordinates 703 + * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point 704 + * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point 705 + * @can_position: is it legal to position the plane such that it 706 + * doesn't cover the entire crtc? This will generally 707 + * only be false for primary planes. 708 + * @can_update_disabled: can the plane be updated while the crtc 709 + * is disabled? 710 + * 711 + * Checks that a desired plane update is valid, and updates various 712 + * bits of derived state (clipped coordinates etc.). Drivers that provide 713 + * their own plane handling rather than helper-provided implementations may 714 + * still wish to call this function to avoid duplication of error checking 715 + * code. 716 + * 717 + * RETURNS: 718 + * Zero if update appears valid, error code on failure 719 + */ 720 + int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, 721 + const struct drm_crtc_state *crtc_state, 722 + const struct drm_rect *clip, 723 + int min_scale, 724 + int max_scale, 725 + bool can_position, 726 + bool can_update_disabled) 727 + { 728 + struct drm_framebuffer *fb = plane_state->fb; 729 + struct drm_rect *src = &plane_state->src; 730 + struct drm_rect *dst = &plane_state->dst; 731 + unsigned int rotation = plane_state->rotation; 732 + int hscale, vscale; 733 + 734 + WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc); 735 + 736 + *src = drm_plane_state_src(plane_state); 737 + *dst = drm_plane_state_dest(plane_state); 738 + 739 + if (!fb) { 740 + plane_state->visible = false; 741 + return 0; 742 + } 743 + 744 + /* crtc should only be NULL when disabling (i.e., !fb) */ 745 + if (WARN_ON(!plane_state->crtc)) { 746 + plane_state->visible = false; 747 + return 0; 748 + } 749 + 750 + if (!crtc_state->enable && !can_update_disabled) { 751 + DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n"); 752 + return -EINVAL; 753 + } 754 + 755 + drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); 756 + 757 + /* Check scaling */ 758 + hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); 759 + vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); 760 + if (hscale < 0 || vscale < 0) { 761 + DRM_DEBUG_KMS("Invalid scaling of plane\n"); 762 + drm_rect_debug_print("src: ", &plane_state->src, true); 763 + drm_rect_debug_print("dst: ", &plane_state->dst, false); 764 + return -ERANGE; 765 + } 766 + 767 + plane_state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale); 768 + 769 + drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation); 770 + 771 + if (!plane_state->visible) 772 + /* 773 + * Plane isn't visible; some drivers can handle this 774 + * so we just return success here. Drivers that can't 775 + * (including those that use the primary plane helper's 776 + * update function) will return an error from their 777 + * update_plane handler. 778 + */ 779 + return 0; 780 + 781 + if (!can_position && !drm_rect_equals(dst, clip)) { 782 + DRM_DEBUG_KMS("Plane must cover entire CRTC\n"); 783 + drm_rect_debug_print("dst: ", dst, false); 784 + drm_rect_debug_print("clip: ", clip, false); 785 + return -EINVAL; 786 + } 787 + 788 + return 0; 789 + } 790 + EXPORT_SYMBOL(drm_atomic_helper_check_plane_state); 791 + 792 + /** 699 793 * drm_atomic_helper_check_planes - validate state object for planes changes 700 794 * @dev: DRM device 701 795 * @state: the driver state object ··· 1001 907 * 1002 908 * Drivers can use this for building their own atomic commit if they don't have 1003 909 * a pure helper-based modeset implementation. 910 + * 911 + * Since these updates are not synchronized with lockings, only code paths 912 + * called from &drm_mode_config_helper_funcs.atomic_commit_tail can look at the 913 + * legacy state filled out by this helper. Defacto this means this helper and 914 + * the legacy state pointers are only really useful for transitioning an 915 + * existing driver to the atomic world. 1004 916 */ 1005 917 void 1006 918 drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, ··· 1887 1787 !try_wait_for_completion(&old_conn_state->commit->flip_done)) 1888 1788 return -EBUSY; 1889 1789 1890 - /* commit tracked through new_crtc_state->commit, no need to do it explicitly */ 1891 - if (new_conn_state->crtc) 1892 - continue; 1893 - 1894 - commit = crtc_or_fake_commit(state, old_conn_state->crtc); 1790 + /* Always track connectors explicitly for e.g. link retraining. */ 1791 + commit = crtc_or_fake_commit(state, new_conn_state->crtc ?: old_conn_state->crtc); 1895 1792 if (!commit) 1896 1793 return -ENOMEM; 1897 1794 ··· 1902 1805 !try_wait_for_completion(&old_plane_state->commit->flip_done)) 1903 1806 return -EBUSY; 1904 1807 1905 - /* 1906 - * Unlike connectors, always track planes explicitly for 1907 - * async pageflip support. 1908 - */ 1808 + /* Always track planes explicitly for async pageflip support. */ 1909 1809 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); 1910 1810 if (!commit) 1911 1811 return -ENOMEM;
+8
drivers/gpu/drm/drm_debugfs.c
··· 158 158 } 159 159 } 160 160 161 + if (drm_core_check_feature(dev, DRIVER_MODESET)) { 162 + ret = drm_framebuffer_debugfs_init(minor); 163 + if (ret) { 164 + DRM_ERROR("Failed to create framebuffer debugfs file\n"); 165 + return ret; 166 + } 167 + } 168 + 161 169 if (dev->driver->debugfs_init) { 162 170 ret = dev->driver->debugfs_init(minor); 163 171 if (ret) {
-1
drivers/gpu/drm/drm_dp_helper.c
··· 1097 1097 aux->ddc.class = I2C_CLASS_DDC; 1098 1098 aux->ddc.owner = THIS_MODULE; 1099 1099 aux->ddc.dev.parent = aux->dev; 1100 - aux->ddc.dev.of_node = aux->dev->of_node; 1101 1100 1102 1101 strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev), 1103 1102 sizeof(aux->ddc.name));
-47
drivers/gpu/drm/drm_drv.c
··· 75 75 76 76 static struct dentry *drm_debugfs_root; 77 77 78 - #define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV" 79 - 80 - void drm_dev_printk(const struct device *dev, const char *level, 81 - unsigned int category, const char *function_name, 82 - const char *prefix, const char *format, ...) 83 - { 84 - struct va_format vaf; 85 - va_list args; 86 - 87 - if (category != DRM_UT_NONE && !(drm_debug & category)) 88 - return; 89 - 90 - va_start(args, format); 91 - vaf.fmt = format; 92 - vaf.va = &args; 93 - 94 - if (dev) 95 - dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix, 96 - &vaf); 97 - else 98 - printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf); 99 - 100 - va_end(args); 101 - } 102 - EXPORT_SYMBOL(drm_dev_printk); 103 - 104 - void drm_printk(const char *level, unsigned int category, 105 - const char *format, ...) 106 - { 107 - struct va_format vaf; 108 - va_list args; 109 - 110 - if (category != DRM_UT_NONE && !(drm_debug & category)) 111 - return; 112 - 113 - va_start(args, format); 114 - vaf.fmt = format; 115 - vaf.va = &args; 116 - 117 - printk("%s" "[" DRM_NAME ":%ps]%s %pV", 118 - level, __builtin_return_address(0), 119 - strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf); 120 - 121 - va_end(args); 122 - } 123 - EXPORT_SYMBOL(drm_printk); 124 - 125 78 /* 126 79 * DRM Minors 127 80 * A DRM device can provide several char-dev interfaces on the DRM-Major. Each
+70 -34
drivers/gpu/drm/drm_edid.c
··· 3398 3398 do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len, 3399 3399 const u8 *video_db, u8 video_len) 3400 3400 { 3401 + struct drm_display_info *info = &connector->display_info; 3401 3402 int modes = 0, offset = 0, i, multi_present = 0, multi_len; 3402 3403 u8 vic_len, hdmi_3d_len = 0; 3403 3404 u16 mask; ··· 3526 3525 } 3527 3526 3528 3527 out: 3528 + if (modes > 0) 3529 + info->has_hdmi_infoframe = true; 3529 3530 return modes; 3530 3531 } 3531 3532 ··· 3764 3761 { 3765 3762 u8 len = cea_db_payload_len(db); 3766 3763 3767 - if (len >= 6) 3768 - connector->eld[5] |= (db[6] >> 7) << 1; /* Supports_AI */ 3764 + if (len >= 6 && (db[6] & (1 << 7))) 3765 + connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_SUPPORTS_AI; 3769 3766 if (len >= 8) { 3770 3767 connector->latency_present[0] = db[8] >> 7; 3771 3768 connector->latency_present[1] = (db[8] >> 6) & 1; ··· 3837 3834 } 3838 3835 EXPORT_SYMBOL(drm_edid_get_monitor_name); 3839 3836 3840 - /** 3837 + static void clear_eld(struct drm_connector *connector) 3838 + { 3839 + memset(connector->eld, 0, sizeof(connector->eld)); 3840 + 3841 + connector->latency_present[0] = false; 3842 + connector->latency_present[1] = false; 3843 + connector->video_latency[0] = 0; 3844 + connector->audio_latency[0] = 0; 3845 + connector->video_latency[1] = 0; 3846 + connector->audio_latency[1] = 0; 3847 + } 3848 + 3849 + /* 3841 3850 * drm_edid_to_eld - build ELD from EDID 3842 3851 * @connector: connector corresponding to the HDMI/DP sink 3843 3852 * @edid: EDID to parse 3844 3853 * 3845 3854 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The 3846 - * Conn_Type, HDCP and Port_ID ELD fields are left for the graphics driver to 3847 - * fill in. 3855 + * HDCP and Port_ID ELD fields are left for the graphics driver to fill in. 3848 3856 */ 3849 - void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) 3857 + static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) 3850 3858 { 3851 3859 uint8_t *eld = connector->eld; 3852 3860 u8 *cea; ··· 3866 3852 int mnl; 3867 3853 int dbl; 3868 3854 3869 - memset(eld, 0, sizeof(connector->eld)); 3870 - 3871 - connector->latency_present[0] = false; 3872 - connector->latency_present[1] = false; 3873 - connector->video_latency[0] = 0; 3874 - connector->audio_latency[0] = 0; 3875 - connector->video_latency[1] = 0; 3876 - connector->audio_latency[1] = 0; 3855 + clear_eld(connector); 3877 3856 3878 3857 if (!edid) 3879 3858 return; ··· 3877 3870 return; 3878 3871 } 3879 3872 3880 - mnl = get_monitor_name(edid, eld + 20); 3873 + mnl = get_monitor_name(edid, &eld[DRM_ELD_MONITOR_NAME_STRING]); 3874 + DRM_DEBUG_KMS("ELD monitor %s\n", &eld[DRM_ELD_MONITOR_NAME_STRING]); 3881 3875 3882 - eld[4] = (cea[1] << 5) | mnl; 3883 - DRM_DEBUG_KMS("ELD monitor %s\n", eld + 20); 3876 + eld[DRM_ELD_CEA_EDID_VER_MNL] = cea[1] << DRM_ELD_CEA_EDID_VER_SHIFT; 3877 + eld[DRM_ELD_CEA_EDID_VER_MNL] |= mnl; 3884 3878 3885 - eld[0] = 2 << 3; /* ELD version: 2 */ 3879 + eld[DRM_ELD_VER] = DRM_ELD_VER_CEA861D; 3886 3880 3887 - eld[16] = edid->mfg_id[0]; 3888 - eld[17] = edid->mfg_id[1]; 3889 - eld[18] = edid->prod_code[0]; 3890 - eld[19] = edid->prod_code[1]; 3881 + eld[DRM_ELD_MANUFACTURER_NAME0] = edid->mfg_id[0]; 3882 + eld[DRM_ELD_MANUFACTURER_NAME1] = edid->mfg_id[1]; 3883 + eld[DRM_ELD_PRODUCT_CODE0] = edid->prod_code[0]; 3884 + eld[DRM_ELD_PRODUCT_CODE1] = edid->prod_code[1]; 3891 3885 3892 3886 if (cea_revision(cea) >= 3) { 3893 3887 int i, start, end; ··· 3909 3901 /* Audio Data Block, contains SADs */ 3910 3902 sad_count = min(dbl / 3, 15 - total_sad_count); 3911 3903 if (sad_count >= 1) 3912 - memcpy(eld + 20 + mnl + total_sad_count * 3, 3904 + memcpy(&eld[DRM_ELD_CEA_SAD(mnl, total_sad_count)], 3913 3905 &db[1], sad_count * 3); 3914 3906 total_sad_count += sad_count; 3915 3907 break; 3916 3908 case SPEAKER_BLOCK: 3917 3909 /* Speaker Allocation Data Block */ 3918 3910 if (dbl >= 1) 3919 - eld[7] = db[1]; 3911 + eld[DRM_ELD_SPEAKER] = db[1]; 3920 3912 break; 3921 3913 case VENDOR_BLOCK: 3922 3914 /* HDMI Vendor-Specific Data Block */ ··· 3928 3920 } 3929 3921 } 3930 3922 } 3931 - eld[5] |= total_sad_count << 4; 3923 + eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= total_sad_count << DRM_ELD_SAD_COUNT_SHIFT; 3924 + 3925 + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || 3926 + connector->connector_type == DRM_MODE_CONNECTOR_eDP) 3927 + eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_DP; 3928 + else 3929 + eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_HDMI; 3932 3930 3933 3931 eld[DRM_ELD_BASELINE_ELD_LEN] = 3934 3932 DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); ··· 3942 3928 DRM_DEBUG_KMS("ELD size %d, SAD count %d\n", 3943 3929 drm_eld_size(eld), total_sad_count); 3944 3930 } 3945 - EXPORT_SYMBOL(drm_edid_to_eld); 3946 3931 3947 3932 /** 3948 3933 * drm_edid_to_sad - extracts SADs from EDID ··· 4251 4238 struct drm_display_info *display = &connector->display_info; 4252 4239 struct drm_hdmi_info *hdmi = &display->hdmi; 4253 4240 4241 + display->has_hdmi_infoframe = true; 4242 + 4254 4243 if (hf_vsdb[6] & 0x80) { 4255 4244 hdmi->scdc.supported = true; 4256 4245 if (hf_vsdb[6] & 0x40) ··· 4426 4411 info->cea_rev = 0; 4427 4412 info->max_tmds_clock = 0; 4428 4413 info->dvi_dual = false; 4414 + info->has_hdmi_infoframe = false; 4429 4415 4430 4416 info->non_desktop = !!(quirks & EDID_QUIRK_NON_DESKTOP); 4431 4417 ··· 4624 4608 * @edid: EDID data 4625 4609 * 4626 4610 * Add the specified modes to the connector's mode list. Also fills out the 4627 - * &drm_display_info structure in @connector with any information which can be 4628 - * derived from the edid. 4611 + * &drm_display_info structure and ELD in @connector with any information which 4612 + * can be derived from the edid. 4629 4613 * 4630 4614 * Return: The number of modes added or 0 if we couldn't find any. 4631 4615 */ ··· 4635 4619 u32 quirks; 4636 4620 4637 4621 if (edid == NULL) { 4622 + clear_eld(connector); 4638 4623 return 0; 4639 4624 } 4640 4625 if (!drm_edid_is_valid(edid)) { 4626 + clear_eld(connector); 4641 4627 dev_warn(connector->dev->dev, "%s: EDID invalid.\n", 4642 4628 connector->name); 4643 4629 return 0; 4644 4630 } 4645 4631 4646 4632 quirks = edid_get_quirks(edid); 4633 + 4634 + drm_edid_to_eld(connector, edid); 4647 4635 4648 4636 /* 4649 4637 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks. ··· 4924 4904 * drm_hdmi_vendor_infoframe_from_display_mode() - fill an HDMI infoframe with 4925 4905 * data from a DRM display mode 4926 4906 * @frame: HDMI vendor infoframe 4907 + * @connector: the connector 4927 4908 * @mode: DRM display mode 4928 4909 * 4929 4910 * Note that there's is a need to send HDMI vendor infoframes only when using a ··· 4935 4914 */ 4936 4915 int 4937 4916 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 4917 + struct drm_connector *connector, 4938 4918 const struct drm_display_mode *mode) 4939 4919 { 4920 + /* 4921 + * FIXME: sil-sii8620 doesn't have a connector around when 4922 + * we need one, so we have to be prepared for a NULL connector. 4923 + */ 4924 + bool has_hdmi_infoframe = connector ? 4925 + connector->display_info.has_hdmi_infoframe : false; 4940 4926 int err; 4941 4927 u32 s3d_flags; 4942 4928 u8 vic; ··· 4951 4923 if (!frame || !mode) 4952 4924 return -EINVAL; 4953 4925 4926 + if (!has_hdmi_infoframe) 4927 + return -EINVAL; 4928 + 4954 4929 vic = drm_match_hdmi_mode(mode); 4955 4930 s3d_flags = mode->flags & DRM_MODE_FLAG_3D_MASK; 4956 4931 4957 - if (!vic && !s3d_flags) 4958 - return -EINVAL; 4932 + /* 4933 + * Even if it's not absolutely necessary to send the infoframe 4934 + * (ie.vic==0 and s3d_struct==0) we will still send it if we 4935 + * know that the sink can handle it. This is based on a 4936 + * suggestion in HDMI 2.0 Appendix F. Apparently some sinks 4937 + * have trouble realizing that they shuld switch from 3D to 2D 4938 + * mode if the source simply stops sending the infoframe when 4939 + * it wants to switch from 3D to 2D. 4940 + */ 4959 4941 4960 4942 if (vic && s3d_flags) 4961 4943 return -EINVAL; ··· 4974 4936 if (err < 0) 4975 4937 return err; 4976 4938 4977 - if (vic) 4978 - frame->vic = vic; 4979 - else 4980 - frame->s3d_struct = s3d_structure_from_display_mode(mode); 4939 + frame->vic = vic; 4940 + frame->s3d_struct = s3d_structure_from_display_mode(mode); 4981 4941 4982 4942 return 0; 4983 4943 }
-37
drivers/gpu/drm/drm_fb_cma_helper.c
··· 130 130 } 131 131 EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr); 132 132 133 - #ifdef CONFIG_DEBUG_FS 134 - static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m) 135 - { 136 - int i; 137 - 138 - seq_printf(m, "fb: %dx%d@%4.4s\n", fb->width, fb->height, 139 - (char *)&fb->format->format); 140 - 141 - for (i = 0; i < fb->format->num_planes; i++) { 142 - seq_printf(m, " %d: offset=%d pitch=%d, obj: ", 143 - i, fb->offsets[i], fb->pitches[i]); 144 - drm_gem_cma_describe(drm_fb_cma_get_gem_obj(fb, i), m); 145 - } 146 - } 147 - 148 - /** 149 - * drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects 150 - * in debugfs. 151 - * @m: output file 152 - * @arg: private data for the callback 153 - */ 154 - int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg) 155 - { 156 - struct drm_info_node *node = (struct drm_info_node *) m->private; 157 - struct drm_device *dev = node->minor->dev; 158 - struct drm_framebuffer *fb; 159 - 160 - mutex_lock(&dev->mode_config.fb_lock); 161 - drm_for_each_fb(fb, dev) 162 - drm_fb_cma_describe(fb, m); 163 - mutex_unlock(&dev->mode_config.fb_lock); 164 - 165 - return 0; 166 - } 167 - EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show); 168 - #endif 169 - 170 133 static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma) 171 134 { 172 135 return dma_mmap_writecombine(info->device, vma, info->screen_base,
+56 -13
drivers/gpu/drm/drm_fb_helper.c
··· 150 150 { 151 151 int err; 152 152 153 + if (!fb_helper) 154 + return 0; 155 + 153 156 mutex_lock(&fb_helper->lock); 154 157 err = __drm_fb_helper_add_one_connector(fb_helper, connector); 155 158 mutex_unlock(&fb_helper->lock); ··· 164 161 /** 165 162 * drm_fb_helper_single_add_all_connectors() - add all connectors to fbdev 166 163 * emulation helper 167 - * @fb_helper: fbdev initialized with drm_fb_helper_init 164 + * @fb_helper: fbdev initialized with drm_fb_helper_init, can be NULL 168 165 * 169 166 * This functions adds all the available connectors for use with the given 170 167 * fb_helper. This is a separate step to allow drivers to freely assign ··· 182 179 struct drm_connector_list_iter conn_iter; 183 180 int i, ret = 0; 184 181 185 - if (!drm_fbdev_emulation) 182 + if (!drm_fbdev_emulation || !fb_helper) 186 183 return 0; 187 184 188 185 mutex_lock(&fb_helper->lock); ··· 247 244 struct drm_connector *connector) 248 245 { 249 246 int err; 247 + 248 + if (!fb_helper) 249 + return 0; 250 250 251 251 mutex_lock(&fb_helper->lock); 252 252 err = __drm_fb_helper_remove_one_connector(fb_helper, connector); ··· 490 484 491 485 /** 492 486 * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration 493 - * @fb_helper: fbcon to restore 487 + * @fb_helper: driver-allocated fbdev helper, can be NULL 494 488 * 495 489 * This should be called from driver's drm &drm_driver.lastclose callback 496 490 * when implementing an fbcon on top of kms using this helper. This ensures that ··· 504 498 bool do_delayed; 505 499 int ret; 506 500 507 - if (!drm_fbdev_emulation) 501 + if (!drm_fbdev_emulation || !fb_helper) 508 502 return -ENODEV; 509 503 510 504 if (READ_ONCE(fb_helper->deferred_setup)) ··· 799 793 struct drm_mode_config *config = &dev->mode_config; 800 794 int i; 801 795 802 - if (!drm_fbdev_emulation) 796 + if (!drm_fbdev_emulation) { 797 + dev->fb_helper = fb_helper; 803 798 return 0; 799 + } 804 800 805 801 if (!max_conn_count) 806 802 return -EINVAL; ··· 836 828 fb_helper->crtc_info[i].mode_set.crtc = crtc; 837 829 i++; 838 830 } 831 + 832 + dev->fb_helper = fb_helper; 839 833 840 834 return 0; 841 835 out_free: ··· 893 883 894 884 /** 895 885 * drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device 896 - * @fb_helper: driver-allocated fbdev helper 886 + * @fb_helper: driver-allocated fbdev helper, can be NULL 897 887 * 898 888 * A wrapper around unregister_framebuffer, to release the fb_info 899 889 * framebuffer device. This must be called before releasing all resources for ··· 908 898 909 899 /** 910 900 * drm_fb_helper_fini - finialize a &struct drm_fb_helper 911 - * @fb_helper: driver-allocated fbdev helper 901 + * @fb_helper: driver-allocated fbdev helper, can be NULL 912 902 * 913 903 * This cleans up all remaining resources associated with @fb_helper. Must be 914 904 * called after drm_fb_helper_unlink_fbi() was called. ··· 917 907 { 918 908 struct fb_info *info; 919 909 920 - if (!drm_fbdev_emulation || !fb_helper) 910 + if (!fb_helper) 911 + return; 912 + 913 + fb_helper->dev->fb_helper = NULL; 914 + 915 + if (!drm_fbdev_emulation) 921 916 return; 922 917 923 918 cancel_work_sync(&fb_helper->resume_work); ··· 952 937 953 938 /** 954 939 * drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer 955 - * @fb_helper: driver-allocated fbdev helper 940 + * @fb_helper: driver-allocated fbdev helper, can be NULL 956 941 * 957 942 * A wrapper around unlink_framebuffer implemented by fbdev core 958 943 */ ··· 1153 1138 1154 1139 /** 1155 1140 * drm_fb_helper_set_suspend - wrapper around fb_set_suspend 1156 - * @fb_helper: driver-allocated fbdev helper 1141 + * @fb_helper: driver-allocated fbdev helper, can be NULL 1157 1142 * @suspend: whether to suspend or resume 1158 1143 * 1159 1144 * A wrapper around fb_set_suspend implemented by fbdev core. ··· 1170 1155 /** 1171 1156 * drm_fb_helper_set_suspend_unlocked - wrapper around fb_set_suspend that also 1172 1157 * takes the console lock 1173 - * @fb_helper: driver-allocated fbdev helper 1158 + * @fb_helper: driver-allocated fbdev helper, can be NULL 1174 1159 * @suspend: whether to suspend or resume 1175 1160 * 1176 1161 * A wrapper around fb_set_suspend() that takes the console lock. If the lock ··· 2591 2576 /** 2592 2577 * drm_fb_helper_hotplug_event - respond to a hotplug notification by 2593 2578 * probing all the outputs attached to the fb 2594 - * @fb_helper: the drm_fb_helper 2579 + * @fb_helper: driver-allocated fbdev helper, can be NULL 2595 2580 * 2596 2581 * Scan the connectors attached to the fb_helper and try to put together a 2597 2582 * setup after notification of a change in output configuration. ··· 2613 2598 { 2614 2599 int err = 0; 2615 2600 2616 - if (!drm_fbdev_emulation) 2601 + if (!drm_fbdev_emulation || !fb_helper) 2617 2602 return 0; 2618 2603 2619 2604 mutex_lock(&fb_helper->lock); ··· 2640 2625 return 0; 2641 2626 } 2642 2627 EXPORT_SYMBOL(drm_fb_helper_hotplug_event); 2628 + 2629 + /** 2630 + * drm_fb_helper_lastclose - DRM driver lastclose helper for fbdev emulation 2631 + * @dev: DRM device 2632 + * 2633 + * This function can be used as the &drm_driver->lastclose callback for drivers 2634 + * that only need to call drm_fb_helper_restore_fbdev_mode_unlocked(). 2635 + */ 2636 + void drm_fb_helper_lastclose(struct drm_device *dev) 2637 + { 2638 + drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper); 2639 + } 2640 + EXPORT_SYMBOL(drm_fb_helper_lastclose); 2641 + 2642 + /** 2643 + * drm_fb_helper_output_poll_changed - DRM mode config \.output_poll_changed 2644 + * helper for fbdev emulation 2645 + * @dev: DRM device 2646 + * 2647 + * This function can be used as the 2648 + * &drm_mode_config_funcs.output_poll_changed callback for drivers that only 2649 + * need to call drm_fb_helper_hotplug_event(). 2650 + */ 2651 + void drm_fb_helper_output_poll_changed(struct drm_device *dev) 2652 + { 2653 + drm_fb_helper_hotplug_event(dev->fb_helper); 2654 + } 2655 + EXPORT_SYMBOL(drm_fb_helper_output_poll_changed); 2643 2656 2644 2657 /* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT) 2645 2658 * but the module doesn't depend on any fb console symbols. At least
+79 -8
drivers/gpu/drm/drm_framebuffer.c
··· 25 25 #include <drm/drm_auth.h> 26 26 #include <drm/drm_framebuffer.h> 27 27 #include <drm/drm_atomic.h> 28 + #include <drm/drm_print.h> 28 29 30 + #include "drm_internal.h" 29 31 #include "drm_crtc_internal.h" 30 32 31 33 /** ··· 80 78 src_h > fb_height || 81 79 src_y > fb_height - src_h) { 82 80 DRM_DEBUG_KMS("Invalid source coordinates " 83 - "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n", 81 + "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n", 84 82 src_w >> 16, ((src_w & 0xffff) * 15625) >> 10, 85 83 src_h >> 16, ((src_h & 0xffff) * 15625) >> 10, 86 84 src_x >> 16, ((src_x & 0xffff) * 15625) >> 10, 87 - src_y >> 16, ((src_y & 0xffff) * 15625) >> 10); 85 + src_y >> 16, ((src_y & 0xffff) * 15625) >> 10, 86 + fb->width, fb->height); 88 87 return -ENOSPC; 89 88 } 90 89 ··· 769 766 struct drm_plane *plane; 770 767 struct drm_connector *conn; 771 768 struct drm_connector_state *conn_state; 772 - int i, ret = 0; 769 + int i, ret; 773 770 unsigned plane_mask; 771 + bool disable_crtcs = false; 772 + 773 + retry_disable: 774 + drm_modeset_acquire_init(&ctx, 0); 774 775 775 776 state = drm_atomic_state_alloc(dev); 776 - if (!state) 777 - return -ENOMEM; 778 - 779 - drm_modeset_acquire_init(&ctx, 0); 777 + if (!state) { 778 + ret = -ENOMEM; 779 + goto out; 780 + } 780 781 state->acquire_ctx = &ctx; 781 782 782 783 retry: ··· 801 794 goto unlock; 802 795 } 803 796 804 - if (plane_state->crtc->primary == plane) { 797 + if (disable_crtcs && plane_state->crtc->primary == plane) { 805 798 struct drm_crtc_state *crtc_state; 806 799 807 800 crtc_state = drm_atomic_get_existing_crtc_state(state, plane_state->crtc); ··· 826 819 plane->old_fb = plane->fb; 827 820 } 828 821 822 + /* This list is only filled when disable_crtcs is set. */ 829 823 for_each_new_connector_in_state(state, conn, conn_state, i) { 830 824 ret = drm_atomic_set_crtc_for_connector(conn_state, NULL); 831 825 ··· 849 841 850 842 drm_atomic_state_put(state); 851 843 844 + out: 852 845 drm_modeset_drop_locks(&ctx); 853 846 drm_modeset_acquire_fini(&ctx); 847 + 848 + if (ret == -EINVAL && !disable_crtcs) { 849 + disable_crtcs = true; 850 + goto retry_disable; 851 + } 854 852 855 853 return ret; 856 854 } ··· 971 957 return fb_plane_height(height, fb->format, plane); 972 958 } 973 959 EXPORT_SYMBOL(drm_framebuffer_plane_height); 960 + 961 + void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, 962 + const struct drm_framebuffer *fb) 963 + { 964 + struct drm_format_name_buf format_name; 965 + unsigned int i; 966 + 967 + drm_printf_indent(p, indent, "refcount=%u\n", 968 + drm_framebuffer_read_refcount(fb)); 969 + drm_printf_indent(p, indent, "format=%s\n", 970 + drm_get_format_name(fb->format->format, &format_name)); 971 + drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); 972 + drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); 973 + drm_printf_indent(p, indent, "layers:\n"); 974 + 975 + for (i = 0; i < fb->format->num_planes; i++) { 976 + drm_printf_indent(p, indent + 1, "size[%u]=%dx%d\n", i, 977 + drm_framebuffer_plane_width(fb->width, fb, i), 978 + drm_framebuffer_plane_height(fb->height, fb, i)); 979 + drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); 980 + drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); 981 + drm_printf_indent(p, indent + 1, "obj[%u]:%s\n", i, 982 + fb->obj[i] ? "" : "(null)"); 983 + if (fb->obj[i]) 984 + drm_gem_print_info(p, indent + 2, fb->obj[i]); 985 + } 986 + } 987 + 988 + #ifdef CONFIG_DEBUG_FS 989 + static int drm_framebuffer_info(struct seq_file *m, void *data) 990 + { 991 + struct drm_info_node *node = m->private; 992 + struct drm_device *dev = node->minor->dev; 993 + struct drm_printer p = drm_seq_file_printer(m); 994 + struct drm_framebuffer *fb; 995 + 996 + mutex_lock(&dev->mode_config.fb_lock); 997 + drm_for_each_fb(fb, dev) { 998 + drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); 999 + drm_framebuffer_print_info(&p, 1, fb); 1000 + } 1001 + mutex_unlock(&dev->mode_config.fb_lock); 1002 + 1003 + return 0; 1004 + } 1005 + 1006 + static const struct drm_info_list drm_framebuffer_debugfs_list[] = { 1007 + { "framebuffer", drm_framebuffer_info, 0 }, 1008 + }; 1009 + 1010 + int drm_framebuffer_debugfs_init(struct drm_minor *minor) 1011 + { 1012 + return drm_debugfs_create_files(drm_framebuffer_debugfs_list, 1013 + ARRAY_SIZE(drm_framebuffer_debugfs_list), 1014 + minor->debugfs_root, minor); 1015 + } 1016 + #endif
+19 -2
drivers/gpu/drm/drm_gem.c
··· 40 40 #include <drm/drmP.h> 41 41 #include <drm/drm_vma_manager.h> 42 42 #include <drm/drm_gem.h> 43 + #include <drm/drm_print.h> 43 44 #include "drm_internal.h" 44 45 45 46 /** @file drm_gem.c ··· 349 348 * @file: drm file-private structure to remove the dumb handle from 350 349 * @dev: corresponding drm_device 351 350 * @handle: the dumb handle to remove 352 - * 351 + * 353 352 * This implements the &drm_driver.dumb_destroy kms driver callback for drivers 354 353 * which use gem to manage their backing storage. 355 354 */ ··· 366 365 * @file_priv: drm file-private structure to register the handle for 367 366 * @obj: object to register 368 367 * @handlep: pointer to return the created handle to the caller 369 - * 368 + * 370 369 * This expects the &drm_device.object_name_lock to be held already and will 371 370 * drop it before returning. Used to avoid races in establishing new handles 372 371 * when importing an object from either an flink name or a dma-buf. ··· 1041 1040 return ret; 1042 1041 } 1043 1042 EXPORT_SYMBOL(drm_gem_mmap); 1043 + 1044 + void drm_gem_print_info(struct drm_printer *p, unsigned int indent, 1045 + const struct drm_gem_object *obj) 1046 + { 1047 + drm_printf_indent(p, indent, "name=%d\n", obj->name); 1048 + drm_printf_indent(p, indent, "refcount=%u\n", 1049 + kref_read(&obj->refcount)); 1050 + drm_printf_indent(p, indent, "start=%08lx\n", 1051 + drm_vma_node_start(&obj->vma_node)); 1052 + drm_printf_indent(p, indent, "size=%zu\n", obj->size); 1053 + drm_printf_indent(p, indent, "imported=%s\n", 1054 + obj->import_attach ? "yes" : "no"); 1055 + 1056 + if (obj->dev->driver->gem_print_info) 1057 + obj->dev->driver->gem_print_info(p, indent, obj); 1058 + }
+32 -21
drivers/gpu/drm/drm_gem_cma_helper.c
··· 397 397 EXPORT_SYMBOL_GPL(drm_gem_cma_get_unmapped_area); 398 398 #endif 399 399 400 - #ifdef CONFIG_DEBUG_FS 401 400 /** 402 - * drm_gem_cma_describe - describe a CMA GEM object for debugfs 403 - * @cma_obj: CMA GEM object 404 - * @m: debugfs file handle 401 + * drm_gem_cma_print_info() - Print &drm_gem_cma_object info for debugfs 402 + * @p: DRM printer 403 + * @indent: Tab indentation level 404 + * @obj: GEM object 405 405 * 406 - * This function can be used to dump a human-readable representation of the 407 - * CMA GEM object into a synthetic file. 406 + * This function can be used as the &drm_driver->gem_print_info callback. 407 + * It prints paddr and vaddr for use in e.g. debugfs output. 408 408 */ 409 - void drm_gem_cma_describe(struct drm_gem_cma_object *cma_obj, 410 - struct seq_file *m) 409 + void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, 410 + const struct drm_gem_object *obj) 411 411 { 412 - struct drm_gem_object *obj = &cma_obj->base; 413 - uint64_t off; 412 + const struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj); 414 413 415 - off = drm_vma_node_start(&obj->vma_node); 416 - 417 - seq_printf(m, "%2d (%2d) %08llx %pad %p %zu", 418 - obj->name, kref_read(&obj->refcount), 419 - off, &cma_obj->paddr, cma_obj->vaddr, obj->size); 420 - 421 - seq_printf(m, "\n"); 414 + drm_printf_indent(p, indent, "paddr=%pad\n", &cma_obj->paddr); 415 + drm_printf_indent(p, indent, "vaddr=%p\n", cma_obj->vaddr); 422 416 } 423 - EXPORT_SYMBOL_GPL(drm_gem_cma_describe); 424 - #endif 417 + EXPORT_SYMBOL(drm_gem_cma_print_info); 425 418 426 419 /** 427 420 * drm_gem_cma_prime_get_sg_table - provide a scatter/gather table of pinned ··· 475 482 { 476 483 struct drm_gem_cma_object *cma_obj; 477 484 478 - if (sgt->nents != 1) 479 - return ERR_PTR(-EINVAL); 485 + if (sgt->nents != 1) { 486 + /* check if the entries in the sg_table are contiguous */ 487 + dma_addr_t next_addr = sg_dma_address(sgt->sgl); 488 + struct scatterlist *s; 489 + unsigned int i; 490 + 491 + for_each_sg(sgt->sgl, s, sgt->nents, i) { 492 + /* 493 + * sg_dma_address(s) is only valid for entries 494 + * that have sg_dma_len(s) != 0 495 + */ 496 + if (!sg_dma_len(s)) 497 + continue; 498 + 499 + if (sg_dma_address(s) != next_addr) 500 + return ERR_PTR(-EINVAL); 501 + 502 + next_addr = sg_dma_address(s) + sg_dma_len(s); 503 + } 504 + } 480 505 481 506 /* Create a CMA GEM buffer. */ 482 507 cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size);
+7
drivers/gpu/drm/drm_internal.h
··· 111 111 struct drm_file *file_priv); 112 112 void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); 113 113 void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); 114 + void drm_gem_print_info(struct drm_printer *p, unsigned int indent, 115 + const struct drm_gem_object *obj); 114 116 115 117 /* drm_debugfs.c drm_debugfs_crc.c */ 116 118 #if defined(CONFIG_DEBUG_FS) ··· 180 178 struct drm_file *file_private); 181 179 int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, 182 180 struct drm_file *file_private); 181 + 182 + /* drm_framebuffer.c */ 183 + void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, 184 + const struct drm_framebuffer *fb); 185 + int drm_framebuffer_debugfs_init(struct drm_minor *minor);
+1 -1
drivers/gpu/drm/drm_mm.c
··· 92 92 * some basic allocator dumpers for debugging. 93 93 * 94 94 * Note that this range allocator is not thread-safe, drivers need to protect 95 - * modifications with their on locking. The idea behind this is that for a full 95 + * modifications with their own locking. The idea behind this is that for a full 96 96 * memory manager additional data needs to be protected anyway, hence internal 97 97 * locking would be fully redundant. 98 98 */
+12 -99
drivers/gpu/drm/drm_plane_helper.c
··· 100 100 } 101 101 102 102 /** 103 - * drm_plane_helper_check_state() - Check plane state for validity 104 - * @state: plane state to check 105 - * @clip: integer clipping coordinates 106 - * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point 107 - * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point 108 - * @can_position: is it legal to position the plane such that it 109 - * doesn't cover the entire crtc? This will generally 110 - * only be false for primary planes. 111 - * @can_update_disabled: can the plane be updated while the crtc 112 - * is disabled? 113 - * 114 - * Checks that a desired plane update is valid, and updates various 115 - * bits of derived state (clipped coordinates etc.). Drivers that provide 116 - * their own plane handling rather than helper-provided implementations may 117 - * still wish to call this function to avoid duplication of error checking 118 - * code. 119 - * 120 - * RETURNS: 121 - * Zero if update appears valid, error code on failure 122 - */ 123 - int drm_plane_helper_check_state(struct drm_plane_state *state, 124 - const struct drm_rect *clip, 125 - int min_scale, 126 - int max_scale, 127 - bool can_position, 128 - bool can_update_disabled) 129 - { 130 - struct drm_crtc *crtc = state->crtc; 131 - struct drm_framebuffer *fb = state->fb; 132 - struct drm_rect *src = &state->src; 133 - struct drm_rect *dst = &state->dst; 134 - unsigned int rotation = state->rotation; 135 - int hscale, vscale; 136 - 137 - *src = drm_plane_state_src(state); 138 - *dst = drm_plane_state_dest(state); 139 - 140 - if (!fb) { 141 - state->visible = false; 142 - return 0; 143 - } 144 - 145 - /* crtc should only be NULL when disabling (i.e., !fb) */ 146 - if (WARN_ON(!crtc)) { 147 - state->visible = false; 148 - return 0; 149 - } 150 - 151 - if (!crtc->enabled && !can_update_disabled) { 152 - DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n"); 153 - return -EINVAL; 154 - } 155 - 156 - drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation); 157 - 158 - /* Check scaling */ 159 - hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale); 160 - vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale); 161 - if (hscale < 0 || vscale < 0) { 162 - DRM_DEBUG_KMS("Invalid scaling of plane\n"); 163 - drm_rect_debug_print("src: ", &state->src, true); 164 - drm_rect_debug_print("dst: ", &state->dst, false); 165 - return -ERANGE; 166 - } 167 - 168 - state->visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale); 169 - 170 - drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation); 171 - 172 - if (!state->visible) 173 - /* 174 - * Plane isn't visible; some drivers can handle this 175 - * so we just return success here. Drivers that can't 176 - * (including those that use the primary plane helper's 177 - * update function) will return an error from their 178 - * update_plane handler. 179 - */ 180 - return 0; 181 - 182 - if (!can_position && !drm_rect_equals(dst, clip)) { 183 - DRM_DEBUG_KMS("Plane must cover entire CRTC\n"); 184 - drm_rect_debug_print("dst: ", dst, false); 185 - drm_rect_debug_print("clip: ", clip, false); 186 - return -EINVAL; 187 - } 188 - 189 - return 0; 190 - } 191 - EXPORT_SYMBOL(drm_plane_helper_check_state); 192 - 193 - /** 194 103 * drm_plane_helper_check_update() - Check plane update for validity 195 104 * @plane: plane object to update 196 105 * @crtc: owning CRTC of owning plane ··· 139 230 bool can_update_disabled, 140 231 bool *visible) 141 232 { 142 - struct drm_plane_state state = { 233 + struct drm_plane_state plane_state = { 143 234 .plane = plane, 144 235 .crtc = crtc, 145 236 .fb = fb, ··· 154 245 .rotation = rotation, 155 246 .visible = *visible, 156 247 }; 248 + struct drm_crtc_state crtc_state = { 249 + .crtc = crtc, 250 + .enable = crtc->enabled, 251 + }; 157 252 int ret; 158 253 159 - ret = drm_plane_helper_check_state(&state, clip, 160 - min_scale, max_scale, 161 - can_position, 162 - can_update_disabled); 254 + ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state, 255 + clip, min_scale, max_scale, 256 + can_position, 257 + can_update_disabled); 163 258 if (ret) 164 259 return ret; 165 260 166 - *src = state.src; 167 - *dst = state.dst; 168 - *visible = state.visible; 261 + *src = plane_state.src; 262 + *dst = plane_state.dst; 263 + *visible = plane_state.visible; 169 264 170 265 return 0; 171 266 }
+50 -4
drivers/gpu/drm/drm_print.c
··· 23 23 * Rob Clark <robdclark@gmail.com> 24 24 */ 25 25 26 + #define DEBUG /* for pr_debug() */ 27 + 26 28 #include <stdarg.h> 27 29 #include <linux/seq_file.h> 28 30 #include <drm/drmP.h> ··· 55 53 */ 56 54 void drm_printf(struct drm_printer *p, const char *f, ...) 57 55 { 58 - struct va_format vaf; 59 56 va_list args; 60 57 61 58 va_start(args, f); 62 - vaf.fmt = f; 63 - vaf.va = &args; 64 - p->printfn(p, &vaf); 59 + drm_vprintf(p, f, &args); 65 60 va_end(args); 66 61 } 67 62 EXPORT_SYMBOL(drm_printf); 63 + 64 + #define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV" 65 + 66 + void drm_dev_printk(const struct device *dev, const char *level, 67 + unsigned int category, const char *function_name, 68 + const char *prefix, const char *format, ...) 69 + { 70 + struct va_format vaf; 71 + va_list args; 72 + 73 + if (category != DRM_UT_NONE && !(drm_debug & category)) 74 + return; 75 + 76 + va_start(args, format); 77 + vaf.fmt = format; 78 + vaf.va = &args; 79 + 80 + if (dev) 81 + dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix, 82 + &vaf); 83 + else 84 + printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf); 85 + 86 + va_end(args); 87 + } 88 + EXPORT_SYMBOL(drm_dev_printk); 89 + 90 + void drm_printk(const char *level, unsigned int category, 91 + const char *format, ...) 92 + { 93 + struct va_format vaf; 94 + va_list args; 95 + 96 + if (category != DRM_UT_NONE && !(drm_debug & category)) 97 + return; 98 + 99 + va_start(args, format); 100 + vaf.fmt = format; 101 + vaf.va = &args; 102 + 103 + printk("%s" "[" DRM_NAME ":%ps]%s %pV", 104 + level, __builtin_return_address(0), 105 + strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf); 106 + 107 + va_end(args); 108 + } 109 + EXPORT_SYMBOL(drm_printk);
+5 -4
drivers/gpu/drm/drm_simple_kms_helper.c
··· 103 103 clip.x2 = crtc_state->adjusted_mode.hdisplay; 104 104 clip.y2 = crtc_state->adjusted_mode.vdisplay; 105 105 106 - ret = drm_plane_helper_check_state(plane_state, &clip, 107 - DRM_PLANE_HELPER_NO_SCALING, 108 - DRM_PLANE_HELPER_NO_SCALING, 109 - false, true); 106 + ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state, 107 + &clip, 108 + DRM_PLANE_HELPER_NO_SCALING, 109 + DRM_PLANE_HELPER_NO_SCALING, 110 + false, true); 110 111 if (ret) 111 112 return ret; 112 113
+7 -4
drivers/gpu/drm/drm_syncobj.c
··· 106 106 * callback when a fence has already been set. 107 107 */ 108 108 if (syncobj->fence) { 109 - *fence = dma_fence_get(syncobj->fence); 109 + *fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 110 + lockdep_is_held(&syncobj->lock))); 110 111 ret = 1; 111 112 } else { 112 113 *fence = NULL; ··· 169 168 170 169 spin_lock(&syncobj->lock); 171 170 172 - old_fence = syncobj->fence; 173 - syncobj->fence = fence; 171 + old_fence = rcu_dereference_protected(syncobj->fence, 172 + lockdep_is_held(&syncobj->lock)); 173 + rcu_assign_pointer(syncobj->fence, fence); 174 174 175 175 if (fence != old_fence) { 176 176 list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { ··· 661 659 container_of(cb, struct syncobj_wait_entry, syncobj_cb); 662 660 663 661 /* This happens inside the syncobj lock */ 664 - wait->fence = dma_fence_get(syncobj->fence); 662 + wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 663 + lockdep_is_held(&syncobj->lock))); 665 664 wake_up_process(wait->task); 666 665 } 667 666
+7 -5
drivers/gpu/drm/drm_vblank.c
··· 663 663 delta_ns = div_s64(1000000LL * (vpos * mode->crtc_htotal + hpos), 664 664 mode->crtc_clock); 665 665 666 - /* save this only for debugging purposes */ 667 - ts_etime = ktime_to_timespec64(etime); 668 - ts_vblank_time = ktime_to_timespec64(*vblank_time); 669 666 /* Subtract time delta from raw timestamp to get final 670 667 * vblank_time timestamp for end of vblank. 671 668 */ 672 - etime = ktime_sub_ns(etime, delta_ns); 673 - *vblank_time = etime; 669 + *vblank_time = ktime_sub_ns(etime, delta_ns); 670 + 671 + if ((drm_debug & DRM_UT_VBL) == 0) 672 + return true; 673 + 674 + ts_etime = ktime_to_timespec64(etime); 675 + ts_vblank_time = ktime_to_timespec64(*vblank_time); 674 676 675 677 DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %lld.%06ld -> %lld.%06ld [e %d us, %d rep]\n", 676 678 pipe, hpos, vpos,
+5 -10
drivers/gpu/drm/drm_vma_manager.c
··· 203 203 int drm_vma_offset_add(struct drm_vma_offset_manager *mgr, 204 204 struct drm_vma_offset_node *node, unsigned long pages) 205 205 { 206 - int ret; 206 + int ret = 0; 207 207 208 208 write_lock(&mgr->vm_lock); 209 209 210 - if (drm_mm_node_allocated(&node->vm_node)) { 211 - ret = 0; 212 - goto out_unlock; 213 - } 210 + if (!drm_mm_node_allocated(&node->vm_node)) 211 + ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, 212 + &node->vm_node, pages); 214 213 215 - ret = drm_mm_insert_node(&mgr->vm_addr_space_mm, &node->vm_node, pages); 216 - if (ret) 217 - goto out_unlock; 218 - 219 - out_unlock: 220 214 write_unlock(&mgr->vm_lock); 215 + 221 216 return ret; 222 217 } 223 218 EXPORT_SYMBOL(drm_vma_offset_add);
+2 -1
drivers/gpu/drm/exynos/exynos_hdmi.c
··· 829 829 DRM_INFO("%s: invalid AVI infoframe (%d)\n", __func__, ret); 830 830 } 831 831 832 - ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, m); 832 + ret = drm_hdmi_vendor_infoframe_from_display_mode(&frm.vendor.hdmi, 833 + &hdata->connector, m); 833 834 if (!ret) 834 835 ret = hdmi_vendor_infoframe_pack(&frm.vendor.hdmi, buf, 835 836 sizeof(buf));
+1 -1
drivers/gpu/drm/gma500/mmu.c
··· 395 395 psb_mmu_clflush(pd->driver, (void *)&v[pt->index]); 396 396 atomic_set(&pd->driver->needs_tlbflush, 1); 397 397 } 398 - kunmap_atomic(pt->v); 398 + kunmap_atomic(v); 399 399 spin_unlock(&pd->driver->lock); 400 400 psb_mmu_free_pt(pt); 401 401 return;
+1 -1
drivers/gpu/drm/gma500/psb_drv.c
··· 527 527 528 528 MODULE_AUTHOR(DRIVER_AUTHOR); 529 529 MODULE_DESCRIPTION(DRIVER_DESC); 530 - MODULE_LICENSE(DRIVER_LICENSE); 530 + MODULE_LICENSE("GPL");
-1
drivers/gpu/drm/gma500/psb_drv.h
··· 36 36 #include "mmu.h" 37 37 38 38 #define DRIVER_AUTHOR "Alan Cox <alan@linux.intel.com> and others" 39 - #define DRIVER_LICENSE "GPL" 40 39 41 40 #define DRIVER_NAME "gma500" 42 41 #define DRIVER_DESC "DRM driver for the Intel GMA500, GMA600, GMA3600, GMA3650"
-1
drivers/gpu/drm/i2c/tda998x_drv.c
··· 1100 1100 1101 1101 drm_mode_connector_update_edid_property(connector, edid); 1102 1102 n = drm_add_edid_modes(connector, edid); 1103 - drm_edid_to_eld(connector, edid); 1104 1103 1105 1104 kfree(edid); 1106 1105
+11 -9
drivers/gpu/drm/i915/intel_display.c
··· 9314 9314 u32 offset; 9315 9315 int ret; 9316 9316 9317 - ret = drm_plane_helper_check_state(&plane_state->base, 9318 - &plane_state->clip, 9319 - DRM_PLANE_HELPER_NO_SCALING, 9320 - DRM_PLANE_HELPER_NO_SCALING, 9321 - true, true); 9317 + ret = drm_atomic_helper_check_plane_state(&plane_state->base, 9318 + &crtc_state->base, 9319 + &plane_state->clip, 9320 + DRM_PLANE_HELPER_NO_SCALING, 9321 + DRM_PLANE_HELPER_NO_SCALING, 9322 + true, true); 9322 9323 if (ret) 9323 9324 return ret; 9324 9325 ··· 12795 12794 can_position = true; 12796 12795 } 12797 12796 12798 - ret = drm_plane_helper_check_state(&state->base, 12799 - &state->clip, 12800 - min_scale, max_scale, 12801 - can_position, true); 12797 + ret = drm_atomic_helper_check_plane_state(&state->base, 12798 + &crtc_state->base, 12799 + &state->clip, 12800 + min_scale, max_scale, 12801 + can_position, true); 12802 12802 if (ret) 12803 12803 return ret; 12804 12804
-1
drivers/gpu/drm/i915/intel_dp.c
··· 5868 5868 if (drm_add_edid_modes(connector, edid)) { 5869 5869 drm_mode_connector_update_edid_property(connector, 5870 5870 edid); 5871 - drm_edid_to_eld(connector, edid); 5872 5871 } else { 5873 5872 kfree(edid); 5874 5873 edid = ERR_PTR(-EINVAL);
+8 -6
drivers/gpu/drm/i915/intel_hdmi.c
··· 513 513 514 514 static void 515 515 intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder, 516 - const struct intel_crtc_state *crtc_state) 516 + const struct intel_crtc_state *crtc_state, 517 + const struct drm_connector_state *conn_state) 517 518 { 518 519 union hdmi_infoframe frame; 519 520 int ret; 520 521 521 522 ret = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi, 523 + conn_state->connector, 522 524 &crtc_state->base.adjusted_mode); 523 525 if (ret < 0) 524 526 return; ··· 587 585 588 586 intel_hdmi_set_avi_infoframe(encoder, crtc_state); 589 587 intel_hdmi_set_spd_infoframe(encoder, crtc_state); 590 - intel_hdmi_set_hdmi_infoframe(encoder, crtc_state); 588 + intel_hdmi_set_hdmi_infoframe(encoder, crtc_state, conn_state); 591 589 } 592 590 593 591 static bool hdmi_sink_is_deep_color(const struct drm_connector_state *conn_state) ··· 728 726 729 727 intel_hdmi_set_avi_infoframe(encoder, crtc_state); 730 728 intel_hdmi_set_spd_infoframe(encoder, crtc_state); 731 - intel_hdmi_set_hdmi_infoframe(encoder, crtc_state); 729 + intel_hdmi_set_hdmi_infoframe(encoder, crtc_state, conn_state); 732 730 } 733 731 734 732 static void cpt_set_infoframes(struct drm_encoder *encoder, ··· 771 769 772 770 intel_hdmi_set_avi_infoframe(encoder, crtc_state); 773 771 intel_hdmi_set_spd_infoframe(encoder, crtc_state); 774 - intel_hdmi_set_hdmi_infoframe(encoder, crtc_state); 772 + intel_hdmi_set_hdmi_infoframe(encoder, crtc_state, conn_state); 775 773 } 776 774 777 775 static void vlv_set_infoframes(struct drm_encoder *encoder, ··· 824 822 825 823 intel_hdmi_set_avi_infoframe(encoder, crtc_state); 826 824 intel_hdmi_set_spd_infoframe(encoder, crtc_state); 827 - intel_hdmi_set_hdmi_infoframe(encoder, crtc_state); 825 + intel_hdmi_set_hdmi_infoframe(encoder, crtc_state, conn_state); 828 826 } 829 827 830 828 static void hsw_set_infoframes(struct drm_encoder *encoder, ··· 857 855 858 856 intel_hdmi_set_avi_infoframe(encoder, crtc_state); 859 857 intel_hdmi_set_spd_infoframe(encoder, crtc_state); 860 - intel_hdmi_set_hdmi_infoframe(encoder, crtc_state); 858 + intel_hdmi_set_hdmi_infoframe(encoder, crtc_state, conn_state); 861 859 } 862 860 863 861 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
-1
drivers/gpu/drm/i915/intel_modes.c
··· 57 57 58 58 drm_mode_connector_update_edid_property(connector, edid); 59 59 ret = drm_add_edid_modes(connector, edid); 60 - drm_edid_to_eld(connector, edid); 61 60 62 61 intel_connector_update_eld_conn_type(connector); 63 62
+4 -4
drivers/gpu/drm/imx/ipuv3-plane.c
··· 342 342 clip.y1 = 0; 343 343 clip.x2 = crtc_state->adjusted_mode.hdisplay; 344 344 clip.y2 = crtc_state->adjusted_mode.vdisplay; 345 - ret = drm_plane_helper_check_state(state, &clip, 346 - DRM_PLANE_HELPER_NO_SCALING, 347 - DRM_PLANE_HELPER_NO_SCALING, 348 - can_position, true); 345 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 346 + DRM_PLANE_HELPER_NO_SCALING, 347 + DRM_PLANE_HELPER_NO_SCALING, 348 + can_position, true); 349 349 if (ret) 350 350 return ret; 351 351
+4 -4
drivers/gpu/drm/mediatek/mtk_drm_plane.c
··· 111 111 clip.x2 = crtc_state->mode.hdisplay; 112 112 clip.y2 = crtc_state->mode.vdisplay; 113 113 114 - return drm_plane_helper_check_state(state, &clip, 115 - DRM_PLANE_HELPER_NO_SCALING, 116 - DRM_PLANE_HELPER_NO_SCALING, 117 - true, true); 114 + return drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 115 + DRM_PLANE_HELPER_NO_SCALING, 116 + DRM_PLANE_HELPER_NO_SCALING, 117 + true, true); 118 118 } 119 119 120 120 static void mtk_plane_atomic_update(struct drm_plane *plane,
+2 -2
drivers/gpu/drm/mediatek/mtk_hdmi.c
··· 1054 1054 u8 buffer[10]; 1055 1055 ssize_t err; 1056 1056 1057 - err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, mode); 1057 + err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, 1058 + &hdmi->conn, mode); 1058 1059 if (err) { 1059 1060 dev_err(hdmi->dev, 1060 1061 "Failed to get vendor infoframe from mode: %zd\n", err); ··· 1223 1222 drm_mode_connector_update_edid_property(conn, edid); 1224 1223 1225 1224 ret = drm_add_edid_modes(conn, edid); 1226 - drm_edid_to_eld(conn, edid); 1227 1225 kfree(edid); 1228 1226 return ret; 1229 1227 }
+4 -4
drivers/gpu/drm/meson/meson_plane.c
··· 61 61 clip.x2 = crtc_state->mode.hdisplay; 62 62 clip.y2 = crtc_state->mode.vdisplay; 63 63 64 - return drm_plane_helper_check_state(state, &clip, 65 - DRM_PLANE_HELPER_NO_SCALING, 66 - DRM_PLANE_HELPER_NO_SCALING, 67 - true, true); 64 + return drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 65 + DRM_PLANE_HELPER_NO_SCALING, 66 + DRM_PLANE_HELPER_NO_SCALING, 67 + true, true); 68 68 } 69 69 70 70 /* Takes a fixed 16.16 number and converts it to integer. */
+6 -4
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
··· 327 327 min_scale = FRAC_16_16(1, 8); 328 328 max_scale = FRAC_16_16(8, 1); 329 329 330 - ret = drm_plane_helper_check_state(state, &clip, min_scale, 331 - max_scale, true, true); 330 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 331 + min_scale, max_scale, 332 + true, true); 332 333 if (ret) 333 334 return ret; 334 335 ··· 506 505 min_scale = FRAC_16_16(1, 8); 507 506 max_scale = FRAC_16_16(8, 1); 508 507 509 - ret = drm_plane_helper_check_state(state, &clip, min_scale, 510 - max_scale, true, true); 508 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 509 + min_scale, max_scale, 510 + true, true); 511 511 if (ret) 512 512 return ret; 513 513
+13 -13
drivers/gpu/drm/nouveau/nv50_display.c
··· 1143 1143 { 1144 1144 int ret; 1145 1145 1146 - ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip, 1147 - DRM_PLANE_HELPER_NO_SCALING, 1148 - DRM_PLANE_HELPER_NO_SCALING, 1149 - true, true); 1146 + ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state, 1147 + &asyw->clip, 1148 + DRM_PLANE_HELPER_NO_SCALING, 1149 + DRM_PLANE_HELPER_NO_SCALING, 1150 + true, true); 1150 1151 asyh->curs.visible = asyw->state.visible; 1151 1152 if (ret || !asyh->curs.visible) 1152 1153 return ret; ··· 1433 1432 if (!fb->format->depth) 1434 1433 return -EINVAL; 1435 1434 1436 - ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip, 1437 - DRM_PLANE_HELPER_NO_SCALING, 1438 - DRM_PLANE_HELPER_NO_SCALING, 1439 - false, true); 1435 + ret = drm_atomic_helper_check_plane_state(&asyw->state, &asyh->state, 1436 + &asyw->clip, 1437 + DRM_PLANE_HELPER_NO_SCALING, 1438 + DRM_PLANE_HELPER_NO_SCALING, 1439 + false, true); 1440 1440 if (ret) 1441 1441 return ret; 1442 1442 ··· 2690 2688 if (!drm_detect_monitor_audio(nv_connector->edid)) 2691 2689 return; 2692 2690 2693 - drm_edid_to_eld(&nv_connector->base, nv_connector->edid); 2694 2691 memcpy(args.data, nv_connector->base.eld, sizeof(args.data)); 2695 2692 2696 2693 nvif_mthd(disp->disp, 0, &args, ··· 2756 2755 = hdmi_infoframe_pack(&avi_frame, args.infoframes, 17); 2757 2756 } 2758 2757 2759 - ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode); 2758 + ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, 2759 + &nv_connector->base, mode); 2760 2760 if (!ret) { 2761 2761 /* We have a Vendor InfoFrame, populate it to the display */ 2762 2762 args.pwr.vendor_infoframe_length ··· 3066 3064 3067 3065 mstc->edid = drm_dp_mst_get_edid(&mstc->connector, mstc->port->mgr, mstc->port); 3068 3066 drm_mode_connector_update_edid_property(&mstc->connector, mstc->edid); 3069 - if (mstc->edid) { 3067 + if (mstc->edid) 3070 3068 ret = drm_add_edid_modes(&mstc->connector, mstc->edid); 3071 - drm_edid_to_eld(&mstc->connector, mstc->edid); 3072 - } 3073 3069 3074 3070 if (!mstc->connector.display_info.bpc) 3075 3071 mstc->connector.display_info.bpc = 8;
+1 -1
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
··· 221 221 return container_of(panel, struct rpi_touchscreen, base); 222 222 } 223 223 224 - static u8 rpi_touchscreen_i2c_read(struct rpi_touchscreen *ts, u8 reg) 224 + static int rpi_touchscreen_i2c_read(struct rpi_touchscreen *ts, u8 reg) 225 225 { 226 226 return i2c_smbus_read_byte_data(ts->i2c, reg); 227 227 }
+62
drivers/gpu/drm/panel/panel-simple.c
··· 1356 1356 }, 1357 1357 }; 1358 1358 1359 + static const struct drm_display_mode mitsubishi_aa070mc01_mode = { 1360 + .clock = 30400, 1361 + .hdisplay = 800, 1362 + .hsync_start = 800 + 0, 1363 + .hsync_end = 800 + 1, 1364 + .htotal = 800 + 0 + 1 + 160, 1365 + .vdisplay = 480, 1366 + .vsync_start = 480 + 0, 1367 + .vsync_end = 480 + 48 + 1, 1368 + .vtotal = 480 + 48 + 1 + 0, 1369 + .vrefresh = 60, 1370 + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, 1371 + }; 1372 + 1373 + static const struct panel_desc mitsubishi_aa070mc01 = { 1374 + .modes = &mitsubishi_aa070mc01_mode, 1375 + .num_modes = 1, 1376 + .bpc = 8, 1377 + .size = { 1378 + .width = 152, 1379 + .height = 91, 1380 + }, 1381 + 1382 + .delay = { 1383 + .enable = 200, 1384 + .unprepare = 200, 1385 + .disable = 400, 1386 + }, 1387 + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 1388 + .bus_flags = DRM_BUS_FLAG_DE_HIGH, 1389 + }; 1390 + 1359 1391 static const struct display_timing nec_nl12880bc20_05_timing = { 1360 1392 .pixelclock = { 67000000, 71000000, 75000000 }, 1361 1393 .hactive = { 1280, 1280, 1280 }, ··· 1869 1837 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 1870 1838 }; 1871 1839 1840 + static const struct display_timing tianma_tm070rvhg71_timing = { 1841 + .pixelclock = { 27700000, 29200000, 39600000 }, 1842 + .hactive = { 800, 800, 800 }, 1843 + .hfront_porch = { 12, 40, 212 }, 1844 + .hback_porch = { 88, 88, 88 }, 1845 + .hsync_len = { 1, 1, 40 }, 1846 + .vactive = { 480, 480, 480 }, 1847 + .vfront_porch = { 1, 13, 88 }, 1848 + .vback_porch = { 32, 32, 32 }, 1849 + .vsync_len = { 1, 1, 3 }, 1850 + .flags = DISPLAY_FLAGS_DE_HIGH, 1851 + }; 1852 + 1853 + static const struct panel_desc tianma_tm070rvhg71 = { 1854 + .timings = &tianma_tm070rvhg71_timing, 1855 + .num_timings = 1, 1856 + .bpc = 8, 1857 + .size = { 1858 + .width = 154, 1859 + .height = 86, 1860 + }, 1861 + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 1862 + }; 1863 + 1872 1864 static const struct drm_display_mode toshiba_lt089ac29000_mode = { 1873 1865 .clock = 79500, 1874 1866 .hdisplay = 1280, ··· 2142 2086 .compatible = "lg,lp129qe", 2143 2087 .data = &lg_lp129qe, 2144 2088 }, { 2089 + .compatible = "mitsubishi,aa070mc01-ca1", 2090 + .data = &mitsubishi_aa070mc01, 2091 + }, { 2145 2092 .compatible = "nec,nl12880bc20-05", 2146 2093 .data = &nec_nl12880bc20_05, 2147 2094 }, { ··· 2201 2142 }, { 2202 2143 .compatible = "tianma,tm070jdhg30", 2203 2144 .data = &tianma_tm070jdhg30, 2145 + }, { 2146 + .compatible = "tianma,tm070rvhg71", 2147 + .data = &tianma_tm070rvhg71, 2204 2148 }, { 2205 2149 .compatible = "toshiba,lt089ac29000", 2206 2150 .data = &toshiba_lt089ac29000,
+1 -4
drivers/gpu/drm/qxl/qxl_ttm.c
··· 123 123 struct qxl_device *qdev; 124 124 int r; 125 125 126 - if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) { 127 - pr_info("%s: vma->vm_pgoff (%ld) < DRM_FILE_PAGE_OFFSET\n", 128 - __func__, vma->vm_pgoff); 126 + if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) 129 127 return -EINVAL; 130 - } 131 128 132 129 file_priv = filp->private_data; 133 130 qdev = file_priv->minor->dev->dev_private;
-1
drivers/gpu/drm/radeon/radeon_connectors.c
··· 392 392 if (radeon_connector->edid) { 393 393 drm_mode_connector_update_edid_property(connector, radeon_connector->edid); 394 394 ret = drm_add_edid_modes(connector, radeon_connector->edid); 395 - drm_edid_to_eld(connector, radeon_connector->edid); 396 395 return ret; 397 396 } 398 397 drm_mode_connector_update_edid_property(connector, NULL);
-1
drivers/gpu/drm/radeon/radeon_dp_mst.c
··· 197 197 if (radeon_connector->edid) { 198 198 drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); 199 199 ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); 200 - drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); 201 200 return ret; 202 201 } 203 202 drm_mode_connector_update_edid_property(&radeon_connector->base, NULL);
+6 -22
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
··· 267 267 .destroy = rockchip_dp_drm_encoder_destroy, 268 268 }; 269 269 270 - static int rockchip_dp_init(struct rockchip_dp_device *dp) 270 + static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) 271 271 { 272 272 struct device *dev = dp->dev; 273 273 struct device_node *np = dev->of_node; 274 - int ret; 275 274 276 275 dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); 277 276 if (IS_ERR(dp->grf)) { ··· 298 299 if (IS_ERR(dp->rst)) { 299 300 DRM_DEV_ERROR(dev, "failed to get dp reset control\n"); 300 301 return PTR_ERR(dp->rst); 301 - } 302 - 303 - ret = clk_prepare_enable(dp->pclk); 304 - if (ret < 0) { 305 - DRM_DEV_ERROR(dp->dev, "failed to enable pclk %d\n", ret); 306 - return ret; 307 - } 308 - 309 - ret = rockchip_dp_pre_init(dp); 310 - if (ret < 0) { 311 - DRM_DEV_ERROR(dp->dev, "failed to pre init %d\n", ret); 312 - clk_disable_unprepare(dp->pclk); 313 - return ret; 314 302 } 315 303 316 304 return 0; ··· 345 359 if (!dp_data) 346 360 return -ENODEV; 347 361 348 - ret = rockchip_dp_init(dp); 349 - if (ret < 0) 350 - return ret; 351 - 352 362 dp->data = dp_data; 353 363 dp->drm_dev = drm_dev; 354 364 ··· 378 396 rockchip_drm_psr_unregister(&dp->encoder); 379 397 380 398 analogix_dp_unbind(dev, master, data); 381 - clk_disable_unprepare(dp->pclk); 382 399 } 383 400 384 401 static const struct component_ops rockchip_dp_component_ops = { ··· 393 412 int ret; 394 413 395 414 ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL); 396 - if (ret) 415 + if (ret < 0) 397 416 return ret; 398 417 399 418 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); ··· 401 420 return -ENOMEM; 402 421 403 422 dp->dev = dev; 404 - 405 423 dp->plat_data.panel = panel; 424 + 425 + ret = rockchip_dp_of_probe(dp); 426 + if (ret < 0) 427 + return ret; 406 428 407 429 /* 408 430 * We just use the drvdata until driver run into component
+1 -3
drivers/gpu/drm/rockchip/cdn-dp-core.c
··· 276 276 277 277 dp->sink_has_audio = drm_detect_monitor_audio(edid); 278 278 ret = drm_add_edid_modes(connector, edid); 279 - if (ret) { 279 + if (ret) 280 280 drm_mode_connector_update_edid_property(connector, 281 281 edid); 282 - drm_edid_to_eld(connector, edid); 283 - } 284 282 } 285 283 mutex_unlock(&dp->lock); 286 284
+1
drivers/gpu/drm/rockchip/inno_hdmi.c
··· 282 282 int rc; 283 283 284 284 rc = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi, 285 + &hdmi->connector, 285 286 mode); 286 287 287 288 return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_VSI,
+3 -3
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 659 659 clip.x2 = crtc_state->adjusted_mode.hdisplay; 660 660 clip.y2 = crtc_state->adjusted_mode.vdisplay; 661 661 662 - ret = drm_plane_helper_check_state(state, &clip, 663 - min_scale, max_scale, 664 - true, true); 662 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 663 + min_scale, max_scale, 664 + true, true); 665 665 if (ret) 666 666 return ret; 667 667
+30
drivers/gpu/drm/rockchip/rockchip_vop_reg.c
··· 149 149 .win_size = ARRAY_SIZE(rk3036_vop_win_data), 150 150 }; 151 151 152 + static const struct vop_win_phy rk3126_win1_data = { 153 + .data_formats = formats_win_lite, 154 + .nformats = ARRAY_SIZE(formats_win_lite), 155 + .enable = VOP_REG(RK3036_SYS_CTRL, 0x1, 1), 156 + .format = VOP_REG(RK3036_SYS_CTRL, 0x7, 6), 157 + .rb_swap = VOP_REG(RK3036_SYS_CTRL, 0x1, 19), 158 + .dsp_info = VOP_REG(RK3126_WIN1_DSP_INFO, 0x0fff0fff, 0), 159 + .dsp_st = VOP_REG(RK3126_WIN1_DSP_ST, 0x1fff1fff, 0), 160 + .yrgb_mst = VOP_REG(RK3126_WIN1_MST, 0xffffffff, 0), 161 + .yrgb_vir = VOP_REG(RK3036_WIN1_VIR, 0xffff, 0), 162 + }; 163 + 164 + static const struct vop_win_data rk3126_vop_win_data[] = { 165 + { .base = 0x00, .phy = &rk3036_win0_data, 166 + .type = DRM_PLANE_TYPE_PRIMARY }, 167 + { .base = 0x00, .phy = &rk3126_win1_data, 168 + .type = DRM_PLANE_TYPE_CURSOR }, 169 + }; 170 + 171 + static const struct vop_data rk3126_vop = { 172 + .intr = &rk3036_intr, 173 + .common = &rk3036_common, 174 + .modeset = &rk3036_modeset, 175 + .output = &rk3036_output, 176 + .win = rk3126_vop_win_data, 177 + .win_size = ARRAY_SIZE(rk3126_vop_win_data), 178 + }; 179 + 152 180 static const struct vop_scl_extension rk3288_win_full_scl_ext = { 153 181 .cbcr_vsd_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 31), 154 182 .cbcr_vsu_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 30), ··· 538 510 static const struct of_device_id vop_driver_dt_match[] = { 539 511 { .compatible = "rockchip,rk3036-vop", 540 512 .data = &rk3036_vop }, 513 + { .compatible = "rockchip,rk3126-vop", 514 + .data = &rk3126_vop }, 541 515 { .compatible = "rockchip,rk3288-vop", 542 516 .data = &rk3288_vop }, 543 517 { .compatible = "rockchip,rk3368-vop",
+6
drivers/gpu/drm/rockchip/rockchip_vop_reg.h
··· 878 878 #define RK3036_HWC_LUT_ADDR 0x800 879 879 /* rk3036 register definition end */ 880 880 881 + /* rk3126 register definition */ 882 + #define RK3126_WIN1_MST 0x4c 883 + #define RK3126_WIN1_DSP_INFO 0x50 884 + #define RK3126_WIN1_DSP_ST 0x54 885 + /* rk3126 register definition end */ 886 + 881 887 #endif /* _ROCKCHIP_VOP_REG_H */
+5
drivers/gpu/drm/selftests/test-drm_mm.c
··· 682 682 drm_mm_for_each_node_safe(node, next, &mm) 683 683 drm_mm_remove_node(node); 684 684 DRM_MM_BUG_ON(!drm_mm_clean(&mm)); 685 + 686 + cond_resched(); 685 687 } 686 688 687 689 ret = 0; ··· 946 944 drm_mm_for_each_node_safe(node, next, &mm) 947 945 drm_mm_remove_node(node); 948 946 DRM_MM_BUG_ON(!drm_mm_clean(&mm)); 947 + 948 + cond_resched(); 949 949 } 950 950 951 951 ret = 0; ··· 1072 1068 drm_mm_for_each_node_safe(node, next, &mm) 1073 1069 drm_mm_remove_node(node); 1074 1070 DRM_MM_BUG_ON(!drm_mm_clean(&mm)); 1071 + 1075 1072 cond_resched(); 1076 1073 } 1077 1074
+1
drivers/gpu/drm/sti/Kconfig
··· 8 8 select DRM_PANEL 9 9 select FW_LOADER 10 10 select SND_SOC_HDMI_CODEC if SND_SOC 11 + select OF 11 12 help 12 13 Choose this option to enable DRM on STM stiH4xx chipset
+8 -2
drivers/gpu/drm/sti/sti_hdmi.c
··· 515 515 516 516 DRM_DEBUG_DRIVER("\n"); 517 517 518 - ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe, mode); 518 + ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe, 519 + hdmi->drm_connector, 520 + mode); 519 521 if (ret < 0) { 520 522 /* 521 523 * Going into that statement does not means vendor infoframe ··· 978 976 979 977 count = drm_add_edid_modes(connector, edid); 980 978 drm_mode_connector_update_edid_property(connector, edid); 981 - drm_edid_to_eld(connector, edid); 982 979 983 980 kfree(edid); 984 981 return count; ··· 1415 1414 init_waitqueue_head(&hdmi->wait_event); 1416 1415 1417 1416 hdmi->irq = platform_get_irq_byname(pdev, "irq"); 1417 + if (hdmi->irq < 0) { 1418 + DRM_ERROR("Cannot get HDMI irq\n"); 1419 + ret = hdmi->irq; 1420 + goto release_adapter; 1421 + } 1418 1422 1419 1423 ret = devm_request_threaded_irq(dev, hdmi->irq, hdmi_irq, 1420 1424 hdmi_irq_thread, IRQF_ONESHOT, dev_name(dev), hdmi);
+8 -30
drivers/gpu/drm/sti/sti_vtg.c
··· 9 9 10 10 #include <linux/module.h> 11 11 #include <linux/notifier.h> 12 + #include <linux/of_platform.h> 12 13 #include <linux/platform_device.h> 13 14 14 15 #include <drm/drmP.h> ··· 73 72 #define AWG_DELAY_ED (-8) 74 73 #define AWG_DELAY_SD (-7) 75 74 76 - static LIST_HEAD(vtg_lookup); 77 - 78 75 /* 79 76 * STI VTG register offset structure 80 77 * ··· 122 123 /** 123 124 * STI VTG structure 124 125 * 125 - * @dev: pointer to device driver 126 - * @np: device node 127 126 * @regs: register mapping 128 127 * @sync_params: synchronisation parameters used to generate timings 129 128 * @irq: VTG irq 130 129 * @irq_status: store the IRQ status value 131 130 * @notifier_list: notifier callback 132 131 * @crtc: the CRTC for vblank event 133 - * @link: List node to link the structure in lookup list 134 132 */ 135 133 struct sti_vtg { 136 - struct device *dev; 137 - struct device_node *np; 138 134 void __iomem *regs; 139 135 struct sti_vtg_sync_params sync_params[VTG_MAX_SYNC_OUTPUT]; 140 136 int irq; 141 137 u32 irq_status; 142 138 struct raw_notifier_head notifier_list; 143 139 struct drm_crtc *crtc; 144 - struct list_head link; 145 140 }; 146 - 147 - static void vtg_register(struct sti_vtg *vtg) 148 - { 149 - list_add_tail(&vtg->link, &vtg_lookup); 150 - } 151 141 152 142 struct sti_vtg *of_vtg_find(struct device_node *np) 153 143 { 154 - struct sti_vtg *vtg; 144 + struct platform_device *pdev; 155 145 156 - list_for_each_entry(vtg, &vtg_lookup, link) { 157 - if (vtg->np == np) 158 - return vtg; 159 - } 160 - return NULL; 146 + pdev = of_find_device_by_node(np); 147 + if (!pdev) 148 + return NULL; 149 + 150 + return (struct sti_vtg *)platform_get_drvdata(pdev); 161 151 } 162 152 163 153 static void vtg_reset(struct sti_vtg *vtg) ··· 385 397 if (!vtg) 386 398 return -ENOMEM; 387 399 388 - vtg->dev = dev; 389 - vtg->np = pdev->dev.of_node; 390 - 391 400 /* Get Memory ressources */ 392 401 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 393 402 if (!res) { ··· 413 428 return ret; 414 429 } 415 430 416 - vtg_register(vtg); 417 431 platform_set_drvdata(pdev, vtg); 418 432 419 - DRM_INFO("%s %s\n", __func__, dev_name(vtg->dev)); 433 + DRM_INFO("%s %s\n", __func__, dev_name(dev)); 420 434 421 - return 0; 422 - } 423 - 424 - static int vtg_remove(struct platform_device *pdev) 425 - { 426 435 return 0; 427 436 } 428 437 ··· 433 454 .of_match_table = vtg_of_match, 434 455 }, 435 456 .probe = vtg_probe, 436 - .remove = vtg_remove, 437 457 }; 438 458 439 459 MODULE_AUTHOR("Benjamin Gaignard <benjamin.gaignard@st.com>");
+3 -3
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
··· 129 129 int fvco_min, fvco_max, delta, best_delta; /* all in khz */ 130 130 131 131 /* Early checks preventing division by 0 & odd results */ 132 - if ((clkin_khz <= 0) || (clkout_khz <= 0)) 132 + if (clkin_khz <= 0 || clkout_khz <= 0) 133 133 return -EINVAL; 134 134 135 135 fvco_min = LANE_MIN_KBPS * 2 * ODF_MAX; ··· 155 155 for (o = ODF_MIN; o <= ODF_MAX; o *= 2) { 156 156 n = DIV_ROUND_CLOSEST(i * o * clkout_khz, clkin_khz); 157 157 /* Check ndiv according to vco range */ 158 - if ((n < n_min) || (n > n_max)) 158 + if (n < n_min || n > n_max) 159 159 continue; 160 160 /* Check if new delta is better & saves parameters */ 161 161 delta = dsi_pll_get_clkout_khz(clkin_khz, i, n, o) - ··· 342 342 .remove = dw_mipi_dsi_stm_remove, 343 343 .driver = { 344 344 .of_match_table = dw_mipi_dsi_stm_dt_ids, 345 - .name = "dw_mipi_dsi-stm", 345 + .name = "stm32-display-dsi", 346 346 }, 347 347 }; 348 348
+46 -20
drivers/gpu/drm/stm/ltdc.c
··· 33 33 34 34 #define MAX_IRQ 4 35 35 36 + #define MAX_ENDPOINTS 2 37 + 36 38 #define HWVER_10200 0x010200 37 39 #define HWVER_10300 0x010300 38 40 #define HWVER_20101 0x020101 ··· 558 556 src_h = state->src_h >> 16; 559 557 560 558 /* Reject scaling */ 561 - if ((src_w != state->crtc_w) || (src_h != state->crtc_h)) { 559 + if (src_w != state->crtc_w || src_h != state->crtc_h) { 562 560 DRM_ERROR("Scaling is not supported"); 563 561 return -EINVAL; 564 562 } ··· 858 856 struct ltdc_device *ldev = ddev->dev_private; 859 857 struct device *dev = ddev->dev; 860 858 struct device_node *np = dev->of_node; 861 - struct drm_bridge *bridge; 862 - struct drm_panel *panel; 859 + struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL}; 860 + struct drm_panel *panel[MAX_ENDPOINTS] = {NULL}; 863 861 struct drm_crtc *crtc; 864 862 struct reset_control *rstc; 865 863 struct resource *res; 866 - int irq, ret, i; 864 + int irq, ret, i, endpoint_not_ready = -ENODEV; 867 865 868 866 DRM_DEBUG_DRIVER("\n"); 869 867 870 - ret = drm_of_find_panel_or_bridge(np, 0, 0, &panel, &bridge); 871 - if (ret) 872 - return ret; 868 + /* Get endpoints if any */ 869 + for (i = 0; i < MAX_ENDPOINTS; i++) { 870 + ret = drm_of_find_panel_or_bridge(np, 0, i, &panel[i], 871 + &bridge[i]); 872 + 873 + /* 874 + * If at least one endpoint is ready, continue probing, 875 + * else if at least one endpoint is -EPROBE_DEFER and 876 + * there is no previous ready endpoints, defer probing. 877 + */ 878 + if (!ret) 879 + endpoint_not_ready = 0; 880 + else if (ret == -EPROBE_DEFER && endpoint_not_ready) 881 + endpoint_not_ready = -EPROBE_DEFER; 882 + } 883 + 884 + if (endpoint_not_ready) 885 + return endpoint_not_ready; 873 886 874 887 rstc = devm_reset_control_get_exclusive(dev, NULL); 875 888 ··· 945 928 946 929 DRM_INFO("ltdc hw version 0x%08x - ready\n", ldev->caps.hw_version); 947 930 948 - if (panel) { 949 - bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_DPI); 950 - if (IS_ERR(bridge)) { 951 - DRM_ERROR("Failed to create panel-bridge\n"); 952 - ret = PTR_ERR(bridge); 953 - goto err; 931 + /* Add endpoints panels or bridges if any */ 932 + for (i = 0; i < MAX_ENDPOINTS; i++) { 933 + if (panel[i]) { 934 + bridge[i] = drm_panel_bridge_add(panel[i], 935 + DRM_MODE_CONNECTOR_DPI); 936 + if (IS_ERR(bridge[i])) { 937 + DRM_ERROR("panel-bridge endpoint %d\n", i); 938 + ret = PTR_ERR(bridge[i]); 939 + goto err; 940 + } 954 941 } 955 - } 956 942 957 - ret = ltdc_encoder_init(ddev, bridge); 958 - if (ret) { 959 - DRM_ERROR("Failed to init encoder\n"); 960 - goto err; 943 + if (bridge[i]) { 944 + ret = ltdc_encoder_init(ddev, bridge[i]); 945 + if (ret) { 946 + DRM_ERROR("init encoder endpoint %d\n", i); 947 + goto err; 948 + } 949 + } 961 950 } 962 951 963 952 crtc = devm_kzalloc(dev, sizeof(*crtc), GFP_KERNEL); ··· 991 968 return 0; 992 969 993 970 err: 994 - drm_panel_bridge_remove(bridge); 971 + for (i = 0; i < MAX_ENDPOINTS; i++) 972 + drm_panel_bridge_remove(bridge[i]); 995 973 996 974 clk_disable_unprepare(ldev->pixel_clk); 997 975 ··· 1002 978 void ltdc_unload(struct drm_device *ddev) 1003 979 { 1004 980 struct ltdc_device *ldev = ddev->dev_private; 981 + int i; 1005 982 1006 983 DRM_DEBUG_DRIVER("\n"); 1007 984 1008 - drm_of_panel_bridge_remove(ddev->dev->of_node, 0, 0); 985 + for (i = 0; i < MAX_ENDPOINTS; i++) 986 + drm_of_panel_bridge_remove(ddev->dev->of_node, 0, i); 1009 987 1010 988 clk_disable_unprepare(ldev->pixel_clk); 1011 989 }
+2 -2
drivers/gpu/drm/tegra/dc.c
··· 491 491 clip.y2 = crtc_state->mode.vdisplay; 492 492 493 493 /* Check plane state for visibility and calculate clipping bounds */ 494 - err = drm_plane_helper_check_state(state, &clip, 0, INT_MAX, 495 - true, true); 494 + err = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 495 + 0, INT_MAX, true, true); 496 496 if (err < 0) 497 497 return err; 498 498
-1
drivers/gpu/drm/tegra/output.c
··· 39 39 40 40 if (edid) { 41 41 err = drm_add_edid_modes(connector, edid); 42 - drm_edid_to_eld(connector, edid); 43 42 kfree(edid); 44 43 } 45 44
+1 -1
drivers/gpu/drm/tilcdc/tilcdc_drv.c
··· 507 507 static struct drm_info_list tilcdc_debugfs_list[] = { 508 508 { "regs", tilcdc_regs_show, 0 }, 509 509 { "mm", tilcdc_mm_show, 0 }, 510 - { "fb", drm_fb_cma_debugfs_show, 0 }, 511 510 }; 512 511 513 512 static int tilcdc_debugfs_init(struct drm_minor *minor) ··· 540 541 .lastclose = tilcdc_lastclose, 541 542 .irq_handler = tilcdc_irq, 542 543 .gem_free_object_unlocked = drm_gem_cma_free_object, 544 + .gem_print_info = drm_gem_cma_print_info, 543 545 .gem_vm_ops = &drm_gem_cma_vm_ops, 544 546 .dumb_create = drm_gem_cma_dumb_create, 545 547
+1 -3
drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
··· 414 414 void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m) 415 415 { 416 416 struct spi_transfer *tmp; 417 - struct list_head *pos; 418 417 int i = 0; 419 418 420 - list_for_each(pos, &m->transfers) { 421 - tmp = list_entry(pos, struct spi_transfer, transfer_list); 419 + list_for_each_entry(tmp, &m->transfers, transfer_list) { 422 420 423 421 if (tmp->tx_buf) 424 422 tinydrm_dbg_spi_print(spi, tmp, tmp->tx_buf, i, true);
+1 -7
drivers/gpu/drm/tinydrm/mipi-dbi.c
··· 961 961 .write = mipi_dbi_debugfs_command_write, 962 962 }; 963 963 964 - static const struct drm_info_list mipi_dbi_debugfs_list[] = { 965 - { "fb", drm_fb_cma_debugfs_show, 0 }, 966 - }; 967 - 968 964 /** 969 965 * mipi_dbi_debugfs_init - Create debugfs entries 970 966 * @minor: DRM minor ··· 983 987 debugfs_create_file("command", mode, minor->debugfs_root, mipi, 984 988 &mipi_dbi_debugfs_command_fops); 985 989 986 - return drm_debugfs_create_files(mipi_dbi_debugfs_list, 987 - ARRAY_SIZE(mipi_dbi_debugfs_list), 988 - minor->debugfs_root, minor); 990 + return 0; 989 991 } 990 992 EXPORT_SYMBOL(mipi_dbi_debugfs_init); 991 993
+15 -1
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 287 287 288 288 drm_mode_connector_update_edid_property(connector, edid); 289 289 ret = drm_add_edid_modes(connector, edid); 290 - drm_edid_to_eld(connector, edid); 291 290 kfree(edid); 292 291 293 292 return ret; ··· 694 695 } 695 696 } 696 697 698 + static enum drm_mode_status 699 + vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc, 700 + const struct drm_display_mode *mode) 701 + { 702 + /* HSM clock must be 108% of the pixel clock. Additionally, 703 + * the AXI clock needs to be at least 25% of pixel clock, but 704 + * HSM ends up being the limiting factor. 705 + */ 706 + if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100)) 707 + return MODE_CLOCK_HIGH; 708 + 709 + return MODE_OK; 710 + } 711 + 697 712 static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { 713 + .mode_valid = vc4_hdmi_encoder_mode_valid, 698 714 .disable = vc4_hdmi_encoder_disable, 699 715 .enable = vc4_hdmi_encoder_enable, 700 716 };
+26 -12
drivers/gpu/drm/vc4/vc4_plane.c
··· 86 86 u32 hvs; /* HVS_FORMAT_* */ 87 87 u32 pixel_order; 88 88 bool has_alpha; 89 - bool flip_cbcr; 90 89 } hvs_formats[] = { 91 90 { 92 91 .drm = DRM_FORMAT_XRGB8888, .hvs = HVS_PIXEL_FORMAT_RGBA8888, ··· 120 121 .pixel_order = HVS_PIXEL_ORDER_ABGR, .has_alpha = false, 121 122 }, 122 123 { 124 + .drm = DRM_FORMAT_RGB888, .hvs = HVS_PIXEL_FORMAT_RGB888, 125 + .pixel_order = HVS_PIXEL_ORDER_XRGB, .has_alpha = false, 126 + }, 127 + { 128 + .drm = DRM_FORMAT_BGR888, .hvs = HVS_PIXEL_FORMAT_RGB888, 129 + .pixel_order = HVS_PIXEL_ORDER_XBGR, .has_alpha = false, 130 + }, 131 + { 123 132 .drm = DRM_FORMAT_YUV422, 124 133 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, 134 + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 125 135 }, 126 136 { 127 137 .drm = DRM_FORMAT_YVU422, 128 138 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE, 129 - .flip_cbcr = true, 139 + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 130 140 }, 131 141 { 132 142 .drm = DRM_FORMAT_YUV420, 133 143 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, 144 + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 134 145 }, 135 146 { 136 147 .drm = DRM_FORMAT_YVU420, 137 148 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE, 138 - .flip_cbcr = true, 149 + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 139 150 }, 140 151 { 141 152 .drm = DRM_FORMAT_NV12, 142 153 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE, 154 + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 155 + }, 156 + { 157 + .drm = DRM_FORMAT_NV21, 158 + .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE, 159 + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 143 160 }, 144 161 { 145 162 .drm = DRM_FORMAT_NV16, 146 163 .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE, 164 + .pixel_order = HVS_PIXEL_ORDER_XYCBCR, 165 + }, 166 + { 167 + .drm = DRM_FORMAT_NV61, 168 + .hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE, 169 + .pixel_order = HVS_PIXEL_ORDER_XYCRCB, 147 170 }, 148 171 }; 149 172 ··· 638 617 * The pointers may be any byte address. 639 618 */ 640 619 vc4_state->ptr0_offset = vc4_state->dlist_count; 641 - if (!format->flip_cbcr) { 642 - for (i = 0; i < num_planes; i++) 643 - vc4_dlist_write(vc4_state, vc4_state->offsets[i]); 644 - } else { 645 - WARN_ON_ONCE(num_planes != 3); 646 - vc4_dlist_write(vc4_state, vc4_state->offsets[0]); 647 - vc4_dlist_write(vc4_state, vc4_state->offsets[2]); 648 - vc4_dlist_write(vc4_state, vc4_state->offsets[1]); 649 - } 620 + for (i = 0; i < num_planes; i++) 621 + vc4_dlist_write(vc4_state, vc4_state->offsets[i]); 650 622 651 623 /* Pointer Context Word 0/1/2: Written by the HVS */ 652 624 for (i = 0; i < num_planes; i++)
+2 -2
drivers/gpu/drm/via/via_drv.h
··· 74 74 volatile uint32_t *last_pause_ptr; 75 75 volatile uint32_t *hw_addr_ptr; 76 76 drm_via_ring_buffer_t ring; 77 - struct timeval last_vblank; 77 + ktime_t last_vblank; 78 78 int last_vblank_valid; 79 - unsigned usec_per_vblank; 79 + ktime_t nsec_per_vblank; 80 80 atomic_t vbl_received; 81 81 drm_via_state_t hc_state; 82 82 char pci_buf[VIA_PCI_BUF_SIZE];
+10 -17
drivers/gpu/drm/via/via_irq.c
··· 88 88 static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1}; 89 89 90 90 91 - static unsigned time_diff(struct timeval *now, struct timeval *then) 92 - { 93 - return (now->tv_usec >= then->tv_usec) ? 94 - now->tv_usec - then->tv_usec : 95 - 1000000 - (then->tv_usec - now->tv_usec); 96 - } 97 - 98 91 u32 via_get_vblank_counter(struct drm_device *dev, unsigned int pipe) 99 92 { 100 93 drm_via_private_t *dev_priv = dev->dev_private; ··· 104 111 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 105 112 u32 status; 106 113 int handled = 0; 107 - struct timeval cur_vblank; 114 + ktime_t cur_vblank; 108 115 drm_via_irq_t *cur_irq = dev_priv->via_irqs; 109 116 int i; 110 117 ··· 112 119 if (status & VIA_IRQ_VBLANK_PENDING) { 113 120 atomic_inc(&dev_priv->vbl_received); 114 121 if (!(atomic_read(&dev_priv->vbl_received) & 0x0F)) { 115 - do_gettimeofday(&cur_vblank); 122 + cur_vblank = ktime_get(); 116 123 if (dev_priv->last_vblank_valid) { 117 - dev_priv->usec_per_vblank = 118 - time_diff(&cur_vblank, 119 - &dev_priv->last_vblank) >> 4; 124 + dev_priv->nsec_per_vblank = 125 + ktime_sub(cur_vblank, 126 + dev_priv->last_vblank) >> 4; 120 127 } 121 128 dev_priv->last_vblank = cur_vblank; 122 129 dev_priv->last_vblank_valid = 1; 123 130 } 124 131 if (!(atomic_read(&dev_priv->vbl_received) & 0xFF)) { 125 - DRM_DEBUG("US per vblank is: %u\n", 126 - dev_priv->usec_per_vblank); 132 + DRM_DEBUG("nsec per vblank is: %llu\n", 133 + ktime_to_ns(dev_priv->nsec_per_vblank)); 127 134 } 128 135 drm_handle_vblank(dev, 0); 129 136 handled = 1; ··· 343 350 int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) 344 351 { 345 352 drm_via_irqwait_t *irqwait = data; 346 - struct timeval now; 353 + struct timespec64 now; 347 354 int ret = 0; 348 355 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; 349 356 drm_via_irq_t *cur_irq = dev_priv->via_irqs; ··· 377 384 378 385 ret = via_driver_irq_wait(dev, irqwait->request.irq, force_sequence, 379 386 &irqwait->request.sequence); 380 - do_gettimeofday(&now); 387 + ktime_get_ts64(&now); 381 388 irqwait->reply.tval_sec = now.tv_sec; 382 - irqwait->reply.tval_usec = now.tv_usec; 389 + irqwait->reply.tval_usec = now.tv_nsec / NSEC_PER_USEC; 383 390 384 391 return ret; 385 392 }
+12
drivers/gpu/drm/virtio/virtgpu_display.c
··· 71 71 return virtio_gpu_surface_dirty(virtio_gpu_fb, clips, num_clips); 72 72 } 73 73 74 + static int 75 + virtio_gpu_framebuffer_create_handle(struct drm_framebuffer *fb, 76 + struct drm_file *file_priv, 77 + unsigned int *handle) 78 + { 79 + struct virtio_gpu_framebuffer *virtio_gpu_fb = 80 + to_virtio_gpu_framebuffer(fb); 81 + 82 + return drm_gem_handle_create(file_priv, virtio_gpu_fb->obj, handle); 83 + } 84 + 74 85 static const struct drm_framebuffer_funcs virtio_gpu_fb_funcs = { 86 + .create_handle = virtio_gpu_framebuffer_create_handle, 75 87 .destroy = virtio_gpu_user_framebuffer_destroy, 76 88 .dirty = virtio_gpu_framebuffer_surface_dirty, 77 89 };
+1 -1
drivers/gpu/drm/virtio/virtgpu_ioctl.c
··· 261 261 ret = virtio_gpu_object_attach(vgdev, qobj, res_id, NULL); 262 262 } else { 263 263 /* use a gem reference since unref list undoes them */ 264 - drm_gem_object_reference(&qobj->gem_base); 264 + drm_gem_object_get(&qobj->gem_base); 265 265 mainbuf.bo = &qobj->tbo; 266 266 list_add(&mainbuf.head, &validate_list); 267 267
+2 -4
drivers/gpu/drm/virtio/virtgpu_kms.c
··· 272 272 struct virtio_gpu_device *vgdev = dev->dev_private; 273 273 struct virtio_gpu_fpriv *vfpriv; 274 274 uint32_t id; 275 - char dbgname[64], tmpname[TASK_COMM_LEN]; 275 + char dbgname[TASK_COMM_LEN]; 276 276 277 277 /* can't create contexts without 3d renderer */ 278 278 if (!vgdev->has_virgl_3d) 279 279 return 0; 280 280 281 - get_task_comm(tmpname, current); 282 - snprintf(dbgname, sizeof(dbgname), "%s", tmpname); 283 - dbgname[63] = 0; 284 281 /* allocate a virt GPU context for this opener */ 285 282 vfpriv = kzalloc(sizeof(*vfpriv), GFP_KERNEL); 286 283 if (!vfpriv) 287 284 return -ENOMEM; 288 285 286 + get_task_comm(dbgname, current); 289 287 virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname, &id); 290 288 291 289 vfpriv->ctx_id = id;
+13 -27
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 441 441 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, 442 442 struct drm_plane_state *state) 443 443 { 444 + struct drm_crtc_state *crtc_state = NULL; 444 445 struct drm_framebuffer *new_fb = state->fb; 445 - bool visible; 446 - 447 - struct drm_rect src = { 448 - .x1 = state->src_x, 449 - .y1 = state->src_y, 450 - .x2 = state->src_x + state->src_w, 451 - .y2 = state->src_y + state->src_h, 452 - }; 453 - struct drm_rect dest = { 454 - .x1 = state->crtc_x, 455 - .y1 = state->crtc_y, 456 - .x2 = state->crtc_x + state->crtc_w, 457 - .y2 = state->crtc_y + state->crtc_h, 458 - }; 459 - struct drm_rect clip = dest; 446 + struct drm_rect clip = {}; 460 447 int ret; 461 448 462 - ret = drm_plane_helper_check_update(plane, state->crtc, new_fb, 463 - &src, &dest, &clip, 464 - DRM_MODE_ROTATE_0, 465 - DRM_PLANE_HELPER_NO_SCALING, 466 - DRM_PLANE_HELPER_NO_SCALING, 467 - false, true, &visible); 449 + if (state->crtc) 450 + crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc); 468 451 452 + if (crtc_state && crtc_state->enable) { 453 + clip.x2 = crtc_state->adjusted_mode.hdisplay; 454 + clip.y2 = crtc_state->adjusted_mode.vdisplay; 455 + } 456 + 457 + ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip, 458 + DRM_PLANE_HELPER_NO_SCALING, 459 + DRM_PLANE_HELPER_NO_SCALING, 460 + false, true); 469 461 470 462 if (!ret && new_fb) { 471 463 struct drm_crtc *crtc = state->crtc; ··· 467 475 struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(new_fb); 468 476 469 477 vcs = vmw_connector_state_to_vcs(du->connector.state); 470 - 471 - if ((dest.x2 > new_fb->width || 472 - dest.y2 > new_fb->height)) { 473 - DRM_ERROR("CRTC area outside of framebuffer\n"); 474 - return -EINVAL; 475 - } 476 478 477 479 /* Only one active implicit framebuffer at a time. */ 478 480 mutex_lock(&dev_priv->global_kms_state_mutex);
+1
drivers/gpu/drm/zte/zx_hdmi.c
··· 108 108 int ret; 109 109 110 110 ret = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi, 111 + &hdmi->connector, 111 112 mode); 112 113 if (ret) { 113 114 DRM_DEV_ERROR(hdmi->dev, "failed to get vendor infoframe: %d\n",
+8 -7
drivers/gpu/drm/zte/zx_plane.c
··· 80 80 clip.x2 = crtc_state->adjusted_mode.hdisplay; 81 81 clip.y2 = crtc_state->adjusted_mode.vdisplay; 82 82 83 - return drm_plane_helper_check_state(plane_state, &clip, 84 - min_scale, max_scale, 85 - true, true); 83 + return drm_atomic_helper_check_plane_state(plane_state, crtc_state, 84 + &clip, min_scale, max_scale, 85 + true, true); 86 86 } 87 87 88 88 static int zx_vl_get_fmt(uint32_t format) ··· 315 315 clip.x2 = crtc_state->adjusted_mode.hdisplay; 316 316 clip.y2 = crtc_state->adjusted_mode.vdisplay; 317 317 318 - return drm_plane_helper_check_state(plane_state, &clip, 319 - DRM_PLANE_HELPER_NO_SCALING, 320 - DRM_PLANE_HELPER_NO_SCALING, 321 - false, true); 318 + return drm_atomic_helper_check_plane_state(plane_state, crtc_state, 319 + &clip, 320 + DRM_PLANE_HELPER_NO_SCALING, 321 + DRM_PLANE_HELPER_NO_SCALING, 322 + false, true); 322 323 } 323 324 324 325 static int zx_gl_get_fmt(uint32_t format)
+31 -20
drivers/video/hdmi.c
··· 321 321 } 322 322 EXPORT_SYMBOL(hdmi_vendor_infoframe_init); 323 323 324 + static int hdmi_vendor_infoframe_length(const struct hdmi_vendor_infoframe *frame) 325 + { 326 + /* for side by side (half) we also need to provide 3D_Ext_Data */ 327 + if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) 328 + return 6; 329 + else if (frame->vic != 0 || frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) 330 + return 5; 331 + else 332 + return 4; 333 + } 334 + 324 335 /** 325 336 * hdmi_vendor_infoframe_pack() - write a HDMI vendor infoframe to binary buffer 326 337 * @frame: HDMI infoframe ··· 352 341 u8 *ptr = buffer; 353 342 size_t length; 354 343 355 - /* empty info frame */ 356 - if (frame->vic == 0 && frame->s3d_struct == HDMI_3D_STRUCTURE_INVALID) 357 - return -EINVAL; 358 - 359 344 /* only one of those can be supplied */ 360 345 if (frame->vic != 0 && frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) 361 346 return -EINVAL; 362 347 363 - /* for side by side (half) we also need to provide 3D_Ext_Data */ 364 - if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) 365 - frame->length = 6; 366 - else 367 - frame->length = 5; 348 + frame->length = hdmi_vendor_infoframe_length(frame); 368 349 369 350 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; 370 351 ··· 375 372 ptr[5] = 0x0c; 376 373 ptr[6] = 0x00; 377 374 378 - if (frame->vic) { 379 - ptr[7] = 0x1 << 5; /* video format */ 380 - ptr[8] = frame->vic; 381 - } else { 375 + if (frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) { 382 376 ptr[7] = 0x2 << 5; /* video format */ 383 377 ptr[8] = (frame->s3d_struct & 0xf) << 4; 384 378 if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) 385 379 ptr[9] = (frame->s3d_ext_data & 0xf) << 4; 380 + } else if (frame->vic) { 381 + ptr[7] = 0x1 << 5; /* video format */ 382 + ptr[8] = frame->vic; 383 + } else { 384 + ptr[7] = 0x0 << 5; /* video format */ 386 385 } 387 386 388 387 hdmi_infoframe_set_checksum(buffer, length); ··· 1170 1165 1171 1166 if (ptr[0] != HDMI_INFOFRAME_TYPE_VENDOR || 1172 1167 ptr[1] != 1 || 1173 - (ptr[2] != 5 && ptr[2] != 6)) 1168 + (ptr[2] != 4 && ptr[2] != 5 && ptr[2] != 6)) 1174 1169 return -EINVAL; 1175 1170 1176 1171 length = ptr[2]; ··· 1198 1193 1199 1194 hvf->length = length; 1200 1195 1201 - if (hdmi_video_format == 0x1) { 1202 - hvf->vic = ptr[4]; 1203 - } else if (hdmi_video_format == 0x2) { 1196 + if (hdmi_video_format == 0x2) { 1197 + if (length != 5 && length != 6) 1198 + return -EINVAL; 1204 1199 hvf->s3d_struct = ptr[4] >> 4; 1205 1200 if (hvf->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) { 1206 - if (length == 6) 1207 - hvf->s3d_ext_data = ptr[5] >> 4; 1208 - else 1201 + if (length != 6) 1209 1202 return -EINVAL; 1203 + hvf->s3d_ext_data = ptr[5] >> 4; 1210 1204 } 1205 + } else if (hdmi_video_format == 0x1) { 1206 + if (length != 5) 1207 + return -EINVAL; 1208 + hvf->vic = ptr[4]; 1209 + } else { 1210 + if (length != 4) 1211 + return -EINVAL; 1211 1212 } 1212 1213 1213 1214 return 0;
+1 -196
include/drm/drmP.h
··· 75 75 #include <drm/drm_sarea.h> 76 76 #include <drm/drm_drv.h> 77 77 #include <drm/drm_prime.h> 78 + #include <drm/drm_print.h> 78 79 #include <drm/drm_pci.h> 79 80 #include <drm/drm_file.h> 80 81 #include <drm/drm_debugfs.h> ··· 95 94 struct pci_dev; 96 95 struct pci_controller; 97 96 98 - /* 99 - * The following categories are defined: 100 - * 101 - * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... 102 - * This is the category used by the DRM_DEBUG() macro. 103 - * 104 - * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ... 105 - * This is the category used by the DRM_DEBUG_DRIVER() macro. 106 - * 107 - * KMS: used in the modesetting code. 108 - * This is the category used by the DRM_DEBUG_KMS() macro. 109 - * 110 - * PRIME: used in the prime code. 111 - * This is the category used by the DRM_DEBUG_PRIME() macro. 112 - * 113 - * ATOMIC: used in the atomic code. 114 - * This is the category used by the DRM_DEBUG_ATOMIC() macro. 115 - * 116 - * VBL: used for verbose debug message in the vblank code 117 - * This is the category used by the DRM_DEBUG_VBL() macro. 118 - * 119 - * Enabling verbose debug messages is done through the drm.debug parameter, 120 - * each category being enabled by a bit. 121 - * 122 - * drm.debug=0x1 will enable CORE messages 123 - * drm.debug=0x2 will enable DRIVER messages 124 - * drm.debug=0x3 will enable CORE and DRIVER messages 125 - * ... 126 - * drm.debug=0x3f will enable all messages 127 - * 128 - * An interesting feature is that it's possible to enable verbose logging at 129 - * run-time by echoing the debug value in its sysfs node: 130 - * # echo 0xf > /sys/module/drm/parameters/debug 131 - */ 132 - #define DRM_UT_NONE 0x00 133 - #define DRM_UT_CORE 0x01 134 - #define DRM_UT_DRIVER 0x02 135 - #define DRM_UT_KMS 0x04 136 - #define DRM_UT_PRIME 0x08 137 - #define DRM_UT_ATOMIC 0x10 138 - #define DRM_UT_VBL 0x20 139 - #define DRM_UT_STATE 0x40 140 - #define DRM_UT_LEASE 0x80 141 - 142 97 /***********************************************************************/ 143 98 /** \name DRM template customization defaults */ 144 99 /*@{*/ 145 - 146 - /***********************************************************************/ 147 - /** \name Macros to make printk easier */ 148 - /*@{*/ 149 - 150 - #define _DRM_PRINTK(once, level, fmt, ...) \ 151 - do { \ 152 - printk##once(KERN_##level "[" DRM_NAME "] " fmt, \ 153 - ##__VA_ARGS__); \ 154 - } while (0) 155 - 156 - #define DRM_INFO(fmt, ...) \ 157 - _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__) 158 - #define DRM_NOTE(fmt, ...) \ 159 - _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__) 160 - #define DRM_WARN(fmt, ...) \ 161 - _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__) 162 - 163 - #define DRM_INFO_ONCE(fmt, ...) \ 164 - _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__) 165 - #define DRM_NOTE_ONCE(fmt, ...) \ 166 - _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__) 167 - #define DRM_WARN_ONCE(fmt, ...) \ 168 - _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__) 169 - 170 - /** 171 - * Error output. 172 - * 173 - * \param fmt printf() like format string. 174 - * \param arg arguments 175 - */ 176 - #define DRM_DEV_ERROR(dev, fmt, ...) \ 177 - drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ 178 - fmt, ##__VA_ARGS__) 179 - #define DRM_ERROR(fmt, ...) \ 180 - drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__) 181 - 182 - /** 183 - * Rate limited error output. Like DRM_ERROR() but won't flood the log. 184 - * 185 - * \param fmt printf() like format string. 186 - * \param arg arguments 187 - */ 188 - #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...) \ 189 - ({ \ 190 - static DEFINE_RATELIMIT_STATE(_rs, \ 191 - DEFAULT_RATELIMIT_INTERVAL, \ 192 - DEFAULT_RATELIMIT_BURST); \ 193 - \ 194 - if (__ratelimit(&_rs)) \ 195 - DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \ 196 - }) 197 - #define DRM_ERROR_RATELIMITED(fmt, ...) \ 198 - DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__) 199 - 200 - #define DRM_DEV_INFO(dev, fmt, ...) \ 201 - drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt, \ 202 - ##__VA_ARGS__) 203 - 204 - #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \ 205 - ({ \ 206 - static bool __print_once __read_mostly; \ 207 - if (!__print_once) { \ 208 - __print_once = true; \ 209 - DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__); \ 210 - } \ 211 - }) 212 - 213 - /** 214 - * Debug output. 215 - * 216 - * \param fmt printf() like format string. 217 - * \param arg arguments 218 - */ 219 - #define DRM_DEV_DEBUG(dev, fmt, args...) \ 220 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \ 221 - ##args) 222 - #define DRM_DEBUG(fmt, ...) \ 223 - drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__) 224 - 225 - #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \ 226 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \ 227 - fmt, ##args) 228 - #define DRM_DEBUG_DRIVER(fmt, ...) \ 229 - drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) 230 - 231 - #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \ 232 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \ 233 - ##args) 234 - #define DRM_DEBUG_KMS(fmt, ...) \ 235 - drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__) 236 - 237 - #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \ 238 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \ 239 - fmt, ##args) 240 - #define DRM_DEBUG_PRIME(fmt, ...) \ 241 - drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__) 242 - 243 - #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \ 244 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \ 245 - fmt, ##args) 246 - #define DRM_DEBUG_ATOMIC(fmt, ...) \ 247 - drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) 248 - 249 - #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \ 250 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \ 251 - ##args) 252 - #define DRM_DEBUG_VBL(fmt, ...) \ 253 - drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__) 254 - 255 - #define DRM_DEBUG_LEASE(fmt, ...) \ 256 - drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__) 257 - 258 - #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \ 259 - ({ \ 260 - static DEFINE_RATELIMIT_STATE(_rs, \ 261 - DEFAULT_RATELIMIT_INTERVAL, \ 262 - DEFAULT_RATELIMIT_BURST); \ 263 - if (__ratelimit(&_rs)) \ 264 - drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \ 265 - __func__, "", fmt, ##args); \ 266 - }) 267 - 268 - /** 269 - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. 270 - * 271 - * \param fmt printf() like format string. 272 - * \param arg arguments 273 - */ 274 - #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...) \ 275 - DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args) 276 - #define DRM_DEBUG_RATELIMITED(fmt, args...) \ 277 - DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args) 278 - #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...) \ 279 - _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args) 280 - #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ 281 - DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args) 282 - #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...) \ 283 - _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args) 284 - #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ 285 - DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args) 286 - #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...) \ 287 - _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args) 288 - #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ 289 - DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args) 290 - 291 - /* Format strings and argument splitters to simplify printing 292 - * various "complex" objects 293 - */ 294 - 295 - /*@}*/ 296 100 297 101 /***********************************************************************/ 298 102 /** \name Internal types and structures */ 299 103 /*@{*/ 300 104 301 105 #define DRM_IF_VERSION(maj, min) (maj << 16 | min) 302 - 303 106 304 107 /** 305 108 * drm_drv_uses_atomic_modeset - check if the driver implements
+7
include/drm/drm_atomic_helper.h
··· 38 38 39 39 int drm_atomic_helper_check_modeset(struct drm_device *dev, 40 40 struct drm_atomic_state *state); 41 + int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, 42 + const struct drm_crtc_state *crtc_state, 43 + const struct drm_rect *clip, 44 + int min_scale, 45 + int max_scale, 46 + bool can_position, 47 + bool can_update_disabled); 41 48 int drm_atomic_helper_check_planes(struct drm_device *dev, 42 49 struct drm_atomic_state *state); 43 50 int drm_atomic_helper_check(struct drm_device *dev,
+12 -2
include/drm/drm_connector.h
··· 270 270 bool dvi_dual; 271 271 272 272 /** 273 + * @has_hdmi_infoframe: Does the sink support the HDMI infoframe? 274 + */ 275 + bool has_hdmi_infoframe; 276 + 277 + /** 273 278 * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even 274 279 * more stuff redundant with @bus_formats. 275 280 */ ··· 709 704 * @force: a DRM_FORCE_<foo> state for forced mode sets 710 705 * @override_edid: has the EDID been overwritten through debugfs for testing? 711 706 * @encoder_ids: valid encoders for this connector 712 - * @encoder: encoder driving this connector, if any 713 707 * @eld: EDID-like data, if present 714 708 * @latency_present: AV delay info from ELD, if found 715 709 * @video_latency: video latency info from ELD, if found ··· 878 874 879 875 #define DRM_CONNECTOR_MAX_ENCODER 3 880 876 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 881 - struct drm_encoder *encoder; /* currently active encoder */ 877 + /** 878 + * @encoder: Currently bound encoder driving this connector, if any. 879 + * Only really meaningful for non-atomic drivers. Atomic drivers should 880 + * instead look at &drm_connector_state.best_encoder, and in case they 881 + * need the CRTC driving this output, &drm_connector_state.crtc. 882 + */ 883 + struct drm_encoder *encoder; 882 884 883 885 #define MAX_ELD_BYTES 128 884 886 /* EDID bits */
+9
include/drm/drm_device.h
··· 17 17 struct drm_sg_mem; 18 18 struct drm_local_map; 19 19 struct drm_vma_offset_manager; 20 + struct drm_fb_helper; 20 21 21 22 struct inode; 22 23 ··· 186 185 struct drm_vma_offset_manager *vma_offset_manager; 187 186 /*@} */ 188 187 int switch_power_state; 188 + 189 + /** 190 + * @fb_helper: 191 + * 192 + * Pointer to the fbdev emulation structure. 193 + * Set by drm_fb_helper_init() and cleared by drm_fb_helper_fini(). 194 + */ 195 + struct drm_fb_helper *fb_helper; 189 196 }; 190 197 191 198 #endif
+1
include/drm/drm_dp_helper.h
··· 635 635 # define DP_SET_POWER_D0 0x1 636 636 # define DP_SET_POWER_D3 0x2 637 637 # define DP_SET_POWER_MASK 0x3 638 + # define DP_SET_POWER_D3_AUX_ON 0x5 638 639 639 640 #define DP_EDP_DPCD_REV 0x700 /* eDP 1.2 */ 640 641 # define DP_EDP_11 0x00
+15 -7
include/drm/drm_drv.h
··· 39 39 struct dma_buf_attachment; 40 40 struct drm_display_mode; 41 41 struct drm_mode_create_dumb; 42 + struct drm_printer; 42 43 43 44 /* driver capabilities and requirements mask */ 44 45 #define DRIVER_USE_AGP 0x1 ··· 430 429 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 431 430 432 431 /** 432 + * @gem_print_info: 433 + * 434 + * If driver subclasses struct &drm_gem_object, it can implement this 435 + * optional hook for printing additional driver specific info. 436 + * 437 + * drm_printf_indent() should be used in the callback passing it the 438 + * indent argument. 439 + * 440 + * This callback is called from drm_gem_print_info(). 441 + */ 442 + void (*gem_print_info)(struct drm_printer *p, unsigned int indent, 443 + const struct drm_gem_object *obj); 444 + 445 + /** 433 446 * @gem_create_object: constructor for gem objects 434 447 * 435 448 * Hook for allocating the GEM object struct, for use by core ··· 607 592 int dev_priv_size; 608 593 }; 609 594 610 - __printf(6, 7) 611 - void drm_dev_printk(const struct device *dev, const char *level, 612 - unsigned int category, const char *function_name, 613 - const char *prefix, const char *format, ...); 614 - __printf(3, 4) 615 - void drm_printk(const char *level, unsigned int category, 616 - const char *format, ...); 617 595 extern unsigned int drm_debug; 618 596 619 597 int drm_dev_init(struct drm_device *dev,
+1 -1
include/drm/drm_edid.h
··· 333 333 struct drm_connector; 334 334 struct drm_display_mode; 335 335 336 - void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); 337 336 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads); 338 337 int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb); 339 338 int drm_av_sync_delay(struct drm_connector *connector, ··· 356 357 bool is_hdmi2_sink); 357 358 int 358 359 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 360 + struct drm_connector *connector, 359 361 const struct drm_display_mode *mode); 360 362 void 361 363 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
+5 -1
include/drm/drm_encoder.h
··· 88 88 * @head: list management 89 89 * @base: base KMS object 90 90 * @name: human readable name, can be overwritten by the driver 91 - * @crtc: currently bound CRTC 92 91 * @bridge: bridge associated to the encoder 93 92 * @funcs: control functions 94 93 * @helper_private: mid-layer private data ··· 165 166 */ 166 167 uint32_t possible_clones; 167 168 169 + /** 170 + * @crtc: Currently bound CRTC, only really meaningful for non-atomic 171 + * drivers. Atomic drivers should instead check 172 + * &drm_connector_state.crtc. 173 + */ 168 174 struct drm_crtc *crtc; 169 175 struct drm_bridge *bridge; 170 176 const struct drm_encoder_funcs *funcs;
-6
include/drm/drm_fb_cma_helper.h
··· 36 36 struct drm_plane_state *state, 37 37 unsigned int plane); 38 38 39 - #ifdef CONFIG_DEBUG_FS 40 - struct seq_file; 41 - 42 - int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg); 43 - #endif 44 - 45 39 #endif 46 40
+11
include/drm/drm_fb_helper.h
··· 310 310 int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector); 311 311 int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, 312 312 struct drm_connector *connector); 313 + 314 + void drm_fb_helper_lastclose(struct drm_device *dev); 315 + void drm_fb_helper_output_poll_changed(struct drm_device *dev); 313 316 #else 314 317 static inline void drm_fb_helper_prepare(struct drm_device *dev, 315 318 struct drm_fb_helper *helper, ··· 508 505 struct drm_connector *connector) 509 506 { 510 507 return 0; 508 + } 509 + 510 + static inline void drm_fb_helper_lastclose(struct drm_device *dev) 511 + { 512 + } 513 + 514 + static inline void drm_fb_helper_output_poll_changed(struct drm_device *dev) 515 + { 511 516 } 512 517 513 518 #endif
+1 -1
include/drm/drm_framebuffer.h
··· 264 264 * 265 265 * This functions returns the framebuffer's reference count. 266 266 */ 267 - static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) 267 + static inline uint32_t drm_framebuffer_read_refcount(const struct drm_framebuffer *fb) 268 268 { 269 269 return kref_read(&fb->base.refcount); 270 270 }
+7 -9
include/drm/drm_gem_cma_helper.h
··· 9 9 * struct drm_gem_cma_object - GEM object backed by CMA memory allocations 10 10 * @base: base GEM object 11 11 * @paddr: physical address of the backing memory 12 - * @sgt: scatter/gather table for imported PRIME buffers 12 + * @sgt: scatter/gather table for imported PRIME buffers. The table can have 13 + * more than one entry but they are guaranteed to have contiguous 14 + * DMA addresses. 13 15 * @vaddr: kernel virtual address of the backing memory 14 16 */ 15 17 struct drm_gem_cma_object { ··· 23 21 void *vaddr; 24 22 }; 25 23 26 - static inline struct drm_gem_cma_object * 27 - to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) 28 - { 29 - return container_of(gem_obj, struct drm_gem_cma_object, base); 30 - } 24 + #define to_drm_gem_cma_obj(gem_obj) \ 25 + container_of(gem_obj, struct drm_gem_cma_object, base) 31 26 32 27 #ifndef CONFIG_MMU 33 28 #define DRM_GEM_CMA_UNMAPPED_AREA_FOPS \ ··· 90 91 unsigned long flags); 91 92 #endif 92 93 93 - #ifdef CONFIG_DEBUG_FS 94 - void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); 95 - #endif 94 + void drm_gem_cma_print_info(struct drm_printer *p, unsigned int indent, 95 + const struct drm_gem_object *obj); 96 96 97 97 struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); 98 98 struct drm_gem_object *
+1 -1
include/drm/drm_mm.h
··· 386 386 * @color: opaque tag value to use for this node 387 387 * @mode: fine-tune the allocation search and placement 388 388 * 389 - * This is a simplified version of drm_mm_insert_node_in_range_generic() with no 389 + * This is a simplified version of drm_mm_insert_node_in_range() with no 390 390 * range restrictions applied. 391 391 * 392 392 * The preallocated node must be cleared to 0.
+1 -1
include/drm/drm_mode_config.h
··· 752 752 bool allow_fb_modifiers; 753 753 754 754 /** 755 - * @modifiers: Plane property to list support modifier/format 755 + * @modifiers_property: Plane property to list support modifier/format 756 756 * combination. 757 757 */ 758 758 struct drm_property *modifiers_property;
-3
include/drm/drm_modeset_helper_vtables.h
··· 801 801 * resolution can call drm_add_modes_noedid(), and mark the preferred 802 802 * one using drm_set_preferred_mode(). 803 803 * 804 - * Finally drivers that support audio probably want to update the ELD 805 - * data, too, using drm_edid_to_eld(). 806 - * 807 804 * This function is only called after the @detect hook has indicated 808 805 * that a sink is connected and when the EDID isn't overridden through 809 806 * sysfs or the kernel commandline.
+12 -2
include/drm/drm_plane.h
··· 474 474 * @format_types: array of formats supported by this plane 475 475 * @format_count: number of formats supported 476 476 * @format_default: driver hasn't supplied supported formats for the plane 477 - * @crtc: currently bound CRTC 478 - * @fb: currently bound fb 477 + * @modifiers: array of modifiers supported by this plane 478 + * @modifier_count: number of modifiers supported 479 479 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by 480 480 * drm_mode_set_config_internal() to implement correct refcounting. 481 481 * @funcs: helper functions ··· 512 512 uint64_t *modifiers; 513 513 unsigned int modifier_count; 514 514 515 + /** 516 + * @crtc: Currently bound CRTC, only really meaningful for non-atomic 517 + * drivers. Atomic drivers should instead check &drm_plane_state.crtc. 518 + */ 515 519 struct drm_crtc *crtc; 520 + 521 + /** 522 + * @fb: Currently bound framebuffer, only really meaningful for 523 + * non-atomic drivers. Atomic drivers should instead check 524 + * &drm_plane_state.fb. 525 + */ 516 526 struct drm_framebuffer *fb; 517 527 518 528 struct drm_framebuffer *old_fb;
-5
include/drm/drm_plane_helper.h
··· 38 38 */ 39 39 #define DRM_PLANE_HELPER_NO_SCALING (1<<16) 40 40 41 - int drm_plane_helper_check_state(struct drm_plane_state *state, 42 - const struct drm_rect *clip, 43 - int min_scale, int max_scale, 44 - bool can_position, 45 - bool can_update_disabled); 46 41 int drm_plane_helper_check_update(struct drm_plane *plane, 47 42 struct drm_crtc *crtc, 48 43 struct drm_framebuffer *fb,
+219
include/drm/drm_print.h
··· 80 80 __printf(2, 3) 81 81 void drm_printf(struct drm_printer *p, const char *f, ...); 82 82 83 + /** 84 + * drm_vprintf - print to a &drm_printer stream 85 + * @p: the &drm_printer 86 + * @fmt: format string 87 + * @va: the va_list 88 + */ 89 + __printf(2, 0) 90 + static inline void 91 + drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va) 92 + { 93 + struct va_format vaf = { .fmt = fmt, .va = va }; 94 + 95 + p->printfn(p, &vaf); 96 + } 97 + 98 + /** 99 + * drm_printf_indent - Print to a &drm_printer stream with indentation 100 + * @printer: DRM printer 101 + * @indent: Tab indentation level (max 5) 102 + * @fmt: Format string 103 + */ 104 + #define drm_printf_indent(printer, indent, fmt, ...) \ 105 + drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__) 83 106 84 107 /** 85 108 * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file ··· 151 128 }; 152 129 return p; 153 130 } 131 + 132 + /* 133 + * The following categories are defined: 134 + * 135 + * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... 136 + * This is the category used by the DRM_DEBUG() macro. 137 + * 138 + * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ... 139 + * This is the category used by the DRM_DEBUG_DRIVER() macro. 140 + * 141 + * KMS: used in the modesetting code. 142 + * This is the category used by the DRM_DEBUG_KMS() macro. 143 + * 144 + * PRIME: used in the prime code. 145 + * This is the category used by the DRM_DEBUG_PRIME() macro. 146 + * 147 + * ATOMIC: used in the atomic code. 148 + * This is the category used by the DRM_DEBUG_ATOMIC() macro. 149 + * 150 + * VBL: used for verbose debug message in the vblank code 151 + * This is the category used by the DRM_DEBUG_VBL() macro. 152 + * 153 + * Enabling verbose debug messages is done through the drm.debug parameter, 154 + * each category being enabled by a bit. 155 + * 156 + * drm.debug=0x1 will enable CORE messages 157 + * drm.debug=0x2 will enable DRIVER messages 158 + * drm.debug=0x3 will enable CORE and DRIVER messages 159 + * ... 160 + * drm.debug=0x3f will enable all messages 161 + * 162 + * An interesting feature is that it's possible to enable verbose logging at 163 + * run-time by echoing the debug value in its sysfs node: 164 + * # echo 0xf > /sys/module/drm/parameters/debug 165 + */ 166 + #define DRM_UT_NONE 0x00 167 + #define DRM_UT_CORE 0x01 168 + #define DRM_UT_DRIVER 0x02 169 + #define DRM_UT_KMS 0x04 170 + #define DRM_UT_PRIME 0x08 171 + #define DRM_UT_ATOMIC 0x10 172 + #define DRM_UT_VBL 0x20 173 + #define DRM_UT_STATE 0x40 174 + #define DRM_UT_LEASE 0x80 175 + 176 + __printf(6, 7) 177 + void drm_dev_printk(const struct device *dev, const char *level, 178 + unsigned int category, const char *function_name, 179 + const char *prefix, const char *format, ...); 180 + __printf(3, 4) 181 + void drm_printk(const char *level, unsigned int category, 182 + const char *format, ...); 183 + 184 + /* Macros to make printk easier */ 185 + 186 + #define _DRM_PRINTK(once, level, fmt, ...) \ 187 + do { \ 188 + printk##once(KERN_##level "[" DRM_NAME "] " fmt, \ 189 + ##__VA_ARGS__); \ 190 + } while (0) 191 + 192 + #define DRM_INFO(fmt, ...) \ 193 + _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__) 194 + #define DRM_NOTE(fmt, ...) \ 195 + _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__) 196 + #define DRM_WARN(fmt, ...) \ 197 + _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__) 198 + 199 + #define DRM_INFO_ONCE(fmt, ...) \ 200 + _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__) 201 + #define DRM_NOTE_ONCE(fmt, ...) \ 202 + _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__) 203 + #define DRM_WARN_ONCE(fmt, ...) \ 204 + _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__) 205 + 206 + /** 207 + * Error output. 208 + * 209 + * @dev: device pointer 210 + * @fmt: printf() like format string. 211 + */ 212 + #define DRM_DEV_ERROR(dev, fmt, ...) \ 213 + drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\ 214 + fmt, ##__VA_ARGS__) 215 + #define DRM_ERROR(fmt, ...) \ 216 + drm_printk(KERN_ERR, DRM_UT_NONE, fmt, ##__VA_ARGS__) 217 + 218 + /** 219 + * Rate limited error output. Like DRM_ERROR() but won't flood the log. 220 + * 221 + * @dev: device pointer 222 + * @fmt: printf() like format string. 223 + */ 224 + #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...) \ 225 + ({ \ 226 + static DEFINE_RATELIMIT_STATE(_rs, \ 227 + DEFAULT_RATELIMIT_INTERVAL, \ 228 + DEFAULT_RATELIMIT_BURST); \ 229 + \ 230 + if (__ratelimit(&_rs)) \ 231 + DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \ 232 + }) 233 + #define DRM_ERROR_RATELIMITED(fmt, ...) \ 234 + DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__) 235 + 236 + #define DRM_DEV_INFO(dev, fmt, ...) \ 237 + drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt, \ 238 + ##__VA_ARGS__) 239 + 240 + #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \ 241 + ({ \ 242 + static bool __print_once __read_mostly; \ 243 + if (!__print_once) { \ 244 + __print_once = true; \ 245 + DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__); \ 246 + } \ 247 + }) 248 + 249 + /** 250 + * Debug output. 251 + * 252 + * @dev: device pointer 253 + * @fmt: printf() like format string. 254 + */ 255 + #define DRM_DEV_DEBUG(dev, fmt, args...) \ 256 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \ 257 + ##args) 258 + #define DRM_DEBUG(fmt, ...) \ 259 + drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__) 260 + 261 + #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \ 262 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \ 263 + fmt, ##args) 264 + #define DRM_DEBUG_DRIVER(fmt, ...) \ 265 + drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) 266 + 267 + #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \ 268 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \ 269 + ##args) 270 + #define DRM_DEBUG_KMS(fmt, ...) \ 271 + drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__) 272 + 273 + #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \ 274 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \ 275 + fmt, ##args) 276 + #define DRM_DEBUG_PRIME(fmt, ...) \ 277 + drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__) 278 + 279 + #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \ 280 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \ 281 + fmt, ##args) 282 + #define DRM_DEBUG_ATOMIC(fmt, ...) \ 283 + drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) 284 + 285 + #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \ 286 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \ 287 + ##args) 288 + #define DRM_DEBUG_VBL(fmt, ...) \ 289 + drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__) 290 + 291 + #define DRM_DEBUG_LEASE(fmt, ...) \ 292 + drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__) 293 + 294 + #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \ 295 + ({ \ 296 + static DEFINE_RATELIMIT_STATE(_rs, \ 297 + DEFAULT_RATELIMIT_INTERVAL, \ 298 + DEFAULT_RATELIMIT_BURST); \ 299 + if (__ratelimit(&_rs)) \ 300 + drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \ 301 + __func__, "", fmt, ##args); \ 302 + }) 303 + 304 + /** 305 + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log. 306 + * 307 + * @dev: device pointer 308 + * @fmt: printf() like format string. 309 + */ 310 + #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...) \ 311 + DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args) 312 + #define DRM_DEBUG_RATELIMITED(fmt, args...) \ 313 + DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args) 314 + #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...) \ 315 + _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args) 316 + #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \ 317 + DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args) 318 + #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...) \ 319 + _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args) 320 + #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \ 321 + DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args) 322 + #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...) \ 323 + _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args) 324 + #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \ 325 + DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args) 326 + 154 327 #endif /* DRM_PRINT_H_ */
+1 -1
include/drm/drm_syncobj.h
··· 49 49 * This field should not be used directly. Use drm_syncobj_fence_get 50 50 * and drm_syncobj_replace_fence instead. 51 51 */ 52 - struct dma_fence *fence; 52 + struct dma_fence __rcu *fence; 53 53 /** 54 54 * @cb_list: 55 55 * List of callbacks to call when the fence gets replaced
+1 -1
include/drm/drm_vma_manager.h
··· 152 152 * Start address of @node for page-based addressing. 0 if the node does not 153 153 * have an offset allocated. 154 154 */ 155 - static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node *node) 155 + static inline unsigned long drm_vma_node_start(const struct drm_vma_offset_node *node) 156 156 { 157 157 return node->vm_node.start; 158 158 }
+1
include/drm/tinydrm/tinydrm.h
··· 46 46 */ 47 47 #define TINYDRM_GEM_DRIVER_OPS \ 48 48 .gem_free_object = tinydrm_gem_cma_free_object, \ 49 + .gem_print_info = drm_gem_cma_print_info, \ 49 50 .gem_vm_ops = &drm_gem_cma_vm_ops, \ 50 51 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \ 51 52 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
+3
include/linux/dma-fence-array.h
··· 21 21 #define __LINUX_DMA_FENCE_ARRAY_H 22 22 23 23 #include <linux/dma-fence.h> 24 + #include <linux/irq_work.h> 24 25 25 26 /** 26 27 * struct dma_fence_array_cb - callback helper for fence array ··· 48 47 unsigned num_fences; 49 48 atomic_t num_pending; 50 49 struct dma_fence **fences; 50 + 51 + struct irq_work work; 51 52 }; 52 53 53 54 extern const struct dma_fence_ops dma_fence_array_ops;
+1 -1
include/linux/dma-fence.h
··· 242 242 * The caller is required to hold the RCU read lock. 243 243 */ 244 244 static inline struct dma_fence * 245 - dma_fence_get_rcu_safe(struct dma_fence * __rcu *fencep) 245 + dma_fence_get_rcu_safe(struct dma_fence __rcu **fencep) 246 246 { 247 247 do { 248 248 struct dma_fence *fence;
+23
include/linux/reservation.h
··· 167 167 } 168 168 169 169 /** 170 + * reservation_object_lock_interruptible - lock the reservation object 171 + * @obj: the reservation object 172 + * @ctx: the locking context 173 + * 174 + * Locks the reservation object interruptible for exclusive access and 175 + * modification. Note, that the lock is only against other writers, readers 176 + * will run concurrently with a writer under RCU. The seqlock is used to 177 + * notify readers if they overlap with a writer. 178 + * 179 + * As the reservation object may be locked by multiple parties in an 180 + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle 181 + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation 182 + * object may be locked by itself by passing NULL as @ctx. 183 + */ 184 + static inline int 185 + reservation_object_lock_interruptible(struct reservation_object *obj, 186 + struct ww_acquire_ctx *ctx) 187 + { 188 + return ww_mutex_lock_interruptible(&obj->lock, ctx); 189 + } 190 + 191 + 192 + /** 170 193 * reservation_object_trylock - trylock the reservation object 171 194 * @obj: the reservation object 172 195 *