1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
<!---======================= begin_copyright_notice ============================
Copyright (C) 2020-2021 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ==========================-->
## Opcode
MEDIA_LD = 0x37
## Format
| | | | | | | |
| --- | --- | --- | --- | --- | --- | --- |
| 0x37(MEDIA_LD) | Modifiers | Surface | Plane | Block_width | Block_height | X_offset |
| | Y_offset | Dst | | | | |
## Semantics
UD reg_pitch = block_width < 4 ? 4 : nextPowerOf2(block_width);
for (i = 0; i < block_height; ++i) {
for (j = 0; j < block_width; ++j) {
dst[i*reg_pitch+j] = surface[y_offset+i][x_offset+j]; // one byte
}
}
## Description
Reads a rectangular block of data from <surface> and stores the values in <dst>.
- **Modifiers(ub):**
- Bit[2..0]: encodes the modifiers for the read
- 0b000: no modifiers
- 0b010: top_field -- for interleaved surfaces, indicates only the top field surface data are needed
- 0b011: bottom_field -- for interleaved surfaces, indicates only the bottom field surface data are needed.
- **Surface(ub):** Index of the surface variable. It must be a 2D surface.
- T0(SLM): no
- T5(stateless): no
- **Plane(ub):** The index to the sub-plane as defined in different surface formats. See [5] for a description of the planes represented by each index value. Valid values are [0], [3]
- **Block_width(ub):** Width in bytes of the block being accessed. Valid values are [1], [64]
- **Block_height(ub):** Height in rows of blocks being accessed. Valid values are [1], [64]
- **X_offset(scalar):** The X byte offset of the upper left corner of the block into the surface. Must have type UD
- **Y_offset(scalar):** The Y byte offset of the upper left corner of the block into the surface. Must have type UD
- **Dst(raw_operand):** Return value. Each row starts at row_id * <register_pitch> bytes, and <block_width> bytes are returned
#### Properties
- **Out-of-bound Access:** On read: implementation defined behavior based on surface format.
## Text
```
MEDIA_LD.<mods> (<block_width>, <block_height>) <surface> <plane> <x_offset> <y_offset> <dst> //<mods> is the bits for the modifiers field.
```
## Notes
top_field and bottom_field modifiers are used to provide support for interleaved textures, by controlling the vertical line stride and vertical line stride offset of a media read.
.. _table_MediaWidthHeightCombinations:
.. table:: **Legal width/height combination and their pitch:**
| Block Width (bytes) | Register Pitch (bytes) | Maximum Block Height (rows) |
| --- | ---| ---| ---|
| 1-4 | 4 | 64 |
| 5-8 | 8 | 32 |
| 9-16 | 16 | 16 |
| 17-32 | 32 | 8 |
| 33-64 | 64 | 4 |
|