Skip to content

Commit 3e234e9

Browse files
committed
Merge tag 'drm-intel-fixes-2021-08-12' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
- GVT fix for Windows VM hang. - Display fix of 12 BPC bits for display 12 and newer. - Don't try to access some media register for fused off domains. - Fix kerneldoc build warnings. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/YRU/hnQ1sNr+j37x@intel.com
2 parents bf71bde + ffd5caa commit 3e234e9

6 files changed

Lines changed: 56 additions & 125 deletions

File tree

Documentation/gpu/rfc/i915_gem_lmem.rst

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -18,114 +18,5 @@ real, with all the uAPI bits is:
1818
* Route shmem backend over to TTM SYSTEM for discrete
1919
* TTM purgeable object support
2020
* Move i915 buddy allocator over to TTM
21-
* MMAP ioctl mode(see `I915 MMAP`_)
22-
* SET/GET ioctl caching(see `I915 SET/GET CACHING`_)
2321
* Send RFC(with mesa-dev on cc) for final sign off on the uAPI
2422
* Add pciid for DG1 and turn on uAPI for real
25-
26-
New object placement and region query uAPI
27-
==========================================
28-
Starting from DG1 we need to give userspace the ability to allocate buffers from
29-
device local-memory. Currently the driver supports gem_create, which can place
30-
buffers in system memory via shmem, and the usual assortment of other
31-
interfaces, like dumb buffers and userptr.
32-
33-
To support this new capability, while also providing a uAPI which will work
34-
beyond just DG1, we propose to offer three new bits of uAPI:
35-
36-
DRM_I915_QUERY_MEMORY_REGIONS
37-
-----------------------------
38-
New query ID which allows userspace to discover the list of supported memory
39-
regions(like system-memory and local-memory) for a given device. We identify
40-
each region with a class and instance pair, which should be unique. The class
41-
here would be DEVICE or SYSTEM, and the instance would be zero, on platforms
42-
like DG1.
43-
44-
Side note: The class/instance design is borrowed from our existing engine uAPI,
45-
where we describe every physical engine in terms of its class, and the
46-
particular instance, since we can have more than one per class.
47-
48-
In the future we also want to expose more information which can further
49-
describe the capabilities of a region.
50-
51-
.. kernel-doc:: include/uapi/drm/i915_drm.h
52-
:functions: drm_i915_gem_memory_class drm_i915_gem_memory_class_instance drm_i915_memory_region_info drm_i915_query_memory_regions
53-
54-
GEM_CREATE_EXT
55-
--------------
56-
New ioctl which is basically just gem_create but now allows userspace to provide
57-
a chain of possible extensions. Note that if we don't provide any extensions and
58-
set flags=0 then we get the exact same behaviour as gem_create.
59-
60-
Side note: We also need to support PXP[1] in the near future, which is also
61-
applicable to integrated platforms, and adds its own gem_create_ext extension,
62-
which basically lets userspace mark a buffer as "protected".
63-
64-
.. kernel-doc:: include/uapi/drm/i915_drm.h
65-
:functions: drm_i915_gem_create_ext
66-
67-
I915_GEM_CREATE_EXT_MEMORY_REGIONS
68-
----------------------------------
69-
Implemented as an extension for gem_create_ext, we would now allow userspace to
70-
optionally provide an immutable list of preferred placements at creation time,
71-
in priority order, for a given buffer object. For the placements we expect
72-
them each to use the class/instance encoding, as per the output of the regions
73-
query. Having the list in priority order will be useful in the future when
74-
placing an object, say during eviction.
75-
76-
.. kernel-doc:: include/uapi/drm/i915_drm.h
77-
:functions: drm_i915_gem_create_ext_memory_regions
78-
79-
One fair criticism here is that this seems a little over-engineered[2]. If we
80-
just consider DG1 then yes, a simple gem_create.flags or something is totally
81-
all that's needed to tell the kernel to allocate the buffer in local-memory or
82-
whatever. However looking to the future we need uAPI which can also support
83-
upcoming Xe HP multi-tile architecture in a sane way, where there can be
84-
multiple local-memory instances for a given device, and so using both class and
85-
instance in our uAPI to describe regions is desirable, although specifically
86-
for DG1 it's uninteresting, since we only have a single local-memory instance.
87-
88-
Existing uAPI issues
89-
====================
90-
Some potential issues we still need to resolve.
91-
92-
I915 MMAP
93-
---------
94-
In i915 there are multiple ways to MMAP GEM object, including mapping the same
95-
object using different mapping types(WC vs WB), i.e multiple active mmaps per
96-
object. TTM expects one MMAP at most for the lifetime of the object. If it
97-
turns out that we have to backpedal here, there might be some potential
98-
userspace fallout.
99-
100-
I915 SET/GET CACHING
101-
--------------------
102-
In i915 we have set/get_caching ioctl. TTM doesn't let us to change this, but
103-
DG1 doesn't support non-snooped pcie transactions, so we can just always
104-
allocate as WB for smem-only buffers. If/when our hw gains support for
105-
non-snooped pcie transactions then we must fix this mode at allocation time as
106-
a new GEM extension.
107-
108-
This is related to the mmap problem, because in general (meaning, when we're
109-
not running on intel cpus) the cpu mmap must not, ever, be inconsistent with
110-
allocation mode.
111-
112-
Possible idea is to let the kernel picks the mmap mode for userspace from the
113-
following table:
114-
115-
smem-only: WB. Userspace does not need to call clflush.
116-
117-
smem+lmem: We only ever allow a single mode, so simply allocate this as uncached
118-
memory, and always give userspace a WC mapping. GPU still does snooped access
119-
here(assuming we can't turn it off like on DG1), which is a bit inefficient.
120-
121-
lmem only: always WC
122-
123-
This means on discrete you only get a single mmap mode, all others must be
124-
rejected. That's probably going to be a new default mode or something like
125-
that.
126-
127-
Links
128-
=====
129-
[1] https://patchwork.freedesktop.org/series/86798/
130-
131-
[2] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5599#note_553791

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,16 +5746,18 @@ static void bdw_set_pipemisc(const struct intel_crtc_state *crtc_state)
57465746

57475747
switch (crtc_state->pipe_bpp) {
57485748
case 18:
5749-
val |= PIPEMISC_DITHER_6_BPC;
5749+
val |= PIPEMISC_6_BPC;
57505750
break;
57515751
case 24:
5752-
val |= PIPEMISC_DITHER_8_BPC;
5752+
val |= PIPEMISC_8_BPC;
57535753
break;
57545754
case 30:
5755-
val |= PIPEMISC_DITHER_10_BPC;
5755+
val |= PIPEMISC_10_BPC;
57565756
break;
57575757
case 36:
5758-
val |= PIPEMISC_DITHER_12_BPC;
5758+
/* Port output 12BPC defined for ADLP+ */
5759+
if (DISPLAY_VER(dev_priv) > 12)
5760+
val |= PIPEMISC_12_BPC_ADLP;
57595761
break;
57605762
default:
57615763
MISSING_CASE(crtc_state->pipe_bpp);
@@ -5808,15 +5810,27 @@ int bdw_get_pipemisc_bpp(struct intel_crtc *crtc)
58085810

58095811
tmp = intel_de_read(dev_priv, PIPEMISC(crtc->pipe));
58105812

5811-
switch (tmp & PIPEMISC_DITHER_BPC_MASK) {
5812-
case PIPEMISC_DITHER_6_BPC:
5813+
switch (tmp & PIPEMISC_BPC_MASK) {
5814+
case PIPEMISC_6_BPC:
58135815
return 18;
5814-
case PIPEMISC_DITHER_8_BPC:
5816+
case PIPEMISC_8_BPC:
58155817
return 24;
5816-
case PIPEMISC_DITHER_10_BPC:
5818+
case PIPEMISC_10_BPC:
58175819
return 30;
5818-
case PIPEMISC_DITHER_12_BPC:
5819-
return 36;
5820+
/*
5821+
* PORT OUTPUT 12 BPC defined for ADLP+.
5822+
*
5823+
* TODO:
5824+
* For previous platforms with DSI interface, bits 5:7
5825+
* are used for storing pipe_bpp irrespective of dithering.
5826+
* Since the value of 12 BPC is not defined for these bits
5827+
* on older platforms, need to find a workaround for 12 BPC
5828+
* MIPI DSI HW readout.
5829+
*/
5830+
case PIPEMISC_12_BPC_ADLP:
5831+
if (DISPLAY_VER(dev_priv) > 12)
5832+
return 36;
5833+
fallthrough;
58205834
default:
58215835
MISSING_CASE(tmp);
58225836
return 0;

drivers/gpu/drm/i915/gvt/handlers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt)
31493149
MMIO_DFH(_MMIO(0xb100), D_BDW, F_CMD_ACCESS, NULL, NULL);
31503150
MMIO_DFH(_MMIO(0xb10c), D_BDW, F_CMD_ACCESS, NULL, NULL);
31513151
MMIO_D(_MMIO(0xb110), D_BDW);
3152+
MMIO_D(GEN9_SCRATCH_LNCF1, D_BDW_PLUS);
31523153

31533154
MMIO_F(_MMIO(0x24d0), 48, F_CMD_ACCESS | F_CMD_WRITE_PATCH, 0, 0,
31543155
D_BDW_PLUS, NULL, force_nonpriv_write);

drivers/gpu/drm/i915/gvt/mmio_context.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ static struct engine_mmio gen9_engine_mmio_list[] __cacheline_aligned = {
105105
{RCS0, COMMON_SLICE_CHICKEN2, 0xffff, true}, /* 0x7014 */
106106
{RCS0, GEN9_CS_DEBUG_MODE1, 0xffff, false}, /* 0x20ec */
107107
{RCS0, GEN8_L3SQCREG4, 0, false}, /* 0xb118 */
108+
{RCS0, GEN9_SCRATCH1, 0, false}, /* 0xb11c */
109+
{RCS0, GEN9_SCRATCH_LNCF1, 0, false}, /* 0xb008 */
108110
{RCS0, GEN7_HALF_SLICE_CHICKEN1, 0xffff, true}, /* 0xe100 */
109111
{RCS0, HALF_SLICE_CHICKEN2, 0xffff, true}, /* 0xe180 */
110112
{RCS0, HALF_SLICE_CHICKEN3, 0xffff, true}, /* 0xe184 */

drivers/gpu/drm/i915/i915_gpu_error.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,18 @@ static void err_print_gt(struct drm_i915_error_state_buf *m,
727727
if (GRAPHICS_VER(m->i915) >= 12) {
728728
int i;
729729

730-
for (i = 0; i < GEN12_SFC_DONE_MAX; i++)
730+
for (i = 0; i < GEN12_SFC_DONE_MAX; i++) {
731+
/*
732+
* SFC_DONE resides in the VD forcewake domain, so it
733+
* only exists if the corresponding VCS engine is
734+
* present.
735+
*/
736+
if (!HAS_ENGINE(gt->_gt, _VCS(i * 2)))
737+
continue;
738+
731739
err_printf(m, " SFC_DONE[%d]: 0x%08x\n", i,
732740
gt->sfc_done[i]);
741+
}
733742

734743
err_printf(m, " GAM_DONE: 0x%08x\n", gt->gam_done);
735744
}
@@ -1581,6 +1590,14 @@ static void gt_record_regs(struct intel_gt_coredump *gt)
15811590

15821591
if (GRAPHICS_VER(i915) >= 12) {
15831592
for (i = 0; i < GEN12_SFC_DONE_MAX; i++) {
1593+
/*
1594+
* SFC_DONE resides in the VD forcewake domain, so it
1595+
* only exists if the corresponding VCS engine is
1596+
* present.
1597+
*/
1598+
if (!HAS_ENGINE(gt->_gt, _VCS(i * 2)))
1599+
continue;
1600+
15841601
gt->sfc_done[i] =
15851602
intel_uncore_read(uncore, GEN12_SFC_DONE(i));
15861603
}

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,11 +6163,17 @@ enum {
61636163
#define PIPEMISC_HDR_MODE_PRECISION (1 << 23) /* icl+ */
61646164
#define PIPEMISC_OUTPUT_COLORSPACE_YUV (1 << 11)
61656165
#define PIPEMISC_PIXEL_ROUNDING_TRUNC REG_BIT(8) /* tgl+ */
6166-
#define PIPEMISC_DITHER_BPC_MASK (7 << 5)
6167-
#define PIPEMISC_DITHER_8_BPC (0 << 5)
6168-
#define PIPEMISC_DITHER_10_BPC (1 << 5)
6169-
#define PIPEMISC_DITHER_6_BPC (2 << 5)
6170-
#define PIPEMISC_DITHER_12_BPC (3 << 5)
6166+
/*
6167+
* For Display < 13, Bits 5-7 of PIPE MISC represent DITHER BPC with
6168+
* valid values of: 6, 8, 10 BPC.
6169+
* ADLP+, the bits 5-7 represent PORT OUTPUT BPC with valid values of:
6170+
* 6, 8, 10, 12 BPC.
6171+
*/
6172+
#define PIPEMISC_BPC_MASK (7 << 5)
6173+
#define PIPEMISC_8_BPC (0 << 5)
6174+
#define PIPEMISC_10_BPC (1 << 5)
6175+
#define PIPEMISC_6_BPC (2 << 5)
6176+
#define PIPEMISC_12_BPC_ADLP (4 << 5) /* adlp+ */
61716177
#define PIPEMISC_DITHER_ENABLE (1 << 4)
61726178
#define PIPEMISC_DITHER_TYPE_MASK (3 << 2)
61736179
#define PIPEMISC_DITHER_TYPE_SP (0 << 2)

0 commit comments

Comments
 (0)