← Documents Documentation/gpu/i915.rst GitHub 원문 ↗

Linux 6.18.37 · GPU·DRM

drm/i915 Intel GFX Driver

Intel i915의 core, display, GEM·GTT, microcontroller, perf와 usage stats를 연결하는 상위 문서 전문 번역입니다.

Source pathDocumentation/gpu/i915.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

i915.rst:1-747

Intel i915 driver의 core power·interrupt·virtualization, display pipeline, GT engine, GEM·GTT memory management, GuC/HuC/DMC firmware, tracing, perf OA와 client usage statistics를 연결하는 상위 index입니다. Kernel-doc 116개의 source path와 selector option을 모두 보존하고 실제 서술 절은 한국어로 전문 번역했습니다.

i915 문서 지도
영역핵심 주제
CoreRuntime PM·IRQ·GVT-g·workaround
DisplayPlane·flip·hotplug·audio·PSR·FBC·DMC·clock
GT·GEMEngine·context·GTT·relocation·eviction·submission
MicrocontrollerWOPCM·GuC·HuC·DMC
ObservabilityTracepoint·perf stream·OA
ABI·styleRegister macro guide·DRM client fdinfo stats

상위 절과 구현 source의 관계입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ===========================
2 drm/i915 Intel GFX Driver
3 ===========================
4
5 The drm/i915 driver supports all (with the exception of some very early
6 models) integrated GFX chipsets with both Intel display and rendering
7 blocks. This excludes a set of SoC platforms with an SGX rendering unit,
8 those have basic support through the gma500 drm driver.
9
10 Core Driver Infrastructure
11 ==========================
12
13 This section covers core driver infrastructure used by both the display
14 and the GEM parts of the driver.
15
16 Runtime Power Management
17 ------------------------
18
19 .. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
20 :doc: runtime pm
21
22 .. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
23 :internal:
24
25 .. kernel-doc:: drivers/gpu/drm/i915/intel_uncore.c
26 :internal:
27
28 Interrupt Handling
29 ------------------
30
31 .. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
32 :doc: interrupt handling
33
34 .. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
35 :functions: intel_irq_init intel_irq_init_hw intel_hpd_init
36
37 .. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
38 :functions: intel_irq_suspend
39
40 .. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
41 :functions: intel_irq_resume
42
43 Intel GVT-g Guest Support(vGPU)
44 -------------------------------
45
46 .. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
47 :doc: Intel GVT-g guest support
48
49 .. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
50 :internal:
51
52 Intel GVT-g Host Support(vGPU device model)
53 -------------------------------------------
54
55 .. kernel-doc:: drivers/gpu/drm/i915/intel_gvt.c
56 :doc: Intel GVT-g host support
57
58 .. kernel-doc:: drivers/gpu/drm/i915/intel_gvt.c
59 :internal:
60
61 Workarounds
62 -----------
63
64 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_workarounds.c
65 :doc: Hardware workarounds
66
67 Display Hardware Handling
68 =========================
69
70 This section covers everything related to the display hardware including
71 the mode setting infrastructure, plane, sprite and cursor handling and
72 display, output probing and related topics.
73
74 Mode Setting Infrastructure
75 ---------------------------
76
77 The i915 driver is thus far the only DRM driver which doesn't use the
78 common DRM helper code to implement mode setting sequences. Thus it has
79 its own tailor-made infrastructure for executing a display configuration
80 change.
81
82 Frontbuffer Tracking
83 --------------------
84
85 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
86 :doc: frontbuffer tracking
87
88 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.h
89 :internal:
90
91 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
92 :internal:
93
94 Display FIFO Underrun Reporting
95 -------------------------------
96
97 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
98 :doc: fifo underrun handling
99
100 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
101 :internal:
102
103 Plane Configuration
104 -------------------
105
106 This section covers plane configuration and composition with the primary
107 plane, sprites, cursors and overlays. This includes the infrastructure
108 to do atomic vsync'ed updates of all this state and also tightly coupled
109 topics like watermark setup and computation, framebuffer compression and
110 panel self refresh.
111
112 Atomic Plane Helpers
113 --------------------
114
115 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_plane.c
116 :doc: atomic plane helpers
117
118 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_plane.c
119 :internal:
120
121 Asynchronous Page Flip
122 ----------------------
123
124 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_display.c
125 :doc: asynchronous flip implementation
126
127 Output Probing
128 --------------
129
130 This section covers output probing and related infrastructure like the
131 hotplug interrupt storm detection and mitigation code. Note that the
132 i915 driver still uses most of the common DRM helper code for output
133 probing, so those sections fully apply.
134
135 Hotplug
136 -------
137
138 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
139 :doc: Hotplug
140
141 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
142 :internal:
143
144 High Definition Audio
145 ---------------------
146
147 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
148 :doc: High Definition Audio over HDMI and Display Port
149
150 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
151 :internal:
152
153 .. kernel-doc:: include/drm/intel/i915_component.h
154 :internal:
155
156 Intel HDMI LPE Audio Support
157 ----------------------------
158
159 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
160 :doc: LPE Audio integration for HDMI or DP playback
161
162 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
163 :internal:
164
165 Panel Self Refresh PSR (PSR/SRD)
166 --------------------------------
167
168 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
169 :doc: Panel Self Refresh (PSR/SRD)
170
171 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
172 :internal:
173
174 Frame Buffer Compression (FBC)
175 ------------------------------
176
177 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
178 :doc: Frame Buffer Compression (FBC)
179
180 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
181 :internal:
182
183 Display Refresh Rate Switching (DRRS)
184 -------------------------------------
185
186 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_drrs.c
187 :doc: Display Refresh Rate Switching (DRRS)
188
189 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_drrs.c
190 :internal:
191
192 DPIO
193 ----
194
195 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpio_phy.c
196 :doc: DPIO
197
198 DMC Firmware Support
199 --------------------
200
201 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc.c
202 :doc: DMC Firmware Support
203
204 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc.c
205 :internal:
206
207 DMC Flip Queue
208 --------------------
209
210 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_flipq.c
211 :doc: DMC Flip Queue
212
213 DMC wakelock support
214 --------------------
215
216 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc_wl.c
217 :doc: DMC wakelock support
218
219 Video BIOS Table (VBT)
220 ----------------------
221
222 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_bios.c
223 :doc: Video BIOS Table (VBT)
224
225 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_bios.c
226 :internal:
227
228 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_vbt_defs.h
229 :internal:
230
231 Display clocks
232 --------------
233
234 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_cdclk.c
235 :doc: CDCLK / RAWCLK
236
237 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_cdclk.c
238 :internal:
239
240 Display PLLs
241 ------------
242
243 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.c
244 :doc: Display PLLs
245
246 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.c
247 :internal:
248
249 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.h
250 :internal:
251
252 Display State Buffer
253 --------------------
254
255 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dsb.c
256 :doc: DSB
257
258 .. kernel-doc:: drivers/gpu/drm/i915/display/intel_dsb.c
259 :internal:
260
261 GT Programming
262 ==============
263
264 Multicast/Replicated (MCR) Registers
265 ------------------------------------
266
267 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_mcr.c
268 :doc: GT Multicast/Replicated (MCR) Register Support
269
270 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_mcr.c
271 :internal:
272
273 Memory Management and Command Submission
274 ========================================
275
276 This sections covers all things related to the GEM implementation in the
277 i915 driver.
278
279 Intel GPU Basics
280 ----------------
281
282 An Intel GPU has multiple engines. There are several engine types:
283
284 - Render Command Streamer (RCS). An engine for rendering 3D and
285 performing compute.
286 - Blitting Command Streamer (BCS). An engine for performing blitting and/or
287 copying operations.
288 - Video Command Streamer. An engine used for video encoding and decoding. Also
289 sometimes called 'BSD' in hardware documentation.
290 - Video Enhancement Command Streamer (VECS). An engine for video enhancement.
291 Also sometimes called 'VEBOX' in hardware documentation.
292 - Compute Command Streamer (CCS). An engine that has access to the media and
293 GPGPU pipelines, but not the 3D pipeline.
294 - Graphics Security Controller (GSCCS). A dedicated engine for internal
295 communication with GSC controller on security related tasks like
296 High-bandwidth Digital Content Protection (HDCP), Protected Xe Path (PXP),
297 and HuC firmware authentication.
298
299 The Intel GPU family is a family of integrated GPU's using Unified
300 Memory Access. For having the GPU "do work", user space will feed the
301 GPU batch buffers via one of the ioctls `DRM_IOCTL_I915_GEM_EXECBUFFER2`
302 or `DRM_IOCTL_I915_GEM_EXECBUFFER2_WR`. Most such batchbuffers will
303 instruct the GPU to perform work (for example rendering) and that work
304 needs memory from which to read and memory to which to write. All memory
305 is encapsulated within GEM buffer objects (usually created with the ioctl
306 `DRM_IOCTL_I915_GEM_CREATE`). An ioctl providing a batchbuffer for the GPU
307 to create will also list all GEM buffer objects that the batchbuffer reads
308 and/or writes. For implementation details of memory management see
309 `GEM BO Management Implementation Details`_.
310
311 The i915 driver allows user space to create a context via the ioctl
312 `DRM_IOCTL_I915_GEM_CONTEXT_CREATE` which is identified by a 32-bit
313 integer. Such a context should be viewed by user-space as -loosely-
314 analogous to the idea of a CPU process of an operating system. The i915
315 driver guarantees that commands issued to a fixed context are to be
316 executed so that writes of a previously issued command are seen by
317 reads of following commands. Actions issued between different contexts
318 (even if from the same file descriptor) are NOT given that guarantee
319 and the only way to synchronize across contexts (even from the same
320 file descriptor) is through the use of fences. At least as far back as
321 Gen4, also have that a context carries with it a GPU HW context;
322 the HW context is essentially (most of at least) the state of a GPU.
323 In addition to the ordering guarantees, the kernel will restore GPU
324 state via HW context when commands are issued to a context, this saves
325 user space the need to restore (most of at least) the GPU state at the
326 start of each batchbuffer. The non-deprecated ioctls to submit batchbuffer
327 work can pass that ID (in the lower bits of drm_i915_gem_execbuffer2::rsvd1)
328 to identify what context to use with the command.
329
330 The GPU has its own memory management and address space. The kernel
331 driver maintains the memory translation table for the GPU. For older
332 GPUs (i.e. those before Gen8), there is a single global such translation
333 table, a global Graphics Translation Table (GTT). For newer generation
334 GPUs each context has its own translation table, called Per-Process
335 Graphics Translation Table (PPGTT). Of important note, is that although
336 PPGTT is named per-process it is actually per context. When user space
337 submits a batchbuffer, the kernel walks the list of GEM buffer objects
338 used by the batchbuffer and guarantees that not only is the memory of
339 each such GEM buffer object resident but it is also present in the
340 (PP)GTT. If the GEM buffer object is not yet placed in the (PP)GTT,
341 then it is given an address. Two consequences of this are: the kernel
342 needs to edit the batchbuffer submitted to write the correct value of
343 the GPU address when a GEM BO is assigned a GPU address and the kernel
344 might evict a different GEM BO from the (PP)GTT to make address room
345 for another GEM BO. Consequently, the ioctls submitting a batchbuffer
346 for execution also include a list of all locations within buffers that
347 refer to GPU-addresses so that the kernel can edit the buffer correctly.
348 This process is dubbed relocation.
349
350 Locking Guidelines
351 ------------------
352
353 .. note::
354 This is a description of how the locking should be after
355 refactoring is done. Does not necessarily reflect what the locking
356 looks like while WIP.
357
358 #. All locking rules and interface contracts with cross-driver interfaces
359 (dma-buf, dma_fence) need to be followed.
360
361 #. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
362 is to be hoisted at highest level and passed down within i915_gem_ctx
363 in the call chain
364
365 #. While holding lru/memory manager (buddy, drm_mm, whatever) locks
366 system memory allocations are not allowed
367
368 #. Do not nest different lru/memory manager locks within each other.
369 Take them in turn to update memory allocations, relying on the object’s
370 dma_resv ww_mutex to serialize against other operations.
371
372 #. The suggestion for lru/memory managers locks is that they are small
373 enough to be spinlocks.
374
375 #. All features need to come with exhaustive kernel selftests and/or
376 IGT tests when appropriate
377
378 #. All LMEM uAPI paths need to be fully restartable (_interruptible()
379 for all locks/waits/sleeps)
380
381 * Error handling validation through signal injection.
382 Still the best strategy we have for validating GEM uAPI
383 corner cases.
384 Must be excessively used in the IGT, and we need to check
385 that we really have full path coverage of all error cases.
386
387 * -EDEADLK handling with ww_mutex
388
389 GEM BO Management Implementation Details
390 ----------------------------------------
391
392 .. kernel-doc:: drivers/gpu/drm/i915/i915_vma_types.h
393 :doc: Virtual Memory Address
394
395 Buffer Object Eviction
396 ----------------------
397
398 This section documents the interface functions for evicting buffer
399 objects to make space available in the virtual gpu address spaces. Note
400 that this is mostly orthogonal to shrinking buffer objects caches, which
401 has the goal to make main memory (shared with the gpu through the
402 unified memory architecture) available.
403
404 .. kernel-doc:: drivers/gpu/drm/i915/i915_gem_evict.c
405 :internal:
406
407 Buffer Object Memory Shrinking
408 ------------------------------
409
410 This section documents the interface function for shrinking memory usage
411 of buffer object caches. Shrinking is used to make main memory
412 available. Note that this is mostly orthogonal to evicting buffer
413 objects, which has the goal to make space in gpu virtual address spaces.
414
415 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
416 :internal:
417
418 Batchbuffer Parsing
419 -------------------
420
421 .. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
422 :doc: batch buffer command parser
423
424 .. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
425 :internal:
426
427 User Batchbuffer Execution
428 --------------------------
429
430 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_context_types.h
431
432 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
433 :doc: User command execution
434
435 Scheduling
436 ----------
437 .. kernel-doc:: drivers/gpu/drm/i915/i915_scheduler_types.h
438 :functions: i915_sched_engine
439
440 Logical Rings, Logical Ring Contexts and Execlists
441 --------------------------------------------------
442
443 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_execlists_submission.c
444 :doc: Logical Rings, Logical Ring Contexts and Execlists
445
446 Global GTT views
447 ----------------
448
449 .. kernel-doc:: drivers/gpu/drm/i915/i915_vma_types.h
450 :doc: Global GTT views
451
452 .. kernel-doc:: drivers/gpu/drm/i915/i915_gem_gtt.c
453 :internal:
454
455 GTT Fences and Swizzling
456 ------------------------
457
458 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
459 :internal:
460
461 Global GTT Fence Handling
462 ~~~~~~~~~~~~~~~~~~~~~~~~~
463
464 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
465 :doc: fence register handling
466
467 Hardware Tiling and Swizzling Details
468 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
469
470 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
471 :doc: tiling swizzling details
472
473 Object Tiling IOCTLs
474 --------------------
475
476 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_tiling.c
477 :internal:
478
479 .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_tiling.c
480 :doc: buffer object tiling
481
482 Protected Objects
483 -----------------
484
485 .. kernel-doc:: drivers/gpu/drm/i915/pxp/intel_pxp.c
486 :doc: PXP
487
488 .. kernel-doc:: drivers/gpu/drm/i915/pxp/intel_pxp_types.h
489
490 Microcontrollers
491 ================
492
493 Starting from gen9, three microcontrollers are available on the HW: the
494 graphics microcontroller (GuC), the HEVC/H.265 microcontroller (HuC) and the
495 display microcontroller (DMC). The driver is responsible for loading the
496 firmwares on the microcontrollers; the GuC and HuC firmwares are transferred
497 to WOPCM using the DMA engine, while the DMC firmware is written through MMIO.
498
499 WOPCM
500 -----
501
502 WOPCM Layout
503 ~~~~~~~~~~~~
504
505 .. kernel-doc:: drivers/gpu/drm/i915/gt/intel_wopcm.c
506 :doc: WOPCM Layout
507
508 GuC
509 ---
510
511 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
512 :doc: GuC
513
514 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.h
515
516 GuC Firmware Layout
517 ~~~~~~~~~~~~~~~~~~~
518
519 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h
520 :doc: Firmware Layout
521
522 GuC Memory Management
523 ~~~~~~~~~~~~~~~~~~~~~
524
525 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
526 :doc: GuC Memory Management
527 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
528 :functions: intel_guc_allocate_vma
529
530
531 GuC-specific firmware loader
532 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533
534 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
535 :internal:
536
537 GuC-based command submission
538 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
539
540 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
541 :doc: GuC-based command submission
542
543 GuC ABI
544 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545
546 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
547 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h
548 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
549 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
550 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
551
552 HuC
553 ---
554 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
555 :doc: HuC
556 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
557 :functions: intel_huc_auth
558
559 HuC Memory Management
560 ~~~~~~~~~~~~~~~~~~~~~
561
562 .. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
563 :doc: HuC Memory Management
564
565 HuC Firmware Layout
566 ~~~~~~~~~~~~~~~~~~~
567 The HuC FW layout is the same as the GuC one, see `GuC Firmware Layout`_
568
569 DMC
570 ---
571 See `DMC Firmware Support`_
572
573 Tracing
574 =======
575
576 This sections covers all things related to the tracepoints implemented
577 in the i915 driver.
578
579 i915_ppgtt_create and i915_ppgtt_release
580 ----------------------------------------
581
582 .. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
583 :doc: i915_ppgtt_create and i915_ppgtt_release tracepoints
584
585 i915_context_create and i915_context_free
586 -----------------------------------------
587
588 .. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
589 :doc: i915_context_create and i915_context_free tracepoints
590
591 Perf
592 ====
593
594 Overview
595 --------
596 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
597 :doc: i915 Perf Overview
598
599 Comparison with Core Perf
600 -------------------------
601 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
602 :doc: i915 Perf History and Comparison with Core Perf
603
604 i915 Driver Entry Points
605 ------------------------
606
607 This section covers the entrypoints exported outside of i915_perf.c to
608 integrate with drm/i915 and to handle the `DRM_I915_PERF_OPEN` ioctl.
609
610 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
611 :functions: i915_perf_init
612 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
613 :functions: i915_perf_fini
614 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
615 :functions: i915_perf_register
616 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
617 :functions: i915_perf_unregister
618 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
619 :functions: i915_perf_open_ioctl
620 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
621 :functions: i915_perf_release
622 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
623 :functions: i915_perf_add_config_ioctl
624 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
625 :functions: i915_perf_remove_config_ioctl
626
627 i915 Perf Stream
628 ----------------
629
630 This section covers the stream-semantics-agnostic structures and functions
631 for representing an i915 perf stream FD and associated file operations.
632
633 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
634 :functions: i915_perf_stream
635 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
636 :functions: i915_perf_stream_ops
637
638 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
639 :functions: read_properties_unlocked
640 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
641 :functions: i915_perf_open_ioctl_locked
642 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
643 :functions: i915_perf_destroy_locked
644 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
645 :functions: i915_perf_read
646 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
647 :functions: i915_perf_ioctl
648 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
649 :functions: i915_perf_enable_locked
650 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
651 :functions: i915_perf_disable_locked
652 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
653 :functions: i915_perf_poll
654 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
655 :functions: i915_perf_poll_locked
656
657 i915 Perf Observation Architecture Stream
658 -----------------------------------------
659
660 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
661 :functions: i915_oa_ops
662
663 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
664 :functions: i915_oa_stream_init
665 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
666 :functions: i915_oa_read
667 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
668 :functions: i915_oa_stream_enable
669 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
670 :functions: i915_oa_stream_disable
671 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
672 :functions: i915_oa_wait_unlocked
673 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
674 :functions: i915_oa_poll_wait
675
676 Other i915 Perf Internals
677 -------------------------
678
679 This section simply includes all other currently documented i915 perf internals,
680 in no particular order, but may include some more minor utilities or platform
681 specific details than found in the more high-level sections.
682
683 .. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
684 :internal:
685 :no-identifiers:
686 i915_perf_init
687 i915_perf_fini
688 i915_perf_register
689 i915_perf_unregister
690 i915_perf_open_ioctl
691 i915_perf_release
692 i915_perf_add_config_ioctl
693 i915_perf_remove_config_ioctl
694 read_properties_unlocked
695 i915_perf_open_ioctl_locked
696 i915_perf_destroy_locked
697 i915_perf_read i915_perf_ioctl
698 i915_perf_enable_locked
699 i915_perf_disable_locked
700 i915_perf_poll i915_perf_poll_locked
701 i915_oa_stream_init i915_oa_read
702 i915_oa_stream_enable
703 i915_oa_stream_disable
704 i915_oa_wait_unlocked
705 i915_oa_poll_wait
706
707 Style
708 =====
709
710 The drm/i915 driver codebase has some style rules in addition to (and, in some
711 cases, deviating from) the kernel coding style.
712
713 Register macro definition style
714 -------------------------------
715
716 The style guide for ``i915_reg.h``.
717
718 .. kernel-doc:: drivers/gpu/drm/i915/i915_reg.h
719 :doc: The i915 register macro definition style guide
720
721 .. _i915-usage-stats:
722
723 i915 DRM client usage stats implementation
724 ==========================================
725
726 The drm/i915 driver implements the DRM client usage stats specification as
727 documented in :ref:`drm-client-usage-stats`.
728
729 Example of the output showing the implemented key value pairs and entirety of
730 the currently possible format options:
731
732 ::
733
734 pos: 0
735 flags: 0100002
736 mnt_id: 21
737 drm-driver: i915
738 drm-pdev: 0000:00:02.0
739 drm-client-id: 7
740 drm-engine-render: 9288864723 ns
741 drm-engine-copy: 2035071108 ns
742 drm-engine-video: 0 ns
743 drm-engine-capacity-video: 2
744 drm-engine-video-enhance: 0 ns
745
746 Possible `drm-engine-` key names are: `render`, `copy`, `video` and
747 `video-enhance`.
748

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

i915 범위와 core driver infrastructure

1-67

`drm/i915` driver는 일부 극초기 model을 제외하고 Intel display block과 rendering block을 모두 갖춘 integrated GFX chipset을 지원합니다. SGX rendering unit을 사용하는 일부 SoC platform은 여기서 제외되며 기본 지원은 `gma500` DRM driver가 담당합니다.

Core driver infrastructure 절은 display와 GEM 양쪽이 함께 사용하는 기반을 다룹니다.

Runtime power management block은 `intel_runtime_pm.c`의 runtime PM 문서와 내부 구현, `intel_uncore.c` 내부 API를 연결합니다.

Interrupt handling block은 `i915_irq.c`의 전체 interrupt 설계와 `intel_irq_init`, `intel_irq_init_hw`, `intel_hpd_init`, suspend·resume entry point를 문서화합니다.

GVT-g guest support는 `i915_vgpu.c`, host-side vGPU device model은 `intel_gvt.c`의 문서와 internal API를 연결합니다. Hardware workaround는 `gt/intel_workarounds.c`가 설명합니다.

Core infrastructure 구성
영역Source역할
Runtime PMintel_runtime_pm.c·intel_uncore.cPower reference와 uncore access
Interrupti915_irq.cIRQ init·HPD·suspend·resume
GVT-g guesti915_vgpu.cVirtual GPU guest support
GVT-g hostintel_gvt.cHost-side device model
Workaroundgt/intel_workarounds.cPlatform hardware workaround 적용

Display와 GEM이 공유하는 i915 기반 영역입니다.

Kernel-doc: core infrastructure
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/intel_runtime_pm.c:doc: runtime pm문서 block
drivers/gpu/drm/i915/intel_runtime_pm.c:internal:Internal API
drivers/gpu/drm/i915/intel_uncore.c:internal:Internal API
drivers/gpu/drm/i915/i915_irq.c:doc: interrupt handling문서 block
drivers/gpu/drm/i915/i915_irq.c:functions: intel_irq_init intel_irq_init_hw intel_hpd_init지정 function
drivers/gpu/drm/i915/i915_irq.c:functions: intel_irq_suspend지정 function
drivers/gpu/drm/i915/i915_irq.c:functions: intel_irq_resume지정 function
drivers/gpu/drm/i915/i915_vgpu.c:doc: Intel GVT-g guest support문서 block
drivers/gpu/drm/i915/i915_vgpu.c:internal:Internal API
drivers/gpu/drm/i915/intel_gvt.c:doc: Intel GVT-g host support문서 block
drivers/gpu/drm/i915/intel_gvt.c:internal:Internal API
drivers/gpu/drm/i915/gt/intel_workarounds.c:doc: Hardware workarounds문서 block

Runtime PM, interrupt, GVT-g와 hardware workaround의 12개 source block입니다.

===========================
 drm/i915 Intel GFX Driver
===========================

The drm/i915 driver supports all (with the exception of some very early
models) integrated GFX chipsets with both Intel display and rendering
blocks. This excludes a set of SoC platforms with an SGX rendering unit,
those have basic support through the gma500 drm driver.

Core Driver Infrastructure
==========================

This section covers core driver infrastructure used by both the display
and the GEM parts of the driver.

Runtime Power Management
------------------------

.. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
   :doc: runtime pm

.. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
   :internal:

.. kernel-doc:: drivers/gpu/drm/i915/intel_uncore.c
   :internal:

Interrupt Handling
------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
   :doc: interrupt handling

.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
   :functions: intel_irq_init intel_irq_init_hw intel_hpd_init

.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
   :functions: intel_irq_suspend

.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
   :functions: intel_irq_resume

Intel GVT-g Guest Support(vGPU)
-------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
   :doc: Intel GVT-g guest support

.. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
   :internal:

Intel GVT-g Host Support(vGPU device model)
-------------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/intel_gvt.c
   :doc: Intel GVT-g host support

.. kernel-doc:: drivers/gpu/drm/i915/intel_gvt.c
   :internal:

Workarounds
-----------

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_workarounds.c
   :doc: Hardware workarounds

Display Hardware Handling

Display hardware 처리

68-261

Display hardware 절은 mode-setting infrastructure, primary plane·sprite·cursor, display output probing과 관련 주제를 모두 다룹니다.

현재까지 i915는 mode-setting sequence 구현에 공통 DRM helper code를 사용하지 않는 유일한 DRM driver입니다. 따라서 display configuration 변경을 실행하는 전용 infrastructure를 갖습니다.

Frontbuffer tracking은 `intel_frontbuffer.c`와 header의 public 설명·internal API를 연결하고, FIFO underrun reporting은 `intel_fifo_underrun.c`의 underrun 처리와 내부 함수를 다룹니다.

Plane configuration은 primary plane, sprite, cursor, overlay의 composition을 포괄합니다. 모든 state를 atomic하고 vsync에 맞춰 update하는 기반과 watermark 계산, framebuffer compression, panel self refresh처럼 긴밀히 연결된 주제를 포함합니다.

Atomic plane helper는 `intel_plane.c`, asynchronous page flip은 `intel_display.c`의 구현 문서를 사용합니다.

Output probing은 hotplug interrupt storm detection과 mitigation을 포함합니다. Mode setting과 달리 i915는 output probing에서는 공통 DRM helper 대부분을 사용하므로 해당 공통 문서도 그대로 적용됩니다.

그 밖에 HDMI·DisplayPort HDA와 LPE audio, PSR/SRD, FBC, DRRS, DPIO, DMC firmware·flip queue·wakelock, VBT, CDCLK/RAWCLK, display PLL과 DSB를 각 source의 kernel-doc에서 연결합니다.

Display subsystem index
영역핵심 내용
Mode settingi915 전용 display configuration sequence
Frontbuffer·FIFORendering/display coherency와 underrun 보고
Plane·flipAtomic plane update와 asynchronous page flip
Output·hotplugProbe와 hotplug storm 완화
AudioHDMI/DP HDA와 LPE integration
Panel efficiencyPSR/SRD, FBC, DRRS
DMCFirmware, flip queue, wakelock
Clock·PLL·DSBCDCLK/RAWCLK, display PLL, state buffer

i915 display 문서가 연결하는 주요 기능입니다.

Kernel-doc: display hardware
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/display/intel_frontbuffer.c:doc: frontbuffer tracking문서 block
drivers/gpu/drm/i915/display/intel_frontbuffer.h:internal:Internal API
drivers/gpu/drm/i915/display/intel_frontbuffer.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_fifo_underrun.c:doc: fifo underrun handling문서 block
drivers/gpu/drm/i915/display/intel_fifo_underrun.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_plane.c:doc: atomic plane helpers문서 block
drivers/gpu/drm/i915/display/intel_plane.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_display.c:doc: asynchronous flip implementation문서 block
drivers/gpu/drm/i915/display/intel_hotplug.c:doc: Hotplug문서 block
drivers/gpu/drm/i915/display/intel_hotplug.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_audio.c:doc: High Definition Audio over HDMI and Display Port문서 block
drivers/gpu/drm/i915/display/intel_audio.c:internal:Internal API
include/drm/intel/i915_component.h:internal:Internal API
drivers/gpu/drm/i915/display/intel_lpe_audio.c:doc: LPE Audio integration for HDMI or DP playback문서 block
drivers/gpu/drm/i915/display/intel_lpe_audio.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_psr.c:doc: Panel Self Refresh (PSR/SRD)문서 block
drivers/gpu/drm/i915/display/intel_psr.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_fbc.c:doc: Frame Buffer Compression (FBC)문서 block
drivers/gpu/drm/i915/display/intel_fbc.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_drrs.c:doc: Display Refresh Rate Switching (DRRS)문서 block
drivers/gpu/drm/i915/display/intel_drrs.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_dpio_phy.c:doc: DPIO문서 block
drivers/gpu/drm/i915/display/intel_dmc.c:doc: DMC Firmware Support문서 block
drivers/gpu/drm/i915/display/intel_dmc.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_flipq.c:doc: DMC Flip Queue문서 block
drivers/gpu/drm/i915/display/intel_dmc_wl.c:doc: DMC wakelock support문서 block
drivers/gpu/drm/i915/display/intel_bios.c:doc: Video BIOS Table (VBT)문서 block
drivers/gpu/drm/i915/display/intel_bios.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_vbt_defs.h:internal:Internal API
drivers/gpu/drm/i915/display/intel_cdclk.c:doc: CDCLK / RAWCLK문서 block
drivers/gpu/drm/i915/display/intel_cdclk.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_dpll_mgr.c:doc: Display PLLs문서 block
drivers/gpu/drm/i915/display/intel_dpll_mgr.c:internal:Internal API
drivers/gpu/drm/i915/display/intel_dpll_mgr.h:internal:Internal API
drivers/gpu/drm/i915/display/intel_dsb.c:doc: DSB문서 block
drivers/gpu/drm/i915/display/intel_dsb.c:internal:Internal API

Frontbuffer부터 Display State Buffer까지 36개 source block의 path와 selector입니다.

=========================

This section covers everything related to the display hardware including
the mode setting infrastructure, plane, sprite and cursor handling and
display, output probing and related topics.

Mode Setting Infrastructure
---------------------------

The i915 driver is thus far the only DRM driver which doesn't use the
common DRM helper code to implement mode setting sequences. Thus it has
its own tailor-made infrastructure for executing a display configuration
change.

Frontbuffer Tracking
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
   :doc: frontbuffer tracking

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.h
   :internal:

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_frontbuffer.c
   :internal:

Display FIFO Underrun Reporting
-------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
   :doc: fifo underrun handling

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fifo_underrun.c
   :internal:

Plane Configuration
-------------------

This section covers plane configuration and composition with the primary
plane, sprites, cursors and overlays. This includes the infrastructure
to do atomic vsync'ed updates of all this state and also tightly coupled
topics like watermark setup and computation, framebuffer compression and
panel self refresh.

Atomic Plane Helpers
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_plane.c
   :doc: atomic plane helpers

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_plane.c
   :internal:

Asynchronous Page Flip
----------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_display.c
   :doc: asynchronous flip implementation

Output Probing
--------------

This section covers output probing and related infrastructure like the
hotplug interrupt storm detection and mitigation code. Note that the
i915 driver still uses most of the common DRM helper code for output
probing, so those sections fully apply.

Hotplug
-------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
   :doc: Hotplug

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_hotplug.c
   :internal:

High Definition Audio
---------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
   :doc: High Definition Audio over HDMI and Display Port

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_audio.c
   :internal:

.. kernel-doc:: include/drm/intel/i915_component.h
   :internal:

Intel HDMI LPE Audio Support
----------------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
   :doc: LPE Audio integration for HDMI or DP playback

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_lpe_audio.c
   :internal:

Panel Self Refresh PSR (PSR/SRD)
--------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
   :doc: Panel Self Refresh (PSR/SRD)

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_psr.c
   :internal:

Frame Buffer Compression (FBC)
------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
   :doc: Frame Buffer Compression (FBC)

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_fbc.c
   :internal:

Display Refresh Rate Switching (DRRS)
-------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_drrs.c
   :doc: Display Refresh Rate Switching (DRRS)

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_drrs.c
   :internal:

DPIO
----

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpio_phy.c
   :doc: DPIO

DMC Firmware Support
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc.c
   :doc: DMC Firmware Support

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc.c
   :internal:

DMC Flip Queue
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_flipq.c
   :doc: DMC Flip Queue

DMC wakelock support
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dmc_wl.c
   :doc: DMC wakelock support

Video BIOS Table (VBT)
----------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_bios.c
   :doc: Video BIOS Table (VBT)

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_bios.c
   :internal:

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_vbt_defs.h
   :internal:

Display clocks
--------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_cdclk.c
   :doc: CDCLK / RAWCLK

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_cdclk.c
   :internal:

Display PLLs
------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.c
   :doc: Display PLLs

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.c
   :internal:

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dpll_mgr.h
   :internal:

Display State Buffer
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dsb.c
   :doc: DSB

.. kernel-doc:: drivers/gpu/drm/i915/display/intel_dsb.c
   :internal:

GT Programming

GT programming, GPU 기본과 locking guideline

262-389

GT programming은 `intel_gt_mcr.c`의 multicast/replicated(MCR) register support를 문서화합니다. 이어지는 절은 i915 GEM memory management와 command submission 전반을 설명합니다.

Intel GPU에는 여러 engine type이 있습니다. RCS는 3D rendering과 compute, BCS는 blit·copy, Video Command Streamer 또는 BSD는 video encode·decode, VECS 또는 VEBOX는 video enhancement를 수행합니다. CCS는 media·GPGPU pipeline에 접근하지만 3D pipeline에는 접근하지 않습니다.

GSCCS는 GSC controller와 내부 통신하는 전용 engine으로 HDCP, Protected Xe Path(PXP), HuC firmware authentication 같은 security task를 수행합니다.

Intel GPU engine
Engine별칭역할
RCSRender Command Streamer3D rendering·compute
BCSBlitting Command StreamerBlit·copy
Video Command StreamerBSDVideo encode·decode
VECSVEBOXVideo enhancement
CCSCompute Command StreamerMedia·GPGPU, 3D pipeline 제외
GSCCSGraphics Security Controller CSGSC security communication

문서가 정의하는 command streamer 종류입니다.

Intel integrated GPU는 Unified Memory Access를 사용합니다. Userspace는 `DRM_IOCTL_I915_GEM_EXECBUFFER2` 또는 `DRM_IOCTL_I915_GEM_EXECBUFFER2_WR`로 GPU batch buffer를 제출합니다.

Batch buffer가 읽고 쓸 memory는 GEM buffer object로 캡슐화되며 보통 `DRM_IOCTL_I915_GEM_CREATE`로 만듭니다. Submit IOCTL은 batch buffer가 접근하는 모든 GEM object 목록도 함께 전달합니다.

Userspace는 `DRM_IOCTL_I915_GEM_CONTEXT_CREATE`로 32-bit ID의 context를 만들 수 있습니다. Context는 느슨하게 CPU process와 비슷합니다. 같은 context에 issue한 command는 이전 command의 write가 뒤 command의 read에 보이도록 ordering이 보장됩니다.

서로 다른 context 사이에는 같은 file descriptor에서 왔더라도 이 ordering 보장이 없습니다. Context 사이의 유일한 synchronization 방법은 fence입니다. Gen4 이후 context는 GPU state 대부분을 담는 hardware context도 가지므로 kernel이 command 제출 시 GPU state를 restore합니다. Execbuffer2의 `drm_i915_gem_execbuffer2::rsvd1` lower bit로 context ID를 지정합니다.

GPU는 자체 address space와 memory translation table을 갖습니다. Gen8 이전에는 global GTT 하나를 사용하고, 최신 GPU는 context마다 PPGTT를 사용합니다. 이름은 per-process이지만 실제 범위는 per-context입니다.

Batch 제출 때 kernel은 GEM object 목록을 순회해 각 object memory가 resident이고 (PP)GTT에 존재하도록 보장합니다. 아직 address가 없으면 할당하며 공간을 만들려고 다른 GEM object를 evict할 수 있습니다.

Object의 GPU address가 정해지면 kernel이 batch buffer 안의 GPU address reference를 수정해야 합니다. Submit IOCTL은 이 위치 목록도 전달하며 이 과정을 relocation이라고 합니다.

Locking guideline은 refactoring 완료 후 목표 상태를 설명하며 현재 WIP code와 반드시 같지는 않습니다. Cross-driver `dma-buf`·`dma_fence` 계약을 모두 지키고, 필요할 때 `dma_resv`를 outermost lock으로 두며 `ww_acquire_ctx`를 최상위로 끌어올려 call chain의 `i915_gem_ctx`로 전달합니다.

LRU나 buddy·`drm_mm` 같은 memory-manager lock을 잡은 동안 system memory allocation을 하면 안 됩니다. 서로 다른 LRU·memory-manager lock을 중첩하지 말고 object의 dma_resv `ww_mutex`로 다른 operation과 직렬화하면서 차례로 잡아 allocation을 update합니다.

LRU·memory-manager lock은 spinlock으로 만들 만큼 작게 유지하는 것이 권장됩니다. 모든 feature에는 적절한 exhaustive kernel selftest 또는 IGT test가 필요합니다.

모든 LMEM uAPI path는 완전히 restartable해야 하며 모든 lock·wait·sleep에 `_interruptible()` variant를 사용합니다. Signal injection으로 error handling path를 광범위하게 검증하고 `ww_mutex`의 `-EDEADLK` 처리도 시험해야 합니다.

i915 locking 원칙
규칙요구사항
Cross-driver 계약dma-buf·dma_fence locking 규칙 준수
Outermost lock필요 시 dma_resv, ww_acquire_ctx는 최상위
Memory allocationLRU·memory-manager lock 아래에서 금지
Lock nesting서로 다른 memory-manager lock 중첩 금지
Lock 크기가능하면 작은 spinlock
검증Kernel selftest·IGT와 signal injection
LMEM uAPI모든 wait path restartable·interruptible
Deadlock-EDEADLK rollback 처리

Memory manager와 cross-driver interface의 목표 ordering입니다.

Batch buffer relocation
Userspace가 batch buffer와 접근 GEM object 목록 제출Kernel이 각 object memory residency 확인(PP)GTT address가 없으면 새 address 할당필요하면 다른 object를 address space에서 eviction제출된 relocation 위치의 GPU address 수정지정 context에서 batch 실행

Submit IOCTL이 object를 GPU address space에 배치하는 흐름입니다.

Kernel-doc: GT MCR
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/gt/intel_gt_mcr.c:doc: GT Multicast/Replicated (MCR) Register Support문서 block
drivers/gpu/drm/i915/gt/intel_gt_mcr.c:internal:Internal API

Multicast/replicated register support의 문서와 internal API입니다.

==============

Multicast/Replicated (MCR) Registers
------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_mcr.c
   :doc: GT Multicast/Replicated (MCR) Register Support

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_gt_mcr.c
   :internal:

Memory Management and Command Submission
========================================

This sections covers all things related to the GEM implementation in the
i915 driver.

Intel GPU Basics
----------------

An Intel GPU has multiple engines. There are several engine types:

- Render Command Streamer (RCS). An engine for rendering 3D and
  performing compute.
- Blitting Command Streamer (BCS). An engine for performing blitting and/or
  copying operations.
- Video Command Streamer. An engine used for video encoding and decoding. Also
  sometimes called 'BSD' in hardware documentation.
- Video Enhancement Command Streamer (VECS). An engine for video enhancement.
  Also sometimes called 'VEBOX' in hardware documentation.
- Compute Command Streamer (CCS). An engine that has access to the media and
  GPGPU pipelines, but not the 3D pipeline.
- Graphics Security Controller (GSCCS). A dedicated engine for internal
  communication with GSC controller on security related tasks like
  High-bandwidth Digital Content Protection (HDCP), Protected Xe Path (PXP),
  and HuC firmware authentication.

The Intel GPU family is a family of integrated GPU's using Unified
Memory Access. For having the GPU "do work", user space will feed the
GPU batch buffers via one of the ioctls `DRM_IOCTL_I915_GEM_EXECBUFFER2`
or `DRM_IOCTL_I915_GEM_EXECBUFFER2_WR`. Most such batchbuffers will
instruct the GPU to perform work (for example rendering) and that work
needs memory from which to read and memory to which to write. All memory
is encapsulated within GEM buffer objects (usually created with the ioctl
`DRM_IOCTL_I915_GEM_CREATE`). An ioctl providing a batchbuffer for the GPU
to create will also list all GEM buffer objects that the batchbuffer reads
and/or writes. For implementation details of memory management see
`GEM BO Management Implementation Details`_.

The i915 driver allows user space to create a context via the ioctl
`DRM_IOCTL_I915_GEM_CONTEXT_CREATE` which is identified by a 32-bit
integer. Such a context should be viewed by user-space as -loosely-
analogous to the idea of a CPU process of an operating system. The i915
driver guarantees that commands issued to a fixed context are to be
executed so that writes of a previously issued command are seen by
reads of following commands. Actions issued between different contexts
(even if from the same file descriptor) are NOT given that guarantee
and the only way to synchronize across contexts (even from the same
file descriptor) is through the use of fences. At least as far back as
Gen4, also have that a context carries with it a GPU HW context;
the HW context is essentially (most of at least) the state of a GPU.
In addition to the ordering guarantees, the kernel will restore GPU
state via HW context when commands are issued to a context, this saves
user space the need to restore (most of at least) the GPU state at the
start of each batchbuffer. The non-deprecated ioctls to submit batchbuffer
work can pass that ID (in the lower bits of drm_i915_gem_execbuffer2::rsvd1)
to identify what context to use with the command.

The GPU has its own memory management and address space. The kernel
driver maintains the memory translation table for the GPU. For older
GPUs (i.e. those before Gen8), there is a single global such translation
table, a global Graphics Translation Table (GTT). For newer generation
GPUs each context has its own translation table, called Per-Process
Graphics Translation Table (PPGTT). Of important note, is that although
PPGTT is named per-process it is actually per context. When user space
submits a batchbuffer, the kernel walks the list of GEM buffer objects
used by the batchbuffer and guarantees that not only is the memory of
each such GEM buffer object resident but it is also present in the
(PP)GTT. If the GEM buffer object is not yet placed in the (PP)GTT,
then it is given an address. Two consequences of this are: the kernel
needs to edit the batchbuffer submitted to write the correct value of
the GPU address when a GEM BO is assigned a GPU address and the kernel
might evict a different GEM BO from the (PP)GTT to make address room
for another GEM BO. Consequently, the ioctls submitting a batchbuffer
for execution also include a list of all locations within buffers that
refer to GPU-addresses so that the kernel can edit the buffer correctly.
This process is dubbed relocation.

Locking Guidelines
------------------

.. note::
   This is a description of how the locking should be after
   refactoring is done. Does not necessarily reflect what the locking
   looks like while WIP.

#. All locking rules and interface contracts with cross-driver interfaces
   (dma-buf, dma_fence) need to be followed.

#. dma_resv will be the outermost lock (when needed) and ww_acquire_ctx
   is to be hoisted at highest level and passed down within i915_gem_ctx
   in the call chain

#. While holding lru/memory manager (buddy, drm_mm, whatever) locks
   system memory allocations are not allowed

#. Do not nest different lru/memory manager locks within each other.
   Take them in turn to update memory allocations, relying on the object’s
   dma_resv ww_mutex to serialize against other operations.

#. The suggestion for lru/memory managers locks is that they are small
   enough to be spinlocks.

#. All features need to come with exhaustive kernel selftests and/or
   IGT tests when appropriate

#. All LMEM uAPI paths need to be fully restartable (_interruptible()
   for all locks/waits/sleeps)

        * Error handling validation through signal injection.
          Still the best strategy we have for validating GEM uAPI
          corner cases.
          Must be excessively used in the IGT, and we need to check
          that we really have full path coverage of all error cases.

        * -EDEADLK handling with ww_mutex

GEM BO Management Implementation Details

GEM object 관리와 command submission

390-490

GEM BO implementation detail은 `i915_vma_types.h`의 virtual memory address 문서에서 시작합니다.

Buffer object eviction은 virtual GPU address space에 공간을 만들기 위한 interface입니다. Main memory를 확보하려는 buffer-object cache shrinking과 목적이 대체로 독립적입니다.

반대로 GEM shrinker는 unified memory architecture를 통해 GPU와 공유되는 main memory를 확보하며 GPU virtual address 공간 확보가 목적인 eviction과 구분됩니다.

Batchbuffer parser는 `i915_cmd_parser.c`, userspace command execution은 GEM context type과 `i915_gem_execbuffer.c`가 설명합니다. Scheduler는 `i915_sched_engine`, logical ring·context·execlist는 `intel_execlists_submission.c` 문서를 연결합니다.

GTT 관련 절은 global GTT view, GTT fence와 swizzling, fence register 처리, hardware tiling swizzle detail 및 tiling IOCTL을 포괄합니다.

Protected object는 `intel_pxp.c`와 `intel_pxp_types.h`의 PXP 문서를 연결합니다.

GEM·submission 하위 영역
영역목적
VMAGEM object의 virtual memory address 표현
EvictionGPU virtual address space 확보
ShrinkerMain memory 확보
Batch parserUserspace command validation
ExecbufferUser batch submission
Scheduler·execlistEngine ordering과 logical context submission
GTT view·fence·swizzleGlobal mapping과 tiled memory address 변환
PXPProtected object와 secure path

Address-space 관리에서 protected object까지의 문서 index입니다.

Kernel-doc: GEM과 submission
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/i915_vma_types.h:doc: Virtual Memory Address문서 block
drivers/gpu/drm/i915/i915_gem_evict.c:internal:Internal API
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:internal:Internal API
drivers/gpu/drm/i915/i915_cmd_parser.c:doc: batch buffer command parser문서 block
drivers/gpu/drm/i915/i915_cmd_parser.c:internal:Internal API
drivers/gpu/drm/i915/gem/i915_gem_context_types.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:doc: User command execution문서 block
drivers/gpu/drm/i915/i915_scheduler_types.h:functions: i915_sched_engine지정 function
drivers/gpu/drm/i915/gt/intel_execlists_submission.c:doc: Logical Rings, Logical Ring Contexts and Execlists문서 block
drivers/gpu/drm/i915/i915_vma_types.h:doc: Global GTT views문서 block
drivers/gpu/drm/i915/i915_gem_gtt.c:internal:Internal API
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c:internal:Internal API
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c:doc: fence register handling문서 block
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c:doc: tiling swizzling details문서 block
drivers/gpu/drm/i915/gem/i915_gem_tiling.c:internal:Internal API
drivers/gpu/drm/i915/gem/i915_gem_tiling.c:doc: buffer object tiling문서 block
drivers/gpu/drm/i915/pxp/intel_pxp.c:doc: PXP문서 block
drivers/gpu/drm/i915/pxp/intel_pxp_types.h(selector 없음)File 전체 또는 기본 selector

VMA, eviction, shrinker, parser, execbuffer, scheduler, GTT, tiling과 PXP의 18개 block입니다.

----------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_vma_types.h
   :doc: Virtual Memory Address

Buffer Object Eviction
----------------------

This section documents the interface functions for evicting buffer
objects to make space available in the virtual gpu address spaces. Note
that this is mostly orthogonal to shrinking buffer objects caches, which
has the goal to make main memory (shared with the gpu through the
unified memory architecture) available.

.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_evict.c
   :internal:

Buffer Object Memory Shrinking
------------------------------

This section documents the interface function for shrinking memory usage
of buffer object caches. Shrinking is used to make main memory
available. Note that this is mostly orthogonal to evicting buffer
objects, which has the goal to make space in gpu virtual address spaces.

.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_shrinker.c
   :internal:

Batchbuffer Parsing
-------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
   :doc: batch buffer command parser

.. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
   :internal:

User Batchbuffer Execution
--------------------------

.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_context_types.h

.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
   :doc: User command execution

Scheduling
----------
.. kernel-doc:: drivers/gpu/drm/i915/i915_scheduler_types.h
   :functions: i915_sched_engine

Logical Rings, Logical Ring Contexts and Execlists
--------------------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_execlists_submission.c
   :doc: Logical Rings, Logical Ring Contexts and Execlists

Global GTT views
----------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_vma_types.h
   :doc: Global GTT views

.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_gtt.c
   :internal:

GTT Fences and Swizzling
------------------------

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
   :internal:

Global GTT Fence Handling
~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
   :doc: fence register handling

Hardware Tiling and Swizzling Details
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
   :doc: tiling swizzling details

Object Tiling IOCTLs
--------------------

.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_tiling.c
   :internal:

.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_tiling.c
   :doc: buffer object tiling

Protected Objects
-----------------

.. kernel-doc:: drivers/gpu/drm/i915/pxp/intel_pxp.c
   :doc: PXP

.. kernel-doc:: drivers/gpu/drm/i915/pxp/intel_pxp_types.h

Microcontrollers

GuC·HuC·DMC microcontroller

491-573

Gen9부터 hardware에는 graphics microcontroller(GuC), HEVC/H.265 microcontroller(HuC), display microcontroller(DMC) 세 종류가 있습니다.

Driver가 각 microcontroller firmware를 load합니다. GuC와 HuC firmware는 DMA engine으로 WOPCM에 전달하고 DMC firmware는 MMIO로 기록합니다.

WOPCM 절은 `intel_wopcm.c`의 layout, GuC 절은 core object와 header를 문서화합니다. Firmware layout은 `intel_uc_fw_abi.h`, GuC memory management와 `intel_guc_allocate_vma`는 `intel_guc.c`가 설명합니다.

GuC-specific loader는 `intel_guc_fw.c`, GuC-based command submission은 `intel_guc_submission.c`를 사용합니다. GuC ABI는 message, MMIO communication, CTB communication, action과 KLV header 다섯 개 source로 나뉩니다.

HuC 절은 core 문서와 `intel_huc_auth`, memory management를 포함합니다. HuC firmware layout은 GuC layout과 같습니다. DMC는 앞의 Display Hardware Handling 절에 있는 DMC Firmware Support를 참조합니다.

Microcontroller firmware load
Driver가 platform에 맞는 GuC·HuC·DMC firmware 선택GuC·HuC image를 DMA engine으로 WOPCM에 전송GuC command submission·HuC authentication 초기화DMC image는 MMIO write로 display microcontroller에 전달

Firmware 종류별 전달 경로입니다.

Microcontroller 역할
ControllerFirmware 경로주요 역할
GuCDMA → WOPCMGraphics control·command submission
HuCDMA → WOPCMHEVC/H.265와 firmware authentication
DMCMMIO writeDisplay microcontroller 기능

Gen9 이후 세 microcontroller의 문서 영역입니다.

Kernel-doc: microcontrollers
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/gt/intel_wopcm.c:doc: WOPCM Layout문서 block
drivers/gpu/drm/i915/gt/uc/intel_guc.c:doc: GuC문서 block
drivers/gpu/drm/i915/gt/uc/intel_guc.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h:doc: Firmware Layout문서 block
drivers/gpu/drm/i915/gt/uc/intel_guc.c:doc: GuC Memory Management문서 block
drivers/gpu/drm/i915/gt/uc/intel_guc.c:functions: intel_guc_allocate_vma지정 function
drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c:internal:Internal API
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:doc: GuC-based command submission문서 block
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h(selector 없음)File 전체 또는 기본 selector
drivers/gpu/drm/i915/gt/uc/intel_huc.c:doc: HuC문서 block
drivers/gpu/drm/i915/gt/uc/intel_huc.c:functions: intel_huc_auth지정 function
drivers/gpu/drm/i915/gt/uc/intel_huc.c:doc: HuC Memory Management문서 block

WOPCM, GuC firmware·memory·submission·ABI와 HuC의 16개 block입니다.

================

Starting from gen9, three microcontrollers are available on the HW: the
graphics microcontroller (GuC), the HEVC/H.265 microcontroller (HuC) and the
display microcontroller (DMC). The driver is responsible for loading the
firmwares on the microcontrollers; the GuC and HuC firmwares are transferred
to WOPCM using the DMA engine, while the DMC firmware is written through MMIO.

WOPCM
-----

WOPCM Layout
~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/intel_wopcm.c
   :doc: WOPCM Layout

GuC
---

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
   :doc: GuC

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.h

GuC Firmware Layout
~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h
   :doc: Firmware Layout

GuC Memory Management
~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
   :doc: GuC Memory Management
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc.c
   :functions: intel_guc_allocate_vma


GuC-specific firmware loader
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
   :internal:

GuC-based command submission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
   :doc: GuC-based command submission

GuC ABI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h

HuC
---
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
   :doc: HuC
.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
   :functions: intel_huc_auth

HuC Memory Management
~~~~~~~~~~~~~~~~~~~~~

.. kernel-doc:: drivers/gpu/drm/i915/gt/uc/intel_huc.c
   :doc: HuC Memory Management

HuC Firmware Layout
~~~~~~~~~~~~~~~~~~~
The HuC FW layout is the same as the GuC one, see `GuC Firmware Layout`_

DMC
---
See `DMC Firmware Support`_

Tracing

i915 tracepoint

574-591

Tracing 절은 i915 driver가 구현한 tracepoint를 다룹니다.

첫 block은 `i915_ppgtt_create`와 `i915_ppgtt_release` tracepoint로 per-context GPU address-space lifetime을 관찰합니다. 둘째 block은 `i915_context_create`와 `i915_context_free` tracepoint로 context lifetime을 추적합니다.

Tracepoint group
GroupEvents
PPGTT lifetimei915_ppgtt_create·i915_ppgtt_release
Context lifetimei915_context_create·i915_context_free

Address space와 execution context의 생성·해제를 관찰합니다.

Kernel-doc: tracing
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/i915_trace.h:doc: i915_ppgtt_create and i915_ppgtt_release tracepoints문서 block
drivers/gpu/drm/i915/i915_trace.h:doc: i915_context_create and i915_context_free tracepoints문서 block

`i915_trace.h`의 두 tracepoint 문서 block입니다.

=======

This sections covers all things related to the tracepoints implemented
in the i915 driver.

i915_ppgtt_create and i915_ppgtt_release
----------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
   :doc: i915_ppgtt_create and i915_ppgtt_release tracepoints

i915_context_create and i915_context_free
-----------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
   :doc: i915_context_create and i915_context_free tracepoints

Perf

i915 perf와 OA stream

592-707

Perf 절은 i915 performance monitoring overview와 core perf subsystem과의 역사·차이를 설명합니다.

Driver entry point는 `i915_perf.c` 밖으로 export되어 drm/i915에 통합되고 `DRM_I915_PERF_OPEN` ioctl을 처리하는 function입니다. Init·fini, register·unregister, open·release와 metric configuration add·remove를 포함합니다.

i915 perf stream 절은 stream semantics와 무관하게 perf stream FD와 file operation을 표현하는 structure·function을 다룹니다. Property parsing, locked open·destroy, read·ioctl, enable·disable, poll path를 연결합니다.

Observation Architecture(OA) stream은 `i915_oa_ops`와 stream init, OA read, enable·disable, wait·poll function을 문서화합니다.

Other internals block은 앞의 고수준 절에서 이미 포함한 identifier를 `:no-identifiers:`로 제외한 뒤 나머지 documented internal function을 순서 없이 포함합니다. Minor utility나 platform-specific detail도 들어갈 수 있습니다.

DRM_I915_PERF_OPEN lifecycle
i915_perf_init·register로 driver 기능 준비DRM_I915_PERF_OPEN property parsingLocked open에서 stream과 OA backend 초기화Enable 후 read·poll·ioctl로 sample 소비Disable·destroy·releaseDriver unregister·fini

Perf FD가 생성되어 data를 읽고 종료되는 대표 흐름입니다.

Perf 문서 계층
계층대표 symbol
Driver integrationi915_perf_init·register·open_ioctl·release
Metric configi915_perf_add_config_ioctl·remove_config_ioctl
Perf streami915_perf_stream·i915_perf_stream_ops
FD operationi915_perf_read·ioctl·poll
OA backendi915_oa_ops·stream_init·read·wait
Other internals고수준 절에서 제외되지 않은 internal identifier

Entry point, generic stream과 OA backend를 구분합니다.

Kernel-doc: i915 perf
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/i915_perf.c:doc: i915 Perf Overview문서 block
drivers/gpu/drm/i915/i915_perf.c:doc: i915 Perf History and Comparison with Core Perf문서 block
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_init지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_fini지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_register지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_unregister지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_open_ioctl지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_release지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_add_config_ioctl지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_remove_config_ioctl지정 function
drivers/gpu/drm/i915/i915_perf_types.h:functions: i915_perf_stream지정 function
drivers/gpu/drm/i915/i915_perf_types.h:functions: i915_perf_stream_ops지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: read_properties_unlocked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_open_ioctl_locked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_destroy_locked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_read지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_ioctl지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_enable_locked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_disable_locked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_poll지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_perf_poll_locked지정 function
drivers/gpu/drm/i915/i915_perf_types.h:functions: i915_oa_ops지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_stream_init지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_read지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_stream_enable지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_stream_disable지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_wait_unlocked지정 function
drivers/gpu/drm/i915/i915_perf.c:functions: i915_oa_poll_wait지정 function
drivers/gpu/drm/i915/i915_perf.c:internal: | :no-identifiers: | i915_perf_init | i915_perf_fini | i915_perf_register | i915_perf_unregister | i915_perf_open_ioctl | i915_perf_release | i915_perf_add_config_ioctl | i915_perf_remove_config_ioctl | read_properties_unlocked | i915_perf_open_ioctl_locked | i915_perf_destroy_locked | i915_perf_read i915_perf_ioctl | i915_perf_enable_locked | i915_perf_disable_locked | i915_perf_poll i915_perf_poll_locked | i915_oa_stream_init i915_oa_read | i915_oa_stream_enable | i915_oa_stream_disable | i915_oa_wait_unlocked | i915_oa_poll_waitInternal API

Overview, driver entry point, stream, OA와 나머지 internal API의 29개 block입니다.

====

Overview
--------
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :doc: i915 Perf Overview

Comparison with Core Perf
-------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :doc: i915 Perf History and Comparison with Core Perf

i915 Driver Entry Points
------------------------

This section covers the entrypoints exported outside of i915_perf.c to
integrate with drm/i915 and to handle the `DRM_I915_PERF_OPEN` ioctl.

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_init
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_fini
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_register
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_unregister
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_open_ioctl
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_release
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_add_config_ioctl
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_remove_config_ioctl

i915 Perf Stream
----------------

This section covers the stream-semantics-agnostic structures and functions
for representing an i915 perf stream FD and associated file operations.

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
   :functions: i915_perf_stream
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
   :functions: i915_perf_stream_ops

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: read_properties_unlocked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_open_ioctl_locked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_destroy_locked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_read
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_ioctl
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_enable_locked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_disable_locked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_poll
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_perf_poll_locked

i915 Perf Observation Architecture Stream
-----------------------------------------

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf_types.h
   :functions: i915_oa_ops

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_stream_init
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_read
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_stream_enable
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_stream_disable
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_wait_unlocked
.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :functions: i915_oa_poll_wait

Other i915 Perf Internals
-------------------------

This section simply includes all other currently documented i915 perf internals,
in no particular order, but may include some more minor utilities or platform
specific details than found in the more high-level sections.

.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
   :internal:
   :no-identifiers:
       i915_perf_init
       i915_perf_fini
       i915_perf_register
       i915_perf_unregister
       i915_perf_open_ioctl
       i915_perf_release
       i915_perf_add_config_ioctl
       i915_perf_remove_config_ioctl
       read_properties_unlocked
       i915_perf_open_ioctl_locked
       i915_perf_destroy_locked
       i915_perf_read i915_perf_ioctl
       i915_perf_enable_locked
       i915_perf_disable_locked
       i915_perf_poll i915_perf_poll_locked
       i915_oa_stream_init i915_oa_read
       i915_oa_stream_enable
       i915_oa_stream_disable
       i915_oa_wait_unlocked
       i915_oa_poll_wait

Style

Style과 DRM client usage stats

708-747

drm/i915 codebase는 kernel coding style에 더해 자체 style rule을 가지며 일부는 공통 style과 다릅니다. `i915_reg.h` register macro definition style guide가 register macro 작성 규칙을 설명합니다.

i915는 `drm-client-usage-stats`에 정의된 DRM client usage statistics specification을 구현합니다.

예시는 일반 fdinfo field인 `pos`, `flags`, `mnt_id`와 표준 `drm-driver`, `drm-pdev`, `drm-client-id`를 먼저 출력하고 engine별 busy time과 capacity를 나열합니다.

i915에서 가능한 `drm-engine-` key 이름은 `render`, `copy`, `video`, `video-enhance`입니다. Video engine group의 capacity가 2인 예처럼 동일 engine 여러 개를 하나의 key로 표현할 수 있습니다.

i915 fdinfo key
Key예제 값·의미
drm-driveri915
drm-pdev0000:00:02.0
drm-client-id7
drm-engine-renderRender busy time(ns)
drm-engine-copyCopy busy time(ns)
drm-engine-videoVideo group busy time(ns)
drm-engine-capacity-video동일 video engine 수
drm-engine-video-enhanceVEBOX busy time(ns)

예제에 나타난 표준 client·engine usage field입니다.

i915 usage parser
drm-driver가 i915인지 확인drm-pdev·drm-client-id로 client 식별render·copy·video·video-enhance busy time 읽기존재하면 engine-capacity를 적용Sample 사이 증가량으로 engine utilization 계산

fdinfo consumer가 i915 engine 통계를 묶는 기본 순서입니다.

Kernel-doc: register style
Source pathSelector·option포함 범위
drivers/gpu/drm/i915/i915_reg.h:doc: The i915 register macro definition style guide문서 block

`i915_reg.h` register macro definition style guide block입니다.

      pos:    0
      flags:  0100002
      mnt_id: 21
      drm-driver: i915
      drm-pdev:   0000:00:02.0
      drm-client-id:      7
      drm-engine-render:  9288864723 ns
      drm-engine-copy:    2035071108 ns
      drm-engine-video:   0 ns
      drm-engine-capacity-video:   2
      drm-engine-video-enhance:   0 ns
=====

The drm/i915 driver codebase has some style rules in addition to (and, in some
cases, deviating from) the kernel coding style.

Register macro definition style
-------------------------------

The style guide for ``i915_reg.h``.

.. kernel-doc:: drivers/gpu/drm/i915/i915_reg.h
   :doc: The i915 register macro definition style guide

.. _i915-usage-stats:

i915 DRM client usage stats implementation
==========================================

The drm/i915 driver implements the DRM client usage stats specification as
documented in :ref:`drm-client-usage-stats`.

Example of the output showing the implemented key value pairs and entirety of
the currently possible format options:

::

      pos:    0
      flags:  0100002
      mnt_id: 21
      drm-driver: i915
      drm-pdev:   0000:00:02.0
      drm-client-id:      7
      drm-engine-render:  9288864723 ns
      drm-engine-copy:    2035071108 ns
      drm-engine-video:   0 ns
      drm-engine-capacity-video:   2
      drm-engine-video-enhance:   0 ns

Possible `drm-engine-` key names are: `render`, `copy`, `video` and
`video-enhance`.