| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 Broadcom |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | 4 | */ |
|---|
| 5 | +#ifndef _VC4_DRV_H_ |
|---|
| 6 | +#define _VC4_DRV_H_ |
|---|
| 8 | 7 | |
|---|
| 9 | | -#include <linux/mm_types.h> |
|---|
| 10 | | -#include <linux/reservation.h> |
|---|
| 11 | | -#include <drm/drmP.h> |
|---|
| 8 | +#include <linux/delay.h> |
|---|
| 9 | +#include <linux/refcount.h> |
|---|
| 10 | +#include <linux/uaccess.h> |
|---|
| 11 | + |
|---|
| 12 | +#include <drm/drm_atomic.h> |
|---|
| 13 | +#include <drm/drm_debugfs.h> |
|---|
| 14 | +#include <drm/drm_device.h> |
|---|
| 12 | 15 | #include <drm/drm_encoder.h> |
|---|
| 13 | 16 | #include <drm/drm_gem_cma_helper.h> |
|---|
| 14 | | -#include <drm/drm_atomic.h> |
|---|
| 15 | | -#include <drm/drm_syncobj.h> |
|---|
| 17 | +#include <drm/drm_managed.h> |
|---|
| 18 | +#include <drm/drm_mm.h> |
|---|
| 19 | +#include <drm/drm_modeset_lock.h> |
|---|
| 16 | 20 | |
|---|
| 17 | 21 | #include "uapi/drm/vc4_drm.h" |
|---|
| 22 | + |
|---|
| 23 | +struct drm_device; |
|---|
| 24 | +struct drm_gem_object; |
|---|
| 18 | 25 | |
|---|
| 19 | 26 | /* Don't forget to update vc4_bo.c: bo_type_names[] when adding to |
|---|
| 20 | 27 | * this. |
|---|
| .. | .. |
|---|
| 61 | 68 | * Note that counter values can't be reset, but you can fake a reset by |
|---|
| 62 | 69 | * destroying the perfmon and creating a new one. |
|---|
| 63 | 70 | */ |
|---|
| 64 | | - u64 counters[0]; |
|---|
| 71 | + u64 counters[]; |
|---|
| 65 | 72 | }; |
|---|
| 66 | 73 | |
|---|
| 67 | 74 | struct vc4_dev { |
|---|
| 68 | | - struct drm_device *dev; |
|---|
| 75 | + struct drm_device base; |
|---|
| 69 | 76 | |
|---|
| 70 | | - struct vc4_hdmi *hdmi; |
|---|
| 71 | 77 | struct vc4_hvs *hvs; |
|---|
| 72 | 78 | struct vc4_v3d *v3d; |
|---|
| 73 | 79 | struct vc4_dpi *dpi; |
|---|
| 74 | | - struct vc4_dsi *dsi1; |
|---|
| 75 | 80 | struct vc4_vec *vec; |
|---|
| 76 | 81 | struct vc4_txp *txp; |
|---|
| 77 | 82 | |
|---|
| .. | .. |
|---|
| 184 | 189 | /* Bitmask of the current bin_alloc used for overflow memory. */ |
|---|
| 185 | 190 | uint32_t bin_alloc_overflow; |
|---|
| 186 | 191 | |
|---|
| 192 | + /* Incremented when an underrun error happened after an atomic commit. |
|---|
| 193 | + * This is particularly useful to detect when a specific modeset is too |
|---|
| 194 | + * demanding in term of memory or HVS bandwidth which is hard to guess |
|---|
| 195 | + * at atomic check time. |
|---|
| 196 | + */ |
|---|
| 197 | + atomic_t underrun; |
|---|
| 198 | + |
|---|
| 187 | 199 | struct work_struct overflow_mem_work; |
|---|
| 188 | 200 | |
|---|
| 189 | 201 | int power_refcount; |
|---|
| 202 | + |
|---|
| 203 | + /* Set to true when the load tracker is supported. */ |
|---|
| 204 | + bool load_tracker_available; |
|---|
| 205 | + |
|---|
| 206 | + /* Set to true when the load tracker is active. */ |
|---|
| 207 | + bool load_tracker_enabled; |
|---|
| 190 | 208 | |
|---|
| 191 | 209 | /* Mutex controlling the power refcount. */ |
|---|
| 192 | 210 | struct mutex power_lock; |
|---|
| .. | .. |
|---|
| 200 | 218 | |
|---|
| 201 | 219 | struct drm_modeset_lock ctm_state_lock; |
|---|
| 202 | 220 | struct drm_private_obj ctm_manager; |
|---|
| 221 | + struct drm_private_obj hvs_channels; |
|---|
| 222 | + struct drm_private_obj load_tracker; |
|---|
| 223 | + |
|---|
| 224 | + /* List of vc4_debugfs_info_entry for adding to debugfs once |
|---|
| 225 | + * the minor is available (after drm_dev_register()). |
|---|
| 226 | + */ |
|---|
| 227 | + struct list_head debugfs_list; |
|---|
| 228 | + |
|---|
| 229 | + /* Mutex for binner bo allocation. */ |
|---|
| 230 | + struct mutex bin_bo_lock; |
|---|
| 231 | + /* Reference count for our binner bo. */ |
|---|
| 232 | + struct kref bin_bo_kref; |
|---|
| 203 | 233 | }; |
|---|
| 204 | 234 | |
|---|
| 205 | 235 | static inline struct vc4_dev * |
|---|
| 206 | 236 | to_vc4_dev(struct drm_device *dev) |
|---|
| 207 | 237 | { |
|---|
| 208 | | - return (struct vc4_dev *)dev->dev_private; |
|---|
| 238 | + return container_of(dev, struct vc4_dev, base); |
|---|
| 209 | 239 | } |
|---|
| 210 | 240 | |
|---|
| 211 | 241 | struct vc4_bo { |
|---|
| .. | .. |
|---|
| 239 | 269 | */ |
|---|
| 240 | 270 | struct vc4_validated_shader_info *validated_shader; |
|---|
| 241 | 271 | |
|---|
| 242 | | - /* normally (resv == &_resv) except for imported bo's */ |
|---|
| 243 | | - struct reservation_object *resv; |
|---|
| 244 | | - struct reservation_object _resv; |
|---|
| 245 | | - |
|---|
| 246 | 272 | /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i |
|---|
| 247 | 273 | * for user-allocated labels. |
|---|
| 248 | 274 | */ |
|---|
| .. | .. |
|---|
| 262 | 288 | static inline struct vc4_bo * |
|---|
| 263 | 289 | to_vc4_bo(struct drm_gem_object *bo) |
|---|
| 264 | 290 | { |
|---|
| 265 | | - return (struct vc4_bo *)bo; |
|---|
| 291 | + return container_of(to_drm_gem_cma_obj(bo), struct vc4_bo, base); |
|---|
| 266 | 292 | } |
|---|
| 267 | 293 | |
|---|
| 268 | 294 | struct vc4_fence { |
|---|
| .. | .. |
|---|
| 275 | 301 | static inline struct vc4_fence * |
|---|
| 276 | 302 | to_vc4_fence(struct dma_fence *fence) |
|---|
| 277 | 303 | { |
|---|
| 278 | | - return (struct vc4_fence *)fence; |
|---|
| 304 | + return container_of(fence, struct vc4_fence, base); |
|---|
| 279 | 305 | } |
|---|
| 280 | 306 | |
|---|
| 281 | 307 | struct vc4_seqno_cb { |
|---|
| .. | .. |
|---|
| 289 | 315 | struct platform_device *pdev; |
|---|
| 290 | 316 | void __iomem *regs; |
|---|
| 291 | 317 | struct clk *clk; |
|---|
| 318 | + struct debugfs_regset32 regset; |
|---|
| 292 | 319 | }; |
|---|
| 293 | 320 | |
|---|
| 294 | 321 | struct vc4_hvs { |
|---|
| 295 | 322 | struct platform_device *pdev; |
|---|
| 296 | 323 | void __iomem *regs; |
|---|
| 297 | 324 | u32 __iomem *dlist; |
|---|
| 325 | + |
|---|
| 326 | + struct clk *core_clk; |
|---|
| 298 | 327 | |
|---|
| 299 | 328 | /* Memory manager for CRTCs to allocate space in the display |
|---|
| 300 | 329 | * list. Units are dwords. |
|---|
| .. | .. |
|---|
| 305 | 334 | spinlock_t mm_lock; |
|---|
| 306 | 335 | |
|---|
| 307 | 336 | struct drm_mm_node mitchell_netravali_filter; |
|---|
| 337 | + |
|---|
| 338 | + struct debugfs_regset32 regset; |
|---|
| 339 | + |
|---|
| 340 | + /* HVS version 5 flag, therefore requires updated dlist structures */ |
|---|
| 341 | + bool hvs5; |
|---|
| 308 | 342 | }; |
|---|
| 309 | 343 | |
|---|
| 310 | 344 | struct vc4_plane { |
|---|
| .. | .. |
|---|
| 314 | 348 | static inline struct vc4_plane * |
|---|
| 315 | 349 | to_vc4_plane(struct drm_plane *plane) |
|---|
| 316 | 350 | { |
|---|
| 317 | | - return (struct vc4_plane *)plane; |
|---|
| 351 | + return container_of(plane, struct vc4_plane, base); |
|---|
| 318 | 352 | } |
|---|
| 319 | 353 | |
|---|
| 320 | 354 | enum vc4_scaling_mode { |
|---|
| .. | .. |
|---|
| 338 | 372 | u32 pos0_offset; |
|---|
| 339 | 373 | u32 pos2_offset; |
|---|
| 340 | 374 | u32 ptr0_offset; |
|---|
| 375 | + u32 lbm_offset; |
|---|
| 341 | 376 | |
|---|
| 342 | 377 | /* Offset where the plane's dlist was last stored in the |
|---|
| 343 | 378 | * hardware at vc4_crtc_atomic_flush() time. |
|---|
| .. | .. |
|---|
| 369 | 404 | * to enable background color fill. |
|---|
| 370 | 405 | */ |
|---|
| 371 | 406 | bool needs_bg_fill; |
|---|
| 407 | + |
|---|
| 408 | + /* Mark the dlist as initialized. Useful to avoid initializing it twice |
|---|
| 409 | + * when async update is not possible. |
|---|
| 410 | + */ |
|---|
| 411 | + bool dlist_initialized; |
|---|
| 412 | + |
|---|
| 413 | + /* Load of this plane on the HVS block. The load is expressed in HVS |
|---|
| 414 | + * cycles/sec. |
|---|
| 415 | + */ |
|---|
| 416 | + u64 hvs_load; |
|---|
| 417 | + |
|---|
| 418 | + /* Memory bandwidth needed for this plane. This is expressed in |
|---|
| 419 | + * bytes/sec. |
|---|
| 420 | + */ |
|---|
| 421 | + u64 membus_load; |
|---|
| 372 | 422 | }; |
|---|
| 373 | 423 | |
|---|
| 374 | 424 | static inline struct vc4_plane_state * |
|---|
| 375 | 425 | to_vc4_plane_state(struct drm_plane_state *state) |
|---|
| 376 | 426 | { |
|---|
| 377 | | - return (struct vc4_plane_state *)state; |
|---|
| 427 | + return container_of(state, struct vc4_plane_state, base); |
|---|
| 378 | 428 | } |
|---|
| 379 | 429 | |
|---|
| 380 | 430 | enum vc4_encoder_type { |
|---|
| 381 | 431 | VC4_ENCODER_TYPE_NONE, |
|---|
| 382 | | - VC4_ENCODER_TYPE_HDMI, |
|---|
| 432 | + VC4_ENCODER_TYPE_HDMI0, |
|---|
| 433 | + VC4_ENCODER_TYPE_HDMI1, |
|---|
| 383 | 434 | VC4_ENCODER_TYPE_VEC, |
|---|
| 384 | 435 | VC4_ENCODER_TYPE_DSI0, |
|---|
| 385 | 436 | VC4_ENCODER_TYPE_DSI1, |
|---|
| .. | .. |
|---|
| 391 | 442 | struct drm_encoder base; |
|---|
| 392 | 443 | enum vc4_encoder_type type; |
|---|
| 393 | 444 | u32 clock_select; |
|---|
| 445 | + |
|---|
| 446 | + void (*pre_crtc_configure)(struct drm_encoder *encoder); |
|---|
| 447 | + void (*pre_crtc_enable)(struct drm_encoder *encoder); |
|---|
| 448 | + void (*post_crtc_enable)(struct drm_encoder *encoder); |
|---|
| 449 | + |
|---|
| 450 | + void (*post_crtc_disable)(struct drm_encoder *encoder); |
|---|
| 451 | + void (*post_crtc_powerdown)(struct drm_encoder *encoder); |
|---|
| 394 | 452 | }; |
|---|
| 395 | 453 | |
|---|
| 396 | 454 | static inline struct vc4_encoder * |
|---|
| .. | .. |
|---|
| 400 | 458 | } |
|---|
| 401 | 459 | |
|---|
| 402 | 460 | struct vc4_crtc_data { |
|---|
| 403 | | - /* Which channel of the HVS this pixelvalve sources from. */ |
|---|
| 404 | | - int hvs_channel; |
|---|
| 461 | + /* Bitmask of channels (FIFOs) of the HVS that the output can source from */ |
|---|
| 462 | + unsigned int hvs_available_channels; |
|---|
| 463 | + |
|---|
| 464 | + /* Which output of the HVS this pixelvalve sources from. */ |
|---|
| 465 | + int hvs_output; |
|---|
| 466 | +}; |
|---|
| 467 | + |
|---|
| 468 | +struct vc4_pv_data { |
|---|
| 469 | + struct vc4_crtc_data base; |
|---|
| 470 | + |
|---|
| 471 | + /* Depth of the PixelValve FIFO in bytes */ |
|---|
| 472 | + unsigned int fifo_depth; |
|---|
| 473 | + |
|---|
| 474 | + /* Number of pixels output per clock period */ |
|---|
| 475 | + u8 pixels_per_clock; |
|---|
| 405 | 476 | |
|---|
| 406 | 477 | enum vc4_encoder_type encoder_types[4]; |
|---|
| 478 | + const char *debugfs_name; |
|---|
| 479 | + |
|---|
| 407 | 480 | }; |
|---|
| 408 | 481 | |
|---|
| 409 | 482 | struct vc4_crtc { |
|---|
| 410 | 483 | struct drm_crtc base; |
|---|
| 484 | + struct platform_device *pdev; |
|---|
| 411 | 485 | const struct vc4_crtc_data *data; |
|---|
| 412 | 486 | void __iomem *regs; |
|---|
| 413 | 487 | |
|---|
| 414 | 488 | /* Timestamp at start of vblank irq - unaffected by lock delays. */ |
|---|
| 415 | 489 | ktime_t t_vblank; |
|---|
| 416 | 490 | |
|---|
| 417 | | - /* Which HVS channel we're using for our CRTC. */ |
|---|
| 418 | | - int channel; |
|---|
| 419 | | - |
|---|
| 420 | 491 | u8 lut_r[256]; |
|---|
| 421 | 492 | u8 lut_g[256]; |
|---|
| 422 | 493 | u8 lut_b[256]; |
|---|
| 423 | | - /* Size in pixels of the COB memory allocated to this CRTC. */ |
|---|
| 424 | | - u32 cob_size; |
|---|
| 425 | 494 | |
|---|
| 426 | 495 | struct drm_pending_vblank_event *event; |
|---|
| 496 | + |
|---|
| 497 | + struct debugfs_regset32 regset; |
|---|
| 427 | 498 | }; |
|---|
| 428 | 499 | |
|---|
| 429 | 500 | static inline struct vc4_crtc * |
|---|
| 430 | 501 | to_vc4_crtc(struct drm_crtc *crtc) |
|---|
| 431 | 502 | { |
|---|
| 432 | | - return (struct vc4_crtc *)crtc; |
|---|
| 503 | + return container_of(crtc, struct vc4_crtc, base); |
|---|
| 504 | +} |
|---|
| 505 | + |
|---|
| 506 | +static inline const struct vc4_crtc_data * |
|---|
| 507 | +vc4_crtc_to_vc4_crtc_data(const struct vc4_crtc *crtc) |
|---|
| 508 | +{ |
|---|
| 509 | + return crtc->data; |
|---|
| 510 | +} |
|---|
| 511 | + |
|---|
| 512 | +static inline const struct vc4_pv_data * |
|---|
| 513 | +vc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc) |
|---|
| 514 | +{ |
|---|
| 515 | + const struct vc4_crtc_data *data = vc4_crtc_to_vc4_crtc_data(crtc); |
|---|
| 516 | + |
|---|
| 517 | + return container_of(data, struct vc4_pv_data, base); |
|---|
| 518 | +} |
|---|
| 519 | + |
|---|
| 520 | +struct vc4_crtc_state { |
|---|
| 521 | + struct drm_crtc_state base; |
|---|
| 522 | + /* Dlist area for this CRTC configuration. */ |
|---|
| 523 | + struct drm_mm_node mm; |
|---|
| 524 | + bool feed_txp; |
|---|
| 525 | + bool txp_armed; |
|---|
| 526 | + unsigned int assigned_channel; |
|---|
| 527 | + |
|---|
| 528 | + struct { |
|---|
| 529 | + unsigned int left; |
|---|
| 530 | + unsigned int right; |
|---|
| 531 | + unsigned int top; |
|---|
| 532 | + unsigned int bottom; |
|---|
| 533 | + } margins; |
|---|
| 534 | + |
|---|
| 535 | + /* Transitional state below, only valid during atomic commits */ |
|---|
| 536 | + bool update_muxing; |
|---|
| 537 | +}; |
|---|
| 538 | + |
|---|
| 539 | +#define VC4_HVS_CHANNEL_DISABLED ((unsigned int)-1) |
|---|
| 540 | + |
|---|
| 541 | +static inline struct vc4_crtc_state * |
|---|
| 542 | +to_vc4_crtc_state(struct drm_crtc_state *crtc_state) |
|---|
| 543 | +{ |
|---|
| 544 | + return container_of(crtc_state, struct vc4_crtc_state, base); |
|---|
| 433 | 545 | } |
|---|
| 434 | 546 | |
|---|
| 435 | 547 | #define V3D_READ(offset) readl(vc4->v3d->regs + offset) |
|---|
| 436 | 548 | #define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset) |
|---|
| 437 | 549 | #define HVS_READ(offset) readl(vc4->hvs->regs + offset) |
|---|
| 438 | 550 | #define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) |
|---|
| 551 | + |
|---|
| 552 | +#define VC4_REG32(reg) { .name = #reg, .offset = reg } |
|---|
| 439 | 553 | |
|---|
| 440 | 554 | struct vc4_exec_info { |
|---|
| 441 | 555 | /* Sequence number for this bin/render job. */ |
|---|
| .. | .. |
|---|
| 548 | 662 | * NULL otherwise. |
|---|
| 549 | 663 | */ |
|---|
| 550 | 664 | struct vc4_perfmon *perfmon; |
|---|
| 665 | + |
|---|
| 666 | + /* Whether the exec has taken a reference to the binner BO, which should |
|---|
| 667 | + * happen with a VC4_PACKET_TILE_BINNING_MODE_CONFIG packet. |
|---|
| 668 | + */ |
|---|
| 669 | + bool bin_bo_used; |
|---|
| 551 | 670 | }; |
|---|
| 552 | 671 | |
|---|
| 553 | 672 | /* Per-open file private data. Any driver-specific resource that has to be |
|---|
| .. | .. |
|---|
| 558 | 677 | struct idr idr; |
|---|
| 559 | 678 | struct mutex lock; |
|---|
| 560 | 679 | } perfmon; |
|---|
| 680 | + |
|---|
| 681 | + bool bin_bo_used; |
|---|
| 561 | 682 | }; |
|---|
| 562 | 683 | |
|---|
| 563 | 684 | static inline struct vc4_exec_info * |
|---|
| .. | .. |
|---|
| 625 | 746 | }; |
|---|
| 626 | 747 | |
|---|
| 627 | 748 | /** |
|---|
| 628 | | - * _wait_for - magic (register) wait macro |
|---|
| 749 | + * __wait_for - magic wait macro |
|---|
| 629 | 750 | * |
|---|
| 630 | | - * Does the right thing for modeset paths when run under kdgb or similar atomic |
|---|
| 631 | | - * contexts. Note that it's important that we check the condition again after |
|---|
| 632 | | - * having timed out, since the timeout could be due to preemption or similar and |
|---|
| 633 | | - * we've never had a chance to check the condition before the timeout. |
|---|
| 751 | + * Macro to help avoid open coding check/wait/timeout patterns. Note that it's |
|---|
| 752 | + * important that we check the condition again after having timed out, since the |
|---|
| 753 | + * timeout could be due to preemption or similar and we've never had a chance to |
|---|
| 754 | + * check the condition before the timeout. |
|---|
| 634 | 755 | */ |
|---|
| 635 | | -#define _wait_for(COND, MS, W) ({ \ |
|---|
| 636 | | - unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \ |
|---|
| 637 | | - int ret__ = 0; \ |
|---|
| 638 | | - while (!(COND)) { \ |
|---|
| 639 | | - if (time_after(jiffies, timeout__)) { \ |
|---|
| 640 | | - if (!(COND)) \ |
|---|
| 641 | | - ret__ = -ETIMEDOUT; \ |
|---|
| 756 | +#define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ |
|---|
| 757 | + const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ |
|---|
| 758 | + long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ |
|---|
| 759 | + int ret__; \ |
|---|
| 760 | + might_sleep(); \ |
|---|
| 761 | + for (;;) { \ |
|---|
| 762 | + const bool expired__ = ktime_after(ktime_get_raw(), end__); \ |
|---|
| 763 | + OP; \ |
|---|
| 764 | + /* Guarantee COND check prior to timeout */ \ |
|---|
| 765 | + barrier(); \ |
|---|
| 766 | + if (COND) { \ |
|---|
| 767 | + ret__ = 0; \ |
|---|
| 642 | 768 | break; \ |
|---|
| 643 | 769 | } \ |
|---|
| 644 | | - if (W && drm_can_sleep()) { \ |
|---|
| 645 | | - msleep(W); \ |
|---|
| 646 | | - } else { \ |
|---|
| 647 | | - cpu_relax(); \ |
|---|
| 770 | + if (expired__) { \ |
|---|
| 771 | + ret__ = -ETIMEDOUT; \ |
|---|
| 772 | + break; \ |
|---|
| 648 | 773 | } \ |
|---|
| 774 | + usleep_range(wait__, wait__ * 2); \ |
|---|
| 775 | + if (wait__ < (Wmax)) \ |
|---|
| 776 | + wait__ <<= 1; \ |
|---|
| 649 | 777 | } \ |
|---|
| 650 | 778 | ret__; \ |
|---|
| 651 | 779 | }) |
|---|
| 652 | 780 | |
|---|
| 653 | | -#define wait_for(COND, MS) _wait_for(COND, MS, 1) |
|---|
| 781 | +#define _wait_for(COND, US, Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ |
|---|
| 782 | + (Wmax)) |
|---|
| 783 | +#define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) |
|---|
| 654 | 784 | |
|---|
| 655 | 785 | /* vc4_bo.c */ |
|---|
| 656 | 786 | struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); |
|---|
| .. | .. |
|---|
| 660 | 790 | int vc4_dumb_create(struct drm_file *file_priv, |
|---|
| 661 | 791 | struct drm_device *dev, |
|---|
| 662 | 792 | struct drm_mode_create_dumb *args); |
|---|
| 663 | | -struct dma_buf *vc4_prime_export(struct drm_device *dev, |
|---|
| 664 | | - struct drm_gem_object *obj, int flags); |
|---|
| 793 | +struct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags); |
|---|
| 665 | 794 | int vc4_create_bo_ioctl(struct drm_device *dev, void *data, |
|---|
| 666 | 795 | struct drm_file *file_priv); |
|---|
| 667 | 796 | int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, |
|---|
| .. | .. |
|---|
| 678 | 807 | struct drm_file *file_priv); |
|---|
| 679 | 808 | vm_fault_t vc4_fault(struct vm_fault *vmf); |
|---|
| 680 | 809 | int vc4_mmap(struct file *filp, struct vm_area_struct *vma); |
|---|
| 681 | | -struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj); |
|---|
| 682 | 810 | int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); |
|---|
| 683 | 811 | struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, |
|---|
| 684 | 812 | struct dma_buf_attachment *attach, |
|---|
| 685 | 813 | struct sg_table *sgt); |
|---|
| 686 | 814 | void *vc4_prime_vmap(struct drm_gem_object *obj); |
|---|
| 687 | 815 | int vc4_bo_cache_init(struct drm_device *dev); |
|---|
| 688 | | -void vc4_bo_cache_destroy(struct drm_device *dev); |
|---|
| 689 | | -int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); |
|---|
| 690 | 816 | int vc4_bo_inc_usecnt(struct vc4_bo *bo); |
|---|
| 691 | 817 | void vc4_bo_dec_usecnt(struct vc4_bo *bo); |
|---|
| 692 | 818 | void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); |
|---|
| .. | .. |
|---|
| 694 | 820 | |
|---|
| 695 | 821 | /* vc4_crtc.c */ |
|---|
| 696 | 822 | extern struct platform_driver vc4_crtc_driver; |
|---|
| 697 | | -int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg); |
|---|
| 698 | | -bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, |
|---|
| 699 | | - bool in_vblank_irq, int *vpos, int *hpos, |
|---|
| 700 | | - ktime_t *stime, ktime_t *etime, |
|---|
| 701 | | - const struct drm_display_mode *mode); |
|---|
| 823 | +int vc4_crtc_disable_at_boot(struct drm_crtc *crtc); |
|---|
| 824 | +int vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc, |
|---|
| 825 | + const struct drm_crtc_funcs *crtc_funcs, |
|---|
| 826 | + const struct drm_crtc_helper_funcs *crtc_helper_funcs); |
|---|
| 827 | +void vc4_crtc_destroy(struct drm_crtc *crtc); |
|---|
| 828 | +int vc4_page_flip(struct drm_crtc *crtc, |
|---|
| 829 | + struct drm_framebuffer *fb, |
|---|
| 830 | + struct drm_pending_vblank_event *event, |
|---|
| 831 | + uint32_t flags, |
|---|
| 832 | + struct drm_modeset_acquire_ctx *ctx); |
|---|
| 833 | +struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc); |
|---|
| 834 | +void vc4_crtc_destroy_state(struct drm_crtc *crtc, |
|---|
| 835 | + struct drm_crtc_state *state); |
|---|
| 836 | +void vc4_crtc_reset(struct drm_crtc *crtc); |
|---|
| 702 | 837 | void vc4_crtc_handle_vblank(struct vc4_crtc *crtc); |
|---|
| 703 | | -void vc4_crtc_txp_armed(struct drm_crtc_state *state); |
|---|
| 838 | +void vc4_crtc_get_margins(struct drm_crtc_state *state, |
|---|
| 839 | + unsigned int *left, unsigned int *right, |
|---|
| 840 | + unsigned int *top, unsigned int *bottom); |
|---|
| 704 | 841 | |
|---|
| 705 | 842 | /* vc4_debugfs.c */ |
|---|
| 706 | | -int vc4_debugfs_init(struct drm_minor *minor); |
|---|
| 843 | +void vc4_debugfs_init(struct drm_minor *minor); |
|---|
| 844 | +#ifdef CONFIG_DEBUG_FS |
|---|
| 845 | +void vc4_debugfs_add_file(struct drm_device *drm, |
|---|
| 846 | + const char *filename, |
|---|
| 847 | + int (*show)(struct seq_file*, void*), |
|---|
| 848 | + void *data); |
|---|
| 849 | +void vc4_debugfs_add_regset32(struct drm_device *drm, |
|---|
| 850 | + const char *filename, |
|---|
| 851 | + struct debugfs_regset32 *regset); |
|---|
| 852 | +#else |
|---|
| 853 | +static inline void vc4_debugfs_add_file(struct drm_device *drm, |
|---|
| 854 | + const char *filename, |
|---|
| 855 | + int (*show)(struct seq_file*, void*), |
|---|
| 856 | + void *data) |
|---|
| 857 | +{ |
|---|
| 858 | +} |
|---|
| 859 | + |
|---|
| 860 | +static inline void vc4_debugfs_add_regset32(struct drm_device *drm, |
|---|
| 861 | + const char *filename, |
|---|
| 862 | + struct debugfs_regset32 *regset) |
|---|
| 863 | +{ |
|---|
| 864 | +} |
|---|
| 865 | +#endif |
|---|
| 707 | 866 | |
|---|
| 708 | 867 | /* vc4_drv.c */ |
|---|
| 709 | 868 | void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); |
|---|
| 710 | 869 | |
|---|
| 711 | 870 | /* vc4_dpi.c */ |
|---|
| 712 | 871 | extern struct platform_driver vc4_dpi_driver; |
|---|
| 713 | | -int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 714 | 872 | |
|---|
| 715 | 873 | /* vc4_dsi.c */ |
|---|
| 716 | 874 | extern struct platform_driver vc4_dsi_driver; |
|---|
| 717 | | -int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 718 | 875 | |
|---|
| 719 | 876 | /* vc4_fence.c */ |
|---|
| 720 | 877 | extern const struct dma_fence_ops vc4_fence_ops; |
|---|
| 721 | 878 | |
|---|
| 722 | 879 | /* vc4_gem.c */ |
|---|
| 723 | | -void vc4_gem_init(struct drm_device *dev); |
|---|
| 724 | | -void vc4_gem_destroy(struct drm_device *dev); |
|---|
| 880 | +int vc4_gem_init(struct drm_device *dev); |
|---|
| 725 | 881 | int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, |
|---|
| 726 | 882 | struct drm_file *file_priv); |
|---|
| 727 | 883 | int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, |
|---|
| .. | .. |
|---|
| 742 | 898 | |
|---|
| 743 | 899 | /* vc4_hdmi.c */ |
|---|
| 744 | 900 | extern struct platform_driver vc4_hdmi_driver; |
|---|
| 745 | | -int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 746 | 901 | |
|---|
| 747 | 902 | /* vc4_vec.c */ |
|---|
| 748 | 903 | extern struct platform_driver vc4_vec_driver; |
|---|
| 749 | | -int vc4_vec_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 750 | 904 | |
|---|
| 751 | 905 | /* vc4_txp.c */ |
|---|
| 752 | 906 | extern struct platform_driver vc4_txp_driver; |
|---|
| 753 | | -int vc4_txp_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 754 | 907 | |
|---|
| 755 | 908 | /* vc4_irq.c */ |
|---|
| 756 | 909 | irqreturn_t vc4_irq(int irq, void *arg); |
|---|
| .. | .. |
|---|
| 761 | 914 | |
|---|
| 762 | 915 | /* vc4_hvs.c */ |
|---|
| 763 | 916 | extern struct platform_driver vc4_hvs_driver; |
|---|
| 917 | +void vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output); |
|---|
| 918 | +int vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output); |
|---|
| 919 | +int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state); |
|---|
| 920 | +void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state); |
|---|
| 921 | +void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state); |
|---|
| 922 | +void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *state); |
|---|
| 764 | 923 | void vc4_hvs_dump_state(struct drm_device *dev); |
|---|
| 765 | | -int vc4_hvs_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 924 | +void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel); |
|---|
| 925 | +void vc4_hvs_mask_underrun(struct drm_device *dev, int channel); |
|---|
| 766 | 926 | |
|---|
| 767 | 927 | /* vc4_kms.c */ |
|---|
| 768 | 928 | int vc4_kms_load(struct drm_device *dev); |
|---|
| .. | .. |
|---|
| 770 | 930 | /* vc4_plane.c */ |
|---|
| 771 | 931 | struct drm_plane *vc4_plane_init(struct drm_device *dev, |
|---|
| 772 | 932 | enum drm_plane_type type); |
|---|
| 933 | +int vc4_plane_create_additional_planes(struct drm_device *dev); |
|---|
| 773 | 934 | u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); |
|---|
| 774 | 935 | u32 vc4_plane_dlist_size(const struct drm_plane_state *state); |
|---|
| 775 | 936 | void vc4_plane_async_set_fb(struct drm_plane *plane, |
|---|
| .. | .. |
|---|
| 777 | 938 | |
|---|
| 778 | 939 | /* vc4_v3d.c */ |
|---|
| 779 | 940 | extern struct platform_driver vc4_v3d_driver; |
|---|
| 780 | | -int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused); |
|---|
| 781 | | -int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused); |
|---|
| 941 | +extern const struct of_device_id vc4_v3d_dt_match[]; |
|---|
| 782 | 942 | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4); |
|---|
| 943 | +int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used); |
|---|
| 944 | +void vc4_v3d_bin_bo_put(struct vc4_dev *vc4); |
|---|
| 945 | +int vc4_v3d_pm_get(struct vc4_dev *vc4); |
|---|
| 946 | +void vc4_v3d_pm_put(struct vc4_dev *vc4); |
|---|
| 783 | 947 | |
|---|
| 784 | 948 | /* vc4_validate.c */ |
|---|
| 785 | 949 | int |
|---|
| .. | .. |
|---|
| 820 | 984 | struct drm_file *file_priv); |
|---|
| 821 | 985 | int vc4_perfmon_get_values_ioctl(struct drm_device *dev, void *data, |
|---|
| 822 | 986 | struct drm_file *file_priv); |
|---|
| 987 | + |
|---|
| 988 | +#endif /* _VC4_DRV_H_ */ |
|---|