Basic Skylake enabling
Subsystems (4)
cover Basic Skylake enabling
Hi,
This series implements basic enabling for Skylake (SKL), bringing us to roughly feature parity with earlier platforms.
Skylake (SKL) is the latest Intel® Processor containing Intel® HD Graphics.
The major GPU hardware features include:
- Gen9 Intel® HD Graphics graphics
- The addition of a 3rd display plane (not concurrent with the cursor)
- Five HDMI/DP/eDP display ports
The bulk of the series is on the display side where things have changed quite a bit with new DPLL, watermarks and display planes code. The remaining of the patches deals with incremental changes in various features of the device: RC6, forcewake engines, power wells, execlists, ...
Big thanks to everyone who contributed for their tireless efforts.
Signature · 143 lines
Damien
Daisy Sun (1):
drm/i915/skl: SKL FBC enablement
Damien Lespiau (49):
drm/i915/skl: Add the Skylake PCI ids
drm/i915/skl: Add an IS_GEN9() define
drm/i915/skl: Fence registers on SKL are the same as SNB
drm/i915/skl: Provide a placeholder for init_clock_gating()
drm/i915/skl: Use gen8_ring_dispatch_execbuffer() on GEN9
drm/i915/skl: Skylake shares the interrupt logic with Broadwell
drm/i915/skl: Framebuffers need to be aligned to 256Kb on Skylake
drm/i915/skl: Implement thew new update_plane() for primary planes
drm/i915/skl: Don't create a VGA connector on Skylake
drm/i915/skl: Don't try to read out the PCH transcoder state if not
present
drm/i915/skl: Program the DDI buffer translation tables
drm/i915/skl: Add support for DP voltage swings and pre-emphasis
drm/i915/skl: Skylake doesn't need the DP AUX clock divider programmed
drm/i915/skl: Skylake moves AUX_CTL from PCH to CPU
drm/i915/skl: Add the additional graphics stolen sizes
drm/i915/skl: gen9 uses the same bind_vma() vfuncs as gen6+
drm/i915/skl: Implement the get_aux_clock_divider() DP vfunc
drm/i915/skl: Provide a get_aux_send_ctl() vfunc for skylake
drm/i915/skl: Initialize PPGTT like gen8
drm/i915/skl: Allow the reg_read ioctl to return RCS_TIMESTAMP
drm/i915/skl: report the same INSTDONE registers as gen8
drm/i915/skl: Report the PDP regs as in gen8
drm/i915/skl: SKL shares the same underrun interrupt as BDW
drm/i915/skl: Adjust the display engine interrupts
drm/i915/skl: Implement WaDisableSDEUnitClockGating:skl
drm/i915/skl: Implement Wa4x4STCOptimizationDisable:skl
drm/i915/skl: Implement WaDisableDgMirrorFixInHalfSliceChicken5:skl
drm/i915/skl: Skylake has 2 "sprite" planes per pipe
drm/i915/skl: Implement drm_plane vfuncs
drm/i915/skl: Adjust assert_sprites_disabled()
drm/i915/skl: Introduce a I915_MAX_PLANES macro
drm/i915/skl: Introduce intel_num_planes()
drm/i915/skl: Move gen9 pm initialization into its own branch
drm/i915/skl: Add DDB allocation management structures
drm/i915/skl: Allocate DDB portions for display planes
drm/i915/skl: Program the DDB allocation
drm/i915: Rewrite ABS_DIFF() in a safer manner
drm/i915/skl: Provide skl-specific pll hw state cross-checking
drm/i915/skl: Implement queue_flip
drm/i915/skl: Store the new WM state at the very end of the update
drm/i915: Introduce a for_each_plane() macro
drm/i915/skl: Flush the WM configuration
drm/i915/skl: Read back the DDB allocation hw state
drm/i915/skl: Augment the latency debugfs files for SKL
drm/i915/skl: Expose skl_ddb_get_hw_state()
drm/i915/skl: Add a debugfs file to dump the DDB allocation
drm/i915/skl: Check the DDB state at modeset
drm/i915/skl: Retrieve the frequency limits
drm/i915/skl: Disable contexts if execlists aren't enabled
Imre Deak (1):
drm/i915/skl: don't set the AsyncFlip performance mode for Gen9+
Jesse Barnes (4):
drm/i915/skl: fetch, enable/disable pfit as needed
drm/i915/skl: add turbo support
drm/i915: only reset media, blt, and render engines on GPU hangs
drm/i915/skl: AUX irqs have moved
Michael H. Nguyen (1):
drm/i915/skl: Add Gen9 LRC size
Pradeep Bhat (5):
drm/i915/skl: Read the Memory Latency Values for WM computation
drm/i915/skl: Register definitions and macros for SKL Watermark regs
drm/i915/skl: Definition of SKL WM param structs for pipe/plane
drm/i915/skl: SKL Watermark Computation
drm/i915/skl: Read the pipe WM HW state
Robert Beckett (1):
drm/i915/skl: i915_swizzle_info gen9 fix
Satheeshakrishna M (20):
drm/i915/skl: Add an IS_SKYLAKE macro
drm/i915/skl: SKL pipe misc programming
drm/i915/skl: vfuncs for skl eld and global resource
drm/i915/skl: SKL backlight enabling
drm/i915/skl: Restore pipe B/C interrupts
drm/i915/skl: Sunrise Point PCH detection
drm/i915/skl: Register definitions for SKL Clocks
drm/i915/skl: Structure/enum definitions for SKL clocks
drm/i915/skl: CD clock back calculation for SKL
drm/i915/skl: Determine enabled PLL and its linkrate/pixel clock
drm/i915/skl: Query DPLL attached to port on SKL
drm/i915/skl: Define shared DPLLs for Skylake
drm/i915/skl: Adjust the port PLL selection code
drm/i915/skl: Always use DPLL0 for eDP
drm/i915/skl: Implementation of SKL DPLL programming
drm/i915/skl: Adding power domains for AUX controllers
drm/i915/skl: Register definition for SKL power well
drm/i915/skl: Implementation of SKL display power well support
drm/i915/skl: Enable/disable power well for aux transaction
drm/i915/skl: Enabling MISC IO power well
Vandana Kannan (3):
drm/i915/gen9: Add 2us read latency to WM level
drm/i915/gen9: Disable WM if corresponding latency is 0
drm/i915/skl: Apply eDP WA only for gen < 9
Zhe Wang (4):
drm/i915/skl: Gen9 Forcewake
drm/i915/skl: Enable Gen9 RC6
drm/i915/skl: Gen9 multi-engine forcewake
drm/i915: Gen9 shadowed registers
arch/x86/kernel/early-quirks.c | 23 +
drivers/gpu/drm/i915/i915_debugfs.c | 123 ++-
drivers/gpu/drm/i915/i915_dma.c | 2 +-
drivers/gpu/drm/i915/i915_drv.c | 26 +-
drivers/gpu/drm/i915/i915_drv.h | 117 ++-
drivers/gpu/drm/i915/i915_gem.c | 1 +
drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
drivers/gpu/drm/i915/i915_gem_gtt.c | 20 +-
drivers/gpu/drm/i915/i915_gpu_error.c | 3 +
drivers/gpu/drm/i915/i915_irq.c | 54 +-
drivers/gpu/drm/i915/i915_reg.h | 359 +++++++-
drivers/gpu/drm/i915/intel_ddi.c | 629 +++++++++++++-
drivers/gpu/drm/i915/intel_display.c | 358 +++++++-
drivers/gpu/drm/i915/intel_dp.c | 136 ++-
drivers/gpu/drm/i915/intel_drv.h | 28 +-
drivers/gpu/drm/i915/intel_lrc.c | 8 +-
drivers/gpu/drm/i915/intel_panel.c | 2 +-
drivers/gpu/drm/i915/intel_pm.c | 1385 +++++++++++++++++++++++++++++--
drivers/gpu/drm/i915/intel_ringbuffer.c | 4 +-
drivers/gpu/drm/i915/intel_sprite.c | 206 ++++-
drivers/gpu/drm/i915/intel_uncore.c | 324 +++++++-
include/drm/i915_pciids.h | 17 +
22 files changed, 3651 insertions(+), 176 deletions(-)
--
1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxPATCH 1/89 drm/i915/skl: Add the Skylake PCI ids
v2: Squash in 2nd patch from Damien for more ids (Daniel)
v3: info->has*ring -> info->ring_mask conversion. Also add VEBOX support.
v4: Fold in update from Damien
v5: Rebase and add GEN_DEFAULT_PIPEOFFSETS
v6: Add more PCI ID (Vandana)
v7: Rebase and add IVB_CURSOR_OFFSETS
v8: Renamed the macro from _PCI_IDS to _IDS for consistency
--- drivers/gpu/drm/i915/i915_drv.c | 14 +++++++++++++- include/drm/i915_pciids.h | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.c +13 -1
@@ -356,6 +356,17 @@ static const struct intel_device_info intel_cherryview_info = { CURSOR_OFFSETS, }; +static const struct intel_device_info intel_skylake_info = { + .is_preliminary =1 , + .gen =9 , .num_pipes =3 , + .need_gfx_hws =1 , .has_hotplug =1 , + .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING , + .has_llc =1 , + .has_ddi =1 , +GEN_DEFAULT_PIPEOFFSETS , +IVB_CURSOR_OFFSETS , +}; +/* * Make sure any device matches here are from most specific to most * general. For example, since the Quanta match is based on the subsystem
@@ -392,7 +403,8 @@ static const struct intel_device_info intel_cherryview_info = {INTEL_BDW_GT12D_IDS (&intel_broadwell_d_info), \INTEL_BDW_GT3M_IDS (&intel_broadwell_gt3m_info), \INTEL_BDW_GT3D_IDS (&intel_broadwell_gt3d_info), \ - INTEL_CHV_IDS(&intel_cherryview_info) +INTEL_CHV_IDS (&intel_cherryview_info), \ + INTEL_SKL_IDS(&intel_skylake_info)static const struct pci_device_id pciidlist[] = {/* aka */ INTEL_PCI_IDS ,
include/drm/i915_pciids.h +17 -0
@@ -259,4 +259,21 @@INTEL_VGA_DEVICE (0x22b2 , info), \ INTEL_VGA_DEVICE(0x22b3, info) +#define INTEL_SKL_IDS (info) \ + INTEL_VGA_DEVICE(0x1916, info),/* ULT GT2 */ \ +INTEL_VGA_DEVICE (0x1906 , info),/* ULT GT1 */ \ +INTEL_VGA_DEVICE (0x1926 , info),/* ULT GT3 */ \ +INTEL_VGA_DEVICE (0x1921 , info),/* ULT GT2F */ \ +INTEL_VGA_DEVICE (0x190E , info),/* ULX GT1 */ \ +INTEL_VGA_DEVICE (0x191E , info),/* ULX GT2 */ \ +INTEL_VGA_DEVICE (0x1912 , info),/* DT GT2 */ \ +INTEL_VGA_DEVICE (0x1902 , info),/* DT GT1 */ \ +INTEL_VGA_DEVICE (0x191B , info),/* Halo GT2 */ \ +INTEL_VGA_DEVICE (0x192B , info),/* Halo GT3 */ \ +INTEL_VGA_DEVICE (0x190B , info),/* Halo GT1 */ \ +INTEL_VGA_DEVICE (0x191A , info),/* SRV GT2 */ \ +INTEL_VGA_DEVICE (0x192A , info),/* SRV GT3 */ \ +INTEL_VGA_DEVICE (0x190A , info),/* SRV GT1 */ \ +INTEL_VGA_DEVICE (0x191D , info)/* WKS GT2 */ + #endif /* _I915_PCIIDS_H */
Signature · 1 line
1.8.3.1
PATCH 2/89 drm/i915/skl: Add an IS_GEN9() define
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_drv.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2114,6 +2114,7 @@ struct drm_i915_cmd_table {#define IS_GEN6 (dev) (INTEL_INFO(dev)->gen == 6)#define IS_GEN7 (dev) (INTEL_INFO(dev)->gen == 7)#define IS_GEN8 (dev) (INTEL_INFO(dev)->gen == 8) +#define IS_GEN9 (dev) (INTEL_INFO(dev)->gen == 9)#define RENDER_RING (1<<RCS)#define BSD_RING (1<<VCS)
Signature · 1 line
1.8.3.1
PATCH 3/89 drm/i915/skl: Add an IS_SKYLAKE macro
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
Adding new macro IS_SKYLAKE for skylake specific implementation.
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -358,6 +358,7 @@ static const struct intel_device_info intel_cherryview_info = {static const struct intel_device_info intel_skylake_info = { .is_preliminary =1 , + .is_skylake =1 , .gen =9 , .num_pipes =3 , .need_gfx_hws =1 , .has_hotplug =1 , .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING ,
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -545,6 +545,7 @@ struct intel_uncore { func(is_ivybridge) sep \ func(is_valleyview) sep \ func(is_haswell) sep \ + func(is_skylake) sep \ func(is_preliminary) sep \ func(has_fbc) sep \ func(has_pipe_cxsr) sep \
@@ -2084,6 +2085,7 @@ struct drm_i915_cmd_table {#define IS_CHERRYVIEW (dev) (INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))#define IS_HASWELL (dev) (INTEL_INFO(dev)->is_haswell)#define IS_BROADWELL (dev) (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev)) +#define IS_SKYLAKE (dev) (INTEL_INFO(dev)->is_skylake)#define IS_MOBILE (dev) (INTEL_INFO(dev)->is_mobile)#define IS_HSW_EARLY_SDV (dev) (IS_HASWELL(dev) && \ (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
Signature · 1 line
1.8.3.1
PATCH 4/89 drm/i915/skl: SKL FBC enablement
In reply to Damien LespiauFrom: Daisy Sun <[email protected]>
Enable FBC feature on Skylake
Issue: VIZ-3788
--- drivers/gpu/drm/i915/i915_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -364,6 +364,7 @@ static const struct intel_device_info intel_skylake_info = { .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .has_llc = 1, .has_ddi = 1, + .has_fbc = 1, GEN_DEFAULT_PIPEOFFSETS, IVB_CURSOR_OFFSETS, };
Signature · 1 line
1.8.3.1
PATCH 5/89 drm/i915/skl: i915_swizzle_info gen9 fix
In reply to Damien LespiauFrom: Robert Beckett <[email protected]>
Fix ARB_MODE register read for gen >= 8 in i915_swizzle_info
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -1971,7 +1971,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data) I915_READ(MAD_DIMM_C2));seq_printf (m,"TILECTL = 0x%08x\n" ,I915_READ (TILECTL )); -if (IS_GEN8 (dev)) +if (INTEL_INFO (dev)->gen >=8 )seq_printf (m,"GAMTARBMODE = 0x%08x\n" ,I915_READ (GAMTARBMODE ));else
Signature · 1 line
1.8.3.1
Re: [PATCH 05/89] drm/i915/skl: i915_swizzle_info gen9 fix
Quoted 6 lines · Damien Lespiau
From: Robert Beckett <[email protected]>
Fix
ARB_MODEregister read for gen >= 8 ini915_swizzle_infoSigned-off-by Robert Beckett <[email protected]>Signed-off-by Damien Lespiau <[email protected]>
given that the swizzle stuff is gone, shouldn't we just have a gen9+ check to do nothing?
-Daniel
Quoted 24 lines
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +1
-1@@ -1971,7 +1971,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data) I915_READ(MAD_DIMM_C2));seq_printf (m,"TILECTL = 0x%08x\n" ,I915_READ (TILECTL )); -if (IS_GEN8 (dev)) +if (INTEL_INFO (dev)->gen >=8 )seq_printf (m,"GAMTARBMODE = 0x%08x\n" ,I915_READ (GAMTARBMODE ));else Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 05/89] drm/i915/skl: i915_swizzle_info gen9 fix
Quoted 10 lines · Daniel Vetter
Quoted 6 lines · Damien Lespiau
From: Robert Beckett <[email protected]>
Fix
ARB_MODEregister read for gen >= 8 ini915_swizzle_infoSigned-off-by Robert Beckett <[email protected]>Signed-off-by Damien Lespiau <[email protected]>given that the swizzle stuff is gone, shouldn't we just have a gen9+ check to do nothing?
Well, the swizzled bits are still in the SKL docs, they are really not expected to be used though. We can either still dump them in that debugfs file, or nothing at all. I vote for keeping the dump "just in case", but I can see the alternative working as well. No strong opinion either way.
Signature · 1 line
Damien
PATCH 6/89 drm/i915/skl: Fence registers on SKL are the same as SNB
In reply to Damien Lespiauv1: Rebased on top of the i915_gpu_error.c extraction.
--- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_gpu_error.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -3148,6 +3148,7 @@ static void i915_gem_write_fence(struct drm_device *dev, int reg, obj->stride, obj->tiling_mode);switch (INTEL_INFO (dev)->gen) { +case 9 :case 8 :case 7 :case 6 :
drivers/gpu/drm/i915/i915_gpu_error.c +1 -0
@@ -765,6 +765,7 @@ static void i915_gem_record_fences(struct drm_device *dev,/* Fences */ switch (INTEL_INFO (dev)->gen) { +case 9 :case 8 :case 7 :case 6 :
Signature · 1 line
1.8.3.1
PATCH 7/89 drm/i915/skl: Provide a placeholder for init_clock_gating()
In reply to Damien Lespiauv2: Rebase on top of the broadwell_init_clock_gating() name change
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -66,6 +66,10 @@* i915.i915_enable_fbc parameter */ +static void gen9_init_clock_gating (struct drm_device *dev) +{ +} +static void i8xx_disable_fbc (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -7395,6 +7399,8 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = haswell_init_clock_gating; else if (INTEL_INFO(dev)->gen == 8) dev_priv->display.init_clock_gating = broadwell_init_clock_gating; + else if (INTEL_INFO(dev)->gen == 9) + dev_priv->display.init_clock_gating = gen9_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) { dev_priv->display.update_wm = cherryview_update_wm; dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm;
Signature · 1 line
1.8.3.1
PATCH 8/89 drm/i915/skl: Use gen8_ring_dispatch_execbuffer() on GEN9
In reply to Damien Lespiau--- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -1
@@ -2361,7 +2361,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)if (IS_HASWELL (dev)) ring->dispatch_execbuffer = hsw_ring_dispatch_execbuffer; -else if (IS_GEN8 (dev)) +else if (INTEL_INFO (dev)->gen >=8 ) ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;else if (INTEL_INFO (dev)->gen >=6 ) ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer;
Signature · 1 line
1.8.3.1
Re: [PATCH 08/89] drm/i915/skl: Use gen8_ring_dispatch_execbuffer() on GEN9
Quoted 1 line · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>
While discussing this with Damien, he mentioned that legacy ring buffer submission is not supported on gen 9 and perhaps dispatch_execbuffer should be set to null instead.
Quoted 24 lines
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_ringbuffer.c +1
-2@@ -2361,7 +2361,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)if (IS_HASWELL (dev)) ring->dispatch_execbuffer = hsw_ring_dispatch_execbuffer; -else if (IS_GEN8 (dev)) +else if (INTEL_INFO (dev)->gen >=8 ) ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;else if (INTEL_INFO (dev)->gen >=6 ) ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/89] drm/i915/skl: Use gen8_ring_dispatch_execbuffer() on GEN9
Quoted 12 lines · Thomas Wood
Quoted 11 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_ringbuffer.c +0
-0@@ -2361,7 +2361,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
Quoted 11 lines
drivers/gpu/drm/i915/intel_ringbuffer.c int intel_init_render_ring_buffer(struct drm_device *dev) · line 2367
Quoted 7 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +1
-1if (IS_HASWELL (dev)) ring->dispatch_execbuffer = hsw_ring_dispatch_execbuffer; -else if (IS_GEN8 (dev)) +else if (INTEL_INFO (dev)->gen >=8 ) ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;else if (INTEL_INFO (dev)->gen >=6 ) ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer;While discussing this with Damien, he mentioned that legacy ring buffer submission is not supported on gen 9 and perhaps
dispatch_execbuffershould be set to null instead.
We can just drop the whole patch I guess, not expecting to run that code on gen >= 9.
Signature · 1 line
Damien
PATCH 9/89 drm/i915/skl: Skylake shares the interrupt logic with Broadwell
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -4749,7 +4749,7 @@ void intel_irq_init(struct drm_device *dev) dev->driver->enable_vblank = valleyview_enable_vblank; dev->driver->disable_vblank = valleyview_disable_vblank; dev_priv->display.hpd_irq_setup = i915_hpd_irq_setup; - }else if (IS_GEN8 (dev)) { + }else if (INTEL_INFO (dev)->gen >=8 ) { dev->driver->irq_handler = gen8_irq_handler; dev->driver->irq_preinstall = gen8_irq_reset; dev->driver->irq_postinstall = gen8_irq_postinstall;
Signature · 1 line
1.8.3.1
PATCH 10/89 drm/i915/skl: don't set the AsyncFlip performance mode for Gen9+
In reply to Damien LespiauFrom: Imre Deak <[email protected]>
The following sets the AsyncFlip performance mode for everything above Gen6:
commit 4790cb36b3eede8fb0cca529dc1d31b9936fa24b
Author: Chris Wilson <[email protected]> Date: Sun Jan 20 16:11:20 2013 +0000
drm/i915: Disable AsyncFlip performance optimisations
Starting from Gen9 the MI_MODE register layout changes and doesn't include the above bit.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -1
@@ -815,7 +815,7 @@ static int init_render_ring(struct intel_engine_cs *ring)* * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv,bdw,chv */ -if (INTEL_INFO (dev)->gen >=6 ) +if (INTEL_INFO (dev)->gen >=6 &&INTEL_INFO (dev)->gen <9 )I915_WRITE (MI_MODE ,_MASKED_BIT_ENABLE (ASYNC_FLIP_PERF_DISABLE ));/* Required for the hardware to program scanline values for waiting */
Signature · 1 line
1.8.3.1
PATCH 11/89 drm/i915/skl: Framebuffers need to be aligned to 256Kb on Skylake
In reply to Damien Lespiau--- drivers/gpu/drm/i915/intel_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -2199,7 +2199,9 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,switch (obj->tiling_mode) {case I915_TILING_NONE : -if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) alignment =128 *1024 ;else if (INTEL_INFO (dev)->gen >=4 ) alignment =4 *1024 ;
Signature · 1 line
1.8.3.1
Re: [PATCH 11/89] drm/i915/skl: Framebuffers need to be aligned to 256Kb on Skylake
Quoted 1 line · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>
Does the X tiling alignment value need to be set too?
A minor point, but perhaps use KB in the subject rather than Kb?
Quoted 26 lines
--- drivers/gpu/drm/i915/intel_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +3
-2@@ -2199,7 +2199,9 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,switch (obj->tiling_mode) {case I915_TILING_NONE : -if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) alignment =128 *1024 ;else if (INTEL_INFO (dev)->gen >=4 ) alignment =4 *1024 ; --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 11/89 drm/i915/skl: Framebuffers need to be aligned to 256KB on Skylake
v2: Also align X tiled fbs to 256KB (Thomas)
--- drivers/gpu/drm/i915/intel_display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -3
@@ -2182,7 +2182,9 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,switch (obj->tiling_mode) {case I915_TILING_NONE : -if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) alignment =128 *1024 ;else if (INTEL_INFO (dev)->gen >=4 ) alignment =4 *1024 ;
@@ -2190,8 +2192,12 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, alignment =64 *1024 ;break ;case I915_TILING_X : -/* pin() will align the object as required by fence */ - alignment =0 ; +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else { +/* pin() will align the object as required by fence */ + alignment =0 ; + }break ;case I915_TILING_Y :WARN (1 ,"Y tiled bo slipped through, driver bug!\n" );
Signature · 1 line
1.8.3.1
Re: [PATCH 11/89 v2] drm/i915/skl: Framebuffers need to be aligned to 256KB on Skylake
Quoted 3 lines · Damien Lespiau
v2: Also align X tiled fbs to 256KB (Thomas)
Signed-off-by Damien Lespiau <[email protected]>
Quoted 37 lines
--- drivers/gpu/drm/i915/intel_display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_display.c +9
-4@@ -2182,7 +2182,9 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev,switch (obj->tiling_mode) {case I915_TILING_NONE : -if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else if (IS_BROADWATER (dev) ||IS_CRESTLINE (dev)) alignment =128 *1024 ;else if (INTEL_INFO (dev)->gen >=4 ) alignment =4 *1024 ;@@ -2190,8 +2192,12 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, alignment =64 *1024 ;break ;case I915_TILING_X : -/* pin() will align the object as required by fence */ - alignment =0 ; +if (INTEL_INFO (dev)->gen >=9 ) + alignment =256 *1024 ; +else { +/* pin() will align the object as required by fence */ + alignment =0 ; + }break ;case I915_TILING_Y :WARN (1 ,"Y tiled bo slipped through, driver bug!\n" ); --1.8.3.1
PATCH 12/89 drm/i915/skl: Implement thew new update_plane() for primary planes
In reply to Damien LespiauSkylake makes primary planes the same as sprite planes and call the result "universal planes".
This commit emulates a primary plane with plane 0, taking the opportunity to redefine primary and sprite registers to be identical now that the underlying hardware is. It also makes sense as plenty of fields have changed.
v2: Rebase on top of the vma code.
v3: Follow upstream evolution:
- Drop return values.
- Remove pipe checks since redudant and BUG instead.
- Remove tiling checks and BUG instead.
- Drop commented out DISP_MODIFY usage.
v4: s/plane/primary_plane/
v5: Misc fixes:
- Fix the fields we need to clear up
- Disable trickle feed
- Correctly use PLANE_OFFSET for the panning
v6: (Jesse)
Use pipe src size when programming plane size. This makes cloned configs work correctly w/o the use of a panel fitter.
v7: Rebase on top of Ville's rmw elimination series
--- drivers/gpu/drm/i915/i915_reg.h | 110 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 88 +++++++++++++++++++++++++++- 2 files changed, 195 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +109 -1
@@ -26,8 +26,8 @@#define _I915_REG_H_#define _PIPE (pipe, a, b) ((a) + (pipe)*((b)-(a))) +#define _PLANE (plane, a, b) _PIPE(plane, a, b)#define _TRANSCODER (tran, a, b) ((a) + (tran)*((b)-(a))) -#define _PORT (port, a, b) ((a) + (port)*((b)-(a)))#define _PIPE3 (pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \ (pipe) == PIPE_B ? (b) : (c))
@@ -4495,6 +4495,114 @@ enum punit_power_well {#define SPCONSTALPHA (pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA)#define SPGAMC (pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) +/* Skylake plane registers */ + +#define _PLANE_CTL_1_A 0x70180 +#define _PLANE_CTL_2_A 0x70280 +#define _PLANE_CTL_3_A 0x70380 +#define PLANE_CTL_ENABLE (1 << 31) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_FORMAT_MASK (0xf << 24) +#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24) +#define PLANE_CTL_FORMAT_NV12 ( 1 << 24) +#define PLANE_CTL_FORMAT_XRGB_2101010 ( 2 << 24) +#define PLANE_CTL_FORMAT_XRGB_8888 ( 4 << 24) +#define PLANE_CTL_FORMAT_XRGB_16161616F ( 6 << 24) +#define PLANE_CTL_FORMAT_AYUV ( 8 << 24) +#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24) +#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_KEY_ENABLE (1 << 22) +#define PLANE_CTL_ORDER_BGRX (0 << 20) +#define PLANE_CTL_ORDER_RGBX (1 << 20) +#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16) +#define PLANE_CTL_YUV422_YUYV ( 0 << 16) +#define PLANE_CTL_YUV422_UYVY ( 1 << 16) +#define PLANE_CTL_YUV422_YVYU ( 2 << 16) +#define PLANE_CTL_YUV422_VYUY ( 3 << 16) +#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15) +#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_TILED_MASK (0x7 << 10) +#define PLANE_CTL_TILED_LINEAR ( 0 << 10) +#define PLANE_CTL_TILED_X ( 1 << 10) +#define PLANE_CTL_TILED_Y ( 4 << 10) +#define PLANE_CTL_TILED_YF ( 5 << 10) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_DISABLE ( 0 << 4) +#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4) +#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4) +#define _PLANE_STRIDE_1_A 0x70188 +#define _PLANE_STRIDE_2_A 0x70288 +#define _PLANE_STRIDE_3_A 0x70388 +#define _PLANE_POS_1_A 0x7018c +#define _PLANE_POS_2_A 0x7028c +#define _PLANE_POS_3_A 0x7038c +#define _PLANE_SIZE_1_A 0x70190 +#define _PLANE_SIZE_2_A 0x70290 +#define _PLANE_SIZE_3_A 0x70390 +#define _PLANE_SURF_1_A 0x7019c +#define _PLANE_SURF_2_A 0x7029c +#define _PLANE_SURF_3_A 0x7039c +#define _PLANE_OFFSET_1_A 0x701a4 +#define _PLANE_OFFSET_2_A 0x702a4 +#define _PLANE_OFFSET_3_A 0x703a4 + +#define _PLANE_CTL_1_B 0x71180 +#define _PLANE_CTL_2_B 0x71280 +#define _PLANE_CTL_3_B 0x71380 +#define _PLANE_CTL_1 (pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B) +#define _PLANE_CTL_2 (pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B) +#define _PLANE_CTL_3 (pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B) +#define PLANE_CTL (pipe, plane) \ + _PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe)) + +#define _PLANE_STRIDE_1_B 0x71188 +#define _PLANE_STRIDE_2_B 0x71288 +#define _PLANE_STRIDE_3_B 0x71388 +#define _PLANE_STRIDE_1 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B) +#define _PLANE_STRIDE_2 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B) +#define _PLANE_STRIDE_3 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B) +#define PLANE_STRIDE (pipe, plane) \ + _PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe)) + +#define _PLANE_POS_1_B 0x7118c +#define _PLANE_POS_2_B 0x7128c +#define _PLANE_POS_3_B 0x7138c +#define _PLANE_POS_1 (pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B) +#define _PLANE_POS_2 (pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B) +#define _PLANE_POS_3 (pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B) +#define PLANE_POS (pipe, plane) \ + _PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe)) + +#define _PLANE_SIZE_1_B 0x71190 +#define _PLANE_SIZE_2_B 0x71290 +#define _PLANE_SIZE_3_B 0x71390 +#define _PLANE_SIZE_1 (pipe) _PIPE(pipe, _PLANE_SIZE_1_A, _PLANE_SIZE_1_B) +#define _PLANE_SIZE_2 (pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B) +#define _PLANE_SIZE_3 (pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B) +#define PLANE_SIZE (pipe, plane) \ + _PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe)) + +#define _PLANE_SURF_1_B 0x7119c +#define _PLANE_SURF_2_B 0x7129c +#define _PLANE_SURF_3_B 0x7139c +#define _PLANE_SURF_1 (pipe) _PIPE(pipe, _PLANE_SURF_1_A, _PLANE_SURF_1_B) +#define _PLANE_SURF_2 (pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B) +#define _PLANE_SURF_3 (pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B) +#define PLANE_SURF (pipe, plane) \ + _PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe)) + +#define _PLANE_OFFSET_1_B 0x711a4 +#define _PLANE_OFFSET_2_B 0x712a4 +#define _PLANE_OFFSET_1 (pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B) +#define _PLANE_OFFSET_2 (pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B) +#define PLANE_OFFSET (pipe, plane) \ + _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)
drivers/gpu/drm/i915/intel_display.c +86 -2
100 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 12/89] drm/i915/skl: Implement thew new update_plane() for primary planes
Quoted 53 lines · Damien Lespiau
Skylake makes primary planes the same as sprite planes and call the result "universal planes".
This commit emulates a primary plane with plane 0, taking the opportunity to redefine primary and sprite registers to be identical now that the underlying hardware is. It also makes sense as plenty of fields have changed.
v2: Rebase on top of the vma code.
v3: Follow upstream evolution:
- Drop return values.
- Remove pipe checks since redudant and BUG instead.
- Remove tiling checks and BUG instead.
- Drop commented outDISP_MODIFYusage.v4: s/plane/primary_plane/
v5: Misc fixes:
- Fix the fields we need to clear up
- Disable trickle feed
- Correctly usePLANE_OFFSETfor the panningv6: (Jesse)
Use pipe src size when programming plane size. This makes cloned configs work correctly w/o the use of a panel fitter.v7: Rebase on top of Ville's rmw elimination series
Signed-off-by Damien Lespiau <[email protected]> (v1,5,6,7)Signed-off-by Daniel Vetter <[email protected]> (v2,3)--- drivers/gpu/drm/i915/i915_reg.h | 110 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 88 +++++++++++++++++++++++++++- 2 files changed, 195 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-1@@ -26,8 +26,8 @@#define _I915_REG_H_#define _PIPE (pipe, a, b) ((a) + (pipe)*((b)-(a))) +#define _PLANE (plane, a, b) _PIPE(plane, a, b)#define _TRANSCODER (tran, a, b) ((a) + (tran)*((b)-(a))) -#define _PORT (port, a, b) ((a) + (port)*((b)-(a)))#define _PIPE3 (pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \ (pipe) == PIPE_B ? (b) : (c))
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4503
Quoted 9 lines
drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -4495,6 +4495,114 @@ enum punit_power_well {#define SPCONSTALPHA (pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA)#define SPGAMC (pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) +/* Skylake plane registers */ + +#define _PLANE_CTL_1_A 0x70180 +#define _PLANE_CTL_2_A 0x70280 +#define _PLANE_CTL_3_A 0x70380
#first-bickesheding ;)
Since the definitions os 4_A, {1,2,3,4}_B and {1,2,3,4}_C are all in the
same spec with same bits below I'd prefer to define them here.
Quoted 1 line
+#define PLANE_CTL_ENABLE (1 << 31)
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4511
Quoted 9 lines
drivers/gpu/drm/i915/i915_reg.h +8
-0+#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_FORMAT_MASK (0xf << 24) +#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24) +#define PLANE_CTL_FORMAT_NV12 ( 1 << 24) +#define PLANE_CTL_FORMAT_XRGB_2101010 ( 2 << 24) +#define PLANE_CTL_FORMAT_XRGB_8888 ( 4 << 24) +#define PLANE_CTL_FORMAT_XRGB_16161616F ( 6 << 24) +#define PLANE_CTL_FORMAT_AYUV ( 8 << 24)
1010 missed or useless to add here?
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4515
Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24) +#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_KEY_ENABLE (1 << 22)
Key is [22:21] and 01, i.e 22=0 also is a kind of Key enabled. Or just the source matters?
In this case second bikesheding would be change for SOURCE_KEY_ENABLE
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4523
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +8
-0+#define PLANE_CTL_ORDER_BGRX (0 << 20) +#define PLANE_CTL_ORDER_RGBX (1 << 20) +#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16) +#define PLANE_CTL_YUV422_YUYV ( 0 << 16) +#define PLANE_CTL_YUV422_UYVY ( 1 << 16) +#define PLANE_CTL_YUV422_YVYU ( 2 << 16) +#define PLANE_CTL_YUV422_VYUY ( 3 << 16) +#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15)
+#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14)
Quoted 1 line
On Spec there is a restrictions: "Do not program this field to 1b." So I'd prefer to declare FEED_ENABLE (0 << 14). Just to avoid have to always ~ it.
Quoted 143 lines
drivers/gpu/drm/i915/i915_reg.h +60
-0+#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_TILED_MASK (0x7 << 10) +#define PLANE_CTL_TILED_LINEAR ( 0 << 10) +#define PLANE_CTL_TILED_X ( 1 << 10) +#define PLANE_CTL_TILED_Y ( 4 << 10) +#define PLANE_CTL_TILED_YF ( 5 << 10) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_DISABLE ( 0 << 4) +#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4) +#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4) +#define _PLANE_STRIDE_1_A 0x70188 +#define _PLANE_STRIDE_2_A 0x70288 +#define _PLANE_STRIDE_3_A 0x70388 +#define _PLANE_POS_1_A 0x7018c +#define _PLANE_POS_2_A 0x7028c +#define _PLANE_POS_3_A 0x7038c +#define _PLANE_SIZE_1_A 0x70190 +#define _PLANE_SIZE_2_A 0x70290 +#define _PLANE_SIZE_3_A 0x70390 +#define _PLANE_SURF_1_A 0x7019c +#define _PLANE_SURF_2_A 0x7029c +#define _PLANE_SURF_3_A 0x7039c +#define _PLANE_OFFSET_1_A 0x701a4 +#define _PLANE_OFFSET_2_A 0x702a4 +#define _PLANE_OFFSET_3_A 0x703a4 + +#define _PLANE_CTL_1_B 0x71180 +#define _PLANE_CTL_2_B 0x71280 +#define _PLANE_CTL_3_B 0x71380 +#define _PLANE_CTL_1 (pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B) +#define _PLANE_CTL_2 (pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B) +#define _PLANE_CTL_3 (pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B) +#define PLANE_CTL (pipe, plane) \ + _PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe)) + +#define _PLANE_STRIDE_1_B 0x71188 +#define _PLANE_STRIDE_2_B 0x71288 +#define _PLANE_STRIDE_3_B 0x71388 +#define _PLANE_STRIDE_1 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B) +#define _PLANE_STRIDE_2 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B) +#define _PLANE_STRIDE_3 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B) +#define PLANE_STRIDE (pipe, plane) \ + _PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe)) + +#define _PLANE_POS_1_B 0x7118c +#define _PLANE_POS_2_B 0x7128c +#define _PLANE_POS_3_B 0x7138c +#define _PLANE_POS_1 (pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B) +#define _PLANE_POS_2 (pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B) +#define _PLANE_POS_3 (pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B) +#define PLANE_POS (pipe, plane) \ + _PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe)) + +#define _PLANE_SIZE_1_B 0x71190 +#define _PLANE_SIZE_2_B 0x71290 +#define _PLANE_SIZE_3_B 0x71390 +#define _PLANE_SIZE_1 (pipe) _PIPE(pipe, _PLANE_SIZE_1_A,
_PLANE_SIZE_1_B)
+#define_PLANE_SIZE_2(pipe)_PIPE(pipe,_PLANE_SIZE_2_A,_PLANE_SIZE_2_B)
+#define_PLANE_SIZE_3(pipe)_PIPE(pipe,_PLANE_SIZE_3_A,_PLANE_SIZE_3_B)drivers/gpu/drm/i915/i915_reg.h +7
-0+#define PLANE_SIZE (pipe, plane) \ + _PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe)) + +#define _PLANE_SURF_1_B 0x7119c +#define _PLANE_SURF_2_B 0x7129c +#define _PLANE_SURF_3_B 0x7139c +#define _PLANE_SURF_1 (pipe) _PIPE(pipe, _PLANE_SURF_1_A,
_PLANE_SURF_1_B)
+#define_PLANE_SURF_2(pipe)_PIPE(pipe,_PLANE_SURF_2_A,_PLANE_SURF_2_B)
+#define_PLANE_SURF_3(pipe)_PIPE(pipe,_PLANE_SURF_3_A,_PLANE_SURF_3_B)drivers/gpu/drm/i915/i915_reg.h +6
-0+#define PLANE_SURF (pipe, plane) \ + _PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe)) + +#define _PLANE_OFFSET_1_B 0x711a4 +#define _PLANE_OFFSET_2_B 0x712a4 +#define _PLANE_OFFSET_1 (pipe) _PIPE(pipe, _PLANE_OFFSET_1_A,
_PLANE_OFFSET_1_B)
+#define_PLANE_OFFSET_2(pipe)_PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B)drivers/gpu/drm/i915/i915_reg.h +3
-0+#define PLANE_OFFSET (pipe, plane) \ + _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)drivers/gpu/drm/i915/intel_display.c +41
-0@@ -2640,6 +2640,86 @@ static void ironlake_update_primary_plane(structdrm_crtc *crtc,POSTING_READ (reg ); } +static void skylake_update_primary_plane (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_framebuffer *intel_fb; +struct drm_i915_gem_object *obj; +int pipe = intel_crtc->pipe; +u32 plane_ctl, stride; + +if (!intel_crtc->primary_enabled) { +I915_WRITE (PLANE_CTL (pipe,0 ),0 ); +I915_WRITE (PLANE_SURF (pipe,0 ),0 ); +POSTING_READ (PLANE_CTL (pipe,0 )); +return ; + } + + plane_ctl =PLANE_CTL_ENABLE | +PLANE_CTL_PIPE_GAMMA_ENABLE | +PLANE_CTL_PIPE_CSC_ENABLE ; + +switch (fb->pixel_format) { +case DRM_FORMAT_RGB565 : + plane_ctl |=PLANE_CTL_FORMAT_RGB_565 ; +break ; +case DRM_FORMAT_XRGB8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 ; +break ; +case DRM_FORMAT_XBGR8888 : + plane_ctl |=PLANE_CTL_ORDER_RGBX ; + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 ; +break ; +case DRM_FORMAT_XRGB2101010 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_2101010 ; +break ; +case DRM_FORMAT_XBGR2101010 : + plane_ctl |=PLANE_CTL_ORDER_RGBX ; + plane_ctl |=PLANE_CTL_FORMAT_XRGB_2101010 ; +break ;
drivers/gpu/drm/i915/intel_display.c static void ironlake_update_primary_plane(struct · line 2694
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+default : +BUG (); + } + + intel_fb =to_intel_framebuffer (fb); + obj = intel_fb->obj; +switch (obj->tiling_mode) { +case I915_TILING_NONE : + stride = fb->pitches[0 ] >>6 ;
A comment here would be good to explain this:
"For Linear memory this field specifies the stride in chunks of 64 bytes"
drivers/gpu/drm/i915/intel_display.c static void ironlake_update_primary_plane(struct drm_crtc *crtc, · line 2696
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +4
-0+break ; +case I915_TILING_X : + plane_ctl |=PLANE_CTL_TILED_X ; + stride = fb->pitches[0 ] >>9 ;
and something like or better than the following here:
"Fox X-tiled this field specifies the stride in number of tiles" 1/512 bytes.
drivers/gpu/drm/i915/intel_display.c static void ironlake_update_primary_plane(struct drm_crtc *crtc,
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+break ; +default :
is I915_TILING_Y impossible?
+ BUG();
Quoted 45 lines
drivers/gpu/drm/i915/intel_display.c +23
-0+ } + + plane_ctl &= ~PLANE_CTL_TRICKLE_FEED_DISABLE ; + plane_ctl |=PLANE_CTL_PLANE_GAMMA_DISABLE ; + +I915_WRITE (PLANE_CTL (pipe,0 ), plane_ctl); + +DRM_DEBUG_KMS ("Writing base %08lX %d,%d,%d,%d pitch=%d\n" , +i915_gem_obj_ggtt_offset (obj), + x, y, fb->width, fb->height, + fb->pitches[0 ]); + +I915_WRITE (PLANE_POS (pipe,0 ),0 ); +I915_WRITE (PLANE_OFFSET (pipe,0 ), (y <<16 ) | x); +I915_WRITE (PLANE_SIZE (pipe,0 ), + (intel_crtc->config.pipe_src_h -1 ) <<16 | + (intel_crtc->config.pipe_src_w -1 )); +I915_WRITE (PLANE_STRIDE (pipe,0 ), stride); +I915_WRITE (PLANE_SURF (pipe,0 ),i915_gem_obj_ggtt_offset (obj)); + +POSTING_READ (PLANE_SURF (pipe,0 )); +} +/* Assume fb object is pinned & idle & fenced and just update base pointers */
static int
intel_pipe_set_base_atomic(structdrm_crtc*crtc, structdrm_framebuffer
*fb,drivers/gpu/drm/i915/intel_display.c +6
-2@@ -12481,8 +12561,12 @@ static void intel_init_display(struct drm_device *dev) dev_priv->display.crtc_enable = haswell_crtc_enable; dev_priv->display.crtc_disable = haswell_crtc_disable; dev_priv->display.off = ironlake_crtc_off; - dev_priv->display.update_primary_plane = - ironlake_update_primary_plane; +if (INTEL_INFO (dev)->gen >=9 ) + dev_priv->display.update_primary_plane = + skylake_update_primary_plane; +else + dev_priv->display.update_primary_plane = + ironlake_update_primary_plane; }else if (HAS_PCH_SPLIT (dev)) { dev_priv->display.get_pipe_config =ironlake_get_pipe_config; dev_priv->display.get_plane_config =
Quoted 9 lines
ironlake_get_plane_config;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Regardless the bikeshedings, and if all answers to the questions above result in no change to the code, consider this
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v8 12/89 drm/i915/skl: Implement the new update_plane() for primary planes
Skylake makes primary planes the same as sprite planes and call the result "universal planes".
This commit emulates a primary plane with plane 0, taking the opportunity to redefine primary and sprite registers to be identical now that the underlying hardware is. It also makes sense as plenty of fields have changed.
v2: Rebase on top of the vma code.
v3: Follow upstream evolution:
- Drop return values.
- Remove pipe checks since redudant and BUG instead.
- Remove tiling checks and BUG instead.
- Drop commented out DISP_MODIFY usage.
v4: s/plane/primary_plane/
v5: Misc fixes:
- Fix the fields we need to clear up
- Disable trickle feed
- Correctly use PLANE_OFFSET for the panning
v6: (Jesse)
Use pipe src size when programming plane size. This makes cloned configs work correctly w/o the use of a panel fitter.
v7: Rebase on top of Ville's rmw elimination series
v8: Remove clearing the trickle feed bit now that we don't do a RMW (Rodrigo,
Damien)
Add a comment about the stride unit (Rodrigo)
--- drivers/gpu/drm/i915/i915_reg.h | 110 ++++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 92 ++++++++++++++++++++++++++++- 2 files changed, 199 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +109 -1
@@ -26,8 +26,8 @@#define _I915_REG_H_#define _PIPE (pipe, a, b) ((a) + (pipe)*((b)-(a))) +#define _PLANE (plane, a, b) _PIPE(plane, a, b)#define _TRANSCODER (tran, a, b) ((a) + (tran)*((b)-(a))) -#define _PORT (port, a, b) ((a) + (port)*((b)-(a)))#define _PIPE3 (pipe, a, b, c) ((pipe) == PIPE_A ? (a) : \ (pipe) == PIPE_B ? (b) : (c))
@@ -4507,6 +4507,114 @@ enum punit_power_well {#define SPCONSTALPHA (pipe, plane) _PIPE(pipe * 2 + plane, _SPACONSTALPHA, _SPBCONSTALPHA)#define SPGAMC (pipe, plane) _PIPE(pipe * 2 + plane, _SPAGAMC, _SPBGAMC) +/* Skylake plane registers */ + +#define _PLANE_CTL_1_A 0x70180 +#define _PLANE_CTL_2_A 0x70280 +#define _PLANE_CTL_3_A 0x70380 +#define PLANE_CTL_ENABLE (1 << 31) +#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_CTL_FORMAT_MASK (0xf << 24) +#define PLANE_CTL_FORMAT_YUV422 ( 0 << 24) +#define PLANE_CTL_FORMAT_NV12 ( 1 << 24) +#define PLANE_CTL_FORMAT_XRGB_2101010 ( 2 << 24) +#define PLANE_CTL_FORMAT_XRGB_8888 ( 4 << 24) +#define PLANE_CTL_FORMAT_XRGB_16161616F ( 6 << 24) +#define PLANE_CTL_FORMAT_AYUV ( 8 << 24) +#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24) +#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24) +#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_CTL_KEY_ENABLE (1 << 22) +#define PLANE_CTL_ORDER_BGRX (0 << 20) +#define PLANE_CTL_ORDER_RGBX (1 << 20) +#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16) +#define PLANE_CTL_YUV422_YUYV ( 0 << 16) +#define PLANE_CTL_YUV422_UYVY ( 1 << 16) +#define PLANE_CTL_YUV422_YVYU ( 2 << 16) +#define PLANE_CTL_YUV422_VYUY ( 3 << 16) +#define PLANE_CTL_DECOMPRESSION_ENABLE (1 << 15) +#define PLANE_CTL_TRICKLE_FEED_DISABLE (1 << 14) +#define PLANE_CTL_PLANE_GAMMA_DISABLE (1 << 13) +#define PLANE_CTL_TILED_MASK (0x7 << 10) +#define PLANE_CTL_TILED_LINEAR ( 0 << 10) +#define PLANE_CTL_TILED_X ( 1 << 10) +#define PLANE_CTL_TILED_Y ( 4 << 10) +#define PLANE_CTL_TILED_YF ( 5 << 10) +#define PLANE_CTL_ALPHA_MASK (0x3 << 4) +#define PLANE_CTL_ALPHA_DISABLE ( 0 << 4) +#define PLANE_CTL_ALPHA_SW_PREMULTIPLY ( 2 << 4) +#define PLANE_CTL_ALPHA_HW_PREMULTIPLY ( 3 << 4) +#define _PLANE_STRIDE_1_A 0x70188 +#define _PLANE_STRIDE_2_A 0x70288 +#define _PLANE_STRIDE_3_A 0x70388 +#define _PLANE_POS_1_A 0x7018c +#define _PLANE_POS_2_A 0x7028c +#define _PLANE_POS_3_A 0x7038c +#define _PLANE_SIZE_1_A 0x70190 +#define _PLANE_SIZE_2_A 0x70290 +#define _PLANE_SIZE_3_A 0x70390 +#define _PLANE_SURF_1_A 0x7019c +#define _PLANE_SURF_2_A 0x7029c +#define _PLANE_SURF_3_A 0x7039c +#define _PLANE_OFFSET_1_A 0x701a4 +#define _PLANE_OFFSET_2_A 0x702a4 +#define _PLANE_OFFSET_3_A 0x703a4 + +#define _PLANE_CTL_1_B 0x71180 +#define _PLANE_CTL_2_B 0x71280 +#define _PLANE_CTL_3_B 0x71380 +#define _PLANE_CTL_1 (pipe) _PIPE(pipe, _PLANE_CTL_1_A, _PLANE_CTL_1_B) +#define _PLANE_CTL_2 (pipe) _PIPE(pipe, _PLANE_CTL_2_A, _PLANE_CTL_2_B) +#define _PLANE_CTL_3 (pipe) _PIPE(pipe, _PLANE_CTL_3_A, _PLANE_CTL_3_B) +#define PLANE_CTL (pipe, plane) \ + _PLANE(plane, _PLANE_CTL_1(pipe), _PLANE_CTL_2(pipe)) + +#define _PLANE_STRIDE_1_B 0x71188 +#define _PLANE_STRIDE_2_B 0x71288 +#define _PLANE_STRIDE_3_B 0x71388 +#define _PLANE_STRIDE_1 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_1_A, _PLANE_STRIDE_1_B) +#define _PLANE_STRIDE_2 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_2_A, _PLANE_STRIDE_2_B) +#define _PLANE_STRIDE_3 (pipe) \ + _PIPE(pipe, _PLANE_STRIDE_3_A, _PLANE_STRIDE_3_B) +#define PLANE_STRIDE (pipe, plane) \ + _PLANE(plane, _PLANE_STRIDE_1(pipe), _PLANE_STRIDE_2(pipe)) + +#define _PLANE_POS_1_B 0x7118c +#define _PLANE_POS_2_B 0x7128c +#define _PLANE_POS_3_B 0x7138c +#define _PLANE_POS_1 (pipe) _PIPE(pipe, _PLANE_POS_1_A, _PLANE_POS_1_B) +#define _PLANE_POS_2 (pipe) _PIPE(pipe, _PLANE_POS_2_A, _PLANE_POS_2_B) +#define _PLANE_POS_3 (pipe) _PIPE(pipe, _PLANE_POS_3_A, _PLANE_POS_3_B) +#define PLANE_POS (pipe, plane) \ + _PLANE(plane, _PLANE_POS_1(pipe), _PLANE_POS_2(pipe)) + +#define _PLANE_SIZE_1_B 0x71190 +#define _PLANE_SIZE_2_B 0x71290 +#define _PLANE_SIZE_3_B 0x71390 +#define _PLANE_SIZE_1 (pipe) _PIPE(pipe, _PLANE_SIZE_1_A, _PLANE_SIZE_1_B) +#define _PLANE_SIZE_2 (pipe) _PIPE(pipe, _PLANE_SIZE_2_A, _PLANE_SIZE_2_B) +#define _PLANE_SIZE_3 (pipe) _PIPE(pipe, _PLANE_SIZE_3_A, _PLANE_SIZE_3_B) +#define PLANE_SIZE (pipe, plane) \ + _PLANE(plane, _PLANE_SIZE_1(pipe), _PLANE_SIZE_2(pipe)) + +#define _PLANE_SURF_1_B 0x7119c +#define _PLANE_SURF_2_B 0x7129c +#define _PLANE_SURF_3_B 0x7139c +#define _PLANE_SURF_1 (pipe) _PIPE(pipe, _PLANE_SURF_1_A, _PLANE_SURF_1_B) +#define _PLANE_SURF_2 (pipe) _PIPE(pipe, _PLANE_SURF_2_A, _PLANE_SURF_2_B) +#define _PLANE_SURF_3 (pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B) +#define PLANE_SURF (pipe, plane) \ + _PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe)) + +#define _PLANE_OFFSET_1_B 0x711a4 +#define _PLANE_OFFSET_2_B 0x712a4 +#define _PLANE_OFFSET_1 (pipe) _PIPE(pipe, _PLANE_OFFSET_1_A, _PLANE_OFFSET_1_B) +#define _PLANE_OFFSET_2 (pipe) _PIPE(pipe, _PLANE_OFFSET_2_A, _PLANE_OFFSET_2_B) +#define PLANE_OFFSET (pipe, plane) \ + _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)
drivers/gpu/drm/i915/intel_display.c +90 -2
104 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 13/89 drm/i915/skl: Don't create a VGA connector on Skylake
In reply to Damien Lespiauv2: Rebase on top of the intel_crt_present() addition
v3: Fix rebase error (we were patching the wrong function)
--- drivers/gpu/drm/i915/intel_display.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -12218,6 +12218,9 @@ static bool intel_crt_present(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; +if (INTEL_INFO (dev)->gen >=9 ) +return false; +if (IS_ULT (dev))return false;
Signature · 1 line
1.8.3.1
PATCH 14/89 drm/i915/skl: Don't try to read out the PCH transcoder state if not present
In reply to Damien LespiauWhen the platform doesn't have a FDI link, don't try to read out the state of a potential PCH transcoder.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_display.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2175,6 +2175,8 @@ struct drm_i915_cmd_table {#define HAS_PSR (dev) (IS_HASWELL(dev) || IS_BROADWELL(dev))#define HAS_RUNTIME_PM (dev) (IS_GEN6(dev) || IS_HASWELL(dev) || \ IS_BROADWELL(dev) || IS_VALLEYVIEW(dev)) +#define HAS_FDI (dev) (HAS_PCH_SPLIT(dev) && \ + INTEL_INFO(dev)->gen < 9)#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -7825,7 +7825,8 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,* DDI E. So just check whether this pipe is wired to DDI E and whether * the PCH transcoder is on. */ -if ((port ==PORT_E ) &&I915_READ (LPT_TRANSCONF ) &TRANS_ENABLE ) { +if (HAS_FDI (dev) && + (port ==PORT_E ) &&I915_READ (LPT_TRANSCONF ) &TRANS_ENABLE ) { pipe_config->has_pch_encoder = true; tmp =I915_READ (FDI_RX_CTL (PIPE_A ));
Signature · 1 line
1.8.3.1
PATCH 15/89 drm/i915/skl: Program the DDI buffer translation tables
In reply to Damien LespiauJani cleaned up the mess between the length of the various DDI buf translation arrays and the number of DDI Translation levels/entries. So now ARRAY_SIZE(skl_ddi_translations_hdmi) is the number of possible entries (instead of needing to remember to divide by 2)
The SKL DP/eDP 1.3/HDMI DDI buf patch needed an update then.
--
Damien
--- drivers/gpu/drm/i915/intel_ddi.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +38 -2
@@ -127,6 +127,32 @@ static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = { { 0x80FFFFFF, 0x001B0002 }, /* 9: 1000 1000 0 */ }; +static const struct ddi_buf_trans skl_ddi_translations_dp[] = { + {0x00000018 ,0x000000a0 }, + {0x00004014 ,0x00000098 }, + {0x00006012 ,0x00000088 }, + {0x00008010 ,0x00000080 }, + {0x00000018 ,0x00000098 }, + {0x00004014 ,0x00000088 }, + {0x00006012 ,0x00000080 }, + {0x00000018 ,0x00000088 }, + {0x00004014 ,0x00000080 }, +}; + +static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = { +/* Idx NT mV T mV db */ + {0x00000018 ,0x000000a0 },/* 0: 400 400 0 */ + {0x00004014 ,0x00000098 },/* 1: 400 600 3.5 */ + {0x00006012 ,0x00000088 },/* 2: 400 800 6 */ + {0x00000018 ,0x0000003c },/* 3: 450 450 0 */ + {0x00000018 ,0x00000098 },/* 4: 600 600 0 */ + {0x00003015 ,0x00000088 },/* 5: 600 800 2.5 */ + {0x00005013 ,0x00000080 },/* 6: 600 1000 4.5 */ + {0x00000018 ,0x00000088 },/* 7: 800 800 0 */ + {0x00000096 ,0x00000080 },/* 8: 800 1000 2 */ + {0x00000018 ,0x00000080 },/* 9: 1200 1200 0 */ +}; +enum port intel_ddi_get_encoder_port (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base;
@@ -169,7 +195,14 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)const struct ddi_buf_trans *ddi_translations_hdmi;const struct ddi_buf_trans *ddi_translations; -if (IS_BROADWELL (dev)) { +if (IS_SKYLAKE (dev)) { + ddi_translations_fdi =NULL ; + ddi_translations_dp = skl_ddi_translations_dp; + ddi_translations_edp = skl_ddi_translations_dp; + ddi_translations_hdmi = skl_ddi_translations_hdmi; + n_hdmi_entries =ARRAY_SIZE (skl_ddi_translations_hdmi); + hdmi_800mV_0dB =7 ; + }else if (IS_BROADWELL (dev)) { ddi_translations_fdi = bdw_ddi_translations_fdi; ddi_translations_dp = bdw_ddi_translations_dp; ddi_translations_edp = bdw_ddi_translations_edp;
@@ -208,7 +241,10 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) ddi_translations = ddi_translations_dp;break ;case PORT_E : - ddi_translations = ddi_translations_fdi; +if (ddi_translations_fdi) + ddi_translations = ddi_translations_fdi; +else + ddi_translations = ddi_translations_dp;break ;default :BUG ();
Signature · 1 line
1.8.3.1
PATCH v7 15/89 drm/i915/skl: Program the DDI buffer translation tables
A couple of things have changed compared to Broadwell:
- Entry 9 is used for eDP
- No more FDI
v2: Update the translation values to latest specs.
v3: Rebase on top of the BDW HDMI translation patch
v4: Remove the low voltage edp tables,
Rebase on top of the patch not writing the HDMI entry on eDP/FDI DDIs (Satheesh, Paulo).
v5: Apply the / 2 fix for the number of HDMI entries (Satheesh)
v6: Rebase on top of Jani's clean up for the DDI_BUF_TRANS tables
v7: Restore the commit message that was mangled by error
--- drivers/gpu/drm/i915/intel_ddi.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +38 -2
@@ -127,6 +127,32 @@ static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = { { 0x80FFFFFF, 0x001B0002 }, /* 9: 1000 1000 0 */ }; +static const struct ddi_buf_trans skl_ddi_translations_dp[] = { + {0x00000018 ,0x000000a0 }, + {0x00004014 ,0x00000098 }, + {0x00006012 ,0x00000088 }, + {0x00008010 ,0x00000080 }, + {0x00000018 ,0x00000098 }, + {0x00004014 ,0x00000088 }, + {0x00006012 ,0x00000080 }, + {0x00000018 ,0x00000088 }, + {0x00004014 ,0x00000080 }, +}; + +static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = { +/* Idx NT mV T mV db */ + {0x00000018 ,0x000000a0 },/* 0: 400 400 0 */ + {0x00004014 ,0x00000098 },/* 1: 400 600 3.5 */ + {0x00006012 ,0x00000088 },/* 2: 400 800 6 */ + {0x00000018 ,0x0000003c },/* 3: 450 450 0 */ + {0x00000018 ,0x00000098 },/* 4: 600 600 0 */ + {0x00003015 ,0x00000088 },/* 5: 600 800 2.5 */ + {0x00005013 ,0x00000080 },/* 6: 600 1000 4.5 */ + {0x00000018 ,0x00000088 },/* 7: 800 800 0 */ + {0x00000096 ,0x00000080 },/* 8: 800 1000 2 */ + {0x00000018 ,0x00000080 },/* 9: 1200 1200 0 */ +}; +enum port intel_ddi_get_encoder_port (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base;
@@ -169,7 +195,14 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)const struct ddi_buf_trans *ddi_translations_hdmi;const struct ddi_buf_trans *ddi_translations; -if (IS_BROADWELL (dev)) { +if (IS_SKYLAKE (dev)) { + ddi_translations_fdi =NULL ; + ddi_translations_dp = skl_ddi_translations_dp; + ddi_translations_edp = skl_ddi_translations_dp; + ddi_translations_hdmi = skl_ddi_translations_hdmi; + n_hdmi_entries =ARRAY_SIZE (skl_ddi_translations_hdmi); + hdmi_800mV_0dB =7 ; + }else if (IS_BROADWELL (dev)) { ddi_translations_fdi = bdw_ddi_translations_fdi; ddi_translations_dp = bdw_ddi_translations_dp; ddi_translations_edp = bdw_ddi_translations_edp;
@@ -208,7 +241,10 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) ddi_translations = ddi_translations_dp;break ;case PORT_E : - ddi_translations = ddi_translations_fdi; +if (ddi_translations_fdi) + ddi_translations = ddi_translations_fdi; +else + ddi_translations = ddi_translations_dp;break ;default :BUG ();
Signature · 1 line
1.8.3.1
PATCH 16/89 drm/i915/skl: Add support for DP voltage swings and pre-emphasis
In reply to Damien LespiauThey are similar to Haswell.
v2: Rebased on top of drm-intel-nightly
v3: Rebased on top of Sonika's DP train defines renaming
--- drivers/gpu/drm/i915/intel_dp.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +16 -3
@@ -2432,7 +2432,9 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)struct drm_device *dev =intel_dp_to_dev (intel_dp);enum port port =dp_to_dig_port (intel_dp)->port; -if (IS_VALLEYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) +return DP_TRAIN_VOLTAGE_SWING_LEVEL_2 ; +else if (IS_VALLEYVIEW (dev))return DP_TRAIN_VOLTAGE_SWING_LEVEL_3 ;else if (IS_GEN7 (dev) && port ==PORT_A )return DP_TRAIN_VOLTAGE_SWING_LEVEL_2 ;
@@ -2448,7 +2450,18 @@ intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing)struct drm_device *dev =intel_dp_to_dev (intel_dp);enum port port =dp_to_dig_port (intel_dp)->port; -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { +if (INTEL_INFO (dev)->gen >=9 ) { +switch (voltage_swing &DP_TRAIN_VOLTAGE_SWING_MASK ) { +case DP_TRAIN_VOLTAGE_SWING_LEVEL_0 : +return DP_TRAIN_PRE_EMPH_LEVEL_3 ; +case DP_TRAIN_VOLTAGE_SWING_LEVEL_1 : +return DP_TRAIN_PRE_EMPH_LEVEL_2 ; +case DP_TRAIN_VOLTAGE_SWING_LEVEL_2 : +return DP_TRAIN_PRE_EMPH_LEVEL_1 ; +default : +return DP_TRAIN_PRE_EMPH_LEVEL_0 ; + } + }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {switch (voltage_swing &DP_TRAIN_VOLTAGE_SWING_MASK ) {case DP_TRAIN_VOLTAGE_SWING_LEVEL_0 :return DP_TRAIN_PRE_EMPH_LEVEL_3 ;
@@ -2930,7 +2943,7 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP)uint32_t signal_levels, mask;uint8_t train_set = intel_dp->train_set[0 ]; -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { +if (IS_HASWELL (dev) ||IS_BROADWELL (dev) ||INTEL_INFO (dev)->gen >=9 ) { signal_levels =intel_hsw_signal_levels (train_set); mask =DDI_BUF_EMP_MASK ; }else if (IS_CHERRYVIEW (dev)) {
Signature · 1 line
1.8.3.1
PATCH 17/89 drm/i915/skl: Skylake doesn't need the DP AUX clock divider programmed
In reply to Damien LespiauDP_AUX_CTL doesn't have the "2X Bit Clock divider" bitfield any more. I don't see any other register where we should program it, so I assume the hardware knows how to derive it now.
--- drivers/gpu/drm/i915/intel_dp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +4 -1
@@ -446,7 +446,10 @@ static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);struct drm_device *dev = intel_dig_port->base.base.dev; -if (index) +if (INTEL_INFO (dev)->gen >=9 ) { +/* Skylake doesn't need the AUX clock divider programmed */ +return 0 ; + }else if (index)return 0 ;if (intel_dig_port->port ==PORT_A ) {
Signature · 1 line
1.8.3.1
PATCH 18/89 drm/i915/skl: Skylake moves AUX_CTL from PCH to CPU
In reply to Damien LespiauSo we can apply the old aux_ctl = dp_ctl + 0x10 rule again.
--- drivers/gpu/drm/i915/intel_dp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +10 -1
@@ -749,7 +749,16 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)BUG (); } -if (!HAS_DDI (dev)) +/* +* The AUX_CTL register is usually DP_CTL + 0x10. +* +* On Haswell and Broadwell though: +* - Both port A DDI_BUF_CTL and DDI_AUX_CTL are on the CPU +* - Port B/C/D AUX channels are on the PCH, DDI_BUF_CTL on the CPU +* +* Skylake moves AUX_CTL back next to DDI_BUF_CTL, on the CPU. +*/ +if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) intel_dp->aux_ch_ctl_reg = intel_dp->output_reg +0x10 ; intel_dp->aux.name = name;
Signature · 1 line
1.8.3.1
PATCH 19/89 drm/i915/skl: Add the additional graphics stolen sizes
In reply to Damien LespiauSkylake introduces new stolen memory sizes starting at 0xf0 (4MB) and growing by 4MB increments from there.
v2: Rebase on top of the early-quirk changes from Ville.
v3: Rebase on top of the PCI_IDS/IDS macro rename
--- arch/x86/kernel/early-quirks.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.c | 17 ++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)
arch/x86/kernel/early-quirks.c +23 -0
@@ -455,6 +455,23 @@ struct intel_stolen_funcs {u32 (*base)(int num,int slot,int func,size_t size); }; +static size_t __init gen9_stolen_size (int num,int slot,int func) +{ +u16 gmch_ctrl; + + gmch_ctrl =read_pci_config_16 (num, slot, func,SNB_GMCH_CTRL ); + gmch_ctrl >>=BDW_GMCH_GMS_SHIFT ; + gmch_ctrl &=BDW_GMCH_GMS_MASK ; + +if (gmch_ctrl <0xf0 ) +return gmch_ctrl <<25 ;/* 32 MB units */ +else +/* 4MB increments starting at 0xf0 for 4MB */ +return (gmch_ctrl -0xf0 +1 ) <<22 ; +} + +typedef size_t (*stolen_size_fn )(int num,int slot,int func); +static const struct intel_stolen_funcs i830_stolen_funcs__initconst = { .base = i830_stolen_base, .size = i830_stolen_size,
@@ -490,6 +507,11 @@ static const struct intel_stolen_funcs gen8_stolen_funcs __initconst = { .size = gen8_stolen_size, }; +static const struct intel_stolen_funcs gen9_stolen_funcs__initconst = { + .base = intel_stolen_base, + .size = gen9_stolen_size, +}; +static const struct intel_stolen_funcs chv_stolen_funcs__initconst = { .base = intel_stolen_base, .size = chv_stolen_size,
@@ -523,6 +545,7 @@ static const struct pci_device_id intel_stolen_ids[] __initconst = {INTEL_BDW_M_IDS (&gen8_stolen_funcs),INTEL_BDW_D_IDS (&gen8_stolen_funcs),INTEL_CHV_IDS (&chv_stolen_funcs), + INTEL_SKL_IDS(&gen9_stolen_funcs), };static void __init intel_graphics_stolen (int num,int slot,int func)
drivers/gpu/drm/i915/i915_gem_gtt.c +16 -1
@@ -1847,6 +1847,18 @@ static size_t chv_get_stolen_size(u16 gmch_ctrl)return (gmch_ctrl -0x17 +9 ) <<22 ; } +static size_t gen9_get_stolen_size (u16 gen9_gmch_ctl) +{ + gen9_gmch_ctl >>=BDW_GMCH_GMS_SHIFT ; + gen9_gmch_ctl &=BDW_GMCH_GMS_MASK ; + +if (gen9_gmch_ctl <0xf0 ) +return gen9_gmch_ctl <<25 ;/* 32 MB units */ +else +/* 4MB increments starting at 0xf0 for 4MB */ +return (gen9_gmch_ctl -0xf0 +1 ) <<22 ; +} +static int ggtt_probe_common (struct drm_device *dev,size_t gtt_size) {
@@ -1943,7 +1955,10 @@ static int gen8_gmch_probe(struct drm_device *dev,pci_read_config_word (dev->pdev,SNB_GMCH_CTRL , &snb_gmch_ctl); -if (IS_CHERRYVIEW (dev)) { +if (INTEL_INFO (dev)->gen >=9 ) { + *stolen =gen9_get_stolen_size (snb_gmch_ctl); + gtt_size =gen8_get_total_gtt_size (snb_gmch_ctl); + }else if (IS_CHERRYVIEW (dev)) { *stolen =chv_get_stolen_size (snb_gmch_ctl); gtt_size =chv_get_total_gtt_size (snb_gmch_ctl); }else {
Signature · 1 line
1.8.3.1
PATCH 20/89 drm/i915/skl: gen9 uses the same bind_vma() vfuncs as gen6+
In reply to Damien LespiauTemporary plug a BUG() while waiting for a better solution. See:
http://lists.freedesktop.org/archives/intel-gfx/2014-January/038132.html
However Chris was looking at cleaning-up this as well, so went for the easy intermediate solution instead.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -0
@@ -2130,6 +2130,7 @@ static struct i915_vma *__i915_gem_vma_create(struct drm_i915_gem_object *obj, vma->obj = obj;switch (INTEL_INFO (vm->dev)->gen) { +case 9 :case 8 :case 7 :case 6 :
Signature · 1 line
1.8.3.1
PATCH 21/89 drm/i915/skl: Implement the get_aux_clock_divider() DP vfunc
In reply to Damien LespiauWe need to provide a vfunc that will make the code in intel_dp_aux_ch() loop once to start the AUX transaction. The return value (clock divider) is unused on SKL, so just return 1.
--- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +13 -1
@@ -489,6 +489,16 @@ static uint32_t vlv_get_aux_clock_divider(struct intel_dp *intel_dp, int index)return index ?0 :100 ; } +static uint32_t skl_get_aux_clock_divider (struct intel_dp *intel_dp,int index) +{ +/* +* SKL doesn't need us to program the AUX clock divider (Hardware will +* derive the clock from CDCLK automatically). We still implement the +* get_aux_clock_divider vfunc to plug-in into the existing code. +*/ +return index ?0 :1 ; +} + static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, bool has_aux_irq, int send_bytes,
@@ -4726,7 +4736,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,int type;/* intel_dp vfuncs */ -if (IS_VALLEYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; +else if (IS_VALLEYVIEW (dev)) intel_dp->get_aux_clock_divider = vlv_get_aux_clock_divider;else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider;
Signature · 1 line
1.8.3.1
Re: [PATCH 21/89] drm/i915/skl: Implement the get_aux_clock_divider() DP vfunc
I believe this patch should remove the gen9 part of ilk_get_aux_clock_divider.
Also there it just returns 0, but here it returns 0 or 1 depending on the index.
This also is incoherent with the commit description.
Quoted 58 lines · Damien Lespiau
We need to provide a vfunc that will make the code in
intel_dp_aux_ch()loop once to start the AUX transaction. The return value (clock divider) is unused on SKL, so just return 1.Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_dp.c +4
-0@@ -489,6 +489,16 @@ static uint32_t vlv_get_aux_clock_divider(struct intel_dp *intel_dp, int index)return index ?0 :100 ; } +static uint32_t skl_get_aux_clock_divider (struct intel_dp *intel_dp,int index) +{ +/* +* SKL doesn't need us to program the AUX clock divider (Hardware will
+ * derive the clock from CDCLK automatically). We still implement
thedrivers/gpu/drm/i915/intel_dp.c +8
-1+* get_aux_clock_divider vfunc to plug-in into the existing code. +*/ +return index ?0 :1 ; +} + static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, bool has_aux_irq, int send_bytes,@@ -4726,7 +4736,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, int type;/* intel_dp vfuncs */ -if (IS_VALLEYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; +else if (IS_VALLEYVIEW (dev)) intel_dp->get_aux_clock_divider =vlv_get_aux_clock_divider; else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) intel_dp->get_aux_clock_divider =
hsw_get_aux_clock_divider;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 21/89] drm/i915/skl: Implement the get_aux_clock_divider() DP vfunc
Quoted 2 lines · Rodrigo Vivi
I believe this patch should remove the gen9 part of
ilk_get_aux_clock_divider.
The previous patch changing ilk_get_aux_clock_divider() got removed entirely.
Quoted 3 lines
Also there it just returns 0, but here it returns 0 or 1 depending on the index.
This also is incoherent with the commit description.
Yes, when the index is 0, we need to return a non 0 value (chose 1) to have the code using this vfunc loop once. Then, when the index is incremented, we return 0 to stop the loop.
Signature · 1 line
Damien
Quoted 66 lines
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <[email protected]> wrote: We need to provide a vfunc that will make the code in intel_dp_aux_ch() loop once to start the AUX transaction. The return value (clock divider) is unused on SKL, so just return 1. Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a95fb47..4560ced 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -489,6 +489,16 @@ static uint32_t vlv_get_aux_clock_divider(struct intel_dp *intel_dp, int index) return index ? 0 : 100; } +static uint32_t skl_get_aux_clock_divider(struct intel_dp *intel_dp, int index) +{ + /* + * SKL doesn't need us to program the AUX clock divider (Hardware will + * derive the clock from CDCLK automatically). We still implement the + * get_aux_clock_divider vfunc to plug-in into the existing code. + */ + return index ? 0 : 1; +} + static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, bool has_aux_irq, int send_bytes, @@ -4726,7 +4736,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, int type; /* intel_dp vfuncs */ - if (IS_VALLEYVIEW(dev)) + if (INTEL_INFO(dev)->gen >= 9) + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; + else if (IS_VALLEYVIEW(dev)) intel_dp->get_aux_clock_divider = vlv_get_aux_clock_divider; else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider; -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Rodrigo Vivi Blog: http://blog.vivi.eng.br
Rodrigo Vivi
Reviewed-byRe: [PATCH 21/89] drm/i915/skl: Implement the get_aux_clock_divider() DP vfunc
Thanks, so feel free to use:
Quoted 92 lines · Damien Lespiau
Quoted 2 lines · Rodrigo Vivi
I believe this patch should remove the gen9 part of
ilk_get_aux_clock_divider.The previous patch changing
ilk_get_aux_clock_divider()got removed entirely.Quoted 1 line
Also there it just returns 0, but here it returns 0 or 1 depending on
the
Quoted 2 lines
index.
This also is incoherent with the commit description.Yes, when the index is 0, we need to return a non 0 value (chose 1) to have the code using this vfunc loop once. Then, when the index is incremented, we return 0 to stop the loop.
--
DamienQuoted 1 line
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <
Quoted 3 lines
wrote:
We need to provide a vfunc that will make the code in
intel_dp_aux_ch()Quoted 1 line
loop once to start the AUX transaction. The return value (clock
divider)
Quoted 5 lines
is unused on SKL, so just return 1. Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++++++++-Quoted 8 lines
1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a95fb47..4560ced 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -489,6 +489,16 @@ static uint32_tvlv_get_aux_clock_divider(struct
Quoted 5 lines
intel_dp*intel_dp, int index)
return index ? 0 : 100;
}+static
uint32_tskl_get_aux_clock_divider(structintel_dp
*intel_dp,Quoted 9 lines
int index)
+{
+ /*
+ * SKL doesn't need us to program the AUX clock divider
(Hardware will
+ * derive the clock from CDCLK automatically). We still
implement the
+ *get_aux_clock_dividervfunc to plug-in into the existing
code.Quoted 8 lines
+ */
+ return index ? 0 : 1;
+}
+
staticuint32_ti9xx_get_aux_send_ctl(structintel_dp*intel_dp,
boolhas_aux_irq, intsend_bytes,
@@ -4726,7 +4736,9 @@ intel_dp_init_connector(struct
intel_digital_portQuoted 26 lines
*intel_dig_port, int type; /* intel_dp vfuncs */ - if (IS_VALLEYVIEW(dev)) + if (INTEL_INFO(dev)->gen >= 9) + intel_dp->get_aux_clock_divider = skl_get_aux_clock_divider; + else if (IS_VALLEYVIEW(dev)) intel_dp->get_aux_clock_divider = vlv_get_aux_clock_divider; else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) intel_dp->get_aux_clock_divider = hsw_get_aux_clock_divider; -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx-- Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 22/89 drm/i915/skl: Provide a get_aux_send_ctl() vfunc for skylake
In reply to Damien LespiauSkylake doesn't use the pre-charge field now, but, instead, we need to specify the total number of SYNC pulses for the SYNC phase (pre-charge + SYNC pattern pules). Let's use the default value (32) for that.
v3: increase DP AUX TX timeout as 400us is not to be used on SKL
apparently (Jesse).
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_dp.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3630,6 +3630,7 @@ enum punit_power_well {#define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)#define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)#define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0 +#define DP_AUX_CH_CTL_SYNC_PULSE_SKL (c) ((c) - 1)/* * Computing GMCH M and N values for the Display Port link
drivers/gpu/drm/i915/intel_dp.c +19 -1
@@ -529,6 +529,21 @@ static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, (aux_clock_divider <<DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT ); } +static uint32_t skl_get_aux_send_ctl (struct intel_dp *intel_dp, +bool has_aux_irq, +int send_bytes, +uint32_t unused) +{ +return DP_AUX_CH_CTL_SEND_BUSY | +DP_AUX_CH_CTL_DONE | + (has_aux_irq ?DP_AUX_CH_CTL_INTERRUPT :0 ) | +DP_AUX_CH_CTL_TIME_OUT_ERROR | + DP_AUX_CH_CTL_TIME_OUT_1600us | +DP_AUX_CH_CTL_RECEIVE_ERROR | + (send_bytes <<DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT ) | +DP_AUX_CH_CTL_SYNC_PULSE_SKL (32 ); +} + static int intel_dp_aux_ch(struct intel_dp *intel_dp, uint8_t *send, int send_bytes,
@@ -4747,7 +4762,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,else intel_dp->get_aux_clock_divider = i9xx_get_aux_clock_divider; - intel_dp->get_aux_send_ctl = i9xx_get_aux_send_ctl; +if (INTEL_INFO (dev)->gen >=9 ) + intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl; +else + intel_dp->get_aux_send_ctl = i9xx_get_aux_send_ctl;/* Preserve the current hw state. */ intel_dp->DP =I915_READ (intel_dp->output_reg);
Signature · 1 line
1.8.3.1
Re: [PATCH 22/89] drm/i915/skl: Provide a get_aux_send_ctl() vfunc for skylake
Quoted 76 lines · Damien Lespiau
Skylake doesn't use the pre-charge field now, but, instead, we need to specify the total number of SYNC pulses for the SYNC phase (pre-charge + SYNC pattern pules). Let's use the default value (32) for that.
v3: increase DP AUX TX timeout as 400us is not to be used on SKL
apparently (Jesse).Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_dp.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3630,6 +3630,7 @@ enum punit_power_well {#define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)#define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)#define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0 +#define DP_AUX_CH_CTL_SYNC_PULSE_SKL (c) ((c) - 1)/* * Computing GMCH M and N values for the Display Port link drivers/gpu/drm/i915/intel_dp.c +15
-0@@ -529,6 +529,21 @@ static uint32_t i9xx_get_aux_send_ctl(struct intel_dp *intel_dp, (aux_clock_divider <<DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT ); } +static uint32_t skl_get_aux_send_ctl (struct intel_dp *intel_dp, +bool has_aux_irq, +int send_bytes, +uint32_t unused) +{ +return DP_AUX_CH_CTL_SEND_BUSY | +DP_AUX_CH_CTL_DONE | + (has_aux_irq ?DP_AUX_CH_CTL_INTERRUPT :0 ) | +DP_AUX_CH_CTL_TIME_OUT_ERROR | + DP_AUX_CH_CTL_TIME_OUT_1600us | +DP_AUX_CH_CTL_RECEIVE_ERROR | + (send_bytes <<DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT ) | +DP_AUX_CH_CTL_SYNC_PULSE_SKL (32 ); +} + static int intel_dp_aux_ch(struct intel_dp *intel_dp,
uint8_t*send, intsend_bytes,drivers/gpu/drm/i915/intel_dp.c +4
-1@@ -4747,7 +4762,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, else intel_dp->get_aux_clock_divider = i9xx_get_aux_clock_divider; - intel_dp->get_aux_send_ctl = i9xx_get_aux_send_ctl; +if (INTEL_INFO (dev)->gen >=9 ) + intel_dp->get_aux_send_ctl = skl_get_aux_send_ctl; +else + intel_dp->get_aux_send_ctl = i9xx_get_aux_send_ctl;/* Preserve the current hw state. */ intel_dp->DP = I915_READ(intel_dp->output_reg);--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 23/89 drm/i915/skl: Initialize PPGTT like gen8
In reply to Damien Lespiaugen9 uses very similar memory management to what gen8 has. Just follow the flow.
v2: Fix trivial conflict (Damien)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
@@ -1092,7 +1092,7 @@ static int __hw_ppgtt_init(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)if (INTEL_INFO (dev)->gen <8 )return gen6_ppgtt_init (ppgtt); -else if (IS_GEN8 (dev)) +else if (IS_GEN8 (dev) ||IS_GEN9 (dev))return gen8_ppgtt_init (ppgtt, dev_priv->gtt.base.total);else BUG ();
Signature · 1 line
1.8.3.1
Re: [PATCH 23/89] drm/i915/skl: Initialize PPGTT like gen8
This already has the ideal rv-b ;)
But feel free to also use:
Quoted 34 lines · Damien Lespiau
gen9 uses very similar memory management to what gen8 has. Just follow the flow.
v2: Fix trivial conflict (Damien)
Reviewed-by Ben Widawsky <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_gem_gtt.c +1
-1@@ -1092,7 +1092,7 @@ static int __hw_ppgtt_init(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)if (INTEL_INFO (dev)->gen <8 )return gen6_ppgtt_init (ppgtt); -else if (IS_GEN8 (dev)) +else if (IS_GEN8 (dev) ||IS_GEN9 (dev))return gen8_ppgtt_init (ppgtt, dev_priv->gtt.base.total);else BUG();--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 24/89 drm/i915/skl: Allow the reg_read ioctl to return RCS_TIMESTAMP
In reply to Damien Lespiau--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -968,7 +968,7 @@ static const struct register_whitelist {/* supported gens, 0x10 for 4, 0x30 for 4 and 5, etc. */ uint32_t gen_bitmask; } whitelist[] = { - { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 8) }, + { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 9) }, }; int i915_reg_read_ioctl(struct drm_device *dev,
Signature · 1 line
1.8.3.1
Re: [PATCH 24/89] drm/i915/skl: Allow the reg_read ioctl to return RCS_TIMESTAMP
This seems to allow more than just the RCS timestamp, but also allow the I915_REG_READ ioctl for gen9.
Anyway:
Quoted 27 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_uncore.c +1
-2@@ -968,7 +968,7 @@ static const struct register_whitelist {/* supported gens, 0x10 for 4, 0x30 for 4 and 5, etc. */ uint32_t gen_bitmask; } whitelist[] = { - { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 8) }, + { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 9) }, }; int i915_reg_read_ioctl(struct drm_device *dev, --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 24/89] drm/i915/skl: Allow the reg_read ioctl to return RCS_TIMESTAMP
Quoted 2 lines · Rodrigo Vivi
This seems to allow more than just the RCS timestamp, but also allow the
I915_REG_READioctl for gen9.
Well, yes, this array is the white list for the reg_read ioctl, so that's expected.
Quoted 36 lines
Anyway: Reviewed-by: Rodrigo Vivi <[email protected]> On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <[email protected]> wrote: Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 918b761..3b27fb0 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -968,7 +968,7 @@ static const struct register_whitelist { /* supported gens, 0x10 for 4, 0x30 for 4 and 5, etc. */ uint32_t gen_bitmask; } whitelist[] = { - { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 8) }, + { RING_TIMESTAMP(RENDER_RING_BASE), 8, GEN_RANGE(4, 9) }, }; int i915_reg_read_ioctl(struct drm_device *dev, -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Rodrigo Vivi Blog: http://blog.vivi.eng.br
PATCH 25/89 drm/i915/skl: report the same INSTDONE registers as gen8
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_gpu_error.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gpu_error.c +1 -0
@@ -1390,6 +1390,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone)WARN_ONCE (1 ,"Unsupported platform\n" );case 7 :case 8 : +case 9 : instdone[0 ] =I915_READ (GEN7_INSTDONE_1 ); instdone[1 ] =I915_READ (GEN7_SC_INSTDONE ); instdone[2 ] =I915_READ (GEN7_SAMPLER_INSTDONE );
Signature · 1 line
1.8.3.1
Re: [PATCH 25/89] drm/i915/skl: report the same INSTDONE registers as gen8
Quoted 27 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gpu_error.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/i915_gpu_error.c +1
-0@@ -1390,6 +1390,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone) WARN_ONCE(1, "Unsupported platform\n");case 7 :case 8 : +case 9 : instdone[0 ] =I915_READ (GEN7_INSTDONE_1 ); instdone[1 ] =I915_READ (GEN7_SC_INSTDONE );instdone[2] = I915_READ(GEN7_SAMPLER_INSTDONE);--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 26/89 drm/i915/skl: Report the PDP regs as in gen8
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_gpu_error.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_gpu_error.c +1 -0
@@ -924,6 +924,7 @@ static void i915_record_ring_state(struct drm_device *dev, ering->vm_info.gfx_mode =I915_READ (RING_MODE_GEN7 (ring));switch (INTEL_INFO (dev)->gen) { +case 9 :case 8 :for (i =0 ; i <4 ; i++) { ering->vm_info.pdp[i] =
Signature · 1 line
1.8.3.1
Re: [PATCH 26/89] drm/i915/skl: Report the PDP regs as in gen8
I just noticed this is a "legacy" mode 48b and standard for skl would be a 64b aligned..
But anyway this seems to be the right for now so
Quoted 27 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_gpu_error.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/i915_gpu_error.c +1
-0@@ -924,6 +924,7 @@ static void i915_record_ring_state(struct drm_device *dev, ering->vm_info.gfx_mode =I915_READ (RING_MODE_GEN7 (ring));switch (INTEL_INFO (dev)->gen) { +case 9 :case 8 :for (i =0 ; i <4 ; i++) {ering->vm_info.pdp[i] =--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 27/89 drm/i915/skl: SKL shares the same underrun interrupt as BDW
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -503,7 +503,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,ironlake_set_fifo_underrun_reporting (dev, pipe, enable); else if (IS_GEN7(dev)) ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old); - else if (IS_GEN8(dev)) + else if (IS_GEN8(dev) || IS_GEN9(dev)) broadwell_set_fifo_underrun_reporting(dev, pipe, enable);return old;
Signature · 1 line
1.8.3.1
Re: [PATCH 27/89] drm/i915/skl: SKL shares the same underrun interrupt as BDW
the rest of DE_PIPE_INTERRUPT definition is different from BDW to SKL but the underrun is indeed the same!
Quoted 29 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_irq.c +1
-1@@ -503,7 +503,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,ironlake_set_fifo_underrun_reporting (dev, pipe, enable); else if (IS_GEN7(dev)) ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old); - else if (IS_GEN8(dev)) + else if (IS_GEN8(dev) || IS_GEN9(dev)) broadwell_set_fifo_underrun_reporting(dev, pipe, enable);return old;--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 28/89 drm/i915/skl: SKL pipe misc programming
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
Pipe misc programming in gen9 is similar to BDW. Extending the BDW implementation to gen 9.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -7022,7 +7022,7 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc)I915_WRITE (GAMMA_MODE (intel_crtc->pipe),GAMMA_MODE_MODE_8BIT );POSTING_READ (GAMMA_MODE (intel_crtc->pipe)); -if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) ||INTEL_INFO (dev)->gen >=9 ) { val =0 ;switch (intel_crtc->config.pipe_bpp) {
Signature · 1 line
1.8.3.1
Re: [PATCH 28/89] drm/i915/skl: SKL pipe misc programming
Again, PIPE_MISC has differences, but this dither set part is identical!
So:
Quoted 34 lines · Damien Lespiau
From: Satheeshakrishna M <[email protected]>
Pipe misc programming in gen9 is similar to BDW. Extending the BDW implementation to gen 9.
Signed-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -7022,7 +7022,7 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc)I915_WRITE (GAMMA_MODE (intel_crtc->pipe),GAMMA_MODE_MODE_8BIT );POSTING_READ (GAMMA_MODE (intel_crtc->pipe)); -if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) ||INTEL_INFO (dev)->gen >=9 ) { val =0 ;switch (intel_crtc->config.pipe_bpp) {--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 29/89 drm/i915/skl: vfuncs for skl eld and global resource
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
Set gen 9 function pointers for eld write and global resource. Implementation remains same as HSW.
v2: Rebase on top of Sonika's untangling of the if/else ladder (Damien)
--- drivers/gpu/drm/i915/intel_display.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_display.c +4 -0
@@ -12654,6 +12654,10 @@ static void intel_init_display(struct drm_device *dev) dev_priv->display.modeset_global_resources = valleyview_modeset_global_resources; dev_priv->display.write_eld = ironlake_write_eld; + }else if (INTEL_INFO (dev)->gen >=9 ) { + dev_priv->display.write_eld = haswell_write_eld; + dev_priv->display.modeset_global_resources = + haswell_modeset_global_resources; }/* Default just returns -ENODEV to indicate unsupported */
Signature · 1 line
1.8.3.1
Re: [PATCH 29/89] drm/i915/skl: vfuncs for skl eld and global resource
isn't fdi_link_training needed?
if not: Reviewed-by: Rodrigo Vivi <[email protected]>
Quoted 38 lines · Damien Lespiau
From: Satheeshakrishna M <[email protected]>
Set gen 9 function pointers for eld write and global resource. Implementation remains same as HSW.
v2: Rebase on top of Sonika's untangling of the if/else ladder (Damien)
Signed-off-by Satheeshakrishna M <[email protected]> (v1)Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/intel_display.c +4
-0@@ -12654,6 +12654,10 @@ static void intel_init_display(struct drm_device *dev) dev_priv->display.modeset_global_resources = valleyview_modeset_global_resources; dev_priv->display.write_eld = ironlake_write_eld; + }else if (INTEL_INFO (dev)->gen >=9 ) { + dev_priv->display.write_eld = haswell_write_eld; + dev_priv->display.modeset_global_resources = + haswell_modeset_global_resources; }/* Default just returns -ENODEV to indicate unsupported */--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 29/89] drm/i915/skl: vfuncs for skl eld and global resource
Quoted 1 line · Rodrigo Vivi
isn't
fdi_link_trainingneeded?
No, it's not. SKL doesn't have FDI.
Signature · 1 line
Damien
Quoted 46 lines
if not: Reviewed-by: Rodrigo Vivi <[email protected]> On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <[email protected]> wrote: From: Satheeshakrishna M <[email protected]> Set gen 9 function pointers for eld write and global resource. Implementation remains same as HSW. v2: Rebase on top of Sonika's untangling of the if/else ladder (Damien) Signed-off-by: Satheeshakrishna M <[email protected]> (v1) Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/intel_display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bffabfd..48d2d0d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -12654,6 +12654,10 @@ static void intel_init_display(struct drm_device *dev) dev_priv->display.modeset_global_resources = valleyview_modeset_global_resources; dev_priv->display.write_eld = ironlake_write_eld; + } else if (INTEL_INFO(dev)->gen >= 9) { + dev_priv->display.write_eld = haswell_write_eld; + dev_priv->display.modeset_global_resources = + haswell_modeset_global_resources; } /* Default just returns -ENODEV to indicate unsupported */ -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Rodrigo Vivi Blog: http://blog.vivi.eng.br
PATCH 30/89 drm/i915/skl: SKL backlight enabling
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
Extending the BDW backlight implementation to SKL.
--- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_panel.c +1 -1
@@ -1317,7 +1317,7 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 )) { dev_priv->display.setup_backlight = bdw_setup_backlight; dev_priv->display.enable_backlight = bdw_enable_backlight; dev_priv->display.disable_backlight = pch_disable_backlight;
Signature · 1 line
1.8.3.1
Re: [PATCH 30/89] drm/i915/skl: SKL backlight enabling
This is wrong.
A skl_enable_backlight must be created setting c8254 propperly without the shift 16. Also maybe setting c8354h.
Quoted 34 lines · Damien Lespiau
From: Satheeshakrishna M <[email protected]>
Extending the BDW backlight implementation to SKL.
Signed-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_panel.c +1
-1@@ -1317,7 +1317,7 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 )) { dev_priv->display.setup_backlight = bdw_setup_backlight; dev_priv->display.enable_backlight = bdw_enable_backlight;dev_priv->display.disable_backlight =
pch_disable_backlight;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 30/89] drm/i915/skl: SKL backlight enabling
Quoted 4 lines · Rodrigo Vivi
This is wrong.
A
skl_enable_backlightmust be created setting c8254 propperly without the shift 16. Also maybe setting c8354h.
Nope, this is all right for skl/spt, with the small exception that it'll need the equivalent of [1]. I'll post another version addressing Ville's comments.
BR,
Jani.
[1] http://mid.gmane.org/[email protected]
Quoted 49 lines
Quoted 34 lines · Damien Lespiau
From: Satheeshakrishna M <[email protected]>
Extending the BDW backlight implementation to SKL.
Signed-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_panel.c +1
-1@@ -1317,7 +1317,7 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 )) { dev_priv->display.setup_backlight = bdw_setup_backlight; dev_priv->display.enable_backlight = bdw_enable_backlight;dev_priv->display.disable_backlight =
pch_disable_backlight;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH 30/89] drm/i915/skl: SKL backlight enabling
besides the override bit,
c8254h for bdw has the pwm frequency on 31:16 and on skl the frequency on same register address is from 31:0 and also a pwm 2 register on c8354h. So I think this patch can be right if there is an if IS_SKL without the >> 16 part inside bdw_enable_backlight.
Quoted 73 lines · Jani Nikula
Quoted 3 lines · Rodrigo Vivi
This is wrong.
A
skl_enable_backlightmust be created setting c8254 propperly withoutthe
Quoted 1 line
shift 16. Also maybe setting c8354h.
Nope, this is all right for skl/spt, with the small exception that it'll need the equivalent of [1]. I'll post another version addressing Ville's comments.
BR,
Jani.[1] http://mid.gmane.org/[email protected]
Quoted 26 lines
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <[email protected]
Quoted 20 lines · wrote:
From: Satheeshakrishna M <[email protected]>
Extending the BDW backlight implementation to SKL.
Signed-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_panel.c +0
-0@@ -1317,7 +1317,7 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;Quoted 4 lines
drivers/gpu/drm/i915/intel_panel.c void intel_panel_init_backlight_funcs(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_panel.c +1
-1-if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 )) { dev_priv->display.setup_backlight = bdw_setup_backlight; dev_priv->display.enable_backlight =
bdw_enable_backlight;Quoted 13 lines
Quoted 10 lines
dev_priv->display.disable_backlight =
pch_disable_backlight;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 7 lines
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Jani Nikula, Intel Open Source Technology Center
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
Reviewed-byRe: [PATCH 30/89] drm/i915/skl: SKL backlight enabling
Oh Jani showed me that I was looking to the wrong spec.
So just ignore my previous comments and use:
Quoted 92 lines · Rodrigo Vivi
besides the override bit,
c8254h for bdw has the pwm frequency on 31:16 and on skl the frequency on same register address is from 31:0 and also a pwm 2 register on c8354h. So I think this patch can be right if there is an ifIS_SKLwithout the >> 16 part insidebdw_enable_backlight.Quoted 71 lines · Jani Nikula
Quoted 3 lines · Rodrigo Vivi
This is wrong.
A
skl_enable_backlightmust be created setting c8254 propperly withoutthe
Quoted 1 line
shift 16. Also maybe setting c8354h.
Nope, this is all right for skl/spt, with the small exception that it'll need the equivalent of [1]. I'll post another version addressing Ville's comments.
BR,
Jani.[1] http://mid.gmane.org/[email protected]
Quoted 3 lines
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <
Quoted 22 lines
Quoted 20 lines · wrote:
From: Satheeshakrishna M <[email protected]>
Extending the BDW backlight implementation to SKL.
Signed-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_panel.c +0
-0@@ -1317,7 +1317,7 @@ void intel_panel_init_backlight_funcs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;Quoted 3 lines
drivers/gpu/drm/i915/intel_panel.c void intel_panel_init_backlight_funcs(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_panel.c +1
-1-if (IS_BROADWELL (dev)) { +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 )) { dev_priv->display.setup_backlight =
bdw_setup_backlight;Quoted 1 line
drivers/gpu/drm/i915/intel_panel.c void intel_panel_init_backlight_funcs(struct · line 1323
Quoted 1 line
drivers/gpu/drm/i915/intel_panel.c +0
-0dev_priv->display.enable_backlight =
bdw_enable_backlight;Quoted 13 lines
Quoted 10 lines
dev_priv->display.disable_backlight =
pch_disable_backlight;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 7 lines
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 3 lines
--
Jani Nikula, Intel Open Source Technology Center--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 31/89 drm/i915/skl: Restore pipe B/C interrupts
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
Extending BDW implementation to gen9. Pipe B/C interrupt restoration after exiting LPSP.
v2: Fix minor rebasing conflict.
--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -6277,7 +6277,7 @@ static void hsw_power_well_post_enable(struct drm_i915_private *dev_priv)outb (inb (VGA_MSR_READ ),VGA_MSR_WRITE );vga_put (dev->pdev,VGA_RSRC_LEGACY_IO ); -if (IS_BROADWELL (dev)) +if (IS_BROADWELL (dev) || (INTEL_INFO (dev)->gen >=9 ))gen8_irq_power_well_post_enable (dev_priv); }
Signature · 1 line
1.8.3.1
PATCH 32/89 drm/i915/skl: Adjust the display engine interrupts
In reply to Damien LespiauTo accomodate the extra planes, the bit definitions were shuffled around a bit.
v2: Rebase on top of the for_each_pipe() change adding dev_priv as first
argument.
--- drivers/gpu/drm/i915/i915_irq.c | 37 ++++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/i915_reg.h | 13 +++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +28 -9
@@ -2584,7 +2584,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) }for_each_pipe (dev_priv, pipe) { -uint32_t pipe_iir; +uint32_t pipe_iir, flip_done =0 , fault_errors =0 ;if (!(master_ctl &GEN8_DE_PIPE_IRQ (pipe)))continue ;
@@ -2593,10 +2593,16 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)if (pipe_iir) { ret =IRQ_HANDLED ;I915_WRITE (GEN8_DE_PIPE_IIR (pipe), pipe_iir); +if (pipe_iir &GEN8_PIPE_VBLANK )intel_pipe_handle_vblank (dev, pipe); -if (pipe_iir &GEN8_PIPE_PRIMARY_FLIP_DONE ) { +if (IS_GEN9 (dev)) + flip_done = pipe_iir &GEN9_PIPE_PLANE1_FLIP_DONE ; +else + flip_done = pipe_iir &GEN8_PIPE_PRIMARY_FLIP_DONE ; + +if (flip_done) {intel_prepare_page_flip (dev, pipe);intel_finish_page_flip_plane (dev, pipe); }
@@ -2611,11 +2617,16 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) pipe_name(pipe)); } -if (pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ) { + +if (IS_GEN9 (dev)) + fault_errors = pipe_iir &GEN9_DE_PIPE_IRQ_FAULT_ERRORS ; +else + fault_errors = pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; + +if (fault_errors)DRM_ERROR ("Fault errors on pipe %c\n: 0x%08x" ,pipe_name (pipe), pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ); - } }else DRM_ERROR ("The master control interrupt lied (DE PIPE)!\n" ); }
@@ -3845,12 +3856,20 @@ static void gen8_gt_irq_postinstall(struct drm_i915_private *dev_priv)static void gen8_de_irq_postinstall (struct drm_i915_private *dev_priv) { -uint32_t de_pipe_masked =GEN8_PIPE_PRIMARY_FLIP_DONE | -GEN8_PIPE_CDCLK_CRC_DONE | -GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; -uint32_t de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | -GEN8_PIPE_FIFO_UNDERRUN ; +uint32_t de_pipe_masked =GEN8_PIPE_CDCLK_CRC_DONE ; +uint32_t de_pipe_enables;int pipe; + +if (IS_GEN9 (dev_priv)) + de_pipe_masked |=GEN9_PIPE_PLANE1_FLIP_DONE | +GEN9_DE_PIPE_IRQ_FAULT_ERRORS ; +else + de_pipe_masked |=GEN8_PIPE_PRIMARY_FLIP_DONE | +GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; + + de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | +GEN8_PIPE_FIFO_UNDERRUN ; + dev_priv->de_irq_mask[PIPE_A ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_B ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_C ] = ~de_pipe_masked;
drivers/gpu/drm/i915/i915_reg.h +13 -0
@@ -4840,10 +4840,23 @@ enum punit_power_well {#define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2)#define GEN8_PIPE_VSYNC (1 << 1)#define GEN8_PIPE_VBLANK (1 << 0) +#define GEN9_PIPE_CURSOR_FAULT (1 << 11) +#define GEN9_PIPE_PLANE3_FAULT (1 << 9) +#define GEN9_PIPE_PLANE2_FAULT (1 << 8) +#define GEN9_PIPE_PLANE1_FAULT (1 << 7) +#define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5) +#define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4) +#define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3) +#define GEN9_PIPE_PLANE_FLIP_DONE (p) (1 << (3 + p))#define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \ (GEN8_PIPE_CURSOR_FAULT | \ GEN8_PIPE_SPRITE_FAULT | \ GEN8_PIPE_PRIMARY_FAULT) +#define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \ + (GEN9_PIPE_CURSOR_FAULT | \ + GEN9_PIPE_PLANE3_FAULT | \ + GEN9_PIPE_PLANE2_FAULT | \ + GEN9_PIPE_PLANE1_FAULT)#define GEN8_DE_PORT_ISR 0x44440#define GEN8_DE_PORT_IMR 0x44444
Signature · 1 line
1.8.3.1
Re: [PATCH 32/89] drm/i915/skl: Adjust the display engine interrupts
Quoted 51 lines · Damien Lespiau
To accomodate the extra planes, the bit definitions were shuffled around a bit.
v2: Rebase on top of the
for_each_pipe()change addingdev_privas first
argument.Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 37 ++++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/i915_reg.h | 13 +++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_irq.c +11
-3@@ -2584,7 +2584,7 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) }for_each_pipe (dev_priv, pipe) { -uint32_t pipe_iir; +uint32_t pipe_iir, flip_done =0 , fault_errors =0 ;if (!(master_ctl &GEN8_DE_PIPE_IRQ (pipe)))continue ;@@ -2593,10 +2593,16 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)if (pipe_iir) { ret =IRQ_HANDLED ;I915_WRITE (GEN8_DE_PIPE_IIR (pipe), pipe_iir); +if (pipe_iir &GEN8_PIPE_VBLANK )intel_pipe_handle_vblank (dev, pipe); -if (pipe_iir &GEN8_PIPE_PRIMARY_FLIP_DONE ) { +if (IS_GEN9 (dev)) + flip_done = pipe_iir &GEN9_PIPE_PLANE1_FLIP_DONE ; +else + flip_done = pipe_iir &GEN8_PIPE_PRIMARY_FLIP_DONE ; + +if (flip_done) {intel_prepare_page_flip (dev, pipe);intel_finish_page_flip_plane (dev, pipe); }@@ -2611,11 +2617,16 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) pipe_name(pipe)); } -if (pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ) { + +if (IS_GEN9 (dev)) + fault_errors = pipe_iir &GEN9_DE_PIPE_IRQ_FAULT_ERRORS ;
drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg) · line 2631
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +4
-1+else + fault_errors = pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; + +if (fault_errors)DRM_ERROR ("Fault errors on pipe %c\n: 0x%08x" ,pipe_name (pipe), pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ); - } }else DRM_ERROR ("The master control interrupt lied (DE PIPE)!\n" );
gen8+ irq handling functions would _really_ benefit from a bit of function extraction to prevent them from falling off the right edge of my screen all the time ...
Just in case you have no idea what to do on a rainy day ;-) -Daniel
Quoted 62 lines
drivers/gpu/drm/i915/i915_irq.c +13
-5}@@ -3845,12 +3856,20 @@ static void gen8_gt_irq_postinstall(struct drm_i915_private *dev_priv)static void gen8_de_irq_postinstall (struct drm_i915_private *dev_priv) { -uint32_t de_pipe_masked =GEN8_PIPE_PRIMARY_FLIP_DONE | -GEN8_PIPE_CDCLK_CRC_DONE | -GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; -uint32_t de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | -GEN8_PIPE_FIFO_UNDERRUN ; +uint32_t de_pipe_masked =GEN8_PIPE_CDCLK_CRC_DONE ; +uint32_t de_pipe_enables;int pipe; + +if (IS_GEN9 (dev_priv)) + de_pipe_masked |=GEN9_PIPE_PLANE1_FLIP_DONE | +GEN9_DE_PIPE_IRQ_FAULT_ERRORS ; +else + de_pipe_masked |=GEN8_PIPE_PRIMARY_FLIP_DONE | +GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; + + de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | +GEN8_PIPE_FIFO_UNDERRUN ; + dev_priv->de_irq_mask[PIPE_A ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_B ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_C ] = ~de_pipe_masked;drivers/gpu/drm/i915/i915_reg.h +13
-0@@ -4840,10 +4840,23 @@ enum punit_power_well {#define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2)#define GEN8_PIPE_VSYNC (1 << 1)#define GEN8_PIPE_VBLANK (1 << 0) +#define GEN9_PIPE_CURSOR_FAULT (1 << 11) +#define GEN9_PIPE_PLANE3_FAULT (1 << 9) +#define GEN9_PIPE_PLANE2_FAULT (1 << 8) +#define GEN9_PIPE_PLANE1_FAULT (1 << 7) +#define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5) +#define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4) +#define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3) +#define GEN9_PIPE_PLANE_FLIP_DONE (p) (1 << (3 + p))#define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \ (GEN8_PIPE_CURSOR_FAULT | \ GEN8_PIPE_SPRITE_FAULT | \ GEN8_PIPE_PRIMARY_FAULT) +#define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \ + (GEN9_PIPE_CURSOR_FAULT | \ + GEN9_PIPE_PLANE3_FAULT | \ + GEN9_PIPE_PLANE2_FAULT | \ + GEN9_PIPE_PLANE1_FAULT)#define GEN8_DE_PORT_ISR 0x44440#define GEN8_DE_PORT_IMR 0x44444Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Rodrigo Vivi
Reviewed-byRe: [PATCH 32/89] drm/i915/skl: Adjust the display engine interrupts
Oh cool here are the actual fixes on de_pipe int bits!
I agree with Daniel that a separated function would be better, but what is here is right anyway so
Quoted 156 lines · Daniel Vetter
Quoted 9 lines · Damien Lespiau
To accomodate the extra planes, the bit definitions were shuffled around a bit.
v2: Rebase on top of the
for_each_pipe()change addingdev_privas first
argument.Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 37++++++++++++++++++++++++++++---------
Review
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h | 13 +++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_irq.cdrivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void
Quoted 4 lines
index c62a2e4..734b73e 100644
drivers/gpu/drm/i915/i915_irq.c +0
-0@@ -2584,7 +2584,7 @@ static irqreturn_t gen8_irq_handler(int irq, void*arg)
drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq,
Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +1
-1}for_each_pipe (dev_priv, pipe) { -uint32_t pipe_iir; +uint32_t pipe_iir, flip_done =0 , fault_errors =0 ;if (!(master_ctl &GEN8_DE_PIPE_IRQ (pipe)))continue ;@@ -2593,10 +2593,16 @@ static irqreturn_t gen8_irq_handler(int irq,void *arg)
drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg)
Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +3
-1if (pipe_iir) { ret =IRQ_HANDLED ;I915_WRITE (GEN8_DE_PIPE_IIR (pipe), pipe_iir); +if (pipe_iir &GEN8_PIPE_VBLANK )intel_pipe_handle_vblank (dev, pipe); -if (pipe_iir &GEN8_PIPE_PRIMARY_FLIP_DONE ) { +if (IS_GEN9 (dev)) + flip_done = pipe_iir &
GEN9_PIPE_PLANE1_FLIP_DONE;drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, · line 2603
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+else + flip_done = pipe_iir &
GEN8_PIPE_PRIMARY_FLIP_DONE;drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq,
Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+ +if (flip_done) {intel_prepare_page_flip (dev, pipe);intel_finish_page_flip_plane (dev, pipe); }@@ -2611,11 +2617,16 @@ static irqreturn_t gen8_irq_handler(int irq,void *arg)
drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg)
Quoted 7 lines
drivers/gpu/drm/i915/i915_irq.c +3
-1pipe_name(pipe)); } -if (pipe_iir &GEN8_DE_PIPE_IRQ_FAULT_ERRORS ) { + +if (IS_GEN9 (dev)) + fault_errors = pipe_iir &
GEN9_DE_PIPE_IRQ_FAULT_ERRORS;drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, · line 2624
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+else + fault_errors = pipe_iir &
GEN8_DE_PIPE_IRQ_FAULT_ERRORS;drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg)
Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +2
-0+ +if (fault_errors) DRM_ERROR("Fault errors on pipe %c\n:0x%08x",
drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, · line 2629
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +0
-0pipe_name (pipe), pipe_iir &
GEN8_DE_PIPE_IRQ_FAULT_ERRORS);drivers/gpu/drm/i915/i915_irq.c static irqreturn_t gen8_irq_handler(int irq, void *arg)
Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +0
-1- } }else DRM_ERROR("The master control interrupt lied (DEPIPE)!\n");
gen8+ irq handling functions would _really_ benefit from a bit of function extraction to prevent them from falling off the right edge of my screen all the time ...
Just in case you have no idea what to do on a rainy day ;-) -Daniel
drivers/gpu/drm/i915/i915_irq.c static void gen8_gt_irq_postinstall(struct
Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +0
-0}@@ -3845,12 +3856,20 @@ static void gen8_gt_irq_postinstall(struct
drm_i915_private*dev_priv)Review
Quoted 26 lines
drivers/gpu/drm/i915/i915_irq.c +13
-5static void gen8_de_irq_postinstall (struct drm_i915_private *dev_priv) { -uint32_t de_pipe_masked =GEN8_PIPE_PRIMARY_FLIP_DONE | -GEN8_PIPE_CDCLK_CRC_DONE | -GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; -uint32_t de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | -GEN8_PIPE_FIFO_UNDERRUN ; +uint32_t de_pipe_masked =GEN8_PIPE_CDCLK_CRC_DONE ; +uint32_t de_pipe_enables;int pipe; + +if (IS_GEN9 (dev_priv)) + de_pipe_masked |=GEN9_PIPE_PLANE1_FLIP_DONE | +GEN9_DE_PIPE_IRQ_FAULT_ERRORS ; +else + de_pipe_masked |=GEN8_PIPE_PRIMARY_FLIP_DONE | +GEN8_DE_PIPE_IRQ_FAULT_ERRORS ; + + de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK | +GEN8_PIPE_FIFO_UNDERRUN ; + dev_priv->de_irq_mask[PIPE_A ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_B ] = ~de_pipe_masked; dev_priv->de_irq_mask[PIPE_C ] = ~de_pipe_masked;(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_reg.hQuoted 30 lines
index acd0a7b..5928a75 100644
drivers/gpu/drm/i915/i915_reg.h +13
-1@@ -4840,10 +4840,23 @@ enum punit_power_well {#define GEN8_PIPE_SCAN_LINE_EVENT (1 << 2)#define GEN8_PIPE_VSYNC (1 << 1)#define GEN8_PIPE_VBLANK (1 << 0) +#define GEN9_PIPE_CURSOR_FAULT (1 << 11) +#define GEN9_PIPE_PLANE3_FAULT (1 << 9) +#define GEN9_PIPE_PLANE2_FAULT (1 << 8) +#define GEN9_PIPE_PLANE1_FAULT (1 << 7) +#define GEN9_PIPE_PLANE3_FLIP_DONE (1 << 5) +#define GEN9_PIPE_PLANE2_FLIP_DONE (1 << 4) +#define GEN9_PIPE_PLANE1_FLIP_DONE (1 << 3) +#define GEN9_PIPE_PLANE_FLIP_DONE (p) (1 << (3 + p))#define GEN8_DE_PIPE_IRQ_FAULT_ERRORS \ (GEN8_PIPE_CURSOR_FAULT | \ GEN8_PIPE_SPRITE_FAULT | \ GEN8_PIPE_PRIMARY_FAULT) +#define GEN9_DE_PIPE_IRQ_FAULT_ERRORS \ + (GEN9_PIPE_CURSOR_FAULT | \ + GEN9_PIPE_PLANE3_FAULT | \ + GEN9_PIPE_PLANE2_FAULT | \ + GEN9_PIPE_PLANE1_FAULT)#define GEN8_DE_PORT_ISR 0x44440#define GEN8_DE_PORT_IMR 0x44444 --1.8.3.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 32/89] drm/i915/skl: Adjust the display engine interrupts
Quoted 3 lines · Rodrigo Vivi
Oh cool here are the actual fixes on
de_pipeint bits!
I agree with Daniel that a separated function would be better, but what is here is right anyway so
Took a note about that. Will have to wait for when the situation has settled down a bit.
Signature · 1 line
Damien
PATCH 33/89 drm/i915/skl: Sunrise Point PCH detection
In reply to Damien LespiauFrom: Satheeshakrishna M <[email protected]>
This patch implements detection of SPT and SPT-LP PCH devices.
v2: Added HAS_PCH_SPT macro
--- drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +10 -0
@@ -475,6 +475,16 @@ void intel_detect_pch(struct drm_device *dev)DRM_DEBUG_KMS ("Found LynxPoint LP PCH\n" );WARN_ON (!IS_HASWELL (dev));WARN_ON (!IS_ULT (dev)); + }else if (id ==INTEL_PCH_SPT_DEVICE_ID_TYPE ) { + dev_priv->pch_type =PCH_SPT ; +DRM_DEBUG_KMS ("Found SunrisePoint PCH\n" ); +WARN_ON (!IS_SKYLAKE (dev)); +WARN_ON (IS_ULT (dev)); + }else if (id ==INTEL_PCH_SPT_LP_DEVICE_ID_TYPE ) { + dev_priv->pch_type =PCH_SPT ; +DRM_DEBUG_KMS ("Found SunrisePoint LP PCH\n" ); +WARN_ON (!IS_SKYLAKE (dev)); +WARN_ON (!IS_ULT (dev)); }else continue ;
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -699,6 +699,7 @@ enum intel_pch {PCH_IBX ,/* Ibexpeak PCH */ PCH_CPT ,/* Cougarpoint PCH */ PCH_LPT ,/* Lynxpoint PCH */ +PCH_SPT ,/* Sunrisepoint PCH */ PCH_NOP, };
@@ -2184,8 +2185,11 @@ struct drm_i915_cmd_table {#define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00#define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00#define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 +#define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 +#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00#define INTEL_PCH_TYPE (dev) (to_i915(dev)->pch_type) +#define HAS_PCH_SPT (dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)#define HAS_PCH_LPT (dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)#define HAS_PCH_CPT (dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)#define HAS_PCH_IBX (dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
Signature · 1 line
1.8.3.1
Re: [PATCH 33/89] drm/i915/skl: Sunrise Point PCH detection
Where can I find these pch device id definitions?
Quoted 69 lines · Damien Lespiau
From: Satheeshakrishna M <[email protected]>
This patch implements detection of SPT and SPT-LP PCH devices.
v2: Added
HAS_PCH_SPTmacroSigned-off-by Satheeshakrishna M <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/gpu/drm/i915/i915_drv.c +10
-0@@ -475,6 +475,16 @@ void intel_detect_pch(struct drm_device *dev)DRM_DEBUG_KMS ("Found LynxPoint LP PCH\n" );WARN_ON (!IS_HASWELL (dev));WARN_ON (!IS_ULT (dev)); + }else if (id ==INTEL_PCH_SPT_DEVICE_ID_TYPE ) { + dev_priv->pch_type =PCH_SPT ; +DRM_DEBUG_KMS ("Found SunrisePoint PCH\n" ); +WARN_ON (!IS_SKYLAKE (dev)); +WARN_ON (IS_ULT (dev)); + }else if (id ==INTEL_PCH_SPT_LP_DEVICE_ID_TYPE ) { + dev_priv->pch_type =PCH_SPT ; +DRM_DEBUG_KMS ("Found SunrisePoint LP PCH\n"); +WARN_ON (!IS_SKYLAKE (dev)); +WARN_ON (!IS_ULT (dev)); }else continue ;drivers/gpu/drm/i915/i915_drv.h +4
-1@@ -699,6 +699,7 @@ enum intel_pch {PCH_IBX ,/* Ibexpeak PCH */ PCH_CPT ,/* Cougarpoint PCH */ PCH_LPT ,/* Lynxpoint PCH */ +PCH_SPT ,/* Sunrisepoint PCH */ PCH_NOP, };@@ -2184,8 +2185,11 @@ struct drm_i915_cmd_table {#define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00#define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00#define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 +#define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 +#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00#define INTEL_PCH_TYPE (dev) (to_i915(dev)->pch_type) +#define HAS_PCH_SPT (dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)#define HAS_PCH_LPT (dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)#define HAS_PCH_CPT (dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)#define HAS_PCH_IBX (dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 33/89] drm/i915/skl: Sunrise Point PCH detection
Quoted 1 line · Rodrigo Vivi
Where can I find these pch device id definitions?
You'll have to trust Satheesh on that, it's not something we have documented in the GPU specs.
Signature · 1 line
Damien
Quoted 79 lines
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <[email protected]> wrote: From: Satheeshakrishna M <[email protected]> This patch implements detection of SPT and SPT-LP PCH devices. v2: Added HAS_PCH_SPT macro Signed-off-by: Satheeshakrishna M <[email protected]> Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 3d7f823..c6a8a80 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -475,6 +475,16 @@ void intel_detect_pch(struct drm_device *dev) DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); WARN_ON(!IS_HASWELL(dev)); WARN_ON(!IS_ULT(dev)); + } else if (id == INTEL_PCH_SPT_DEVICE_ID_TYPE) { + dev_priv->pch_type = PCH_SPT; + DRM_DEBUG_KMS("Found SunrisePoint PCH\n"); + WARN_ON(!IS_SKYLAKE(dev)); + WARN_ON(IS_ULT(dev)); + } else if (id == INTEL_PCH_SPT_LP_DEVICE_ID_TYPE) { + dev_priv->pch_type = PCH_SPT; + DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n"); + WARN_ON(!IS_SKYLAKE(dev)); + WARN_ON(!IS_ULT(dev)); } else continue; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cf4fc86..be82888 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -699,6 +699,7 @@ enum intel_pch { PCH_IBX, /* Ibexpeak PCH */ PCH_CPT, /* Cougarpoint PCH */ PCH_LPT, /* Lynxpoint PCH */ + PCH_SPT, /* Sunrisepoint PCH */ PCH_NOP, }; @@ -2184,8 +2185,11 @@ struct drm_i915_cmd_table { #define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00 #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 +#define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 +#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00 #define INTEL_PCH_TYPE(dev) (to_i915(dev)->pch_type) +#define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT) #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Rodrigo Vivi Blog: http://blog.vivi.eng.br
Rodrigo Vivi
Reviewed-byRe: [PATCH 33/89] drm/i915/skl: Sunrise Point PCH detection
Oh! ok, so let's not block the progress
Thanks, so feel free to use:
Quoted 91 lines · Damien Lespiau
Quoted 1 line · Rodrigo Vivi
Where can I find these pch device id definitions?
You'll have to trust Satheesh on that, it's not something we have documented in the GPU specs.
--
DamienQuoted 1 line
On Thu, Sep 4, 2014 at 4:26 AM, Damien Lespiau <
Quoted 18 lines
wrote: From: Satheeshakrishna M <[email protected]> This patch implements detection of SPT and SPT-LP PCH devices. v2: Added HAS_PCH_SPT macro Signed-off-by: Satheeshakrishna M <[email protected]> Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 3d7f823..c6a8a80 100644Quoted 8 lines
--- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -475,6 +475,16 @@ void intel_detect_pch(struct drm_device *dev) DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); WARN_ON(!IS_HASWELL(dev)); WARN_ON(!IS_ULT(dev)); + } else if (id ==
INTEL_PCH_SPT_DEVICE_ID_TYPE) {Quoted 52 lines
+ dev_priv->pch_type = PCH_SPT; + DRM_DEBUG_KMS("Found SunrisePoint PCH\n"); + WARN_ON(!IS_SKYLAKE(dev)); + WARN_ON(IS_ULT(dev)); + } else if (id == INTEL_PCH_SPT_LP_DEVICE_ID_TYPE) { + dev_priv->pch_type = PCH_SPT; + DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n"); + WARN_ON(!IS_SKYLAKE(dev)); + WARN_ON(!IS_ULT(dev)); } else continue; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cf4fc86..be82888 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -699,6 +699,7 @@ enum intel_pch { PCH_IBX, /* Ibexpeak PCH */ PCH_CPT, /* Cougarpoint PCH */ PCH_LPT, /* Lynxpoint PCH */ + PCH_SPT, /* Sunrisepoint PCH */ PCH_NOP, }; @@ -2184,8 +2185,11 @@ struct drm_i915_cmd_table { #define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00 #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 +#define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 +#define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00 #define INTEL_PCH_TYPE(dev) (to_i915(dev)->pch_type) +#define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT) #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx-- Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 34/89 drm/i915/skl: Implement WaDisableSDEUnitClockGating:skl
In reply to Damien Lespiau--- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +8 -0
@@ -68,6 +68,14 @@static void gen9_init_clock_gating (struct drm_device *dev) { +struct drm_i915_private *dev_priv = dev->dev_private; + +/* +* WaDisableSDEUnitClockGating:skl +* This seems to be a pre-production w/a. +*/ +I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) | +GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); }static void i8xx_disable_fbc (struct drm_device *dev)
Signature · 1 line
1.8.3.1
Re: [PATCH 34/89] drm/i915/skl: Implement WaDisableSDEUnitClockGating:skl
Yeah, this might be only until B0 but useful for now anyway so feel free to use
Quoted 33 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/intel_pm.c +8
-1@@ -68,6 +68,14 @@static void gen9_init_clock_gating (struct drm_device *dev) { +struct drm_i915_private *dev_priv = dev->dev_private; + +/* +* WaDisableSDEUnitClockGating:skl +* This seems to be a pre-production w/a. +*/ +I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) | +GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); }static void i8xx_disable_fbc (struct drm_device *dev) --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 35/89 drm/i915/skl: Implement Wa4x4STCOptimizationDisable:skl
In reply to Damien Lespiau--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +4 -0
@@ -76,6 +76,10 @@ static void gen9_init_clock_gating(struct drm_device *dev)*/ I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) |GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); + +/* Wa4x4STCOptimizationDisable:skl */ +I915_WRITE (CACHE_MODE_1 , +_MASKED_BIT_ENABLE (GEN8_4x4_STC_OPTIMIZATION_DISABLE)); }static void i8xx_disable_fbc (struct drm_device *dev)
Signature · 1 line
1.8.3.1
Re: [PATCH 35/89] drm/i915/skl: Implement Wa4x4STCOptimizationDisable:skl
Quoted 30 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -76,6 +76,10 @@ static void gen9_init_clock_gating(struct drm_device*dev) */ I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) |GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); + +/* Wa4x4STCOptimizationDisable:skl */ +I915_WRITE (CACHE_MODE_1 , +_MASKED_BIT_ENABLE (GEN8_4x4_STC_OPTIMIZATION_DISABLE)); }static void
i8xx_disable_fbc(struct drm_device *dev)
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 35/89] drm/i915/skl: Implement Wa4x4STCOptimizationDisable:skl
Although I believe that we could have a init_workaround function for skl as we have for bdw and chv
Quoted 43 lines · Rodrigo Vivi
Reviewed-by Rodrigo Vivi <[email protected]>Quoted 25 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -76,6 +76,10 @@ static void gen9_init_clock_gating(struct drm_device*dev) */ I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) |GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); + +/* Wa4x4STCOptimizationDisable:skl */ +I915_WRITE (CACHE_MODE_1 , +_MASKED_BIT_ENABLE (GEN8_4x4_STC_OPTIMIZATION_DISABLE)); }static void
i8xx_disable_fbc(struct drm_device *dev)
--
1.8.3.1Quoted 5 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 35/89] drm/i915/skl: Implement Wa4x4STCOptimizationDisable:skl
Quoted 2 lines · Rodrigo Vivi
Although I believe that we could have a
init_workaroundfunction for skl as we have for bdw and chv
FWIW, the W/A code is in a confusing state right now, with at least two people working on it. I'd like to wait a bit before things settle and have a full W/A pass at that point.
Signature · 1 line
Damien
Quoted 47 lines
On Wed, Sep 17, 2014 at 12:00 PM, Rodrigo Vivi <[email protected]> wrote: Reviewed-by: Rodrigo Vivi <[email protected]> On Thu, Sep 4, 2014 at 4:27 AM, Damien Lespiau <[email protected]> wrote: Signed-off-by: Damien Lespiau <[email protected]> --- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 0dc148c..c38baea 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -76,6 +76,10 @@ static void gen9_init_clock_gating(struct drm_device *dev) */ I915_WRITE(GEN8_UCGCTL6, I915_READ(GEN8_UCGCTL6) | GEN8_SDEUNIT_CLOCK_GATE_DISABLE); + + /* Wa4x4STCOptimizationDisable:skl */ + I915_WRITE(CACHE_MODE_1, + _MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE)); } static void i8xx_disable_fbc(struct drm_device *dev) -- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Rodrigo Vivi Blog: http://blog.vivi.eng.br -- Rodrigo Vivi Blog: http://blog.vivi.eng.br
PATCH 36/89 drm/i915/skl: Implement WaDisableDgMirrorFixInHalfSliceChicken5:skl
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 2 files changed, 11 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -5862,6 +5862,9 @@ enum punit_power_well {#define GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE (1<<10)#define GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE (1<<3) +#define GEN9_HALF_SLICE_CHICKEN5 0xe188 +#define GEN9_DG_MIRROR_FIX_ENABLE (1<<5) +#define GEN8_ROW_CHICKEN 0xe4f0#define PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE (1<<8)#define STALL_DOP_GATING_DISABLE (1<<5)
drivers/gpu/drm/i915/intel_pm.c +8 -0
@@ -77,6 +77,14 @@ static void gen9_init_clock_gating(struct drm_device *dev)I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) |GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); +/* +* WaDisableDgMirrorFixInHalfSliceChicken5:skl +* This is a pre-production w/a. +*/ +I915_WRITE (GEN9_HALF_SLICE_CHICKEN5 , +I915_READ (GEN9_HALF_SLICE_CHICKEN5 ) & + ~GEN9_DG_MIRROR_FIX_ENABLE ); +/* Wa4x4STCOptimizationDisable:skl */ I915_WRITE (CACHE_MODE_1 ,_MASKED_BIT_ENABLE (GEN8_4x4_STC_OPTIMIZATION_DISABLE));
Signature · 1 line
1.8.3.1
Re: [PATCH 36/89] drm/i915/skl: Implement WaDisableDgMirrorFixInHalfSliceChicken5:skl
Quoted 50 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 2 files changed, 11 insertions(+)drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -5862,6 +5862,9 @@ enum punit_power_well {#define GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE (1<<10)#define GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE (1<<3) +#define GEN9_HALF_SLICE_CHICKEN5 0xe188 +#define GEN9_DG_MIRROR_FIX_ENABLE (1<<5) +#define GEN8_ROW_CHICKEN 0xe4f0#define PARTIAL_INSTRUCTION_SHOOTDOWN_DISABLE (1<<8)#define STALL_DOP_GATING_DISABLE (1<<5)drivers/gpu/drm/i915/intel_pm.c +8
-0@@ -77,6 +77,14 @@ static void gen9_init_clock_gating(struct drm_device *dev)I915_WRITE (GEN8_UCGCTL6 ,I915_READ (GEN8_UCGCTL6 ) |GEN8_SDEUNIT_CLOCK_GATE_DISABLE ); +/* +* WaDisableDgMirrorFixInHalfSliceChicken5:skl +* This is a pre-production w/a. +*/ +I915_WRITE (GEN9_HALF_SLICE_CHICKEN5 , +I915_READ (GEN9_HALF_SLICE_CHICKEN5 ) & + ~GEN9_DG_MIRROR_FIX_ENABLE ); +/* Wa4x4STCOptimizationDisable:skl */ I915_WRITE(CACHE_MODE_1,_MASKED_BIT_ENABLE(GEN8_4x4_STC_OPTIMIZATION_DISABLE));--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 37/89 drm/i915/skl: Skylake has 2 "sprite" planes per pipe
In reply to Damien LespiauOn Skylake, we use plane1 as primary plane and plane2/3 as sprite planes.
v2: Rebase on top of the for_each_pipe() change adding dev_priv as first
argument.
--- drivers/gpu/drm/i915/i915_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -1528,7 +1528,7 @@ static void intel_device_info_runtime_init(struct drm_device *dev) info = (struct intel_device_info *)&dev_priv->info; -if (IS_VALLEYVIEW (dev)) +if (IS_VALLEYVIEW (dev) ||INTEL_INFO (dev)->gen ==9 )for_each_pipe (dev_priv, pipe) info->num_sprites[pipe] =2 ;else
Signature · 1 line
1.8.3.1
Re: [PATCH 37/89] drm/i915/skl: Skylake has 2 "sprite" planes per pipe
Quoted 34 lines · Damien Lespiau
On Skylake, we use plane1 as primary plane and plane2/3 as sprite planes.
v2: Rebase on top of the
for_each_pipe()change addingdev_privas first
argument.Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_dma.c +1
-1@@ -1528,7 +1528,7 @@ static void intel_device_info_runtime_init(struct drm_device *dev) info = (struct intel_device_info *)&dev_priv->info; -if (IS_VALLEYVIEW (dev)) +if (IS_VALLEYVIEW (dev) ||INTEL_INFO (dev)->gen ==9 )for_each_pipe (dev_priv, pipe) info->num_sprites[pipe] =2 ;else
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 38/89 drm/i915/skl: Implement drm_plane vfuncs
In reply to Damien LespiauSKL Uses the same hardware for all planes now, so called "universal" planes. Ie both the primary planes and sprite planes share the same logic. This patch implements the drm_plane vfuncs for "sprites" ie planes that aren't the primary plane.
v2: Couple of fixes:
- Actually enabled the planes and fix the plane number
--- drivers/gpu/drm/i915/i915_reg.h | 31 +++++- drivers/gpu/drm/i915/intel_sprite.c | 206 +++++++++++++++++++++++++++++++++++- 2 files changed, 235 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +30 -1
@@ -4513,7 +4513,9 @@ enum punit_power_well {#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24)#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) -#define PLANE_CTL_KEY_ENABLE (1 << 22) +#define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21) +#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21) +#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)#define PLANE_CTL_ORDER_BGRX (0 << 20)#define PLANE_CTL_ORDER_RGBX (1 << 20)#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16)
@@ -4548,6 +4550,12 @@ enum punit_power_well {#define _PLANE_OFFSET_1_A 0x701a4#define _PLANE_OFFSET_2_A 0x702a4#define _PLANE_OFFSET_3_A 0x703a4 +#define _PLANE_KEYVAL_1_A 0x70194 +#define _PLANE_KEYVAL_2_A 0x70294 +#define _PLANE_KEYMSK_1_A 0x70198 +#define _PLANE_KEYMSK_2_A 0x70298 +#define _PLANE_KEYMAX_1_A 0x701a0 +#define _PLANE_KEYMAX_2_A 0x702a0#define _PLANE_CTL_1_B 0x71180#define _PLANE_CTL_2_B 0x71280
@@ -4604,6 +4612,27 @@ enum punit_power_well {#define PLANE_OFFSET (pipe, plane) \ _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +#define _PLANE_KEYVAL_1_B 0x71194 +#define _PLANE_KEYVAL_2_B 0x71294 +#define _PLANE_KEYVAL_1 (pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B) +#define _PLANE_KEYVAL_2 (pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B) +#define PLANE_KEYVAL (pipe, plane) \ + _PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe)) + +#define _PLANE_KEYMSK_1_B 0x71198 +#define _PLANE_KEYMSK_2_B 0x71298 +#define _PLANE_KEYMSK_1 (pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B) +#define _PLANE_KEYMSK_2 (pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B) +#define PLANE_KEYMSK (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe)) + +#define _PLANE_KEYMAX_1_B 0x711a0 +#define _PLANE_KEYMAX_2_B 0x712a0 +#define _PLANE_KEYMAX_1 (pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B) +#define _PLANE_KEYMAX_2 (pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B) +#define PLANE_KEYMAX (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)
drivers/gpu/drm/i915/intel_sprite.c +205 -1
224 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 38/89] drm/i915/skl: Implement drm_plane vfuncs
Quoted 9 lines · Damien Lespiau
SKL Uses the same hardware for all planes now, so called "universal" planes. Ie both the primary planes and sprite planes share the same logic. This patch implements the
drm_planevfuncs for "sprites" ie planes that aren't the primary plane.v2: Couple of fixes:
- Actually enabled the planes and fix the plane numberSigned-off-by Damien Lespiau <[email protected]>
This needs to be de-duped I think ... especially since it will conflict quite badly with Padovan's ongoing work to introduce a struct intel_plane_config.
Not sure yet how we can shuffle the merge here, I guess it'll be a case of who's first wins ;-)
-Daniel
Quoted 299 lines
--- drivers/gpu/drm/i915/i915_reg.h | 31 +++++- drivers/gpu/drm/i915/intel_sprite.c | 206 +++++++++++++++++++++++++++++++++++- 2 files changed, 235 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +30
-1@@ -4513,7 +4513,9 @@ enum punit_power_well {#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24)#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) -#define PLANE_CTL_KEY_ENABLE (1 << 22) +#define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21) +#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21) +#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)#define PLANE_CTL_ORDER_BGRX (0 << 20)#define PLANE_CTL_ORDER_RGBX (1 << 20)#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16)@@ -4548,6 +4550,12 @@ enum punit_power_well {#define _PLANE_OFFSET_1_A 0x701a4#define _PLANE_OFFSET_2_A 0x702a4#define _PLANE_OFFSET_3_A 0x703a4 +#define _PLANE_KEYVAL_1_A 0x70194 +#define _PLANE_KEYVAL_2_A 0x70294 +#define _PLANE_KEYMSK_1_A 0x70198 +#define _PLANE_KEYMSK_2_A 0x70298 +#define _PLANE_KEYMAX_1_A 0x701a0 +#define _PLANE_KEYMAX_2_A 0x702a0#define _PLANE_CTL_1_B 0x71180#define _PLANE_CTL_2_B 0x71280@@ -4604,6 +4612,27 @@ enum punit_power_well {#define PLANE_OFFSET (pipe, plane) \ _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +#define _PLANE_KEYVAL_1_B 0x71194 +#define _PLANE_KEYVAL_2_B 0x71294 +#define _PLANE_KEYVAL_1 (pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B) +#define _PLANE_KEYVAL_2 (pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B) +#define PLANE_KEYVAL (pipe, plane) \ + _PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe)) + +#define _PLANE_KEYMSK_1_B 0x71198 +#define _PLANE_KEYMSK_2_B 0x71298 +#define _PLANE_KEYMSK_1 (pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B) +#define _PLANE_KEYMSK_2 (pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A, _PLANE_KEYMSK_2_B) +#define PLANE_KEYMSK (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe)) + +#define _PLANE_KEYMAX_1_B 0x711a0 +#define _PLANE_KEYMAX_2_B 0x712a0 +#define _PLANE_KEYMAX_1 (pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A, _PLANE_KEYMAX_1_B) +#define _PLANE_KEYMAX_2 (pipe) _PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B) +#define PLANE_KEYMAX (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)drivers/gpu/drm/i915/intel_sprite.c +205
-1@@ -139,6 +139,184 @@ static void intel_update_primary_plane(struct intel_crtc *crtc) }static void +skl_update_plane (struct drm_plane *drm_plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_i915_gem_object *obj,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t x,uint32_t y, +uint32_t src_w,uint32_t src_h) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane +1 ; +u32 plane_ctl, stride; +int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + +/* Mask out pixel format bits in case we change it */ + plane_ctl &= ~PLANE_CTL_FORMAT_MASK ; + plane_ctl &= ~PLANE_CTL_ORDER_RGBX ; + plane_ctl &= ~PLANE_CTL_YUV422_ORDER_MASK ; + plane_ctl &= ~PLANE_CTL_TILED_MASK ; + plane_ctl &= ~PLANE_CTL_ALPHA_MASK ; + +/* Trickle feed has to be enabled */ + plane_ctl &= ~PLANE_CTL_TRICKLE_FEED_DISABLE ; + +switch (fb->pixel_format) { +case DRM_FORMAT_RGB565 : + plane_ctl |=PLANE_CTL_FORMAT_RGB_565 ; +break ; +case DRM_FORMAT_XBGR8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 |PLANE_CTL_ORDER_RGBX ; +break ; +case DRM_FORMAT_XRGB8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 ; +break ; +/* +* XXX: For ARBG/ABGR formats we default to expecting scanout buffers +* to be already pre-multiplied. We need to add a knob (or a different +* DRM_FORMAT) for user-space to configure that. +*/ +case DRM_FORMAT_ABGR8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 | +PLANE_CTL_ORDER_RGBX | +PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +break ; +case DRM_FORMAT_ARGB8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 | +PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +break ; +case DRM_FORMAT_YUYV : + plane_ctl |=PLANE_CTL_FORMAT_YUV422 |PLANE_CTL_YUV422_YUYV ; +break ; +case DRM_FORMAT_YVYU : + plane_ctl |=PLANE_CTL_FORMAT_YUV422 |PLANE_CTL_YUV422_YVYU ; +break ; +case DRM_FORMAT_UYVY : + plane_ctl |=PLANE_CTL_FORMAT_YUV422 |PLANE_CTL_YUV422_UYVY ; +break ; +case DRM_FORMAT_VYUY : + plane_ctl |=PLANE_CTL_FORMAT_YUV422 |PLANE_CTL_YUV422_VYUY ; +break ; +default : +BUG (); + } + +switch (obj->tiling_mode) { +case I915_TILING_NONE : + stride = fb->pitches[0 ] >>6 ; +break ; +case I915_TILING_X : + plane_ctl |=PLANE_CTL_TILED_X ; + stride = fb->pitches[0 ] >>9 ; +break ; +default : +BUG (); + } + + plane_ctl |=PLANE_CTL_ENABLE ; + plane_ctl |=PLANE_CTL_PIPE_CSC_ENABLE ; + +intel_update_sprite_watermarks (drm_plane, crtc, src_w, src_h, + pixel_size, true, + src_w != crtc_w || src_h != crtc_h); + +/* Sizes are 0 based */ + src_w--; + src_h--; + crtc_w--; + crtc_h--; + +I915_WRITE (PLANE_OFFSET (pipe, plane), (y <<16 ) | x); +I915_WRITE (PLANE_STRIDE (pipe, plane), stride); +I915_WRITE (PLANE_POS (pipe, plane), (crtc_y <<16 ) | crtc_x); +I915_WRITE (PLANE_SIZE (pipe, plane), (crtc_h <<16 ) | crtc_w); +I915_WRITE (PLANE_CTL (pipe, plane), plane_ctl); +I915_WRITE (PLANE_SURF (pipe, plane),i915_gem_obj_ggtt_offset (obj)); +POSTING_READ (PLANE_SURF (pipe, plane)); +} + +static void +skl_disable_plane (struct drm_plane *drm_plane,struct drm_crtc *crtc) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane +1 ; + +I915_WRITE (PLANE_CTL (pipe, plane), +I915_READ (PLANE_CTL (pipe, plane)) & ~PLANE_CTL_ENABLE ); + +/* Activate double buffered register update */ +I915_WRITE (PLANE_CTL (pipe, plane),0 ); +POSTING_READ (PLANE_CTL (pipe, plane)); + +intel_update_sprite_watermarks (drm_plane, crtc,0 ,0 ,0 , false, false); +} + +static int +skl_update_colorkey (struct drm_plane *drm_plane, +struct drm_intel_sprite_colorkey *key) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane; +u32 plane_ctl; + +I915_WRITE (PLANE_KEYVAL (pipe, plane), key->min_value); +I915_WRITE (PLANE_KEYMAX (pipe, plane), key->max_value); +I915_WRITE (PLANE_KEYMSK (pipe, plane), key->channel_mask); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + plane_ctl &= ~PLANE_CTL_KEY_ENABLE_MASK ; +if (key->flags &I915_SET_COLORKEY_DESTINATION ) + plane_ctl |=PLANE_CTL_KEY_ENABLE_DESTINATION ; +else if (key->flags &I915_SET_COLORKEY_SOURCE ) + plane_ctl |=PLANE_CTL_KEY_ENABLE_SOURCE ; +I915_WRITE (PLANE_CTL (pipe, plane), plane_ctl); + +POSTING_READ (PLANE_CTL (pipe, plane)); + +return 0 ; +} + +static void +skl_get_colorkey (struct drm_plane *drm_plane, +struct drm_intel_sprite_colorkey *key) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane; +u32 plane_ctl; + + key->min_value =I915_READ (PLANE_KEYVAL (pipe, plane)); + key->max_value =I915_READ (PLANE_KEYMAX (pipe, plane)); + key->channel_mask =I915_READ (PLANE_KEYMSK (pipe, plane)); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + +switch (plane_ctl &PLANE_CTL_KEY_ENABLE_MASK ) { +case PLANE_CTL_KEY_ENABLE_DESTINATION : + key->flags =I915_SET_COLORKEY_DESTINATION ; +break ; +case PLANE_CTL_KEY_ENABLE_SOURCE : + key->flags =I915_SET_COLORKEY_SOURCE ; +break ; +default : + key->flags =I915_SET_COLORKEY_NONE ; + } +} + +static void vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_i915_gem_object *obj, int crtc_x, int crtc_y,@@ -1305,6 +1483,18 @@ static uint32_t vlv_plane_formats[] = { DRM_FORMAT_VYUY, }; +static uint32_t skl_plane_formats[] = { +DRM_FORMAT_RGB565 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_YUYV , +DRM_FORMAT_YVYU , +DRM_FORMAT_UYVY , +DRM_FORMAT_VYUY , +}; +int intel_plane_init (struct drm_device *dev,enum pipe pipe,int plane) {@@ -1368,7 +1558,21 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) num_plane_formats =ARRAY_SIZE (snb_plane_formats); }break ; - +case 9 : +/* +* FIXME: Skylake planes can be scaled (with some restrictions), +* but this is for another time. +*/ + intel_plane->can_scale = false; + intel_plane->max_downscale =1 ; + intel_plane->update_plane = skl_update_plane; + intel_plane->disable_plane = skl_disable_plane; + intel_plane->update_colorkey = skl_update_colorkey; + intel_plane->get_colorkey = skl_get_colorkey; + + plane_formats = skl_plane_formats; + num_plane_formats =ARRAY_SIZE (skl_plane_formats); +break ;default :kfree (intel_plane);return -ENODEV ;Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 38/89] drm/i915/skl: Implement drm_plane vfuncs
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Damien Lespiau
SKL Uses the same hardware for all planes now, so called "universal" planes. Ie both the primary planes and sprite planes share the same logic. This patch implements the
drm_planevfuncs for "sprites" ie planes that aren't the primary plane.
Quoted 6 lines
Quoted 4 lines
v2: Couple of fixes:
- Actually enabled the planes and fix the plane numberSigned-off-by Damien Lespiau <[email protected]>This needs to be de-duped I think ...
I was hoping to do that in a separate task on top. Right now the two code paths are not quite ready to be merged together, close though.
Quoted 5 lines
especially since it will conflict quite badly with Padovan's ongoing work to introduce a struct
intel_plane_config.Not sure yet how we can shuffle the merge here, I guess it'll be a case of who's first wins ;-)
mine mine mine :) well, we shall see, so far, so good.
Signature · 1 line
Damien
Re: [PATCH 38/89] drm/i915/skl: Implement drm_plane vfuncs
In reply to Damien LespiauQuoted 21 lines · Damien Lespiau
SKL Uses the same hardware for all planes now, so called "universal" planes. Ie both the primary planes and sprite planes share the same logic. This patch implements the
drm_planevfuncs for "sprites" ie planes that aren't the primary plane.v2: Couple of fixes:
- Actually enabled the planes and fix the plane numberSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 31 +++++- drivers/gpu/drm/i915/intel_sprite.c | 206 +++++++++++++++++++++++++++++++++++- 2 files changed, 235 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4519
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +3
-1@@ -4513,7 +4513,9 @@ enum punit_power_well {#define PLANE_CTL_FORMAT_INDEXED ( 12 << 24)#define PLANE_CTL_FORMAT_RGB_565 ( 14 << 24)#define PLANE_CTL_PIPE_CSC_ENABLE (1 << 23) -#define PLANE_CTL_KEY_ENABLE (1 << 22) +#define PLANE_CTL_KEY_ENABLE_MASK (0x3 << 21) +#define PLANE_CTL_KEY_ENABLE_SOURCE ( 1 << 21) +#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)
Oh ignore my comments on patch 12/89 regarding these bits! ;)
Quoted 62 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0#define PLANE_CTL_ORDER_BGRX (0 << 20)#define PLANE_CTL_ORDER_RGBX (1 << 20)#define
PLANE_CTL_YUV422_ORDER_MASK(0x3<< 16)drivers/gpu/drm/i915/i915_reg.h +17
-0@@ -4548,6 +4550,12 @@ enum punit_power_well {#define _PLANE_OFFSET_1_A 0x701a4#define _PLANE_OFFSET_2_A 0x702a4#define _PLANE_OFFSET_3_A 0x703a4 +#define _PLANE_KEYVAL_1_A 0x70194 +#define _PLANE_KEYVAL_2_A 0x70294 +#define _PLANE_KEYMSK_1_A 0x70198 +#define _PLANE_KEYMSK_2_A 0x70298 +#define _PLANE_KEYMAX_1_A 0x701a0 +#define _PLANE_KEYMAX_2_A 0x702a0#define _PLANE_CTL_1_B 0x71180#define _PLANE_CTL_2_B 0x71280@@ -4604,6 +4612,27 @@ enum punit_power_well {#define PLANE_OFFSET (pipe, plane) \ _PLANE(plane, _PLANE_OFFSET_1(pipe), _PLANE_OFFSET_2(pipe)) +#define _PLANE_KEYVAL_1_B 0x71194 +#define _PLANE_KEYVAL_2_B 0x71294 +#define _PLANE_KEYVAL_1 (pipe) _PIPE(pipe, _PLANE_KEYVAL_1_A, _PLANE_KEYVAL_1_B) +#define _PLANE_KEYVAL_2 (pipe) _PIPE(pipe, _PLANE_KEYVAL_2_A, _PLANE_KEYVAL_2_B) +#define PLANE_KEYVAL (pipe, plane) \ + _PLANE(plane, _PLANE_KEYVAL_1(pipe), _PLANE_KEYVAL_2(pipe)) + +#define _PLANE_KEYMSK_1_B 0x71198 +#define _PLANE_KEYMSK_2_B 0x71298 +#define _PLANE_KEYMSK_1 (pipe) _PIPE(pipe, _PLANE_KEYMSK_1_A, _PLANE_KEYMSK_1_B) +#define _PLANE_KEYMSK_2 (pipe) _PIPE(pipe, _PLANE_KEYMSK_2_A,
_PLANE_KEYMSK_2_B)drivers/gpu/drm/i915/i915_reg.h +6
-0+#define PLANE_KEYMSK (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMSK_1(pipe), _PLANE_KEYMSK_2(pipe)) + +#define _PLANE_KEYMAX_1_B 0x711a0 +#define _PLANE_KEYMAX_2_B 0x712a0 +#define _PLANE_KEYMAX_1 (pipe) _PIPE(pipe, _PLANE_KEYMAX_1_A,
_PLANE_KEYMAX_1_B)
+#define_PLANE_KEYMAX_2(pipe)_PIPE(pipe, _PLANE_KEYMAX_2_A, _PLANE_KEYMAX_2_B)drivers/gpu/drm/i915/i915_reg.h +3
-0+#define PLANE_KEYMAX (pipe, plane) \ + _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)drivers/gpu/drm/i915/intel_sprite.c +2
-0@@ -139,6 +139,184 @@ static void intel_update_primary_plane(struct intel_crtc *crtc) } static void +skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc, + struct drm_framebuffer *fb,
drivers/gpu/drm/i915/intel_sprite.c static void intel_update_primary_plane(struct · line 154
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +10
-0+ struct drm_i915_gem_object *obj, int crtc_x, int crtc_y, + unsigned int crtc_w, unsigned int crtc_h, + uint32_t x, uint32_t y, + uint32_t src_w, uint32_t src_h) +{ + struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane +1 ;
A comment above to remind skl doesn't have the primary would be good.
Quoted 221 lines
drivers/gpu/drm/i915/intel_sprite.c +27
-0+u32 plane_ctl, stride; +int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + +/* Mask out pixel format bits in case we change it */ + plane_ctl &= ~PLANE_CTL_FORMAT_MASK ; + plane_ctl &= ~PLANE_CTL_ORDER_RGBX ; + plane_ctl &= ~PLANE_CTL_YUV422_ORDER_MASK ; + plane_ctl &= ~PLANE_CTL_TILED_MASK ; + plane_ctl &= ~PLANE_CTL_ALPHA_MASK ; + +/* Trickle feed has to be enabled */ + plane_ctl &= ~PLANE_CTL_TRICKLE_FEED_DISABLE ; + +switch (fb->pixel_format) { +case DRM_FORMAT_RGB565 : + plane_ctl |=PLANE_CTL_FORMAT_RGB_565 ; +break ; +case DRM_FORMAT_XBGR8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 |PLANE_CTL_ORDER_RGBX ; +break ; +case DRM_FORMAT_XRGB8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 ; +break ; +/* +* XXX: For ARBG/ABGR formats we default to expecting scanout buffers
+ * to be already pre-multiplied. We need to add a knob (or a
differentdrivers/gpu/drm/i915/intel_sprite.c +13
-0+* DRM_FORMAT) for user-space to configure that. +*/ +case DRM_FORMAT_ABGR8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 | +PLANE_CTL_ORDER_RGBX | +PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +break ; +case DRM_FORMAT_ARGB8888 : + plane_ctl |=PLANE_CTL_FORMAT_XRGB_8888 | +PLANE_CTL_ALPHA_SW_PREMULTIPLY ; +break ; +case DRM_FORMAT_YUYV : + plane_ctl |= PLANE_CTL_FORMAT_YUV422 |
PLANE_CTL_YUV422_YUYV;drivers/gpu/drm/i915/intel_sprite.c +3
-0+break ; +case DRM_FORMAT_YVYU : + plane_ctl |= PLANE_CTL_FORMAT_YUV422 |
PLANE_CTL_YUV422_YVYU;drivers/gpu/drm/i915/intel_sprite.c +3
-0+break ; +case DRM_FORMAT_UYVY : + plane_ctl |= PLANE_CTL_FORMAT_YUV422 |
PLANE_CTL_YUV422_UYVY;drivers/gpu/drm/i915/intel_sprite.c +3
-0+break ; +case DRM_FORMAT_VYUY : + plane_ctl |= PLANE_CTL_FORMAT_YUV422 |
PLANE_CTL_YUV422_VYUY;drivers/gpu/drm/i915/intel_sprite.c +56
-0+break ; +default : +BUG (); + } + +switch (obj->tiling_mode) { +case I915_TILING_NONE : + stride = fb->pitches[0 ] >>6 ; +break ; +case I915_TILING_X : + plane_ctl |=PLANE_CTL_TILED_X ; + stride = fb->pitches[0 ] >>9 ; +break ; +default : +BUG (); + } + + plane_ctl |=PLANE_CTL_ENABLE ; + plane_ctl |=PLANE_CTL_PIPE_CSC_ENABLE ; + +intel_update_sprite_watermarks (drm_plane, crtc, src_w, src_h, + pixel_size, true, + src_w != crtc_w || src_h != crtc_h); + +/* Sizes are 0 based */ + src_w--; + src_h--; + crtc_w--; + crtc_h--; + +I915_WRITE (PLANE_OFFSET (pipe, plane), (y <<16 ) | x); +I915_WRITE (PLANE_STRIDE (pipe, plane), stride); +I915_WRITE (PLANE_POS (pipe, plane), (crtc_y <<16 ) | crtc_x); +I915_WRITE (PLANE_SIZE (pipe, plane), (crtc_h <<16 ) | crtc_w); +I915_WRITE (PLANE_CTL (pipe, plane), plane_ctl); +I915_WRITE (PLANE_SURF (pipe, plane),i915_gem_obj_ggtt_offset (obj)); +POSTING_READ (PLANE_SURF (pipe, plane)); +} + +static void +skl_disable_plane (struct drm_plane *drm_plane,struct drm_crtc *crtc) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane +1 ; + +I915_WRITE (PLANE_CTL (pipe, plane), +I915_READ (PLANE_CTL (pipe, plane)) & ~PLANE_CTL_ENABLE ); + +/* Activate double buffered register update */ +I915_WRITE (PLANE_CTL (pipe, plane),0 ); +POSTING_READ (PLANE_CTL (pipe, plane)); + + intel_update_sprite_watermarks(drm_plane, crtc, 0, 0, 0, false,false);
drivers/gpu/drm/i915/intel_sprite.c +87
-1+} + +static int +skl_update_colorkey (struct drm_plane *drm_plane, +struct drm_intel_sprite_colorkey *key) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane; +u32 plane_ctl; + +I915_WRITE (PLANE_KEYVAL (pipe, plane), key->min_value); +I915_WRITE (PLANE_KEYMAX (pipe, plane), key->max_value); +I915_WRITE (PLANE_KEYMSK (pipe, plane), key->channel_mask); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + plane_ctl &= ~PLANE_CTL_KEY_ENABLE_MASK ; +if (key->flags &I915_SET_COLORKEY_DESTINATION ) + plane_ctl |=PLANE_CTL_KEY_ENABLE_DESTINATION ; +else if (key->flags &I915_SET_COLORKEY_SOURCE ) + plane_ctl |=PLANE_CTL_KEY_ENABLE_SOURCE ; +I915_WRITE (PLANE_CTL (pipe, plane), plane_ctl); + +POSTING_READ (PLANE_CTL (pipe, plane)); + +return 0 ; +} + +static void +skl_get_colorkey (struct drm_plane *drm_plane, +struct drm_intel_sprite_colorkey *key) +{ +struct drm_device *dev = drm_plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane *intel_plane =to_intel_plane (drm_plane); +const int pipe = intel_plane->pipe; +const int plane = intel_plane->plane; +u32 plane_ctl; + + key->min_value =I915_READ (PLANE_KEYVAL (pipe, plane)); + key->max_value =I915_READ (PLANE_KEYMAX (pipe, plane)); + key->channel_mask =I915_READ (PLANE_KEYMSK (pipe, plane)); + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + +switch (plane_ctl &PLANE_CTL_KEY_ENABLE_MASK ) { +case PLANE_CTL_KEY_ENABLE_DESTINATION : + key->flags =I915_SET_COLORKEY_DESTINATION ; +break ; +case PLANE_CTL_KEY_ENABLE_SOURCE : + key->flags =I915_SET_COLORKEY_SOURCE ; +break ; +default : + key->flags =I915_SET_COLORKEY_NONE ; + } +} + +static void vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_i915_gem_object *obj, int crtc_x, int crtc_y,@@ -1305,6 +1483,18 @@ static uint32_t vlv_plane_formats[] = { DRM_FORMAT_VYUY, }; +static uint32_t skl_plane_formats[] = { +DRM_FORMAT_RGB565 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_YUYV , +DRM_FORMAT_YVYU , +DRM_FORMAT_UYVY , +DRM_FORMAT_VYUY , +}; +int intel_plane_init (struct drm_device *dev,enum pipe pipe,int plane) {@@ -1368,7 +1558,21 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) num_plane_formats =ARRAY_SIZE (snb_plane_formats); }break ; - +case 9 : +/* +* FIXME: Skylake planes can be scaled (with some restrictions), +* but this is for another time. +*/ + intel_plane->can_scale = false; + intel_plane->max_downscale =1 ; + intel_plane->update_plane = skl_update_plane; + intel_plane->disable_plane = skl_disable_plane; + intel_plane->update_colorkey = skl_update_colorkey; + intel_plane->get_colorkey = skl_get_colorkey; + + plane_formats = skl_plane_formats; + num_plane_formats =ARRAY_SIZE (skl_plane_formats); +break ;default :kfree(intel_plane); return -ENODEV;
Quoted 8 lines
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 39/89 drm/i915/skl: Adjust assert_sprites_disabled()
In reply to Damien LespiauLet's put to good use the new PLANE_CTL macros.
--- drivers/gpu/drm/i915/intel_display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +8 -1
@@ -1335,7 +1335,14 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,int reg, sprite;u32 val; -if (IS_VALLEYVIEW (dev)) { +if (INTEL_INFO (dev)->gen >=9 ) { +for_each_sprite (pipe, sprite) { + val =I915_READ (PLANE_CTL (pipe, sprite)); +WARN (val &PLANE_CTL_ENABLE , +"plane %d assertion failure, should be off on pipe %c but is still active\n" , + sprite,pipe_name (pipe)); + } + }else if (IS_VALLEYVIEW (dev)) {for_each_sprite (pipe, sprite) { reg =SPCNTR (pipe, sprite); val =I915_READ (reg);
Signature · 1 line
1.8.3.1
Re: [PATCH 39/89] drm/i915/skl: Adjust assert_sprites_disabled()
Quoted 38 lines · Damien Lespiau
Let's put to good use the new
PLANE_CTLmacros.Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +8
-1@@ -1335,7 +1335,14 @@ static void assert_sprites_disabled(structdrm_i915_private *dev_priv, int reg, sprite;u32 val; -if (IS_VALLEYVIEW (dev)) { +if (INTEL_INFO (dev)->gen >=9 ) { +for_each_sprite (pipe, sprite) { + val =I915_READ (PLANE_CTL (pipe, sprite)); +WARN (val &PLANE_CTL_ENABLE , + "plane %d assertion failure, should be off on pipe %c but is still active\n", + sprite, pipe_name(pipe)); + } + }else if (IS_VALLEYVIEW (dev)) {for_each_sprite (pipe, sprite) {reg = SPCNTR(pipe, sprite); val = I915_READ(reg);--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 40/89 drm/i915/skl: Introduce a I915_MAX_PLANES macro
In reply to Damien LespiauThis can be useful to declare structures around pipes and planes and don't have to go back auditing the code if the next platorm bump that number.
--- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +8 -0
@@ -74,6 +74,14 @@ enum transcoder { };#define transcoder_name (t) ((t) + 'A') +/* +* This is the maximum (across all platforms) number of planes (primary + +* sprites) that can be active at the same time on one pipe. +* +* This value doesn't count the cursor plane. +*/ +#define I915_MAX_PLANES 3 +enum plane {PLANE_A =0 ,PLANE_B ,
Signature · 1 line
1.8.3.1
Re: [PATCH 40/89] drm/i915/skl: Introduce a I915_MAX_PLANES macro
Quoted 16 lines · Damien Lespiau
This can be useful to declare structures around pipes and planes and don't have to go back auditing the code if the next platorm bump that number.
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -74,6 +74,14 @@ enum transcoder { };
drivers/gpu/drm/i915/i915_drv.h enum transcoder { · line 84
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +7
-0#define transcoder_name (t) ((t) + 'A') +/* +* This is the maximum (across all platforms) number of planes (primary + +* sprites) that can be active at the same time on one pipe. +* +* This value doesn't count the cursor plane. +*/ +#define I915_MAX_PLANES 3
Any plan to allow 4 planes on pipes A and B?
+
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +0
-1enum plane {PLANE_A =0 ,PLANE_B , --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 41/89 drm/i915/skl: Introduce intel_num_planes()
In reply to Damien LespiauIt can be handy to get the number of planes for this pipe, ie including the primary plane to loop over them. Introduce a little function to do so.
--- drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +8 -0
@@ -721,6 +721,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi) return container_of(intel_hdmi, struct intel_digital_port, hdmi); } +/* +* Returns the number of planes for this pipe, ie the number of sprites + 1 +* (primary plane). This doesn't count the cursor plane then. +*/ +static inline unsigned int intel_num_planes (struct intel_crtc *crtc) +{ +return INTEL_INFO (crtc->base.dev)->num_sprites[crtc->pipe] +1 ; +}/* i915_irq.c */ bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
Signature · 1 line
1.8.3.1
Re: [PATCH 41/89] drm/i915/skl: Introduce intel_num_planes()
Quoted 38 lines · Damien Lespiau
It can be handy to get the number of planes for this pipe, ie including the primary plane to loop over them. Introduce a little function to do so.
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -721,6 +721,14 @@ hdmi_to_dig_port(struct intel_hdmi *intel_hdmi) return container_of(intel_hdmi, struct intel_digital_port, hdmi); } +/* +* Returns the number of planes for this pipe, ie the number of sprites + 1
+ * (primary plane). This doesn't count the cursor plane then.
+ */drivers/gpu/drm/i915/intel_drv.h +4
-1+static inline unsigned int intel_num_planes (struct intel_crtc *crtc) +{ +return INTEL_INFO (crtc->base.dev)->num_sprites[crtc->pipe] +1 ; +}/* i915_irq.c */ bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, --1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 42/89 drm/i915/skl: Move gen9 pm initialization into its own branch
In reply to Damien LespiauGen9 is different enough (for instance, fetching the memory latency values is different from ILK+) to not take the HAS_PCH_SPLIT() branch, so let's prefer a clean separation.
v2: Rebase on top of the broadwell_init_clock_gating() name change
--- drivers/gpu/drm/i915/intel_pm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +3 -3
@@ -7395,7 +7395,9 @@ void intel_init_pm(struct drm_device *dev)i915_ironlake_get_mem_freq (dev);/* For FIFO watermark updates */ -if (HAS_PCH_SPLIT (dev)) { +if (IS_GEN9 (dev)) { + dev_priv->display.init_clock_gating = gen9_init_clock_gating; + }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev); if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
@@ -7419,8 +7421,6 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = haswell_init_clock_gating; else if (INTEL_INFO(dev)->gen == 8) dev_priv->display.init_clock_gating = broadwell_init_clock_gating; - else if (INTEL_INFO(dev)->gen == 9) - dev_priv->display.init_clock_gating = gen9_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) { dev_priv->display.update_wm = cherryview_update_wm; dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm;
Signature · 1 line
1.8.3.1
Re: [PATCH 42/89] drm/i915/skl: Move gen9 pm initialization into its own branch
Oh I think we should reorganize everything here now...
It got messy... Well it was messy anyway already...
not this patch's fault so:
Quoted 49 lines · Damien Lespiau
Gen9 is different enough (for instance, fetching the memory latency values is different from ILK+) to not take the
HAS_PCH_SPLIT()branch, so let's prefer a clean separation.v2: Rebase on top of the
broadwell_init_clock_gating()name changeSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_pm.c +3
-1@@ -7395,7 +7395,9 @@ void intel_init_pm(struct drm_device *dev)i915_ironlake_get_mem_freq (dev);/* For FIFO watermark updates */ -if (HAS_PCH_SPLIT (dev)) { +if (IS_GEN9 (dev)) { + dev_priv->display.init_clock_gating = gen9_init_clock_gating; + }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&drivers/gpu/drm/i915/intel_pm.c +0
-2@@ -7419,8 +7421,6 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = haswell_init_clock_gating; else if (INTEL_INFO(dev)->gen == 8) dev_priv->display.init_clock_gating = broadwell_init_clock_gating; - else if (INTEL_INFO(dev)->gen == 9) - dev_priv->display.init_clock_gating = gen9_init_clock_gating;} else if (IS_CHERRYVIEW(dev)) { dev_priv->display.update_wm = cherryview_update_wm; dev_priv->display.update_sprite_wm =
valleyview_update_sprite_wm;
--
1.8.3.1_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 43/89 drm/i915/skl: Read the Memory Latency Values for WM computation
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch reads the memory latency values for all the 8 levels for SKL. These values are needed for the Watermark computation.
v2: Incorporated the review comments from Damien on register
indentation.
v3: Updated the code to use the sandybridge_pcode_read for reading
memory latencies for GEN9.
v4: Don't put gen 9 in the middle of an ordered list of ifs
(Damien)
v5 take the rps.hw_lock around sandybridge_pcode_read() (Damien)
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++++ drivers/gpu/drm/i915/i915_reg.h | 9 +++++ drivers/gpu/drm/i915/intel_pm.c | 73 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 82 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -0
@@ -1665,6 +1665,12 @@ struct drm_i915_private {uint16_t spr_latency[5 ];/* cursor */ uint16_t cur_latency[5 ]; +/* +* Raw watermark memory latency values +* for SKL for all 8 levels +* in 1us units. +*/ +uint16_t skl_latency[8 ];/* current hardware state */ struct ilk_wm_values hw;
drivers/gpu/drm/i915/i915_reg.h +9 -0
@@ -2018,6 +2018,15 @@ enum punit_power_well {#define MAD_DIMM_A_SIZE_SHIFT 0#define MAD_DIMM_A_SIZE_MASK (0xff << MAD_DIMM_A_SIZE_SHIFT) +/* SKL GT Driver Mailbox registers for reading memory latencies */ +#define GEN9_MAILBOX_DATA1 0x13812C +#define GEN9_MAILBOX_READ_MEM_LAT (0x6) +#define GEN9_MAILBOX_READ_TIMEOUT 150 +#define GEN9_MEM_LAT_LEVEL_MASK 0xFF +#define GEN9_MEM_LAT_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LAT_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LAT_LEVEL_3_7_SHIFT 24 +/* snb MCH registers for priority tuning */ #define MCH_SSKPD (MCHBAR_MIRROR_BASE_SNB + 0x5d10)#define MCH_SSKPD_WM0_MASK 0x3f
drivers/gpu/drm/i915/intel_pm.c +67 -6
118 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v6 43/89 drm/i915/skl: Read the Memory Latency Values for WM computation
From: Pradeep Bhat <[email protected]>
This patch reads the memory latency values for all the 8 levels for SKL. These values are needed for the Watermark computation.
v2: Incorporated the review comments from Damien on register
indentation.
v3: Updated the code to use the sandybridge_pcode_read for reading
memory latencies for GEN9.
v4: Don't put gen 9 in the middle of an ordered list of ifs
(Damien)
v5: take the rps.hw_lock around sandybridge_pcode_read() (Damien)
v6: Use gen >= 9 in the pcode_read() function for data1.
Move the defines near the gen6 ones and prefix them with PCODE. Remove unused timeout define (the pcode_read() code has a larger timeout already).
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++++ drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_pm.c | 76 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 83 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -0
@@ -1665,6 +1665,12 @@ struct drm_i915_private {uint16_t spr_latency[5 ];/* cursor */ uint16_t cur_latency[5 ]; +/* +* Raw watermark memory latency values +* for SKL for all 8 levels +* in 1us units. +*/ +uint16_t skl_latency[8 ];/* current hardware state */ struct ilk_wm_values hw;
drivers/gpu/drm/i915/i915_reg.h +7 -0
@@ -5855,6 +5855,13 @@ enum punit_power_well {#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8#define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 +#define GEN9_PCODE_DATA1 0x13812C +#define GEN9_PCODE_READ_MEM_LATENCY 0x6 +#define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF +#define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24 +#define GEN6_GT_CORE_STATUS 0x138060#define GEN6_CORE_CPD_STATE_MASK (7<<4)#define GEN6_RCn_MASK 7
drivers/gpu/drm/i915/intel_pm.c +70 -6
121 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 43/89 v6] drm/i915/skl: Read the Memory Latency Values for WM computation
Quoted 16 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch reads the memory latency values for all the 8 levels for SKL. These values are needed for the Watermark computation.
v2: Incorporated the review comments from Damien on register
indentation.v3: Updated the code to use the
sandybridge_pcode_readfor reading
memory latencies for GEN9.v4: Don't put gen 9 in the middle of an ordered list of ifs
(Damien)v5: take the rps.hw_lock around
sandybridge_pcode_read()(Damien)
Quoted 7 lines
v6: Use gen >= 9 in the
pcode_read()function for data1.
Move the defines near the gen6 ones and prefix them with PCODE. Remove unused timeout define (thepcode_read()code has a larger timeout already).Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>
With the pcode gen6 stuff handled by the followup patch this is:
Quoted 180 lines
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++++ drivers/gpu/drm/i915/i915_reg.h | 7 ++++ drivers/gpu/drm/i915/intel_pm.c | 76 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 83 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_drv.h +6
-0@@ -1665,6 +1665,12 @@ struct drm_i915_private {uint16_t spr_latency[5 ];/* cursor */ uint16_t cur_latency[5 ]; +/* +* Raw watermark memory latency values +* for SKL for all 8 levels +* in 1us units. +*/ +uint16_t skl_latency[8 ];/* current hardware state */ struct ilk_wm_values hw;drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -5855,6 +5855,13 @@ enum punit_power_well {#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8#define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16 +#define GEN9_PCODE_DATA1 0x13812C +#define GEN9_PCODE_READ_MEM_LATENCY 0x6 +#define GEN9_MEM_LATENCY_LEVEL_MASK 0xFF +#define GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT 24 +#define GEN6_GT_CORE_STATUS 0x138060#define GEN6_CORE_CPD_STATE_MASK (7<<4)#define GEN6_RCn_MASK 7drivers/gpu/drm/i915/intel_pm.c +70
-6@@ -2239,11 +2239,56 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)PIPE_WM_LINETIME_TIME (linetime); } -static void intel_read_wm_latency (struct drm_device *dev,uint16_t wm[5 ]) +static void intel_read_wm_latency (struct drm_device *dev,uint16_t wm[8 ]) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { +if (IS_GEN9 (dev)) { +uint32_t val; +int ret; + +/* read the first set of memory latencies[0:3] */ + val =0 ;/* data0 to be programmed to 0 for first set */ +mutex_lock (&dev_priv->rps.hw_lock); + ret =sandybridge_pcode_read (dev_priv, +GEN9_PCODE_READ_MEM_LATENCY , + &val); +mutex_unlock (&dev_priv->rps.hw_lock); + +if (ret) { +DRM_ERROR ("SKL Mailbox read error = %d\n" , ret); +return ; + } + + wm[0 ] = val &GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[1 ] = (val >>GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[2 ] = (val >>GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[3 ] = (val >>GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + +/* read the second set of memory latencies[4:7] */ + val =1 ;/* data0 to be programmed to 1 for second set */ +mutex_lock (&dev_priv->rps.hw_lock); + ret =sandybridge_pcode_read (dev_priv, +GEN9_PCODE_READ_MEM_LATENCY , + &val); +mutex_unlock (&dev_priv->rps.hw_lock); +if (ret) { +DRM_ERROR ("SKL Mailbox read error = %d\n" , ret); +return ; + } + + wm[4 ] = val &GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[5 ] = (val >>GEN9_MEM_LATENCY_LEVEL_1_5_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[6 ] = (val >>GEN9_MEM_LATENCY_LEVEL_2_6_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + wm[7 ] = (val >>GEN9_MEM_LATENCY_LEVEL_3_7_SHIFT ) & +GEN9_MEM_LATENCY_LEVEL_MASK ; + + }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD ); wm[0 ] = (sskpd >>56 ) &0xFF ;@@ -2291,7 +2336,9 @@ static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5])int ilk_wm_max_level (const struct drm_device *dev) {/* how many WM levels are we expecting */ -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) +if (IS_GEN9 (dev)) +return 7 ; +else if (IS_HASWELL (dev) ||IS_BROADWELL (dev))return 4 ;else if (INTEL_INFO (dev)->gen >=6 )return 3 ;@@ -2300,7 +2347,7 @@ int ilk_wm_max_level(const struct drm_device *dev) }static void intel_print_wm_latency (struct drm_device *dev,const char *name, -const uint16_t wm[5 ]) +const uint16_t wm[8 ]) {int level, max_level =ilk_wm_max_level (dev);@@ -2313,8 +2360,13 @@ static void intel_print_wm_latency(struct drm_device *dev,continue ; } -/* WM1+ latency values in 0.5us units */ -if (level >0 ) +/* +* - latencies are in us on gen9. +* - before then, WM1+ latency values are in 0.5us units +*/ +if (IS_GEN9 (dev)) + latency *=10 ; +else if (level >0 ) latency *=5 ; DRM_DEBUG_KMS("%s WM%d latency %u (%u.%u usec)\n",@@ -2382,6 +2434,14 @@ static void ilk_setup_wm_latency(struct drm_device *dev)snb_wm_latency_quirk (dev); } +static void skl_setup_wm_latency (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +intel_read_wm_latency (dev, dev_priv->wm.skl_latency); +intel_print_wm_latency (dev,"Gen9 Plane" , dev_priv->wm.skl_latency); +} +static void ilk_compute_wm_parameters (struct drm_crtc *crtc,struct ilk_pipe_wm_parameters *p) {@@ -7396,6 +7456,8 @@ void intel_init_pm(struct drm_device *dev)/* For FIFO watermark updates */ if (IS_GEN9 (dev)) { +skl_setup_wm_latency (dev); + dev_priv->display.init_clock_gating = gen9_init_clock_gating; }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);@@ -7488,6 +7550,8 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val) }I915_WRITE (GEN6_PCODE_DATA , *val); +if (INTEL_INFO (dev_priv)->gen >=9 ) +I915_WRITE (GEN9_PCODE_DATA1 ,0 );I915_WRITE (GEN6_PCODE_MAILBOX ,GEN6_PCODE_READY | mbox); if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0,Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 43/89] drm/i915/skl: Read the Memory Latency Values for WM computation
In reply to Damien LespiauQuoted 29 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch reads the memory latency values for all the 8 levels for SKL. These values are needed for the Watermark computation.
v2: Incorporated the review comments from Damien on register
indentation.v3: Updated the code to use the
sandybridge_pcode_readfor reading
memory latencies for GEN9.v4: Don't put gen 9 in the middle of an ordered list of ifs
(Damien)v5 take the rps.hw_lock around
sandybridge_pcode_read()(Damien)Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 6 ++++ drivers/gpu/drm/i915/i915_reg.h | 9 +++++ drivers/gpu/drm/i915/intel_pm.c | 73 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 82 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 1673
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +6
-0@@ -1665,6 +1665,12 @@ struct drm_i915_private {uint16_t spr_latency[5 ];/* cursor */ uint16_t cur_latency[5 ]; +/* +* Raw watermark memory latency values +* for SKL for all 8 levels +* in 1us units. +*/ +uint16_t skl_latency[8 ];
Not sure if we could unify these somehow to avoid wasted space. But that can be left as a future exercise.
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0/* current hardware state */ struct ilk_wm_values hw;drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2024
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -2018,6 +2018,15 @@ enum punit_power_well {#define MAD_DIMM_A_SIZE_SHIFT 0#define MAD_DIMM_A_SIZE_MASK (0xff << MAD_DIMM_A_SIZE_SHIFT) +/* SKL GT Driver Mailbox registers for reading memory latencies */ +#define GEN9_MAILBOX_DATA1 0x13812C +#define GEN9_MAILBOX_READ_MEM_LAT (0x6) +#define GEN9_MAILBOX_READ_TIMEOUT 150
Timeout not used anywhere. Also spec says 100us.
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2028
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+#define GEN9_MEM_LAT_LEVEL_MASK 0xFF +#define GEN9_MEM_LAT_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LAT_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LAT_LEVEL_3_7_SHIFT 24
This stuff should be grouped along the other pcode register defines.
Also according to Bspec the mailbox data1 register already existed since snb. The hsw cdclk change sequence also mentions that it should be set to 0, but eg. the bdw IPS sequence doesn't mention it. I guess in theory some pcode command might cause it to be clobbered, so I'm thinking we should just explicitly set it to 0 for all platforms in the pcode read/write functions. That should be a separate patch though.
Quoted 140 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0+/* snb MCH registers for priority tuning */ #define MCH_SSKPD (MCHBAR_MIRROR_BASE_SNB + 0x5d10)#define MCH_SSKPD_WM0_MASK 0x3fdrivers/gpu/drm/i915/intel_pm.c +67
-6@@ -2239,11 +2239,53 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)PIPE_WM_LINETIME_TIME (linetime); } -static void intel_read_wm_latency (struct drm_device *dev,uint16_t wm[5 ]) +static void intel_read_wm_latency (struct drm_device *dev,uint16_t wm[8 ]) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) { +if (IS_GEN9 (dev)) { +uint32_t val; +int ret; + +/* read the first set of memory latencies[0:3] */ + val =0 ;/* data0 to be programmed to 0 for first set */ +mutex_lock (&dev_priv->rps.hw_lock); + ret =sandybridge_pcode_read (dev_priv, +GEN9_MAILBOX_READ_MEM_LAT , + &val); +mutex_unlock (&dev_priv->rps.hw_lock); + +if (ret) { +DRM_ERROR ("SKL Mailbox read error = %d\n" , ret); +return ; + } + wm[0 ] = val &GEN9_MEM_LAT_LEVEL_MASK ; + wm[1 ] = (val >>GEN9_MEM_LAT_LEVEL_1_5_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + wm[2 ] = (val >>GEN9_MEM_LAT_LEVEL_2_6_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + wm[3 ] = (val >>GEN9_MEM_LAT_LEVEL_3_7_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + +/* read the second set of memory latencies[4:7] */ + val =1 ;/* data0 to be programmed to 1 for second set */ +mutex_lock (&dev_priv->rps.hw_lock); + ret =sandybridge_pcode_read (dev_priv, +GEN9_MAILBOX_READ_MEM_LAT , + &val); +mutex_unlock (&dev_priv->rps.hw_lock); +if (ret) { +DRM_ERROR ("SKL Mailbox read error = %d\n" , ret); +return ; + } + wm[4 ] = val &GEN9_MEM_LAT_LEVEL_MASK ; + wm[5 ] = (val >>GEN9_MEM_LAT_LEVEL_1_5_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + wm[6 ] = (val >>GEN9_MEM_LAT_LEVEL_2_6_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + wm[7 ] = (val >>GEN9_MEM_LAT_LEVEL_3_7_SHIFT ) & +GEN9_MEM_LAT_LEVEL_MASK ; + }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD ); wm[0 ] = (sskpd >>56 ) &0xFF ;@@ -2291,7 +2333,9 @@ static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5])int ilk_wm_max_level (const struct drm_device *dev) {/* how many WM levels are we expecting */ -if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) +if (IS_GEN9 (dev)) +return 7 ; +else if (IS_HASWELL (dev) ||IS_BROADWELL (dev))return 4 ;else if (INTEL_INFO (dev)->gen >=6 )return 3 ;@@ -2300,7 +2344,7 @@ int ilk_wm_max_level(const struct drm_device *dev) }static void intel_print_wm_latency (struct drm_device *dev,const char *name, -const uint16_t wm[5 ]) +const uint16_t wm[8 ]) {int level, max_level =ilk_wm_max_level (dev);@@ -2313,8 +2357,13 @@ static void intel_print_wm_latency(struct drm_device *dev,continue ; } -/* WM1+ latency values in 0.5us units */ -if (level >0 ) +/* +* - latencies are in us on gen9. +* - before then, WM1+ latency values are in 0.5us units +*/ +if (IS_GEN9 (dev)) + latency *=10 ; +else if (level >0 ) latency *=5 ; DRM_DEBUG_KMS("%s WM%d latency %u (%u.%u usec)\n",@@ -2382,6 +2431,14 @@ static void ilk_setup_wm_latency(struct drm_device *dev)snb_wm_latency_quirk (dev); } +static void skl_setup_wm_latency (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +intel_read_wm_latency (dev, dev_priv->wm.skl_latency); +intel_print_wm_latency (dev,"Gen9 Plane" , dev_priv->wm.skl_latency); +} +static void ilk_compute_wm_parameters (struct drm_crtc *crtc,struct ilk_pipe_wm_parameters *p) {@@ -7396,6 +7453,8 @@ void intel_init_pm(struct drm_device *dev)/* For FIFO watermark updates */ if (IS_GEN9 (dev)) { +skl_setup_wm_latency (dev); + dev_priv->display.init_clock_gating = gen9_init_clock_gating; }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);@@ -7488,6 +7547,8 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u8 mbox, u32 *val) }I915_WRITE (GEN6_PCODE_DATA , *val); +if (IS_GEN9 (dev_priv->dev)) +I915_WRITE (GEN9_MAILBOX_DATA1 ,0 );I915_WRITE (GEN6_PCODE_MAILBOX ,GEN6_PCODE_READY | mbox); if (wait_for((I915_READ(GEN6_PCODE_MAILBOX) & GEN6_PCODE_READY) == 0,Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 43/89] drm/i915/skl: Read the Memory Latency Values for WM computation
Quoted 7 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2024
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+/* SKL GT Driver Mailbox registers for reading memory latencies */ +#define GEN9_MAILBOX_DATA1 0x13812C +#define GEN9_MAILBOX_READ_MEM_LAT (0x6) +#define GEN9_MAILBOX_READ_TIMEOUT 150Timeout not used anywhere. Also spec says 100us.
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2028
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+#define GEN9_MEM_LAT_LEVEL_MASK 0xFF +#define GEN9_MEM_LAT_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LAT_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LAT_LEVEL_3_7_SHIFT 24This stuff should be grouped along the other pcode register defines.
Funny you mention this, I fixed those two in the v6 sent as reply yesterday.
Signature · 1 line
Damien
Re: [PATCH 43/89] drm/i915/skl: Read the Memory Latency Values for WM computation
Quoted 15 lines · Damien Lespiau
Quoted 7 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2024
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+/* SKL GT Driver Mailbox registers for reading memory latencies */ +#define GEN9_MAILBOX_DATA1 0x13812C +#define GEN9_MAILBOX_READ_MEM_LAT (0x6) +#define GEN9_MAILBOX_READ_TIMEOUT 150Timeout not used anywhere. Also spec says 100us.
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2028
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+#define GEN9_MEM_LAT_LEVEL_MASK 0xFF +#define GEN9_MEM_LAT_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LAT_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LAT_LEVEL_3_7_SHIFT 24This stuff should be grouped along the other pcode register defines.
Quoted 2 lines
Funny you mention this, I fixed those two in the v6 sent as reply yesterday.
Well that's two down then. I should stop composing mails the previous day and then forgetting to send them and firing them off the next day without checking if they still make sense :)
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 43/89] drm/i915/skl: Read the Memory Latency Values for WM computation
Quoted 16 lines · Ville Syrjälä
Quoted 15 lines · Damien Lespiau
Quoted 13 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2024
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+/* SKL GT Driver Mailbox registers for reading memory latencies */ +#define GEN9_MAILBOX_DATA1 0x13812C +#define GEN9_MAILBOX_READ_MEM_LAT (0x6) +#define GEN9_MAILBOX_READ_TIMEOUT 150Timeout not used anywhere. Also spec says 100us.
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 2028
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +4
-0+#define GEN9_MEM_LAT_LEVEL_MASK 0xFF +#define GEN9_MEM_LAT_LEVEL_1_5_SHIFT 8 +#define GEN9_MEM_LAT_LEVEL_2_6_SHIFT 16 +#define GEN9_MEM_LAT_LEVEL_3_7_SHIFT 24This stuff should be grouped along the other pcode register defines.
Quoted 4 lines
Quoted 2 lines
Funny you mention this, I fixed those two in the v6 sent as reply yesterday.
Well that's two down then.
The other 2 items were marked as "patch on top is fine/better", so I guess it's now r-b material?
In any case, addressed the 2 points you raised separately.
http://lists.freedesktop.org/archives/intel-gfx/2014-September/052008.html
Signature · 1 line
Damien
PATCH 44/89 drm/i915/skl: Register definitions and macros for SKL Watermark regs
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch defines SKL specific PLANE_WM Watermark registers. It also defines macros to get the addresses of different LP levels within a pipe.
v2: Reworked the register definitions and associated macros to make it more
generic and be able to use for_each_pipe in values computation. Incorporated Damien's review comments and indentation.
v3: Added default values for lines and blocks. Provided mask for blocks.
--- drivers/gpu/drm/i915/i915_reg.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +37 -0
@@ -4066,6 +4066,43 @@ enum punit_power_well {#define I965_CURSOR_MAX_WM 32#define I965_CURSOR_DFT_WM 8 +/* Watermark register definitions for SKL */ +#define CUR_WM_A_0 0x70140 +#define CUR_WM_B_0 0x71140 +#define PLANE_WM_1_A_0 0x70240 +#define PLANE_WM_1_B_0 0x71240 +#define PLANE_WM_2_A_0 0x70340 +#define PLANE_WM_2_B_0 0x71340 +#define PLANE_WM_TRANS_1_A_0 0x70268 +#define PLANE_WM_TRANS_1_B_0 0x71268 +#define PLANE_WM_TRANS_2_A_0 0x70368 +#define PLANE_WM_TRANS_2_B_0 0x71368 +#define CUR_WM_TRANS_A_0 0x70168 +#define CUR_WM_TRANS_B_0 0x71168 +#define PLANE_WM_EN (1 << 31) +#define PLANE_WM_LINES_SHIFT 14 +#define PLANE_WM_LINES_MASK 0x1f +#define PLANE_WM_BLOCKS_MASK 0x3ff +#define PLANE_WM_LINES_DEFAULT 0x1 +#define PLANE_WM_BLOCKS_DEFAULT 0x7 + +#define CUR_WM_0 (pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0) +#define CUR_WM (pipe, level) (CUR_WM_0(pipe) + ((4) * (level))) +#define CUR_WM_TRANS (pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0) + +#define PLANE_WM_1 (pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0) +#define PLANE_WM_2 (pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0) +#define PLANE_WM_BASE (pipe, plane) \ + _PLANE(plane, PLANE_WM_1(pipe), PLANE_WM_2(pipe)) +#define PLANE_WM (pipe, plane, level) \ + (PLANE_WM_BASE(pipe, plane) + ((4) * (level))) +#define PLANE_WM_TRANS_1 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) +#define PLANE_WM_TRANS_2 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) +#define PLANE_WM_TRANS (pipe, plane) \ + _PLANE(plane, PLANE_WM_TRANS_1(pipe), PLANE_WM_TRANS_2(pipe)) +/* define the Watermark register on Ironlake */ #define WM0_PIPEA_ILK 0x45100#define WM0_PIPE_PLANE_MASK (0xffff<<16)
Signature · 1 line
1.8.3.1
Re: [PATCH 44/89] drm/i915/skl: Register definitions and macros for SKL Watermark regs
Quoted 35 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch defines SKL specific
PLANE_WMWatermark registers. It also defines macros to get the addresses of different LP levels within a pipe.v2: Reworked the register definitions and associated macros to make it more
generic and be able to usefor_each_pipein values computation. Incorporated Damien's review comments and indentation.v3: Added default values for lines and blocks. Provided mask for blocks.
Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)drivers/gpu/drm/i915/i915_reg.h +10
-0@@ -4066,6 +4066,43 @@ enum punit_power_well {#define I965_CURSOR_MAX_WM 32#define I965_CURSOR_DFT_WM 8 +/* Watermark register definitions for SKL */ +#define CUR_WM_A_0 0x70140 +#define CUR_WM_B_0 0x71140 +#define PLANE_WM_1_A_0 0x70240 +#define PLANE_WM_1_B_0 0x71240 +#define PLANE_WM_2_A_0 0x70340 +#define PLANE_WM_2_B_0 0x71340 +#define PLANE_WM_TRANS_1_A_0 0x70268 +#define PLANE_WM_TRANS_1_B_0 0x71268 +#define PLANE_WM_TRANS_2_A_0 0x70368
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4088
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10
-0+#define PLANE_WM_TRANS_2_B_0 0x71368 +#define CUR_WM_TRANS_A_0 0x70168 +#define CUR_WM_TRANS_B_0 0x71168 +#define PLANE_WM_EN (1 << 31) +#define PLANE_WM_LINES_SHIFT 14 +#define PLANE_WM_LINES_MASK 0x1f +#define PLANE_WM_BLOCKS_MASK 0x3ff +#define PLANE_WM_LINES_DEFAULT 0x1 +#define PLANE_WM_BLOCKS_DEFAULT 0x7 +
These numbers seemed to make sense when I tried to compare with the spec.
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +6
-0+#define CUR_WM_0 (pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0) +#define CUR_WM (pipe, level) (CUR_WM_0(pipe) + ((4) * (level))) +#define CUR_WM_TRANS (pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0) + +#define PLANE_WM_1 (pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0) +#define PLANE_WM_2 (pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0)
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4104
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10
-0+#define PLANE_WM_BASE (pipe, plane) \ + _PLANE(plane, PLANE_WM_1(pipe), PLANE_WM_2(pipe)) +#define PLANE_WM (pipe, plane, level) \ + (PLANE_WM_BASE(pipe, plane) + ((4) * (level))) +#define PLANE_WM_TRANS_1 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) +#define PLANE_WM_TRANS_2 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) +#define PLANE_WM_TRANS (pipe, plane) \ + _PLANE(plane, PLANE_WM_TRANS_1(pipe), PLANE_WM_TRANS_2(pipe))
I must admit to my eyes glazing over when trying to parse these macros. Not sure if a bit less redirection might help here. Anyway I plugged them into a small test program and the resulting register offsets were all good.
Just one small nit: if the intermediate macros aren't supposed to be used by anywhere outside this file then they might be prefixed with _ to make it clear they're internal.
Either way:
Quoted 11 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0+/* define the Watermark register on Ironlake */ #define WM0_PIPEA_ILK 0x45100#define WM0_PIPE_PLANE_MASK (0xffff<<16)Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 44/89] drm/i915/skl: Register definitions and macros for SKL Watermark regs
Quoted 10 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4104
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +6
-0+#define PLANE_WM_TRANS_1 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) +#define PLANE_WM_TRANS_2 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) +#define PLANE_WM_TRANS (pipe, plane) \ + _PLANE(plane, PLANE_WM_TRANS_1(pipe), PLANE_WM_TRANS_2(pipe))I must admit to my eyes glazing over when trying to parse these macros. Not sure if a bit less redirection might help here. Anyway I plugged them into a small test program and the resulting register offsets were all good.
While I'm generally for simple things, there's some pleasure to be had in abusing the preprocessor a bit. Sometimes it has to be about fun to keep us interested :)
Quoted 3 lines
Just one small nit: if the intermediate macros aren't supposed to be used by anywhere outside this file then they might be prefixed with _ to make it clear they're internal.
Fair enough, will spin a new version for this one.
Quoted 2 lines
Either way:
Reviewed-by Ville Syrjälä <[email protected]>
Signature · 1 line
Damien
PATCH v4 44/89 drm/i915/skl: Register definitions and macros for SKL Watermark regs
In reply to Ville SyrjäläFrom: Pradeep Bhat <[email protected]>
This patch defines SKL specific PLANE_WM Watermark registers. It also defines macros to get the addresses of different LP levels within a pipe.
v2: Reworked the register definitions and associated macros to make it more
generic and be able to use for_each_pipe in values computation. Incorporated Damien's review comments and indentation.
v3: Added default values for lines and blocks. Provided mask for blocks.
v4: Prefix intermedidate (internal-only) macros with _ (Ville)
--- drivers/gpu/drm/i915/i915_reg.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +37 -0
@@ -4078,6 +4078,43 @@ enum punit_power_well {#define I965_CURSOR_MAX_WM 32#define I965_CURSOR_DFT_WM 8 +/* Watermark register definitions for SKL */ +#define CUR_WM_A_0 0x70140 +#define CUR_WM_B_0 0x71140 +#define PLANE_WM_1_A_0 0x70240 +#define PLANE_WM_1_B_0 0x71240 +#define PLANE_WM_2_A_0 0x70340 +#define PLANE_WM_2_B_0 0x71340 +#define PLANE_WM_TRANS_1_A_0 0x70268 +#define PLANE_WM_TRANS_1_B_0 0x71268 +#define PLANE_WM_TRANS_2_A_0 0x70368 +#define PLANE_WM_TRANS_2_B_0 0x71368 +#define CUR_WM_TRANS_A_0 0x70168 +#define CUR_WM_TRANS_B_0 0x71168 +#define PLANE_WM_EN (1 << 31) +#define PLANE_WM_LINES_SHIFT 14 +#define PLANE_WM_LINES_MASK 0x1f +#define PLANE_WM_BLOCKS_MASK 0x3ff +#define PLANE_WM_LINES_DEFAULT 0x1 +#define PLANE_WM_BLOCKS_DEFAULT 0x7 + +#define CUR_WM_0 (pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0) +#define CUR_WM (pipe, level) (CUR_WM_0(pipe) + ((4) * (level))) +#define CUR_WM_TRANS (pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0) + +#define _PLANE_WM_1 (pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0) +#define _PLANE_WM_2 (pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0) +#define _PLANE_WM_BASE (pipe, plane) \ + _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe)) +#define PLANE_WM (pipe, plane, level) \ + (_PLANE_WM_BASE(pipe, plane) + ((4) * (level))) +#define _PLANE_WM_TRANS_1 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) +#define _PLANE_WM_TRANS_2 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) +#define PLANE_WM_TRANS (pipe, plane) \ + _PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)) +/* define the Watermark register on Ironlake */ #define WM0_PIPEA_ILK 0x45100#define WM0_PIPE_PLANE_MASK (0xffff<<16)
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 44/89 drm/i915/skl: Register definitions and macros for SKL Watermark regs
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch defines SKL specific PLANE_WM Watermark registers. It also defines macros to get the addresses of different LP levels within a pipe.
v2: Reworked the register definitions and associated macros to make it more
generic and be able to use for_each_pipe in values computation. Incorporated Damien's review comments and indentation.
v3: Added default values for lines and blocks. Provided mask for blocks.
v4: Prefix intermedidate (internal-only) macros with _ (Ville)
v5: Remove the lines and block defaults value (Ville)
--- drivers/gpu/drm/i915/i915_reg.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +35 -0
@@ -4078,6 +4078,41 @@ enum punit_power_well {#define I965_CURSOR_MAX_WM 32#define I965_CURSOR_DFT_WM 8 +/* Watermark register definitions for SKL */ +#define CUR_WM_A_0 0x70140 +#define CUR_WM_B_0 0x71140 +#define PLANE_WM_1_A_0 0x70240 +#define PLANE_WM_1_B_0 0x71240 +#define PLANE_WM_2_A_0 0x70340 +#define PLANE_WM_2_B_0 0x71340 +#define PLANE_WM_TRANS_1_A_0 0x70268 +#define PLANE_WM_TRANS_1_B_0 0x71268 +#define PLANE_WM_TRANS_2_A_0 0x70368 +#define PLANE_WM_TRANS_2_B_0 0x71368 +#define CUR_WM_TRANS_A_0 0x70168 +#define CUR_WM_TRANS_B_0 0x71168 +#define PLANE_WM_EN (1 << 31) +#define PLANE_WM_LINES_SHIFT 14 +#define PLANE_WM_LINES_MASK 0x1f +#define PLANE_WM_BLOCKS_MASK 0x3ff + +#define CUR_WM_0 (pipe) _PIPE(pipe, CUR_WM_A_0, CUR_WM_B_0) +#define CUR_WM (pipe, level) (CUR_WM_0(pipe) + ((4) * (level))) +#define CUR_WM_TRANS (pipe) _PIPE(pipe, CUR_WM_TRANS_A_0, CUR_WM_TRANS_B_0) + +#define _PLANE_WM_1 (pipe) _PIPE(pipe, PLANE_WM_1_A_0, PLANE_WM_1_B_0) +#define _PLANE_WM_2 (pipe) _PIPE(pipe, PLANE_WM_2_A_0, PLANE_WM_2_B_0) +#define _PLANE_WM_BASE (pipe, plane) \ + _PLANE(plane, _PLANE_WM_1(pipe), _PLANE_WM_2(pipe)) +#define PLANE_WM (pipe, plane, level) \ + (_PLANE_WM_BASE(pipe, plane) + ((4) * (level))) +#define _PLANE_WM_TRANS_1 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_1_A_0, PLANE_WM_TRANS_1_B_0) +#define _PLANE_WM_TRANS_2 (pipe) \ + _PIPE(pipe, PLANE_WM_TRANS_2_A_0, PLANE_WM_TRANS_2_B_0) +#define PLANE_WM_TRANS (pipe, plane) \ + _PLANE(plane, _PLANE_WM_TRANS_1(pipe), _PLANE_WM_TRANS_2(pipe)) +/* define the Watermark register on Ironlake */ #define WM0_PIPEA_ILK 0x45100#define WM0_PIPE_PLANE_MASK (0xffff<<16)
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 45/89 drm/i915/skl: Definition of SKL WM param structs for pipe/plane
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch defines the structures needed for computation of watermarks of pipes and planes for SKL.
v2: Incorporated Damien's review comments and removed unused fields
in structs for future features like rotation, drrs and scaling. The skl_wm_values struct is now made more generic across planes and cursor planes for all pipes.
v3: implemented the plane/cursor split.
--- drivers/gpu/drm/i915/i915_drv.h | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +18 -0
@@ -1381,6 +1381,24 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +}; + +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ]; +bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l; +}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the
drivers/gpu/drm/i915/intel_drv.h +9 -1
@@ -387,6 +387,12 @@ struct intel_mmio_flip {u32 ring_id; }; +struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;
@@ -431,9 +437,11 @@ struct intel_crtc {bool pch_fifo_underrun_disabled;/* per-pipe watermark state */ -struct { +union {/* watermarks currently being used */ struct intel_pipe_wm active; +/* SKL wm values currently in use */ +struct skl_pipe_wm skl_active; } wm;int scanline_offset;
drivers/gpu/drm/i915/intel_pm.c +8 -0
@@ -1928,6 +1928,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; } +struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +}; +struct ilk_pipe_wm_parameters {bool active;uint32_t pipe_htotal;
Signature · 1 line
1.8.3.1
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 26 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch defines the structures needed for computation of watermarks of pipes and planes for SKL.
v2: Incorporated Damien's review comments and removed unused fields
in structs for future features like rotation, drrs and scaling. Theskl_wm_valuesstruct is now made more generic across planes and cursor planes for all pipes.v3: implemented the plane/cursor split.
Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -1381,6 +1381,24 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning;
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1391
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0}; +struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +};
These multi dimensional arrays hurt my eyes. Maybe we should restructure this a bit to eg:
struct skl_wm_values {
struct {
wm_linetime;
plane[MAX_PLANES][8];
...
} pipe[MAX_PIPES];
};The two dimensional plane[][] array is still a bit nasty, but maybe we can live with it.
We could also do the same operatiob for the ilk version to keep stuff similar.
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1396
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+ +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ];
This stuff could also look better as an array of struct of some sort. Also should probably put the bool and uint8_t next to each other in case gcc is smart enough to pack things more tightly.
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1399
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0+bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l;
And this could also be an instance of the same struct use for the proper planes.
I'm actually wondering if we want this cursor stuff around at all. I was under the impression using the cursor eats one of the planes, so we could just as well use the plane always. But if the current code actually implements stuff using the legacy cursor thing I guess we need it for now at least.
Quoted 40 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the drivers/gpu/drm/i915/intel_drv.h +9
-1@@ -387,6 +387,12 @@ struct intel_mmio_flip {u32 ring_id; }; +struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;@@ -431,9 +437,11 @@ struct intel_crtc {bool pch_fifo_underrun_disabled;/* per-pipe watermark state */ -struct { +union {/* watermarks currently being used */ struct intel_pipe_wm active; +/* SKL wm values currently in use */ +struct skl_pipe_wm skl_active; } wm;int scanline_offset;drivers/gpu/drm/i915/intel_pm.c +0
-0
drivers/gpu/drm/i915/intel_pm.c static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · line 1937
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0@@ -1928,6 +1928,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; } +struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +};
I suppose we just need to start using some kind of named indexes for the planes on all platforms so we can unify all this stuff. But that can be done when we have all the code merged so we can better see how to unify things.
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c +1
-0+struct ilk_pipe_wm_parameters {bool active;uint32_t pipe_htotal;Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 43 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1391
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +};These multi dimensional arrays hurt my eyes. Maybe we should restructure this a bit to eg:
struct skl_wm_values { struct { wm_linetime; plane[MAX_PLANES][8]; ... } pipe[MAX_PIPES]; };The two dimensional plane[][] array is still a bit nasty, but maybe we can live with it.
We could also do the same operatiob for the ilk version to keep stuff similar.
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1396
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+ +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ];This stuff could also look better as an array of struct of some sort. Also should probably put the bool and
uint8_tnext to each other in case gcc is smart enough to pack things more tightly.drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1399
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0+bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l;And this could also be an instance of the same struct use for the proper planes.
Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · line 1937
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +};I suppose we just need to start using some kind of named indexes for the planes on all platforms so we can unify all this stuff. But that can be done when we have all the code merged so we can better see how to unify things.
For all those comments, the issue here is that changing something in those definitions has consequences in 10/15 patches that will need to be changed. Rather painful. It'd be much easier to do those change once we have that code upstream, on top. As far as I can see there are minor-ish improvements over what's here.
I've added an item in my post-merge plan. Sounds like an acceptable plan?
Thanks,
Signature · 1 line
Damien
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 57 lines · Damien Lespiau
Quoted 43 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1391
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +};These multi dimensional arrays hurt my eyes. Maybe we should restructure this a bit to eg:
struct skl_wm_values { struct { wm_linetime; plane[MAX_PLANES][8]; ... } pipe[MAX_PIPES]; };The two dimensional plane[][] array is still a bit nasty, but maybe we can live with it.
We could also do the same operatiob for the ilk version to keep stuff similar.
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1396
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+ +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ];This stuff could also look better as an array of struct of some sort. Also should probably put the bool and
uint8_tnext to each other in case gcc is smart enough to pack things more tightly.drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1399
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0+bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l;And this could also be an instance of the same struct use for the proper planes.
Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · line 1937
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +};I suppose we just need to start using some kind of named indexes for the planes on all platforms so we can unify all this stuff. But that can be done when we have all the code merged so we can better see how to unify things.
Quoted 8 lines
For all those comments, the issue here is that changing something in those definitions has consequences in 10/15 patches that will need to be changed. Rather painful. It'd be much easier to do those change once we have that code upstream, on top. As far as I can see there are minor-ish improvements over what's here.
I've added an item in my post-merge plan. Sounds like an acceptable plan?
Sounds good to me, atm all the plane config tracking is seriously all in-flight anyway ...
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 64 lines · Daniel Vetter
Quoted 63 lines · Damien Lespiau
Quoted 43 lines · Ville Syrjälä
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1391
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +};These multi dimensional arrays hurt my eyes. Maybe we should restructure this a bit to eg:
struct skl_wm_values { struct { wm_linetime; plane[MAX_PLANES][8]; ... } pipe[MAX_PIPES]; };The two dimensional plane[][] array is still a bit nasty, but maybe we can live with it.
We could also do the same operatiob for the ilk version to keep stuff similar.
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1396
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+ +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ];This stuff could also look better as an array of struct of some sort. Also should probably put the bool and
uint8_tnext to each other in case gcc is smart enough to pack things more tightly.drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1399
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +3
-0+bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l;And this could also be an instance of the same struct use for the proper planes.
Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels, · line 1937
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +};I suppose we just need to start using some kind of named indexes for the planes on all platforms so we can unify all this stuff. But that can be done when we have all the code merged so we can better see how to unify things.
For all those comments, the issue here is that changing something in those definitions has consequences in 10/15 patches that will need to be changed. Rather painful. It'd be much easier to do those change once we have that code upstream, on top. As far as I can see there are minor-ish improvements over what's here.
Quoted 5 lines
Quoted 2 lines
I've added an item in my post-merge plan. Sounds like an acceptable plan?
Sounds good to me, atm all the plane config tracking is seriously all in-flight anyway ...
Is this patch worthy of your r-b tag then Ville?
Thanks,
Signature · 1 line
Damien
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
In reply to Damien LespiauQuoted 67 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch defines the structures needed for computation of watermarks of pipes and planes for SKL.
v2: Incorporated Damien's review comments and removed unused fields
in structs for future features like rotation, drrs and scaling. Theskl_wm_valuesstruct is now made more generic across planes and cursor planes for all pipes.v3: implemented the plane/cursor split.
Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +18
-0@@ -1381,6 +1381,24 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +}; + +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ]; +bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l; +}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -387,6 +387,12 @@ struct intel_mmio_flip {u32 ring_id; }; +struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc { · line 440
Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1@@ -431,9 +437,11 @@ struct intel_crtc {bool pch_fifo_underrun_disabled;/* per-pipe watermark state */ -struct { +union {
I almost gave my r-b, but then I noticed this. It's going to mess up my pending watermark series. I'm going to add tons of junk here, so union is not really acceptable for me. Needs some other solution.
Quoted 33 lines
drivers/gpu/drm/i915/intel_drv.h +2
-0/* watermarks currently being used */ struct intel_pipe_wm active; +/* SKL wm values currently in use */ +struct skl_pipe_wm skl_active; } wm;int scanline_offset;drivers/gpu/drm/i915/intel_pm.c +8
-0@@ -1928,6 +1928,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; } +struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +}; +struct ilk_pipe_wm_parameters {bool active;uint32_t pipe_htotal;Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 12 lines · Ville Syrjälä
Quoted 12 lines
drivers/gpu/drm/i915/intel_drv.h +6
-0+struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;@@ -431,9 +437,11 @@ struct intel_crtc {bool pch_fifo_underrun_disabled;
Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc { · line 440
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1/* per-pipe watermark state */ -struct { +union {I almost gave my r-b, but then I noticed this. It's going to mess up my pending watermark series. I'm going to add tons of junk here, so union is not really acceptable for me. Needs some other solution.
Well, you could use an anonymous structure in that union? We could also try to merge skl_pipe_wm and intel_pipe_wm at a later point? or just leaving this a struct, wasting a tiny bit of memory be good enough for now?
Signature · 1 line
Damien
Re: [PATCH 45/89] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 21 lines · Damien Lespiau
Quoted 12 lines · Ville Syrjälä
Quoted 12 lines
drivers/gpu/drm/i915/intel_drv.h +6
-0+struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;@@ -431,9 +437,11 @@ struct intel_crtc {bool pch_fifo_underrun_disabled;Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_crtc { · line 440
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +1
-1/* per-pipe watermark state */ -struct { +union {I almost gave my r-b, but then I noticed this. It's going to mess up my pending watermark series. I'm going to add tons of junk here, so union is not really acceptable for me. Needs some other solution.
Quoted 4 lines
Well, you could use an anonymous structure in that union? We could also try to merge
skl_pipe_wmandintel_pipe_wmat a later point? or just leaving this a struct, wasting a tiny bit of memory be good enough for now?
We only have 3 pipes ... you can waste a few kb and no one will notice at all ;-)
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH v4 45/89 drm/i915/skl: Definition of SKL WM param structs for pipe/plane
From: Pradeep Bhat <[email protected]>
This patch defines the structures needed for computation of watermarks of pipes and planes for SKL.
v2: Incorporated Damien's review comments and removed unused fields
in structs for future features like rotation, drrs and scaling. The skl_wm_values struct is now made more generic across planes and cursor planes for all pipes.
v3: implemented the plane/cursor split.
v4: Change the wm union back to a structure (Ville, Daniel)
--- drivers/gpu/drm/i915/i915_drv.h | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++ drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 3 files changed, 34 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +18 -0
@@ -1395,6 +1395,24 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +}; + +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ]; +bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l; +}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the
drivers/gpu/drm/i915/intel_drv.h +8 -0
@@ -399,6 +399,12 @@ struct intel_mmio_flip {u32 ring_id; }; +struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;
@@ -446,6 +452,8 @@ struct intel_crtc {struct {/* watermarks currently being used */ struct intel_pipe_wm active; +/* SKL wm values currently in use */ +struct skl_pipe_wm skl_active; } wm;int scanline_offset;
drivers/gpu/drm/i915/intel_pm.c +8 -0
@@ -1953,6 +1953,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; } +struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +}; +struct ilk_pipe_wm_parameters {bool active;uint32_t pipe_htotal;
Signature · 1 line
1.8.3.1
Re: [PATCH 45/89 v4] drm/i915/skl: Definition of SKL WM param structs for pipe/plane
Quoted 10 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch defines the structures needed for computation of watermarks of pipes and planes for SKL.
v2: Incorporated Damien's review comments and removed unused fields
in structs for future features like rotation, drrs and scaling. Theskl_wm_valuesstruct is now made more generic across planes and cursor planes for all pipes.
Quoted 6 lines
v3: implemented the plane/cursor split.
v4: Change the wm union back to a structure (Ville, Daniel)
Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>
Yeah let's o with this for now. We need to do some house cleaning later but what else is new.
Quoted 82 lines
--- drivers/gpu/drm/i915/i915_drv.h | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 8 ++++++++ drivers/gpu/drm/i915/intel_pm.c | 8 ++++++++ 3 files changed, 34 insertions(+)drivers/gpu/drm/i915/i915_drv.h +18
-0@@ -1395,6 +1395,24 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_wm_values { +bool dirty[I915_MAX_PIPES ]; +uint32_t wm_linetime[I915_MAX_PIPES ]; +uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ]; +uint32_t cursor[I915_MAX_PIPES ][8 ]; +uint32_t plane_trans[I915_MAX_PIPES ][I915_MAX_PLANES ]; +uint32_t cursor_trans[I915_MAX_PIPES ]; +}; + +struct skl_wm_level { +bool plane_en[I915_MAX_PLANES ]; +uint16_t plane_res_b[I915_MAX_PLANES ]; +uint8_t plane_res_l[I915_MAX_PLANES ]; +bool cursor_en; +uint16_t cursor_res_b; +uint8_t cursor_res_l; +}; +/* * This struct helps tracking the state needed for runtime PM, which puts the * device in PCI D3 state. Notice that when this happens, nothing on the drivers/gpu/drm/i915/intel_drv.h +8
-0@@ -399,6 +399,12 @@ struct intel_mmio_flip {u32 ring_id; }; +struct skl_pipe_wm { +struct skl_wm_level wm[8 ]; +struct skl_wm_level trans_wm; +uint32_t linetime; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;@@ -446,6 +452,8 @@ struct intel_crtc {struct {/* watermarks currently being used */ struct intel_pipe_wm active; +/* SKL wm values currently in use */ +struct skl_pipe_wm skl_active; } wm;int scanline_offset;drivers/gpu/drm/i915/intel_pm.c +8
-0@@ -1953,6 +1953,14 @@ static uint32_t ilk_wm_fbc(uint32_t pri_val, uint32_t horiz_pixels,return DIV_ROUND_UP (pri_val *64 , horiz_pixels * bytes_per_pixel) +2 ; } +struct skl_pipe_wm_parameters { +bool active; +uint32_t pipe_htotal; +uint32_t pixel_rate;/* in KHz */ +struct intel_plane_wm_parameters plane[I915_MAX_PLANES ]; +struct intel_plane_wm_parameters cursor; +}; +struct ilk_pipe_wm_parameters {bool active;uint32_t pipe_htotal;Signature · 1 line
1.8.3.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 46/89 drm/i915/skl: Add DDB allocation management structures
In reply to Damien LespiauWe now need to allocate space in the DDB for planes being scanned out ourselves. The data structure to represent an allocation mirrors what we'll need to write in the registers later on: (start, end).
We add that allocation datat to the skl_wm_values structure as part of the values to program the hardware with.
v2: Split planes and cursor for consistency.
v3: Make the skl_ddb_entry_size() parameter const
--- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +19 -0
@@ -1381,8 +1381,27 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_ddb_entry { +uint16_t start, end;/* in number of blocks */ +}; + +static inline uint16_t skl_ddb_entry_size (const struct skl_ddb_entry *entry) +{ +/* end not set, clearly no allocation here. start can be 0 though */ +if (entry->end ==0 ) +return 0 ; + +return entry->end - entry->start +1 ; +} + +struct skl_ddb_allocation { +struct skl_ddb_entry plane[I915_MAX_PIPES ][I915_MAX_PLANES ]; +struct skl_ddb_entry cursor[I915_MAX_PIPES ]; +}; +struct skl_wm_values {bool dirty[I915_MAX_PIPES ]; +struct skl_ddb_allocation ddb;uint32_t wm_linetime[I915_MAX_PIPES ];uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ];uint32_t cursor[I915_MAX_PIPES ][8 ];
Signature · 1 line
1.8.3.1
Re: [PATCH 46/89] drm/i915/skl: Add DDB allocation management structures
Quoted 25 lines · Damien Lespiau
We now need to allocate space in the DDB for planes being scanned out ourselves. The data structure to represent an allocation mirrors what we'll need to write in the registers later on: (start, end).
We add that allocation datat to the
skl_wm_valuesstructure as part of the values to program the hardware with.v2: Split planes and cursor for consistency.
v3: Make the
skl_ddb_entry_size()parameter constSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -1381,8 +1381,27 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_ddb_entry {
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1394
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +10
-0+uint16_t start, end;/* in number of blocks */ +}; + +static inline uint16_t skl_ddb_entry_size (const struct skl_ddb_entry *entry) +{ +/* end not set, clearly no allocation here. start can be 0 though */ +if (entry->end ==0 ) +return 0 ; + +return entry->end - entry->start +1 ;
I would make 'end' exclusive as that allows you to represent an empty block more naturally, and you don't have to worry about the +/-1 adjustments when going between start/end and start/size representation.
Quoted 20 lines
drivers/gpu/drm/i915/i915_drv.h +8
-0+} + +struct skl_ddb_allocation { +struct skl_ddb_entry plane[I915_MAX_PIPES ][I915_MAX_PLANES ]; +struct skl_ddb_entry cursor[I915_MAX_PIPES ]; +}; +struct skl_wm_values {bool dirty[I915_MAX_PIPES ]; +struct skl_ddb_allocation ddb;uint32_t wm_linetime[I915_MAX_PIPES ];uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ];uint32_t cursor[I915_MAX_PIPES ][8 ];Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 46/89] drm/i915/skl: Add DDB allocation management structures
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Damien Lespiau
We now need to allocate space in the DDB for planes being scanned out ourselves. The data structure to represent an allocation mirrors what we'll need to write in the registers later on: (start, end).
We add that allocation datat to the
skl_wm_valuesstructure as part of the values to program the hardware with.v2: Split planes and cursor for consistency.
v3: Make the
skl_ddb_entry_size()parameter constSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -1381,8 +1381,27 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; };
Quoted 15 lines
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1394
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +11
-0+struct skl_ddb_entry { +uint16_t start, end;/* in number of blocks */ +}; + +static inline uint16_t skl_ddb_entry_size (const struct skl_ddb_entry *entry) +{ +/* end not set, clearly no allocation here. start can be 0 though */ +if (entry->end ==0 ) +return 0 ; + +return entry->end - entry->start +1 ;I would make 'end' exclusive as that allows you to represent an empty block more naturally, and you don't have to worry about the +/-1 adjustments when going between start/end and start/size representation.
The values we program in the registers are inclusive (I had a bug where the end of one plane and the start of another plane had the same value and artefacts could be seen, due to the pipes fetching from overlapping DDB space). I took the option of having those values mirror what we need to program. Hopefully the small functions around the skl_ddb_entry structure doesn't make it too bad?
Signature · 1 line
Damien
Re: [PATCH 46/89] drm/i915/skl: Add DDB allocation management structures
Quoted 42 lines · Damien Lespiau
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Damien Lespiau
We now need to allocate space in the DDB for planes being scanned out ourselves. The data structure to represent an allocation mirrors what we'll need to write in the registers later on: (start, end).
We add that allocation datat to the
skl_wm_valuesstructure as part of the values to program the hardware with.v2: Split planes and cursor for consistency.
v3: Make the
skl_ddb_entry_size()parameter constSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -1381,8 +1381,27 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; };Quoted 15 lines
drivers/gpu/drm/i915/i915_drv.h struct ilk_wm_values { · line 1394
Quoted 11 lines
drivers/gpu/drm/i915/i915_drv.h +11
-0+struct skl_ddb_entry { +uint16_t start, end;/* in number of blocks */ +}; + +static inline uint16_t skl_ddb_entry_size (const struct skl_ddb_entry *entry) +{ +/* end not set, clearly no allocation here. start can be 0 though */ +if (entry->end ==0 ) +return 0 ; + +return entry->end - entry->start +1 ;I would make 'end' exclusive as that allows you to represent an empty block more naturally, and you don't have to worry about the +/-1 adjustments when going between start/end and start/size representation.
Quoted 6 lines
The values we program in the registers are inclusive (I had a bug where the end of one plane and the start of another plane had the same value and artefacts could be seen, due to the pipes fetching from overlapping DDB space). I took the option of having those values mirror what we need to program. Hopefully the small functions around the
skl_ddb_entrystructure doesn't make it too bad?
I'd still change to exclusive. Inclusive is just too troublesome to use IMO, you're bound to forget the magic +/-1 somewhere eventually.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 46/89] drm/i915/skl: Add DDB allocation management structures
In reply to Damien LespiauQuoted 4 lines · Damien Lespiau
We now need to allocate space in the DDB for planes being scanned out ourselves. The data structure to represent an allocation mirrors what we'll need to write in the registers later on: (start, end).
Quoted 8 lines
We add that allocation datat to the
skl_wm_valuesstructure as part of the values to program the hardware with.v2: Split planes and cursor for consistency.
v3: Make the
skl_ddb_entry_size()parameter constSigned-off-by Damien Lespiau <[email protected]>
Yeah I'm mostly happy with the fixup patch for the inclusive vs. exclusive, so
Quoted 43 lines
--- drivers/gpu/drm/i915/i915_drv.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/gpu/drm/i915/i915_drv.h +19
-0@@ -1381,8 +1381,27 @@ struct ilk_wm_values {enum intel_ddb_partitioning partitioning; }; +struct skl_ddb_entry { +uint16_t start, end;/* in number of blocks */ +}; + +static inline uint16_t skl_ddb_entry_size (const struct skl_ddb_entry *entry) +{ +/* end not set, clearly no allocation here. start can be 0 though */ +if (entry->end ==0 ) +return 0 ; + +return entry->end - entry->start +1 ; +} + +struct skl_ddb_allocation { +struct skl_ddb_entry plane[I915_MAX_PIPES ][I915_MAX_PLANES ]; +struct skl_ddb_entry cursor[I915_MAX_PIPES ]; +}; +struct skl_wm_values {bool dirty[I915_MAX_PIPES ]; +struct skl_ddb_allocation ddb;uint32_t wm_linetime[I915_MAX_PIPES ];uint32_t plane[I915_MAX_PIPES ][I915_MAX_PLANES ][8 ];uint32_t cursor[I915_MAX_PIPES ][8 ];Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 47/89 drm/i915/skl: SKL Watermark Computation
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch implements the watermark algorithm and its necessary functions. Two function pointers skl_update_wm and skl_update_sprite_wm are provided. The skl_update_wm will update the watermarks for the crtc provided as an argument and then checks for change in DDB allocation for other active pipes and recomputes the watermarks for those Pipes and planes as well. Finally it does the register programming for all dirty pipes. The trigger of the Watermark double buffer registers will have to be once the plane configurations are done by the caller.
v2: fixed the divide-by-0 error in the results computation func.
Also reworked the PLANE_WM register values computation func to make it more compact. Incorporated all other review comments from Damien.
v3: Changed the skl_compute_plane_wm function to now return success
or failure. Also the result blocks and lines are computed here instead of in skl_compute_wm_results function.
v4: Adjust skl_ddb_alloc_changed() to the new planes/cursor split
(Damien)
v5: Reworked the affected functions to implement new plane/cursor
split.
v6: Rework the logic that triggers the DDB allocation and WM computation
of skl_update_other_pipe_wm() to not depend on non-computed DDB values.
Always give a valid cursor_width (at boot it's 0) to keep the invariant that we consider the cursor plane always enabled. Otherwise we end up dividing by 0 in skl_compute_plane_wm() (Damien Lespiau)
v7: Spell out allocation
skl_ddb_ functions should have the ddb as first argument Make the skl_ddb_alloc_changed() parameters const (Damien)
v8: Rebase on top of the crtc->primary changes
v9: Split the staging results structure to not exceed the 1Kb stack
allocation in skl_update_wm()
drm/i915/skl: Don't allocate as much on the stack in skl_update_wm()
Stack space can be scarce and a compiler check has been added to warn if the per-function stack allocation is above 1KB.
We we were hitting that warning in skl_update_wm(), so move the big results array in dev_priv instead.
For reference, here's the compiler warning before this patch:
drivers/gpu/drm/i915/intel_pm.c: In function ‘skl_update_wm’:
drivers/gpu/drm/i915/intel_pm.c:3618:1: warning: the frame size of 1296 bytes
is larger than 1024 bytes [-Wframe-larger-than=]
--- drivers/gpu/drm/i915/i915_drv.h | 12 +- drivers/gpu/drm/i915/intel_pm.c | 423 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +11 -1
@@ -1709,8 +1709,18 @@ struct drm_i915_private {*/ uint16_t skl_latency[8 ]; +/* +* The skl_wm_values structure is a bit too big for stack +* allocation, so we keep the staging struct where we store +* intermediate results here instead. +*/ +struct skl_wm_values skl_results; +/* current hardware state */ -struct ilk_wm_values hw; +union { +struct ilk_wm_values hw; +struct skl_wm_values skl_hw; + }; } wm;struct i915_runtime_pm pm;
drivers/gpu/drm/i915/intel_pm.c +423 -0
435 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 47/89] drm/i915/skl: SKL Watermark Computation
Quoted 100 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch implements the watermark algorithm and its necessary functions. Two function pointers
skl_update_wmandskl_update_sprite_wmare provided. Theskl_update_wmwill update the watermarks for the crtc provided as an argument and then checks for change in DDB allocation for other active pipes and recomputes the watermarks for those Pipes and planes as well. Finally it does the register programming for all dirty pipes. The trigger of the Watermark double buffer registers will have to be once the plane configurations are done by the caller.v2: fixed the divide-by-0 error in the results computation func.
Also reworked thePLANE_WMregister values computation func to make it more compact. Incorporated all other review comments from Damien.v3: Changed the
skl_compute_plane_wmfunction to now return success
or failure. Also the result blocks and lines are computed here instead of inskl_compute_wm_resultsfunction.v4: Adjust
skl_ddb_alloc_changed()to the new planes/cursor split
(Damien)v5: Reworked the affected functions to implement new plane/cursor
split.v6: Rework the logic that triggers the DDB allocation and WM computation
ofskl_update_other_pipe_wm()to not depend on non-computed DDB values.
Always give a validcursor_width(at boot it's 0) to keep the invariant that we consider the cursor plane always enabled. Otherwise we end up dividing by 0 inskl_compute_plane_wm()(Damien Lespiau)v7: Spell out allocation
skl_ddb_functions should have the ddb as first argument Make theskl_ddb_alloc_changed()parameters const (Damien)v8: Rebase on top of the
crtc->primarychangesv9: Split the staging results structure to not exceed the 1Kb stack
allocation inskl_update_wm()Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>drm/i915/skl: Don't allocate as much on the stack in
skl_update_wm()Stack space can be scarce and a compiler check has been added to warn if the per-function stack allocation is above 1KB.
We we were hitting that warning in
skl_update_wm(), so move the big results array indev_privinstead.For reference, here's the compiler warning before this patch:
drivers/gpu/drm/i915/intel_pm.c: In function ‘skl_update_wm’:
drivers/gpu/drm/i915/intel_pm.c:3618:1: warning: the frame size of 1296 bytes
is larger than 1024 bytes [-Wframe-larger-than=]Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 12 +- drivers/gpu/drm/i915/intel_pm.c | 423 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +11
-1@@ -1709,8 +1709,18 @@ struct drm_i915_private {*/ uint16_t skl_latency[8 ]; +/* +* The skl_wm_values structure is a bit too big for stack +* allocation, so we keep the staging struct where we store +* intermediate results here instead. +*/ +struct skl_wm_values skl_results; +/* current hardware state */ -struct ilk_wm_values hw; +union { +struct ilk_wm_values hw; +struct skl_wm_values skl_hw; + }; } wm;struct i915_runtime_pm pm;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2937,6 +2937,427 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); }
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2949
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+static uint32_t skl_pipe_pixel_rate (struct drm_device *dev, +struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +uint32_t pixel_rate; + + pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; + +return pixel_rate; +}
I changed the ilk version to take just the pipe config as a parameter. This should be changed to do the same. I'm not entirely sure it makes sense to have this function around until pipe scaling is implemented, but I guess it serves as a decent reminder that something needs to be done here.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2959
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +static uint32_t skl_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t wm_intermediate_val, ret; + +if (latency ==0 ) +return UINT_MAX ; + + wm_intermediate_val = latency * pixel_rate * bytes_per_pixel;
I was a bit worried if we have enough bits here, but max latency should be 0xff and bytes_per_pixel should always be <=8, so that should allow pixel_rate up to ~2 GHz which seems sufficient since max 2xcdclk is 1350 MHz and the pixel rate should never exceed that. Not that we have such checks anywhere at the moment, but we should eventually add them.
Quoted 23 lines
drivers/gpu/drm/i915/intel_pm.c +23
-0+ ret =DIV_ROUND_UP (wm_intermediate_val,1000 ); + +return ret; +} + +static uint32_t skl_wm_method2 (uint32_t pixel_rate,uint32_t pipe_htotal, +uint32_t horiz_pixels,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t ret, plane_bytes_per_line, wm_intermediate_val; + +if (latency ==0 ) +return UINT_MAX ; + + plane_bytes_per_line = horiz_pixels * bytes_per_pixel; + wm_intermediate_val = latency * pixel_rate; + ret =DIV_ROUND_UP (wm_intermediate_val, pipe_htotal *1000 ) * + plane_bytes_per_line; + +return ret; +} + +static void skl_compute_transition_wm(struct drm_crtc *crtc,
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2992
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ struct skl_pipe_wm_parameters *params, + struct skl_pipe_wm *pipe_wm) +{ +/* +* For now it is suggested to use the LP0 wm val of corresponding +* plane as transition wm val. This is done while computing results. +*/ +if (!params->active) +return ; +}
Seems like a rather pointless function.
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+ +static uint32_t +skl_compute_linetime_wm (struct drm_crtc *crtc,struct skl_pipe_wm_parameters *p) +{ +if (!intel_crtc_active (crtc)) +return 0 ; +
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3009
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+return DIV_ROUND_UP (8 * p->pipe_htotal *1000 , p->pixel_rate); + +} + +static bool skl_ddb_allocation_changed (const struct skl_ddb_allocation *new_ddb, +const struct intel_crtc *intel_crtc) +{ +struct drm_device *dev = intel_crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb;
const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3013
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+enum pipe pipe = intel_crtc->pipe; +size_t size; + + size =ARRAY_SIZE (new_ddb->plane[pipe]) *sizeof (struct skl_ddb_entry );
sizeof(new_ddb->plane[pipe])
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3018
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+if (memcmp (new_ddb->plane[pipe], cur_ddb->plane[pipe], size)) +return true; + +if (memcmp (&new_ddb->cursor[pipe], &cur_ddb->cursor[pipe], +sizeof (struct skl_ddb_entry )))
sizeof(new_ddb->cursor[pipe])
Quoted 63 lines
drivers/gpu/drm/i915/intel_pm.c +63
-0+return true; + +return false; +} + +static void skl_compute_wm_global_parameters (struct drm_device *dev, +struct intel_wm_config *config) +{ +struct drm_crtc *crtc; +struct drm_plane *plane; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) + config->num_pipes_active +=intel_crtc_active (crtc); + +/* FIXME: I don't think we need those two global parameters on SKL */ +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + + config->sprites_enabled |= intel_plane->wm.enabled; + config->sprites_scaled |= intel_plane->wm.scaled; + } +} + +static void skl_compute_wm_pipe_parameters (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *p) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +struct drm_plane *plane; +int i =1 ;/* Index for sprite planes start */ + + p->active =intel_crtc_active (crtc); +if (p->active) { + p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; + p->pixel_rate =skl_pipe_pixel_rate (dev, crtc); + +/* +* For now, assume primary and cursor planes are always enabled. +*/ + p->plane[0 ].enabled = true; + p->plane[0 ].bytes_per_pixel = + crtc->primary->fb->bits_per_pixel /8 ; + p->plane[0 ].horiz_pixels = intel_crtc->config.pipe_src_w; + p->plane[0 ].vert_pixels = intel_crtc->config.pipe_src_h; + + p->cursor.enabled = true; + p->cursor.bytes_per_pixel =4 ; + p->cursor.horiz_pixels = intel_crtc->cursor_width ? + intel_crtc->cursor_width :64 ; + } + +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + +if (intel_plane->pipe == pipe) + p->plane[i++] = intel_plane->wm; + } +} + +static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p, + struct intel_plane_wm_parameters *p_params, + uint16_t max_page_buff_alloc,
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3091
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+uint32_t mem_value, + uint16_t *res_blocks, /* out */ + uint8_t *res_lines /* out */) +{ + uint32_t method1, method2, plane_bytes_per_line; +uint32_t result_bytes; + +if (!p->active || !p_params->enabled) { + *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; + *res_lines =PLANE_WM_LINES_DEFAULT ;
Why do we need to set !=0 values for disabled planes?
Quoted 14 lines
drivers/gpu/drm/i915/intel_pm.c +14
-0+return false; + } + + method1 =skl_wm_method1 (p->pixel_rate, + p_params->bytes_per_pixel, + mem_value); + method2 =skl_wm_method2 (p->pixel_rate, + p->pipe_htotal, + p_params->horiz_pixels, + p_params->bytes_per_pixel, + mem_value); + + plane_bytes_per_line = p_params->horiz_pixels * + p_params->bytes_per_pixel;
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3115
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +/* For now xtile and linear */ +if (((max_page_buff_alloc *512 ) / plane_bytes_per_line) >=1 ) + result_bytes =min (method1, method2); +else + result_bytes = method1; + + *res_blocks =DIV_ROUND_UP (result_bytes,512 ) +1 ; + *res_lines =DIV_ROUND_UP (result_bytes, plane_bytes_per_line); +
Seems we're missing the final validity checks here.
Quoted 51 lines
drivers/gpu/drm/i915/intel_pm.c +51
-0+return true; +} + +static void skl_compute_wm_level (const struct drm_i915_private *dev_priv, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *p, +enum pipe pipe, +int level, +int num_planes, +struct skl_wm_level *result) +{ +uint16_t latency = dev_priv->wm.skl_latency[level]; +uint16_t ddb_blocks; +int i; + +for (i =0 ; i < num_planes; i++) { + ddb_blocks =skl_ddb_entry_size (&ddb->plane[pipe][i]); + + result->plane_en[i] =skl_compute_plane_wm (p, &p->plane[i], + ddb_blocks, + latency, + &result->plane_res_b[i], + &result->plane_res_l[i]); + } + + ddb_blocks =skl_ddb_entry_size (&ddb->cursor[pipe]); + result->cursor_en =skl_compute_plane_wm (p, &p->cursor, ddb_blocks, + latency, &result->cursor_res_b, + &result->cursor_res_l); +} + +static void skl_compute_pipe_wm (struct drm_crtc *crtc, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *params, +struct skl_pipe_wm *pipe_wm) +{ +struct drm_device *dev = crtc->dev; +const struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int level, max_level =ilk_wm_max_level (dev); + +for (level =0 ; level <= max_level; level++) { +skl_compute_wm_level (dev_priv, ddb, params, intel_crtc->pipe, + level,intel_num_planes (intel_crtc), + &pipe_wm->wm[level]); + } + pipe_wm->linetime =skl_compute_linetime_wm (crtc, params); + +skl_compute_transition_wm (crtc, params, pipe_wm); +} +
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3176
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+static void skl_compute_wm_results (struct drm_device *dev, +struct skl_pipe_wm_parameters *p, +struct skl_pipe_wm *p_wm, +struct skl_wm_values *r, +struct intel_crtc *intel_crtc) +{ +int i, level, max_level =ilk_wm_max_level (dev); +uint32_t temp; +enum pipe pipe = intel_crtc->pipe; +uint16_t ddb_blocks;
Could move a bunch of that to a narrower scope.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3185
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9
-0+ +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (intel_crtc); i++) { + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.plane[pipe][i]); + +if ((p_wm->wm[level].plane_res_b[i] > ddb_blocks) || + (p_wm->wm[level].plane_res_l[i] >31 )) + p_wm->wm[level].plane_en[i] = false;
So the validity check is here that I was expecting in skl_compute_plane_wm(). The way this is done makes me think we might overflow the register bitfields if invalid values are propagated this far.
The way the ilk code works is that it won't ever keep around intermediate values that would exceed the register maximum values (such values are already dropped in intel_compute_pipe_wm()), and then it will filter out the otherwise invalid values in ilk_wm_merge() before ilk_compute_wm_results() gets called. Would seem less surprising if we could follow a similar pattern in the skl code.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3196
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c +11
-0+ + temp |= p_wm->wm[level].plane_res_l[i] << +PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].plane_res_b[i]; +if (p_wm->wm[level].plane_en[i]) + temp |=PLANE_WM_EN ; + + r->plane[pipe][i][level] = temp; +/* Use the LP0 WM value for transition WM for now. */ +if (level ==0 ) + r->plane_trans[pipe][i] = temp;
I'd stick this special case into the compute function rather than here.
Quoted 17 lines
drivers/gpu/drm/i915/intel_pm.c +17
-0+ } + + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.cursor[pipe]); + +if ((p_wm->wm[level].cursor_res_b > ddb_blocks) || + (p_wm->wm[level].cursor_res_l >31 )) + p_wm->wm[level].cursor_en = false; + + temp |= p_wm->wm[level].cursor_res_l <<PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].cursor_res_b; + +if (p_wm->wm[level].cursor_en) + temp |=PLANE_WM_EN ; + + r->cursor[pipe][level] = temp; +/* Use the LP0 WM value for transition WM for now. */
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3223
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+if (level ==0 ) + r->cursor_trans[pipe] = temp; + + } + + r->wm_linetime[pipe] = p_wm->linetime; +} + +static void skl_write_wm_values (struct drm_i915_private *dev_priv, +struct skl_wm_values *new)
const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3228
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+{ +struct drm_device *dev = dev_priv->dev; +struct intel_crtc *crtc; +int i, level, max_level =ilk_wm_max_level (dev); +enum pipe pipe;
More stuff that could live in a narrower scope.
Quoted 41 lines
drivers/gpu/drm/i915/intel_pm.c +41
-0+ +list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { + pipe = crtc->pipe; +if (new->dirty[pipe]) { +I915_WRITE (PIPE_WM_LINETIME (pipe), + new->wm_linetime[pipe]); + +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM (pipe, i, level), + new->plane[pipe][i][level]); +I915_WRITE (CUR_WM (pipe, level), + new->cursor[pipe][level]); + } +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM_TRANS (pipe, i), + new->plane_trans[pipe][i]); +I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + } + } + + dev_priv->wm.skl_hw = *new; +} + +static bool skl_update_pipe_wm (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *params, +struct intel_wm_config *config, +struct skl_ddb_allocation *ddb,/* out */ +struct skl_pipe_wm *pipe_wm/* out */ ) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +skl_compute_wm_pipe_parameters (crtc, params); +skl_compute_pipe_wm (crtc, ddb, params, pipe_wm); + +if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm))) +return false; + + intel_crtc->wm.skl_active = *pipe_wm; +return true; +}
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3279
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +static void skl_update_other_pipe_wm (struct drm_device *dev, +struct drm_crtc *crtc, +struct intel_wm_config *config, +struct skl_wm_values *r) +{ +struct intel_crtc *intel_crtc; +struct intel_crtc *this_crtc =to_intel_crtc (crtc); +struct skl_pipe_wm_parameters params; +struct skl_pipe_wm pipe_wm;
More stuff that can be moved to a narrower scope.
Should these be zero initializd? At least the way the ilk code works is that most structures need zero initialization to avoid consulting stack garbage somewhere down the line.
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+ +/* +* If the WM update hasn't changed the allocation for this_crtc (the +* crtc we are currently computing the new WM values for), other +* enabled crtcs will keep the same allocation and we don't need to +* recompute anything for them.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3295
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+*/ +if (!skl_ddb_allocation_changed (&r->ddb, this_crtc)) +return ; + +/* +* Otherwise, because of this_crtc being freshly enabled/disabled, the +* other active pipes need new DDB allocation and WM values. +*/ +list_for_each_entry (intel_crtc, &dev->mode_config.crtc_list, + base.head) {
Not sure how the locking is planned here. In the ilk wm patches that are still pending I'm adding a wm.mutex which might fit the bill. Otherwise we're going to need to make sure we have all the crtc locks held here.
Also if multiple pipes are active we surely can't just go changing the DDB allocation without considering the fact that vblanks for all pipes don't occur at the same time. So some kind of heavy handed synchronization is needed to make sure none of the DDB allocations overlap even for a short period of time.
Quoted 84 lines
drivers/gpu/drm/i915/intel_pm.c +67
-0+bool wm_changed; + +if (this_crtc->pipe == intel_crtc->pipe) +continue ; + +if (!intel_crtc->active) +continue ; + + wm_changed =skl_update_pipe_wm (&intel_crtc->base, + ¶ms, config, + &r->ddb, &pipe_wm); + +/* +* If we end up re-computing the other pipe WM values, it's +* because it was really needed, so we expect the WM values to +* be different. +*/ +WARN_ON (!wm_changed); + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, r, intel_crtc); + r->dirty[intel_crtc->pipe] = true; + } +} + +static void skl_update_wm (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_pipe_wm_parameters params = {}; +struct skl_wm_values *results = &dev_priv->wm.skl_results; +struct skl_pipe_wm pipe_wm = {}; +struct intel_wm_config config = {}; + +memset (results,0 ,sizeof (*results)); + +skl_compute_wm_global_parameters (dev, &config); + +if (!skl_update_pipe_wm (crtc, ¶ms, &config, + &results->ddb, &pipe_wm)) +return ; + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, results, intel_crtc); + results->dirty[intel_crtc->pipe] = true; + +skl_update_other_pipe_wm (dev, crtc, &config, results); +skl_write_wm_values (dev_priv, results); +} + +static void +skl_update_sprite_wm (struct drm_plane *plane,struct drm_crtc *crtc, +uint32_t sprite_width,uint32_t sprite_height, +int pixel_size,bool enabled,bool scaled) +{ +struct intel_plane *intel_plane =to_intel_plane (plane); + + intel_plane->wm.enabled = enabled; + intel_plane->wm.scaled = scaled; + intel_plane->wm.horiz_pixels = sprite_width; + intel_plane->wm.vert_pixels = sprite_height; + intel_plane->wm.bytes_per_pixel = pixel_size; + +skl_update_wm (crtc); +} +static void ilk_update_wm (struct drm_crtc *crtc) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc);@@ -7464,6 +7885,8 @@ void intel_init_pm(struct drm_device *dev)skl_setup_wm_latency (dev); dev_priv->display.init_clock_gating = gen9_init_clock_gating; + dev_priv->display.update_wm = skl_update_wm; + dev_priv->display.update_sprite_wm = skl_update_sprite_wm; }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 47/89] drm/i915/skl: SKL Watermark Computation
Hi Satheesh,
Quoted 16 lines · Ville Syrjälä
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3091
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +13
-0+static bool skl_compute_plane_wm (struct skl_pipe_wm_parameters *p, +struct intel_plane_wm_parameters *p_params, +uint16_t max_page_buff_alloc, +uint32_t mem_value, +uint16_t *res_blocks,/* out */ +uint8_t *res_lines/* out */ ) +{ +uint32_t method1, method2, plane_bytes_per_line; +uint32_t result_bytes; + +if (!p->active || !p_params->enabled) { + *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; + *res_lines =PLANE_WM_LINES_DEFAULT ;Why do we need to set !=0 values for disabled planes?
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return false; + }
Do you remember why we would program some default numbers of blocks/lines for disabled planes? Can't find a reason to do so now.
Thanks,
Signature · 1 line
Damien
Re: [PATCH 47/89] drm/i915/skl: SKL Watermark Computation
Quoted 18 lines · Damien Lespiau
Hi Satheesh,
Quoted 15 lines · Ville Syrjälä
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3091
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +13
-0+static bool skl_compute_plane_wm (struct skl_pipe_wm_parameters *p, +struct intel_plane_wm_parameters *p_params, +uint16_t max_page_buff_alloc, +uint32_t mem_value, +uint16_t *res_blocks,/* out */ +uint8_t *res_lines/* out */ ) +{ +uint32_t method1, method2, plane_bytes_per_line; +uint32_t result_bytes; + +if (!p->active || !p_params->enabled) { + *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; + *res_lines =PLANE_WM_LINES_DEFAULT ;Why do we need to set !=0 values for disabled planes?
Quoted 4 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return false; + }Do you remember why we would program some default numbers of blocks/lines for disabled planes? Can't find a reason to do so now.
Yes, that's not required as returning false here disables the WM itself.
Quoted 3 lines
Thanks,
PATCH v11 47/89 drm/i915/skl: SKL Watermark Computation
In reply to Ville SyrjäläFrom: Pradeep Bhat <[email protected]>
This patch implements the watermark algorithm and its necessary functions. Two function pointers skl_update_wm and skl_update_sprite_wm are provided. The skl_update_wm will update the watermarks for the crtc provided as an argument and then checks for change in DDB allocation for other active pipes and recomputes the watermarks for those Pipes and planes as well. Finally it does the register programming for all dirty pipes. The trigger of the Watermark double buffer registers will have to be once the plane configurations are done by the caller.
v2: fixed the divide-by-0 error in the results computation func.
Also reworked the PLANE_WM register values computation func to make it more compact. Incorporated all other review comments from Damien.
v3: Changed the skl_compute_plane_wm function to now return success
or failure. Also the result blocks and lines are computed here instead of in skl_compute_wm_results function.
v4: Adjust skl_ddb_alloc_changed() to the new planes/cursor split
(Damien)
v5: Reworked the affected functions to implement new plane/cursor
split.
v6: Rework the logic that triggers the DDB allocation and WM computation
of skl_update_other_pipe_wm() to not depend on non-computed DDB values.
Always give a valid cursor_width (at boot it's 0) to keep the invariant that we consider the cursor plane always enabled. Otherwise we end up dividing by 0 in skl_compute_plane_wm() (Damien Lespiau)
v7: Spell out allocation
skl_ddb_ functions should have the ddb as first argument Make the skl_ddb_alloc_changed() parameters const (Damien)
v8: Rebase on top of the crtc->primary changes
v9: Split the staging results structure to not exceed the 1Kb stack
allocation in skl_update_wm()
v10: Make skl_pipe_pixel_rate() take a pointer to the pipe config
Add a comment about overflow considerations for skl_wm_method1() Various additions of const
Various use of sizeof(variable) instead of sizeof(type) Various move of variable definitons to a narrower scope Zero initialize some stack allocated structures to make sure we don't have garbage in case we don't write all the values (Ville)
v11: Remove non-necessary default number of blocks/lines when the plane
is disabled (Ville)
--- drivers/gpu/drm/i915/i915_drv.h | 12 +- drivers/gpu/drm/i915/intel_pm.c | 422 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 433 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +11 -1
@@ -1722,8 +1722,18 @@ struct drm_i915_private {*/ uint16_t skl_latency[8 ]; +/* +* The skl_wm_values structure is a bit too big for stack +* allocation, so we keep the staging struct where we store +* intermediate results here instead. +*/ +struct skl_wm_values skl_results; +/* current hardware state */ -struct ilk_wm_values hw; +union { +struct ilk_wm_values hw; +struct skl_wm_values skl_hw; + }; } wm;struct i915_runtime_pm pm;
drivers/gpu/drm/i915/intel_pm.c +422 -0
434 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 47/89 v11] drm/i915/skl: SKL Watermark Computation
Quoted 54 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch implements the watermark algorithm and its necessary functions. Two function pointers
skl_update_wmandskl_update_sprite_wmare provided. Theskl_update_wmwill update the watermarks for the crtc provided as an argument and then checks for change in DDB allocation for other active pipes and recomputes the watermarks for those Pipes and planes as well. Finally it does the register programming for all dirty pipes. The trigger of the Watermark double buffer registers will have to be once the plane configurations are done by the caller.v2: fixed the divide-by-0 error in the results computation func.
Also reworked thePLANE_WMregister values computation func to make it more compact. Incorporated all other review comments from Damien.v3: Changed the
skl_compute_plane_wmfunction to now return success
or failure. Also the result blocks and lines are computed here instead of inskl_compute_wm_resultsfunction.v4: Adjust
skl_ddb_alloc_changed()to the new planes/cursor split
(Damien)v5: Reworked the affected functions to implement new plane/cursor
split.v6: Rework the logic that triggers the DDB allocation and WM computation
ofskl_update_other_pipe_wm()to not depend on non-computed DDB values.
Always give a validcursor_width(at boot it's 0) to keep the invariant that we consider the cursor plane always enabled. Otherwise we end up dividing by 0 inskl_compute_plane_wm()(Damien Lespiau)v7: Spell out allocation
skl_ddb_functions should have the ddb as first argument Make theskl_ddb_alloc_changed()parameters const (Damien)v8: Rebase on top of the
crtc->primarychangesv9: Split the staging results structure to not exceed the 1Kb stack
allocation inskl_update_wm()v10: Make
skl_pipe_pixel_rate()take a pointer to the pipe config
Add a comment about overflow considerations forskl_wm_method1()Various additions of const
Various use of sizeof(variable) instead of sizeof(type) Various move of variable definitons to a narrower scope Zero initialize some stack allocated structures to make sure we don't have garbage in case we don't write all the values (Ville)
Quoted 5 lines
v11: Remove non-necessary default number of blocks/lines when the plane
is disabled (Ville)Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>
Looks OK. The fixup to move the validity check still seems to need a bit of tweaking but otherwise I think it's sane enough.
I seem to recall that I went through all of the little details the first time around, so I decided to not do that this time. Hopefully my memory is correct ;)
Quoted 471 lines
--- drivers/gpu/drm/i915/i915_drv.h | 12 +- drivers/gpu/drm/i915/intel_pm.c | 422 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 433 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +11
-1@@ -1722,8 +1722,18 @@ struct drm_i915_private {*/ uint16_t skl_latency[8 ]; +/* +* The skl_wm_values structure is a bit too big for stack +* allocation, so we keep the staging struct where we store +* intermediate results here instead. +*/ +struct skl_wm_values skl_results; +/* current hardware state */ -struct ilk_wm_values hw; +union { +struct ilk_wm_values hw; +struct skl_wm_values skl_hw; + }; } wm;struct i915_runtime_pm pm;drivers/gpu/drm/i915/intel_pm.c +422
-0@@ -2957,6 +2957,426 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +static uint32_t skl_pipe_pixel_rate (const struct intel_crtc_config *config) +{ +/* TODO: Take into account the scalers once we support them */ +return config->adjusted_mode.crtc_clock; +} + +/* +* The max latency should be 257 (max the punit can code is 255 and we add 2us +* for the read latency) and bytes_per_pixel should always be <= 8, so that +* should allow pixel_rate up to ~2 GHz which seems sufficient since max +* 2xcdclk is 1350 MHz and the pixel rate should never exceed that. +*/ +static uint32_t skl_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t wm_intermediate_val, ret; + +if (latency ==0 ) +return UINT_MAX ; + + wm_intermediate_val = latency * pixel_rate * bytes_per_pixel; + ret =DIV_ROUND_UP (wm_intermediate_val,1000 ); + +return ret; +} + +static uint32_t skl_wm_method2 (uint32_t pixel_rate,uint32_t pipe_htotal, +uint32_t horiz_pixels,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t ret, plane_bytes_per_line, wm_intermediate_val; + +if (latency ==0 ) +return UINT_MAX ; + + plane_bytes_per_line = horiz_pixels * bytes_per_pixel; + wm_intermediate_val = latency * pixel_rate; + ret =DIV_ROUND_UP (wm_intermediate_val, pipe_htotal *1000 ) * + plane_bytes_per_line; + +return ret; +} + +static void skl_compute_transition_wm (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *params, +struct skl_pipe_wm *pipe_wm) +{ +/* +* For now it is suggested to use the LP0 wm val of corresponding +* plane as transition wm val. This is done while computing results. +*/ +if (!params->active) +return ; +} + +static uint32_t +skl_compute_linetime_wm (struct drm_crtc *crtc,struct skl_pipe_wm_parameters *p) +{ +if (!intel_crtc_active (crtc)) +return 0 ; + +return DIV_ROUND_UP (8 * p->pipe_htotal *1000 , p->pixel_rate); + +} + +static bool skl_ddb_allocation_changed (const struct skl_ddb_allocation *new_ddb, +const struct intel_crtc *intel_crtc) +{ +struct drm_device *dev = intel_crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +const struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb; +enum pipe pipe = intel_crtc->pipe; + +if (memcmp (new_ddb->plane[pipe], cur_ddb->plane[pipe], +sizeof (new_ddb->plane[pipe]))) +return true; + +if (memcmp (&new_ddb->cursor[pipe], &cur_ddb->cursor[pipe], +sizeof (new_ddb->cursor[pipe]))) +return true; + +return false; +} + +static void skl_compute_wm_global_parameters (struct drm_device *dev, +struct intel_wm_config *config) +{ +struct drm_crtc *crtc; +struct drm_plane *plane; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) + config->num_pipes_active +=intel_crtc_active (crtc); + +/* FIXME: I don't think we need those two global parameters on SKL */ +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + + config->sprites_enabled |= intel_plane->wm.enabled; + config->sprites_scaled |= intel_plane->wm.scaled; + } +} + +static void skl_compute_wm_pipe_parameters (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *p) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +struct drm_plane *plane; +int i =1 ;/* Index for sprite planes start */ + + p->active =intel_crtc_active (crtc); +if (p->active) { + p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; + p->pixel_rate =skl_pipe_pixel_rate (&intel_crtc->config); + +/* +* For now, assume primary and cursor planes are always enabled. +*/ + p->plane[0 ].enabled = true; + p->plane[0 ].bytes_per_pixel = + crtc->primary->fb->bits_per_pixel /8 ; + p->plane[0 ].horiz_pixels = intel_crtc->config.pipe_src_w; + p->plane[0 ].vert_pixels = intel_crtc->config.pipe_src_h; + + p->cursor.enabled = true; + p->cursor.bytes_per_pixel =4 ; + p->cursor.horiz_pixels = intel_crtc->cursor_width ? + intel_crtc->cursor_width :64 ; + } + +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + +if (intel_plane->pipe == pipe) + p->plane[i++] = intel_plane->wm; + } +} + +static bool skl_compute_plane_wm (struct skl_pipe_wm_parameters *p, +struct intel_plane_wm_parameters *p_params, +uint16_t max_page_buff_alloc, +uint32_t mem_value, +uint16_t *res_blocks,/* out */ +uint8_t *res_lines/* out */ ) +{ +uint32_t method1, method2, plane_bytes_per_line; +uint32_t result_bytes; + +if (!p->active || !p_params->enabled) +return false; + + method1 =skl_wm_method1 (p->pixel_rate, + p_params->bytes_per_pixel, + mem_value); + method2 =skl_wm_method2 (p->pixel_rate, + p->pipe_htotal, + p_params->horiz_pixels, + p_params->bytes_per_pixel, + mem_value); + + plane_bytes_per_line = p_params->horiz_pixels * + p_params->bytes_per_pixel; + +/* For now xtile and linear */ +if (((max_page_buff_alloc *512 ) / plane_bytes_per_line) >=1 ) + result_bytes =min (method1, method2); +else + result_bytes = method1; + + *res_blocks =DIV_ROUND_UP (result_bytes,512 ) +1 ; + *res_lines =DIV_ROUND_UP (result_bytes, plane_bytes_per_line); + +return true; +} + +static void skl_compute_wm_level (const struct drm_i915_private *dev_priv, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *p, +enum pipe pipe, +int level, +int num_planes, +struct skl_wm_level *result) +{ +uint16_t latency = dev_priv->wm.skl_latency[level]; +uint16_t ddb_blocks; +int i; + +for (i =0 ; i < num_planes; i++) { + ddb_blocks =skl_ddb_entry_size (&ddb->plane[pipe][i]); + + result->plane_en[i] =skl_compute_plane_wm (p, &p->plane[i], + ddb_blocks, + latency, + &result->plane_res_b[i], + &result->plane_res_l[i]); + } + + ddb_blocks =skl_ddb_entry_size (&ddb->cursor[pipe]); + result->cursor_en =skl_compute_plane_wm (p, &p->cursor, ddb_blocks, + latency, &result->cursor_res_b, + &result->cursor_res_l); +} + +static void skl_compute_pipe_wm (struct drm_crtc *crtc, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *params, +struct skl_pipe_wm *pipe_wm) +{ +struct drm_device *dev = crtc->dev; +const struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int level, max_level =ilk_wm_max_level (dev); + +for (level =0 ; level <= max_level; level++) { +skl_compute_wm_level (dev_priv, ddb, params, intel_crtc->pipe, + level,intel_num_planes (intel_crtc), + &pipe_wm->wm[level]); + } + pipe_wm->linetime =skl_compute_linetime_wm (crtc, params); + +skl_compute_transition_wm (crtc, params, pipe_wm); +} + +static void skl_compute_wm_results (struct drm_device *dev, +struct skl_pipe_wm_parameters *p, +struct skl_pipe_wm *p_wm, +struct skl_wm_values *r, +struct intel_crtc *intel_crtc) +{ +int level, max_level =ilk_wm_max_level (dev); +enum pipe pipe = intel_crtc->pipe; + +for (level =0 ; level <= max_level; level++) { +uint16_t ddb_blocks; +uint32_t temp; +int i; + +for (i =0 ; i <intel_num_planes (intel_crtc); i++) { + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.plane[pipe][i]); + +if ((p_wm->wm[level].plane_res_b[i] > ddb_blocks) || + (p_wm->wm[level].plane_res_l[i] >31 )) + p_wm->wm[level].plane_en[i] = false; + + temp |= p_wm->wm[level].plane_res_l[i] << +PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].plane_res_b[i]; +if (p_wm->wm[level].plane_en[i]) + temp |=PLANE_WM_EN ; + + r->plane[pipe][i][level] = temp; +/* Use the LP0 WM value for transition WM for now. */ +if (level ==0 ) + r->plane_trans[pipe][i] = temp; + } + + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.cursor[pipe]); + +if ((p_wm->wm[level].cursor_res_b > ddb_blocks) || + (p_wm->wm[level].cursor_res_l >31 )) + p_wm->wm[level].cursor_en = false; + + temp |= p_wm->wm[level].cursor_res_l <<PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].cursor_res_b; + +if (p_wm->wm[level].cursor_en) + temp |=PLANE_WM_EN ; + + r->cursor[pipe][level] = temp; +/* Use the LP0 WM value for transition WM for now. */ +if (level ==0 ) + r->cursor_trans[pipe] = temp; + + } + + r->wm_linetime[pipe] = p_wm->linetime; +} + +static void skl_write_wm_values (struct drm_i915_private *dev_priv, +const struct skl_wm_values *new) +{ +struct drm_device *dev = dev_priv->dev; +struct intel_crtc *crtc; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { +int i, level, max_level =ilk_wm_max_level (dev); +enum pipe pipe = crtc->pipe; + +if (new->dirty[pipe]) { +I915_WRITE (PIPE_WM_LINETIME (pipe), + new->wm_linetime[pipe]); + +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM (pipe, i, level), + new->plane[pipe][i][level]); +I915_WRITE (CUR_WM (pipe, level), + new->cursor[pipe][level]); + } +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM_TRANS (pipe, i), + new->plane_trans[pipe][i]); +I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + } + } + + dev_priv->wm.skl_hw = *new; +} + +static bool skl_update_pipe_wm (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *params, +struct intel_wm_config *config, +struct skl_ddb_allocation *ddb,/* out */ +struct skl_pipe_wm *pipe_wm/* out */ ) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +skl_compute_wm_pipe_parameters (crtc, params); +skl_compute_pipe_wm (crtc, ddb, params, pipe_wm); + +if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm))) +return false; + + intel_crtc->wm.skl_active = *pipe_wm; +return true; +} + +static void skl_update_other_pipe_wm (struct drm_device *dev, +struct drm_crtc *crtc, +struct intel_wm_config *config, +struct skl_wm_values *r) +{ +struct intel_crtc *intel_crtc; +struct intel_crtc *this_crtc =to_intel_crtc (crtc); + +/* +* If the WM update hasn't changed the allocation for this_crtc (the +* crtc we are currently computing the new WM values for), other +* enabled crtcs will keep the same allocation and we don't need to +* recompute anything for them. +*/ +if (!skl_ddb_allocation_changed (&r->ddb, this_crtc)) +return ; + +/* +* Otherwise, because of this_crtc being freshly enabled/disabled, the +* other active pipes need new DDB allocation and WM values. +*/ +list_for_each_entry (intel_crtc, &dev->mode_config.crtc_list, + base.head) { +struct skl_pipe_wm_parameters params = {}; +struct skl_pipe_wm pipe_wm = {}; +bool wm_changed; + +if (this_crtc->pipe == intel_crtc->pipe) +continue ; + +if (!intel_crtc->active) +continue ; + + wm_changed =skl_update_pipe_wm (&intel_crtc->base, + ¶ms, config, + &r->ddb, &pipe_wm); + +/* +* If we end up re-computing the other pipe WM values, it's +* because it was really needed, so we expect the WM values to +* be different. +*/ +WARN_ON (!wm_changed); + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, r, intel_crtc); + r->dirty[intel_crtc->pipe] = true; + } +} + +static void skl_update_wm (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_pipe_wm_parameters params = {}; +struct skl_wm_values *results = &dev_priv->wm.skl_results; +struct skl_pipe_wm pipe_wm = {}; +struct intel_wm_config config = {}; + +memset (results,0 ,sizeof (*results)); + +skl_compute_wm_global_parameters (dev, &config); + +if (!skl_update_pipe_wm (crtc, ¶ms, &config, + &results->ddb, &pipe_wm)) +return ; + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, results, intel_crtc); + results->dirty[intel_crtc->pipe] = true; + +skl_update_other_pipe_wm (dev, crtc, &config, results); +skl_write_wm_values (dev_priv, results); +} + +static void +skl_update_sprite_wm (struct drm_plane *plane,struct drm_crtc *crtc, +uint32_t sprite_width,uint32_t sprite_height, +int pixel_size,bool enabled,bool scaled) +{ +struct intel_plane *intel_plane =to_intel_plane (plane); + + intel_plane->wm.enabled = enabled; + intel_plane->wm.scaled = scaled; + intel_plane->wm.horiz_pixels = sprite_width; + intel_plane->wm.vert_pixels = sprite_height; + intel_plane->wm.bytes_per_pixel = pixel_size; + +skl_update_wm (crtc); +} +static void ilk_update_wm (struct drm_crtc *crtc) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc);@@ -7486,6 +7906,8 @@ void intel_init_pm(struct drm_device *dev)skl_setup_wm_latency (dev); dev_priv->display.init_clock_gating = gen9_init_clock_gating; + dev_priv->display.update_wm = skl_update_wm; + dev_priv->display.update_sprite_wm = skl_update_sprite_wm; }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);Signature · 1 line
1.8.3.1
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 47/89] drm/i915/skl: SKL Watermark Computation
In reply to Ville SyrjäläQuoted 57 lines · Ville Syrjälä
Quoted 56 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch implements the watermark algorithm and its necessary functions. Two function pointers
skl_update_wmandskl_update_sprite_wmare provided. Theskl_update_wmwill update the watermarks for the crtc provided as an argument and then checks for change in DDB allocation for other active pipes and recomputes the watermarks for those Pipes and planes as well. Finally it does the register programming for all dirty pipes. The trigger of the Watermark double buffer registers will have to be once the plane configurations are done by the caller.v2: fixed the divide-by-0 error in the results computation func.
Also reworked thePLANE_WMregister values computation func to make it more compact. Incorporated all other review comments from Damien.v3: Changed the
skl_compute_plane_wmfunction to now return success
or failure. Also the result blocks and lines are computed here instead of inskl_compute_wm_resultsfunction.v4: Adjust
skl_ddb_alloc_changed()to the new planes/cursor split
(Damien)v5: Reworked the affected functions to implement new plane/cursor
split.v6: Rework the logic that triggers the DDB allocation and WM computation
ofskl_update_other_pipe_wm()to not depend on non-computed DDB values.
Always give a validcursor_width(at boot it's 0) to keep the invariant that we consider the cursor plane always enabled. Otherwise we end up dividing by 0 inskl_compute_plane_wm()(Damien Lespiau)v7: Spell out allocation
skl_ddb_functions should have the ddb as first argument Make theskl_ddb_alloc_changed()parameters const (Damien)v8: Rebase on top of the
crtc->primarychangesv9: Split the staging results structure to not exceed the 1Kb stack
allocation inskl_update_wm()Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>drm/i915/skl: Don't allocate as much on the stack in
skl_update_wm()Stack space can be scarce and a compiler check has been added to warn if the per-function stack allocation is above 1KB.
We we were hitting that warning in
skl_update_wm(), so move the big results array indev_privinstead.
Quoted 7 lines
Quoted 7 lines
For reference, here's the compiler warning before this patch:
drivers/gpu/drm/i915/intel_pm.c: In function ‘skl_update_wm’:
drivers/gpu/drm/i915/intel_pm.c:3618:1: warning: the frame size of 1296 bytes
is larger than 1024 bytes [-Wframe-larger-than=]Signed-off-by Damien Lespiau <[email protected]>
So, v11 is answering all the review comments below but two, which I think need a proper diff to develop and review comfortably, so I'll send them on their own (and then we could them as separate patches or squashed into this one). The two changes in question are:
1/ put the (temporary) transition WM computation in the eponymous
function instead of resolving it at compute_results time
2/ Move the validity checks inside the compute function
Signature · 1 line
Damien
Quoted 544 lines
Quoted 37 lines
--- drivers/gpu/drm/i915/i915_drv.h | 12 +- drivers/gpu/drm/i915/intel_pm.c | 423 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 434 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +11
-1@@ -1709,8 +1709,18 @@ struct drm_i915_private {*/ uint16_t skl_latency[8 ]; +/* +* The skl_wm_values structure is a bit too big for stack +* allocation, so we keep the staging struct where we store +* intermediate results here instead. +*/ +struct skl_wm_values skl_results; +/* current hardware state */ -struct ilk_wm_values hw; +union { +struct ilk_wm_values hw; +struct skl_wm_values skl_hw; + }; } wm;struct i915_runtime_pm pm;drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2937,6 +2937,427 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); }drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2949
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+static uint32_t skl_pipe_pixel_rate (struct drm_device *dev, +struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +uint32_t pixel_rate; + + pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; + +return pixel_rate; +}I changed the ilk version to take just the pipe config as a parameter. This should be changed to do the same. I'm not entirely sure it makes sense to have this function around until pipe scaling is implemented, but I guess it serves as a decent reminder that something needs to be done here.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2959
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +static uint32_t skl_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t wm_intermediate_val, ret; + +if (latency ==0 ) +return UINT_MAX ; + + wm_intermediate_val = latency * pixel_rate * bytes_per_pixel;I was a bit worried if we have enough bits here, but max latency should be
0xffandbytes_per_pixelshould always be <=8, so that should allowpixel_rateup to ~2 GHz which seems sufficient since max 2xcdclk is 1350 MHz and the pixel rate should never exceed that. Not that we have such checks anywhere at the moment, but we should eventually add them.Quoted 23 lines
drivers/gpu/drm/i915/intel_pm.c +23
-0+ ret =DIV_ROUND_UP (wm_intermediate_val,1000 ); + +return ret; +} + +static uint32_t skl_wm_method2 (uint32_t pixel_rate,uint32_t pipe_htotal, +uint32_t horiz_pixels,uint8_t bytes_per_pixel, +uint32_t latency) +{ +uint32_t ret, plane_bytes_per_line, wm_intermediate_val; + +if (latency ==0 ) +return UINT_MAX ; + + plane_bytes_per_line = horiz_pixels * bytes_per_pixel; + wm_intermediate_val = latency * pixel_rate; + ret =DIV_ROUND_UP (wm_intermediate_val, pipe_htotal *1000 ) * + plane_bytes_per_line; + +return ret; +} + +static void skl_compute_transition_wm(struct drm_crtc *crtc,drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2992
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ struct skl_pipe_wm_parameters *params, + struct skl_pipe_wm *pipe_wm) +{ +/* +* For now it is suggested to use the LP0 wm val of corresponding +* plane as transition wm val. This is done while computing results. +*/ +if (!params->active) +return ; +}Seems like a rather pointless function.
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +7
-0+ +static uint32_t +skl_compute_linetime_wm (struct drm_crtc *crtc,struct skl_pipe_wm_parameters *p) +{ +if (!intel_crtc_active (crtc)) +return 0 ; +drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3009
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+return DIV_ROUND_UP (8 * p->pipe_htotal *1000 , p->pixel_rate); + +} + +static bool skl_ddb_allocation_changed (const struct skl_ddb_allocation *new_ddb, +const struct intel_crtc *intel_crtc) +{ +struct drm_device *dev = intel_crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_ddb_allocation *cur_ddb = &dev_priv->wm.skl_hw.ddb;const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3013
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+enum pipe pipe = intel_crtc->pipe; +size_t size; + + size =ARRAY_SIZE (new_ddb->plane[pipe]) *sizeof (struct skl_ddb_entry );
sizeof(new_ddb->plane[pipe])drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3018
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+if (memcmp (new_ddb->plane[pipe], cur_ddb->plane[pipe], size)) +return true; + +if (memcmp (&new_ddb->cursor[pipe], &cur_ddb->cursor[pipe], +sizeof (struct skl_ddb_entry )))
sizeof(new_ddb->cursor[pipe])Quoted 63 lines
drivers/gpu/drm/i915/intel_pm.c +63
-0+return true; + +return false; +} + +static void skl_compute_wm_global_parameters (struct drm_device *dev, +struct intel_wm_config *config) +{ +struct drm_crtc *crtc; +struct drm_plane *plane; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) + config->num_pipes_active +=intel_crtc_active (crtc); + +/* FIXME: I don't think we need those two global parameters on SKL */ +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + + config->sprites_enabled |= intel_plane->wm.enabled; + config->sprites_scaled |= intel_plane->wm.scaled; + } +} + +static void skl_compute_wm_pipe_parameters (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *p) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +struct drm_plane *plane; +int i =1 ;/* Index for sprite planes start */ + + p->active =intel_crtc_active (crtc); +if (p->active) { + p->pipe_htotal = intel_crtc->config.adjusted_mode.crtc_htotal; + p->pixel_rate =skl_pipe_pixel_rate (dev, crtc); + +/* +* For now, assume primary and cursor planes are always enabled. +*/ + p->plane[0 ].enabled = true; + p->plane[0 ].bytes_per_pixel = + crtc->primary->fb->bits_per_pixel /8 ; + p->plane[0 ].horiz_pixels = intel_crtc->config.pipe_src_w; + p->plane[0 ].vert_pixels = intel_crtc->config.pipe_src_h; + + p->cursor.enabled = true; + p->cursor.bytes_per_pixel =4 ; + p->cursor.horiz_pixels = intel_crtc->cursor_width ? + intel_crtc->cursor_width :64 ; + } + +list_for_each_entry (plane, &dev->mode_config.plane_list, head) { +struct intel_plane *intel_plane =to_intel_plane (plane); + +if (intel_plane->pipe == pipe) + p->plane[i++] = intel_plane->wm; + } +} + +static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p, + struct intel_plane_wm_parameters *p_params, + uint16_t max_page_buff_alloc,drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3091
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+uint32_t mem_value, + uint16_t *res_blocks, /* out */ + uint8_t *res_lines /* out */) +{ + uint32_t method1, method2, plane_bytes_per_line; +uint32_t result_bytes; + +if (!p->active || !p_params->enabled) { + *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; + *res_lines =PLANE_WM_LINES_DEFAULT ;Why do we need to set !=0 values for disabled planes?
Quoted 14 lines
drivers/gpu/drm/i915/intel_pm.c +14
-0+return false; + } + + method1 =skl_wm_method1 (p->pixel_rate, + p_params->bytes_per_pixel, + mem_value); + method2 =skl_wm_method2 (p->pixel_rate, + p->pipe_htotal, + p_params->horiz_pixels, + p_params->bytes_per_pixel, + mem_value); + + plane_bytes_per_line = p_params->horiz_pixels * + p_params->bytes_per_pixel;drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3115
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +/* For now xtile and linear */ +if (((max_page_buff_alloc *512 ) / plane_bytes_per_line) >=1 ) + result_bytes =min (method1, method2); +else + result_bytes = method1; + + *res_blocks =DIV_ROUND_UP (result_bytes,512 ) +1 ; + *res_lines =DIV_ROUND_UP (result_bytes, plane_bytes_per_line); +Seems we're missing the final validity checks here.
Quoted 51 lines
drivers/gpu/drm/i915/intel_pm.c +51
-0+return true; +} + +static void skl_compute_wm_level (const struct drm_i915_private *dev_priv, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *p, +enum pipe pipe, +int level, +int num_planes, +struct skl_wm_level *result) +{ +uint16_t latency = dev_priv->wm.skl_latency[level]; +uint16_t ddb_blocks; +int i; + +for (i =0 ; i < num_planes; i++) { + ddb_blocks =skl_ddb_entry_size (&ddb->plane[pipe][i]); + + result->plane_en[i] =skl_compute_plane_wm (p, &p->plane[i], + ddb_blocks, + latency, + &result->plane_res_b[i], + &result->plane_res_l[i]); + } + + ddb_blocks =skl_ddb_entry_size (&ddb->cursor[pipe]); + result->cursor_en =skl_compute_plane_wm (p, &p->cursor, ddb_blocks, + latency, &result->cursor_res_b, + &result->cursor_res_l); +} + +static void skl_compute_pipe_wm (struct drm_crtc *crtc, +struct skl_ddb_allocation *ddb, +struct skl_pipe_wm_parameters *params, +struct skl_pipe_wm *pipe_wm) +{ +struct drm_device *dev = crtc->dev; +const struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int level, max_level =ilk_wm_max_level (dev); + +for (level =0 ; level <= max_level; level++) { +skl_compute_wm_level (dev_priv, ddb, params, intel_crtc->pipe, + level,intel_num_planes (intel_crtc), + &pipe_wm->wm[level]); + } + pipe_wm->linetime =skl_compute_linetime_wm (crtc, params); + +skl_compute_transition_wm (crtc, params, pipe_wm); +} +drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3176
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+static void skl_compute_wm_results (struct drm_device *dev, +struct skl_pipe_wm_parameters *p, +struct skl_pipe_wm *p_wm, +struct skl_wm_values *r, +struct intel_crtc *intel_crtc) +{ +int i, level, max_level =ilk_wm_max_level (dev); +uint32_t temp; +enum pipe pipe = intel_crtc->pipe; +uint16_t ddb_blocks;Could move a bunch of that to a narrower scope.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3185
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9
-0+ +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (intel_crtc); i++) { + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.plane[pipe][i]); + +if ((p_wm->wm[level].plane_res_b[i] > ddb_blocks) || + (p_wm->wm[level].plane_res_l[i] >31 )) + p_wm->wm[level].plane_en[i] = false;So the validity check is here that I was expecting in
skl_compute_plane_wm(). The way this is done makes me think we might overflow the register bitfields if invalid values are propagated this far.The way the ilk code works is that it won't ever keep around intermediate values that would exceed the register maximum values (such values are already dropped in
intel_compute_pipe_wm()), and then it will filter out the otherwise invalid values inilk_wm_merge()beforeilk_compute_wm_results()gets called. Would seem less surprising if we could follow a similar pattern in the skl code.drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3196
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c +11
-0+ + temp |= p_wm->wm[level].plane_res_l[i] << +PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].plane_res_b[i]; +if (p_wm->wm[level].plane_en[i]) + temp |=PLANE_WM_EN ; + + r->plane[pipe][i][level] = temp; +/* Use the LP0 WM value for transition WM for now. */ +if (level ==0 ) + r->plane_trans[pipe][i] = temp;I'd stick this special case into the compute function rather than here.
Quoted 17 lines
drivers/gpu/drm/i915/intel_pm.c +17
-0+ } + + temp =0 ; + ddb_blocks =skl_ddb_entry_size (&r->ddb.cursor[pipe]); + +if ((p_wm->wm[level].cursor_res_b > ddb_blocks) || + (p_wm->wm[level].cursor_res_l >31 )) + p_wm->wm[level].cursor_en = false; + + temp |= p_wm->wm[level].cursor_res_l <<PLANE_WM_LINES_SHIFT ; + temp |= p_wm->wm[level].cursor_res_b; + +if (p_wm->wm[level].cursor_en) + temp |=PLANE_WM_EN ; + + r->cursor[pipe][level] = temp; +/* Use the LP0 WM value for transition WM for now. */ drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3223
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+if (level ==0 ) + r->cursor_trans[pipe] = temp; + + } + + r->wm_linetime[pipe] = p_wm->linetime; +} + +static void skl_write_wm_values (struct drm_i915_private *dev_priv, +struct skl_wm_values *new)const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3228
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+{ +struct drm_device *dev = dev_priv->dev; +struct intel_crtc *crtc; +int i, level, max_level =ilk_wm_max_level (dev); +enum pipe pipe;More stuff that could live in a narrower scope.
Quoted 41 lines
drivers/gpu/drm/i915/intel_pm.c +41
-0+ +list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { + pipe = crtc->pipe; +if (new->dirty[pipe]) { +I915_WRITE (PIPE_WM_LINETIME (pipe), + new->wm_linetime[pipe]); + +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM (pipe, i, level), + new->plane[pipe][i][level]); +I915_WRITE (CUR_WM (pipe, level), + new->cursor[pipe][level]); + } +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_WM_TRANS (pipe, i), + new->plane_trans[pipe][i]); +I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + } + } + + dev_priv->wm.skl_hw = *new; +} + +static bool skl_update_pipe_wm (struct drm_crtc *crtc, +struct skl_pipe_wm_parameters *params, +struct intel_wm_config *config, +struct skl_ddb_allocation *ddb,/* out */ +struct skl_pipe_wm *pipe_wm/* out */ ) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +skl_compute_wm_pipe_parameters (crtc, params); +skl_compute_pipe_wm (crtc, ddb, params, pipe_wm); + +if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm))) +return false; + + intel_crtc->wm.skl_active = *pipe_wm; +return true; +}drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3279
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +static void skl_update_other_pipe_wm (struct drm_device *dev, +struct drm_crtc *crtc, +struct intel_wm_config *config, +struct skl_wm_values *r) +{ +struct intel_crtc *intel_crtc; +struct intel_crtc *this_crtc =to_intel_crtc (crtc); +struct skl_pipe_wm_parameters params; +struct skl_pipe_wm pipe_wm;More stuff that can be moved to a narrower scope.
Should these be zero initializd? At least the way the ilk code works is that most structures need zero initialization to avoid consulting stack garbage somewhere down the line.
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+ +/* +* If the WM update hasn't changed the allocation for this_crtc (the +* crtc we are currently computing the new WM values for), other +* enabled crtcs will keep the same allocation and we don't need to +* recompute anything for them. drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3295
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+*/ +if (!skl_ddb_allocation_changed (&r->ddb, this_crtc)) +return ; + +/* +* Otherwise, because of this_crtc being freshly enabled/disabled, the +* other active pipes need new DDB allocation and WM values. +*/ +list_for_each_entry (intel_crtc, &dev->mode_config.crtc_list, + base.head) {Not sure how the locking is planned here. In the ilk wm patches that are still pending I'm adding a wm.mutex which might fit the bill. Otherwise we're going to need to make sure we have all the crtc locks held here.
Also if multiple pipes are active we surely can't just go changing the DDB allocation without considering the fact that vblanks for all pipes don't occur at the same time. So some kind of heavy handed synchronization is needed to make sure none of the DDB allocations overlap even for a short period of time.
Quoted 77 lines
drivers/gpu/drm/i915/intel_pm.c +67
-0+bool wm_changed; + +if (this_crtc->pipe == intel_crtc->pipe) +continue ; + +if (!intel_crtc->active) +continue ; + + wm_changed =skl_update_pipe_wm (&intel_crtc->base, + ¶ms, config, + &r->ddb, &pipe_wm); + +/* +* If we end up re-computing the other pipe WM values, it's +* because it was really needed, so we expect the WM values to +* be different. +*/ +WARN_ON (!wm_changed); + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, r, intel_crtc); + r->dirty[intel_crtc->pipe] = true; + } +} + +static void skl_update_wm (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_pipe_wm_parameters params = {}; +struct skl_wm_values *results = &dev_priv->wm.skl_results; +struct skl_pipe_wm pipe_wm = {}; +struct intel_wm_config config = {}; + +memset (results,0 ,sizeof (*results)); + +skl_compute_wm_global_parameters (dev, &config); + +if (!skl_update_pipe_wm (crtc, ¶ms, &config, + &results->ddb, &pipe_wm)) +return ; + +skl_compute_wm_results (dev, ¶ms, &pipe_wm, results, intel_crtc); + results->dirty[intel_crtc->pipe] = true; + +skl_update_other_pipe_wm (dev, crtc, &config, results); +skl_write_wm_values (dev_priv, results); +} + +static void +skl_update_sprite_wm (struct drm_plane *plane,struct drm_crtc *crtc, +uint32_t sprite_width,uint32_t sprite_height, +int pixel_size,bool enabled,bool scaled) +{ +struct intel_plane *intel_plane =to_intel_plane (plane); + + intel_plane->wm.enabled = enabled; + intel_plane->wm.scaled = scaled; + intel_plane->wm.horiz_pixels = sprite_width; + intel_plane->wm.vert_pixels = sprite_height; + intel_plane->wm.bytes_per_pixel = pixel_size; + +skl_update_wm (crtc); +} +static void ilk_update_wm (struct drm_crtc *crtc) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc);@@ -7464,6 +7885,8 @@ void intel_init_pm(struct drm_device *dev)skl_setup_wm_latency (dev); dev_priv->display.init_clock_gating = gen9_init_clock_gating; + dev_priv->display.update_wm = skl_update_wm; + dev_priv->display.update_sprite_wm = skl_update_sprite_wm; }else if (HAS_PCH_SPLIT (dev)) {ilk_setup_wm_latency (dev);
Quoted 11 lines
Quoted 7 lines
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Ville Syrjälä Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 48/89 drm/i915/skl: Allocate DDB portions for display planes
In reply to Damien Lespiauv2: Fix the 3rd plane/cursor logic (Pradeep Bhat)
v3: Fix one-by-one error in the DDB allocation code
--- drivers/gpu/drm/i915/intel_pm.c | 150 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +150 -0
@@ -2937,6 +2937,155 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +/* +* On gen9, we need to allocate Display Data Buffer (DDB) portions to the +* different active planes. +*/ + +#define SKL_DDB_SIZE 896/* in blocks */ + +static void +skl_ddb_get_pipe_allocation_limits (struct drm_device *dev, +struct drm_crtc *for_crtc, +struct intel_wm_config *config, +struct skl_pipe_wm_parameters *params, +uint16_t *available, +uint16_t *start, +uint16_t *end) +{ +struct drm_crtc *crtc; +unsigned int ddb_size; +int nth_active_pipe; + +if (!params->active) { + *available =0 ; + *start =0 ; + *end =0 ; +return ; + } + + ddb_size =SKL_DDB_SIZE ; + + ddb_size -=4 ;/* 4 blocks for bypass path allocation */ + + nth_active_pipe =1 ; +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +if (!intel_crtc_active (crtc)) +continue ; + +if (crtc == for_crtc) +break ; + + nth_active_pipe++; + } + + *available = ddb_size / config->num_pipes_active; + *start = (nth_active_pipe -1 ) * ddb_size / config->num_pipes_active; + *end = *start + *available -1 ; +} + +static unsigned int skl_cursor_allocation (struct intel_wm_config *config) +{ +if (config->num_pipes_active ==1 ) +return 32 ; + +return 8 ; +} + +static unsigned int +skl_plane_relative_data_rate (struct intel_plane_wm_parameters *p) +{ +return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; +} + +/* +* We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching +* a 8192x4096@32bpp framebuffer: +* 3 * 4096 * 8192 * 4 < 2^32 +*/ +static unsigned int +skl_get_total_relative_data_rate (struct intel_crtc *intel_crtc, +struct skl_pipe_wm_parameters *params) +{ +unsigned int total_data_rate =0 ; +int plane; + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; + +if (!p->enabled) +continue ; + + total_data_rate +=skl_plane_relative_data_rate (p); + } + +return total_data_rate; +} + +static void +skl_allocate_pipe_ddb (struct drm_crtc *crtc, +struct intel_wm_config *config, +struct skl_pipe_wm_parameters *params, +struct skl_ddb_allocation *ddb/* out */ ) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +uint16_t available, start, end, cursor_blocks; +unsigned int total_data_rate; +int plane; + +skl_ddb_get_pipe_allocation_limits (dev, crtc, config, params, + &available, &start, &end); +if (available ==0 ) { +const size_t size =ARRAY_SIZE (ddb->plane[pipe]) * +sizeof (struct skl_ddb_entry ); + +memset (ddb->plane[pipe],0 , size); +memset (&ddb->cursor[pipe],0 ,sizeof (struct skl_ddb_entry )); +return ; + } + + cursor_blocks =skl_cursor_allocation (config); + ddb->cursor[pipe].start = end - cursor_blocks +1 ; + ddb->cursor[pipe].end = end; + + available -= cursor_blocks; + end -= cursor_blocks; + +/* +* Each active plane get a portion of the remaining space, in +* proportion to the amount of data they need to fetch from memory. +* +* FIXME: we don't always allocate every single block here. +*/ + total_data_rate =skl_get_total_relative_data_rate (intel_crtc, params); + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; +unsigned int data_rate; +uint16_t plane_blocks; + +if (!p->enabled) +continue ; + + data_rate =skl_plane_relative_data_rate (p); + +/* +* promote the expression to 64 bits to avoid overflowing, the +* result is < available as data_rate / total_data_rate < 1 +*/ + plane_blocks =div_u64 ((uint64_t )available * data_rate, + total_data_rate); + + ddb->plane[pipe][plane].start = start; + ddb->plane[pipe][plane].end = start + plane_blocks -1 ; + + start += plane_blocks; + } + +} +static uint32_t skl_pipe_pixel_rate (struct drm_device *dev,struct drm_crtc *crtc) {
@@ -3259,6 +3408,7 @@ static bool skl_update_pipe_wm(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);skl_compute_wm_pipe_parameters (crtc, params); +skl_allocate_pipe_ddb (crtc, config, params, ddb);skl_compute_pipe_wm (crtc, ddb, params, pipe_wm);if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm)))
Signature · 1 line
1.8.3.1
Re: [PATCH 48/89] drm/i915/skl: Allocate DDB portions for display planes
Quoted 18 lines · Damien Lespiau
v2: Fix the 3rd plane/cursor logic (Pradeep Bhat)
v3: Fix one-by-one error in the DDB allocation codeSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 150 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)drivers/gpu/drm/i915/intel_pm.c +2
-0@@ -2937,6 +2937,155 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +/* +* On gen9, we need to allocate Display Data Buffer (DDB) portions to the
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2951
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+* different active planes. +*/ + +#define SKL_DDB_SIZE 896/* in blocks */ + +static void +skl_ddb_get_pipe_allocation_limits(struct drm_device *dev, + struct drm_crtc *for_crtc, + struct intel_wm_config *config, + struct skl_pipe_wm_parameters *params,
const
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+uint16_t *available, + uint16_t *start, + uint16_t *end) +{ + struct drm_crtc *crtc; +unsigned int ddb_size; +int nth_active_pipe; + +if (!params->active) { + *available =0 ;
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2971
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ *start =0 ; + *end =0 ; +return ; + } + + ddb_size =SKL_DDB_SIZE ; + + ddb_size -=4 ;/* 4 blocks for bypass path allocation */ + + nth_active_pipe =1 ;
Why does this start from 1 and not 0? Are we pascal coders now? :P
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2980
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9
-0+list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +if (!intel_crtc_active (crtc)) +continue ; + +if (crtc == for_crtc) +break ; + + nth_active_pipe++; + }
One thing that has been bugging me for a long time is this kind of loops for just counting stuff. I think we want to start using bitmasks to track active pipes/planes/etc. But that's not really related to this patch itself, just a more generic remark. And in this case it wouldn't even help :)
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2982
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+ + *available = ddb_size / config->num_pipes_active;
This seems like a pointless thing to return separately. end-start is the same thing (apart from the +/-1 stuff which should be killed again by making end exclusive).
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2984
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+ *start = (nth_active_pipe -1 ) * ddb_size / config->num_pipes_active; + *end = *start + *available -1 ;
Didn't we have that new struct with start+end in it? Perhaps it should be used here?
As stated before this is going to complicate the application of the DDB registers since we now have to consider the vblanks of potentially multiple active pipes. But it should provide more optiomal DDB usage than the max/num_pipes that the automagic maxfifo mode on most other platforms provides, so I guess we really do want to do it this way. And it seems to me that having two pipes enabled woud more much more common than three pipes.
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2987
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+} + +static unsigned int skl_cursor_allocation (struct intel_wm_config *config)
const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 2996
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9
-0+{ +if (config->num_pipes_active ==1 ) +return 32 ; + +return 8 ; +} + +static unsigned int +skl_plane_relative_data_rate (struct intel_plane_wm_parameters *p)
const
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3008
Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c +12
-0+{ +return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; +} + +/* +* We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching +* a 8192x4096@32bpp framebuffer: +* 3 * 4096 * 8192 * 4 < 2^32 +*/ +static unsigned int +skl_get_total_relative_data_rate (struct intel_crtc *intel_crtc, +struct skl_pipe_wm_parameters *params)
const
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+{ +unsigned int total_data_rate =0 ; +int plane; + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; + +if (!p->enabled) +continue ; +
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3028
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ total_data_rate +=skl_plane_relative_data_rate (p); + } + +return total_data_rate; +} + +static void +skl_allocate_pipe_ddb(struct drm_crtc *crtc, + struct intel_wm_config *config, + struct skl_pipe_wm_parameters *params,
const
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+ struct skl_ddb_allocation *ddb /* out */) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +uint16_t available, start, end, cursor_blocks;
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3044
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+unsigned int total_data_rate; +int plane; + +skl_ddb_get_pipe_allocation_limits (dev, crtc, config, params, + &available, &start, &end); +if (available ==0 ) { +const size_t size =ARRAY_SIZE (ddb->plane[pipe]) * +sizeof (struct skl_ddb_entry ); + +memset (ddb->plane[pipe],0 , size);
sizeof(ddb->plane[pipe])
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3045
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+memset (&ddb->cursor[pipe],0 ,sizeof (struct skl_ddb_entry ));
sizeof(ddb->cursor[pipe])
drivers/gpu/drm/i915/intel_pm.c static bool ilk_disable_lp_wm(struct drm_device *dev) · line 3054
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +9
-0+return ; + } + + cursor_blocks =skl_cursor_allocation (config); + ddb->cursor[pipe].start = end - cursor_blocks +1 ; + ddb->cursor[pipe].end = end; + + available -= cursor_blocks; + end -= cursor_blocks;
I got the impression bspec recommened putting all the cursor allocations into one lump. But I can't really think of any good reason for doing that so this seems fine to me.
Quoted 52 lines
drivers/gpu/drm/i915/intel_pm.c +35
-0+ +/* +* Each active plane get a portion of the remaining space, in +* proportion to the amount of data they need to fetch from memory. +* +* FIXME: we don't always allocate every single block here. +*/ + total_data_rate =skl_get_total_relative_data_rate (intel_crtc, params); + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; +unsigned int data_rate; +uint16_t plane_blocks; + +if (!p->enabled) +continue ; + + data_rate =skl_plane_relative_data_rate (p); + +/* +* promote the expression to 64 bits to avoid overflowing, the +* result is < available as data_rate / total_data_rate < 1 +*/ + plane_blocks =div_u64 ((uint64_t )available * data_rate, + total_data_rate); + + ddb->plane[pipe][plane].start = start; + ddb->plane[pipe][plane].end = start + plane_blocks -1 ; + + start += plane_blocks; + } + +} +static uint32_t skl_pipe_pixel_rate (struct drm_device *dev,struct drm_crtc *crtc) {@@ -3259,6 +3408,7 @@ static bool skl_update_pipe_wm(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);skl_compute_wm_pipe_parameters (crtc, params); +skl_allocate_pipe_ddb (crtc, config, params, ddb);skl_compute_pipe_wm (crtc, ddb, params, pipe_wm);if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm)))Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v6 48/89 drm/i915/skl: Allocate DDB portions for display planes
v2: Fix the 3rd plane/cursor logic (Pradeep Bhat)
v3: Fix one-by-one error in the DDB allocation code
v4: Rebase on top of the skl_pipe_pixel_rate() argument change
v5: Replace the available/start/end output parameters of
skl_ddb_get_pipe_allocation_limits() by a single ddb entry constify a few arguments
Make nth_active_pipe 0 indexed
Use sizeof(variable) instead of sizeof(type)
(Ville)
v6: Use the for_each_crtc() macro instead of list_for_each_entry()
--- drivers/gpu/drm/i915/intel_pm.c | 148 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +148 -0
@@ -2965,6 +2965,153 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +/* +* On gen9, we need to allocate Display Data Buffer (DDB) portions to the +* different active planes. +*/ + +#define SKL_DDB_SIZE 896/* in blocks */ + +static void +skl_ddb_get_pipe_allocation_limits (struct drm_device *dev, +struct drm_crtc *for_crtc, +const struct intel_wm_config *config, +const struct skl_pipe_wm_parameters *params, +struct skl_ddb_entry *alloc/* out */ ) +{ +struct drm_crtc *crtc; +unsigned int pipe_size, ddb_size; +int nth_active_pipe; + +if (!params->active) { + alloc->start =0 ; + alloc->end =0 ; +return ; + } + + ddb_size =SKL_DDB_SIZE ; + + ddb_size -=4 ;/* 4 blocks for bypass path allocation */ + + nth_active_pipe =0 ; +for_each_crtc (dev, crtc) { +if (!intel_crtc_active (crtc)) +continue ; + +if (crtc == for_crtc) +break ; + + nth_active_pipe++; + } + + pipe_size = ddb_size / config->num_pipes_active; + alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active; + alloc->end = alloc->start + pipe_size -1 ; +} + +static unsigned int skl_cursor_allocation (const struct intel_wm_config *config) +{ +if (config->num_pipes_active ==1 ) +return 32 ; + +return 8 ; +} + +static unsigned int +skl_plane_relative_data_rate (const struct intel_plane_wm_parameters *p) +{ +return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; +} + +/* +* We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching +* a 8192x4096@32bpp framebuffer: +* 3 * 4096 * 8192 * 4 < 2^32 +*/ +static unsigned int +skl_get_total_relative_data_rate (struct intel_crtc *intel_crtc, +const struct skl_pipe_wm_parameters *params) +{ +unsigned int total_data_rate =0 ; +int plane; + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +const struct intel_plane_wm_parameters *p; + + p = ¶ms->plane[plane]; +if (!p->enabled) +continue ; + + total_data_rate +=skl_plane_relative_data_rate (p); + } + +return total_data_rate; +} + +static void +skl_allocate_pipe_ddb (struct drm_crtc *crtc, +const struct intel_wm_config *config, +const struct skl_pipe_wm_parameters *params, +struct skl_ddb_allocation *ddb/* out */ ) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +struct skl_ddb_entry alloc; +uint16_t alloc_size, start, cursor_blocks; +unsigned int total_data_rate; +int plane; + +skl_ddb_get_pipe_allocation_limits (dev, crtc, config, params, &alloc); + alloc_size =skl_ddb_entry_size (&alloc); +if (alloc_size ==0 ) { +memset (ddb->plane[pipe],0 ,sizeof (ddb->plane[pipe])); +memset (&ddb->cursor[pipe],0 ,sizeof (ddb->cursor[pipe])); +return ; + } + + cursor_blocks =skl_cursor_allocation (config); + ddb->cursor[pipe].start = alloc.end - cursor_blocks +1 ; + ddb->cursor[pipe].end = alloc.end; + + alloc_size -= cursor_blocks; + alloc.end -= cursor_blocks; + +/* +* Each active plane get a portion of the remaining space, in +* proportion to the amount of data they need to fetch from memory. +* +* FIXME: we may not allocate every single block here. +*/ + total_data_rate =skl_get_total_relative_data_rate (intel_crtc, params); + + start = alloc.start; +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +const struct intel_plane_wm_parameters *p; +unsigned int data_rate; +uint16_t plane_blocks; + + p = ¶ms->plane[plane]; +if (!p->enabled) +continue ; + + data_rate =skl_plane_relative_data_rate (p); + +/* +* promote the expression to 64 bits to avoid overflowing, the +* result is < available as data_rate / total_data_rate < 1 +*/ + plane_blocks =div_u64 ((uint64_t )alloc_size * data_rate, + total_data_rate); + + ddb->plane[pipe][plane].start = start; + ddb->plane[pipe][plane].end = start + plane_blocks -1 ; + + start += plane_blocks; + } + +} +static uint32_t skl_pipe_pixel_rate (const struct intel_crtc_config *config) {/* TODO: Take into account the scalers once we support them */
@@ -3286,6 +3433,7 @@ static bool skl_update_pipe_wm(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);skl_compute_wm_pipe_parameters (crtc, params); +skl_allocate_pipe_ddb (crtc, config, params, ddb);skl_compute_pipe_wm (crtc, ddb, params, pipe_wm);if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm)))
Signature · 1 line
1.8.3.1
Re: [PATCH 48/89 v6] drm/i915/skl: Allocate DDB portions for display planes
Quoted 11 lines · Damien Lespiau
v2: Fix the 3rd plane/cursor logic (Pradeep Bhat)
v3: Fix one-by-one error in the DDB allocation code
v4: Rebase on top of theskl_pipe_pixel_rate()argument change
v5: Replace the available/start/end output parameters of
skl_ddb_get_pipe_allocation_limits()by a single ddb entry constify a few arguments
Makenth_active_pipe0 indexed
Use sizeof(variable) instead of sizeof(type)
(Ville)
v6: Use thefor_each_crtc()macro instead oflist_for_each_entry()
Quoted 1 line
Signed-off-by Damien Lespiau <[email protected]>
Looks good.
Quoted 177 lines
--- drivers/gpu/drm/i915/intel_pm.c | 148 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+)drivers/gpu/drm/i915/intel_pm.c +148
-0@@ -2965,6 +2965,153 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +/* +* On gen9, we need to allocate Display Data Buffer (DDB) portions to the +* different active planes. +*/ + +#define SKL_DDB_SIZE 896/* in blocks */ + +static void +skl_ddb_get_pipe_allocation_limits (struct drm_device *dev, +struct drm_crtc *for_crtc, +const struct intel_wm_config *config, +const struct skl_pipe_wm_parameters *params, +struct skl_ddb_entry *alloc/* out */ ) +{ +struct drm_crtc *crtc; +unsigned int pipe_size, ddb_size; +int nth_active_pipe; + +if (!params->active) { + alloc->start =0 ; + alloc->end =0 ; +return ; + } + + ddb_size =SKL_DDB_SIZE ; + + ddb_size -=4 ;/* 4 blocks for bypass path allocation */ + + nth_active_pipe =0 ; +for_each_crtc (dev, crtc) { +if (!intel_crtc_active (crtc)) +continue ; + +if (crtc == for_crtc) +break ; + + nth_active_pipe++; + } + + pipe_size = ddb_size / config->num_pipes_active; + alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active; + alloc->end = alloc->start + pipe_size -1 ; +} + +static unsigned int skl_cursor_allocation (const struct intel_wm_config *config) +{ +if (config->num_pipes_active ==1 ) +return 32 ; + +return 8 ; +} + +static unsigned int +skl_plane_relative_data_rate (const struct intel_plane_wm_parameters *p) +{ +return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; +} + +/* +* We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching +* a 8192x4096@32bpp framebuffer: +* 3 * 4096 * 8192 * 4 < 2^32 +*/ +static unsigned int +skl_get_total_relative_data_rate (struct intel_crtc *intel_crtc, +const struct skl_pipe_wm_parameters *params) +{ +unsigned int total_data_rate =0 ; +int plane; + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +const struct intel_plane_wm_parameters *p; + + p = ¶ms->plane[plane]; +if (!p->enabled) +continue ; + + total_data_rate +=skl_plane_relative_data_rate (p); + } + +return total_data_rate; +} + +static void +skl_allocate_pipe_ddb (struct drm_crtc *crtc, +const struct intel_wm_config *config, +const struct skl_pipe_wm_parameters *params, +struct skl_ddb_allocation *ddb/* out */ ) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +struct skl_ddb_entry alloc; +uint16_t alloc_size, start, cursor_blocks; +unsigned int total_data_rate; +int plane; + +skl_ddb_get_pipe_allocation_limits (dev, crtc, config, params, &alloc); + alloc_size =skl_ddb_entry_size (&alloc); +if (alloc_size ==0 ) { +memset (ddb->plane[pipe],0 ,sizeof (ddb->plane[pipe])); +memset (&ddb->cursor[pipe],0 ,sizeof (ddb->cursor[pipe])); +return ; + } + + cursor_blocks =skl_cursor_allocation (config); + ddb->cursor[pipe].start = alloc.end - cursor_blocks +1 ; + ddb->cursor[pipe].end = alloc.end; + + alloc_size -= cursor_blocks; + alloc.end -= cursor_blocks; + +/* +* Each active plane get a portion of the remaining space, in +* proportion to the amount of data they need to fetch from memory. +* +* FIXME: we may not allocate every single block here. +*/ + total_data_rate =skl_get_total_relative_data_rate (intel_crtc, params); + + start = alloc.start; +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +const struct intel_plane_wm_parameters *p; +unsigned int data_rate; +uint16_t plane_blocks; + + p = ¶ms->plane[plane]; +if (!p->enabled) +continue ; + + data_rate =skl_plane_relative_data_rate (p); + +/* +* promote the expression to 64 bits to avoid overflowing, the +* result is < available as data_rate / total_data_rate < 1 +*/ + plane_blocks =div_u64 ((uint64_t )alloc_size * data_rate, + total_data_rate); + + ddb->plane[pipe][plane].start = start; + ddb->plane[pipe][plane].end = start + plane_blocks -1 ; + + start += plane_blocks; + } + +} +static uint32_t skl_pipe_pixel_rate (const struct intel_crtc_config *config) {/* TODO: Take into account the scalers once we support them */ @@ -3286,6 +3433,7 @@ static bool skl_update_pipe_wm(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);skl_compute_wm_pipe_parameters (crtc, params); +skl_allocate_pipe_ddb (crtc, config, params, ddb);skl_compute_pipe_wm (crtc, ddb, params, pipe_wm);if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm)))Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 48/89 drm/i915/skl: Allocate DDB portions for display planes
In reply to Damien Lespiauv2: Fix the 3rd plane/cursor logic (Pradeep Bhat)
v3: Fix one-by-one error in the DDB allocation code
v4: Rebase on top of the skl_pipe_pixel_rate() argument change
--- drivers/gpu/drm/i915/intel_pm.c | 150 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +150 -0
@@ -2957,6 +2957,155 @@ static bool ilk_disable_lp_wm(struct drm_device *dev)return _ilk_disable_lp_wm (dev_priv,WM_DIRTY_LP_ALL ); } +/* +* On gen9, we need to allocate Display Data Buffer (DDB) portions to the +* different active planes. +*/ + +#define SKL_DDB_SIZE 896/* in blocks */ + +static void +skl_ddb_get_pipe_allocation_limits (struct drm_device *dev, +struct drm_crtc *for_crtc, +struct intel_wm_config *config, +struct skl_pipe_wm_parameters *params, +uint16_t *available, +uint16_t *start, +uint16_t *end) +{ +struct drm_crtc *crtc; +unsigned int ddb_size; +int nth_active_pipe; + +if (!params->active) { + *available =0 ; + *start =0 ; + *end =0 ; +return ; + } + + ddb_size =SKL_DDB_SIZE ; + + ddb_size -=4 ;/* 4 blocks for bypass path allocation */ + + nth_active_pipe =1 ; +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +if (!intel_crtc_active (crtc)) +continue ; + +if (crtc == for_crtc) +break ; + + nth_active_pipe++; + } + + *available = ddb_size / config->num_pipes_active; + *start = (nth_active_pipe -1 ) * ddb_size / config->num_pipes_active; + *end = *start + *available -1 ; +} + +static unsigned int skl_cursor_allocation (struct intel_wm_config *config) +{ +if (config->num_pipes_active ==1 ) +return 32 ; + +return 8 ; +} + +static unsigned int +skl_plane_relative_data_rate (struct intel_plane_wm_parameters *p) +{ +return p->horiz_pixels * p->vert_pixels * p->bytes_per_pixel; +} + +/* +* We don't overflow 32 bits. Worst case is 3 planes enabled, each fetching +* a 8192x4096@32bpp framebuffer: +* 3 * 4096 * 8192 * 4 < 2^32 +*/ +static unsigned int +skl_get_total_relative_data_rate (struct intel_crtc *intel_crtc, +struct skl_pipe_wm_parameters *params) +{ +unsigned int total_data_rate =0 ; +int plane; + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; + +if (!p->enabled) +continue ; + + total_data_rate +=skl_plane_relative_data_rate (p); + } + +return total_data_rate; +} + +static void +skl_allocate_pipe_ddb (struct drm_crtc *crtc, +struct intel_wm_config *config, +struct skl_pipe_wm_parameters *params, +struct skl_ddb_allocation *ddb/* out */ ) +{ +struct drm_device *dev = crtc->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +enum pipe pipe = intel_crtc->pipe; +uint16_t available, start, end, cursor_blocks; +unsigned int total_data_rate; +int plane; + +skl_ddb_get_pipe_allocation_limits (dev, crtc, config, params, + &available, &start, &end); +if (available ==0 ) { +const size_t size =ARRAY_SIZE (ddb->plane[pipe]) * +sizeof (struct skl_ddb_entry ); + +memset (ddb->plane[pipe],0 , size); +memset (&ddb->cursor[pipe],0 ,sizeof (struct skl_ddb_entry )); +return ; + } + + cursor_blocks =skl_cursor_allocation (config); + ddb->cursor[pipe].start = end - cursor_blocks +1 ; + ddb->cursor[pipe].end = end; + + available -= cursor_blocks; + end -= cursor_blocks; + +/* +* Each active plane get a portion of the remaining space, in +* proportion to the amount of data they need to fetch from memory. +* +* FIXME: we don't always allocate every single block here. +*/ + total_data_rate =skl_get_total_relative_data_rate (intel_crtc, params); + +for (plane =0 ; plane <intel_num_planes (intel_crtc); plane++) { +struct intel_plane_wm_parameters *p = ¶ms->plane[plane]; +unsigned int data_rate; +uint16_t plane_blocks; + +if (!p->enabled) +continue ; + + data_rate =skl_plane_relative_data_rate (p); + +/* +* promote the expression to 64 bits to avoid overflowing, the +* result is < available as data_rate / total_data_rate < 1 +*/ + plane_blocks =div_u64 ((uint64_t )available * data_rate, + total_data_rate); + + ddb->plane[pipe][plane].start = start; + ddb->plane[pipe][plane].end = start + plane_blocks -1 ; + + start += plane_blocks; + } + +} +static uint32_t skl_pipe_pixel_rate (const struct intel_crtc_config *config) {/* TODO: Take into account the scalers once we support them */
@@ -3278,6 +3427,7 @@ static bool skl_update_pipe_wm(struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);skl_compute_wm_pipe_parameters (crtc, params); +skl_allocate_pipe_ddb (crtc, config, params, ddb);skl_compute_pipe_wm (crtc, ddb, params, pipe_wm);if (!memcmp (&intel_crtc->wm.skl_active, pipe_wm,sizeof (*pipe_wm)))
Signature · 1 line
1.8.3.1
PATCH 49/89 drm/i915/skl: Program the DDB allocation
In reply to Damien Lespiauv2: Adapt to the planes/cursor split
--- drivers/gpu/drm/i915/i915_reg.h | 16 ++++++++++++++++ drivers/gpu/drm/i915/intel_pm.c | 9 +++++++++ 2 files changed, 25 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +16 -0
@@ -4602,6 +4602,8 @@ enum punit_power_well {#define _PLANE_KEYMSK_2_A 0x70298#define _PLANE_KEYMAX_1_A 0x701a0#define _PLANE_KEYMAX_2_A 0x702a0 +#define _PLANE_BUF_CFG_1_A 0x7027c +#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_CTL_1_B 0x71180#define _PLANE_CTL_2_B 0x71280
@@ -4679,6 +4681,20 @@ enum punit_power_well {#define PLANE_KEYMAX (pipe, plane) \ _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) +#define _PLANE_BUF_CFG_1_B 0x7127c +#define _PLANE_BUF_CFG_2_B 0x7137c +#define _PLANE_BUF_CFG_1 (pipe) \ + _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B) +#define _PLANE_BUF_CFG_2 (pipe) \ + _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B) +#define PLANE_BUF_CFG (pipe, plane) \ + _PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe)) + +/* SKL new cursor registers */ +#define _CUR_BUF_CFG_A 0x7017c +#define _CUR_BUF_CFG_B 0x7117c +#define CUR_BUF_CFG (pipe) _PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B) +/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)
drivers/gpu/drm/i915/intel_pm.c +9 -0
@@ -3393,6 +3393,15 @@ static void skl_write_wm_values(struct drm_i915_private *dev_priv,I915_WRITE (PLANE_WM_TRANS (pipe, i), new->plane_trans[pipe][i]);I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + +for (i =0 ; i <intel_num_planes (crtc); i++) +I915_WRITE (PLANE_BUF_CFG (pipe, i), + new->ddb.plane[pipe][i].end <<16 | + new->ddb.plane[pipe][i].start); + +I915_WRITE (CUR_BUF_CFG (pipe), + new->ddb.cursor[pipe].end <<16 | + new->ddb.cursor[pipe].start); } }
Signature · 1 line
1.8.3.1
Re: [PATCH 49/89] drm/i915/skl: Program the DDB allocation
Quoted 29 lines · Damien Lespiau
v2: Adapt to the planes/cursor split
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 16 ++++++++++++++++ drivers/gpu/drm/i915/intel_pm.c | 9 +++++++++ 2 files changed, 25 insertions(+)drivers/gpu/drm/i915/i915_reg.h +6
-0@@ -4602,6 +4602,8 @@ enum punit_power_well {#define _PLANE_KEYMSK_2_A 0x70298#define _PLANE_KEYMAX_1_A 0x701a0#define _PLANE_KEYMAX_2_A 0x702a0 +#define _PLANE_BUF_CFG_1_A 0x7027c +#define _PLANE_BUF_CFG_2_A 0x7037c#define _PLANE_CTL_1_B 0x71180#define _PLANE_CTL_2_B 0x71280@@ -4679,6 +4681,20 @@ enum punit_power_well {#define PLANE_KEYMAX (pipe, plane) \ _PLANE(plane, _PLANE_KEYMAX_1(pipe), _PLANE_KEYMAX_2(pipe)) +#define _PLANE_BUF_CFG_1_B 0x7127c +#define _PLANE_BUF_CFG_2_B 0x7137c +#define _PLANE_BUF_CFG_1 (pipe) \ + _PIPE(pipe, _PLANE_BUF_CFG_1_A, _PLANE_BUF_CFG_1_B)
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 4697
Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10
-0+#define _PLANE_BUF_CFG_2 (pipe) \ + _PIPE(pipe, _PLANE_BUF_CFG_2_A, _PLANE_BUF_CFG_2_B) +#define PLANE_BUF_CFG (pipe, plane) \ + _PLANE(plane, _PLANE_BUF_CFG_1(pipe), _PLANE_BUF_CFG_2(pipe)) + +/* SKL new cursor registers */ +#define _CUR_BUF_CFG_A 0x7017c +#define _CUR_BUF_CFG_B 0x7117c +#define CUR_BUF_CFG (pipe) _PIPE(pipe, _CUR_BUF_CFG_A, _CUR_BUF_CFG_B) +
More macros to confuse me :P
The magic numbers look correct again though.
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* VBIOS regs */ #define VGACNTRL 0x71400# define VGA_DISP_DISABLE (1 << 31)drivers/gpu/drm/i915/intel_pm.c +0
-0
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3399
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -3393,6 +3393,15 @@ static void skl_write_wm_values(struct drm_i915_private *dev_priv,I915_WRITE (PLANE_WM_TRANS (pipe, i), new->plane_trans[pipe][i]);I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + +for (i =0 ; i <intel_num_planes (crtc); i++) + I915_WRITE(PLANE_BUF_CFG(pipe, i), + new->ddb.plane[pipe][i].end << 16 |
The spec doesn't say if end is inclusive or exclusive. Someone actually confirmed that from someone or tested it?
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3406
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+ new->ddb.plane[pipe][i].start); + +I915_WRITE (CUR_BUF_CFG (pipe), + new->ddb.cursor[pipe].end <<16 | + new->ddb.cursor[pipe].start); } }
And here we land in deep doodoo wrt. changing the DDB allocation for active pipes. Someone needs to implement the correct logic to sequence the DDB allocation changes so that the allocations don't overlap at any point in time.
So this needs a big FIXME at the very least.
Quoted 8 lines
Signature · 7 lines
-- 1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 49/89] drm/i915/skl: Program the DDB allocation
Quoted 7 lines · Ville Syrjälä
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3393,6 +3393,15 @@ static void skl_write_wm_values(struct drm_i915_private *dev_priv,I915_WRITE (PLANE_WM_TRANS (pipe, i), new->plane_trans[pipe][i]);
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3399
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + +for (i =0 ; i <intel_num_planes (crtc); i++) + I915_WRITE(PLANE_BUF_CFG(pipe, i), + new->ddb.plane[pipe][i].end << 16 |The spec doesn't say if end is inclusive or exclusive. Someone actually confirmed that from someone or tested it?
I remember testing it and having the end of a plane match the start of another produces artefacts.
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3406
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+ new->ddb.plane[pipe][i].start); + +I915_WRITE (CUR_BUF_CFG (pipe), + new->ddb.cursor[pipe].end <<16 | + new->ddb.cursor[pipe].start); } }And here we land in deep doodoo wrt. changing the DDB allocation for active pipes. Someone needs to implement the correct logic to sequence the DDB allocation changes so that the allocations don't overlap at any point in time.
Quoted 1 line
So this needs a big FIXME at the very least.
As seen on IRC, the DDB regs are double buffered and the "flush" patch is supposed to take care of that.
Signature · 1 line
Damien
Ville Syrjälä
Reviewed-byRe: [PATCH 49/89] drm/i915/skl: Program the DDB allocation
Quoted 33 lines · Damien Lespiau
Quoted 7 lines · Ville Syrjälä
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -3393,6 +3393,15 @@ static void skl_write_wm_values(struct drm_i915_private *dev_priv,I915_WRITE (PLANE_WM_TRANS (pipe, i), new->plane_trans[pipe][i]);Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3399
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0I915_WRITE (CUR_WM_TRANS (pipe), new->cursor_trans[pipe]); + +for (i =0 ; i <intel_num_planes (crtc); i++) + I915_WRITE(PLANE_BUF_CFG(pipe, i), + new->ddb.plane[pipe][i].end << 16 |The spec doesn't say if end is inclusive or exclusive. Someone actually confirmed that from someone or tested it?
I remember testing it and having the end of a plane match the start of another produces artefacts.
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c static void skl_write_wm_values(struct drm_i915_private *dev_priv, · line 3406
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+ new->ddb.plane[pipe][i].start); + +I915_WRITE (CUR_BUF_CFG (pipe), + new->ddb.cursor[pipe].end <<16 | + new->ddb.cursor[pipe].start); } }And here we land in deep doodoo wrt. changing the DDB allocation for active pipes. Someone needs to implement the correct logic to sequence the DDB allocation changes so that the allocations don't overlap at any point in time.
Quoted 4 lines
Quoted 1 line
So this needs a big FIXME at the very least.
As seen on IRC, the DDB regs are double buffered and the "flush" patch is supposed to take care of that.
Just went through the new and improved flush patch. The algorithm is solid now, just need to keep moving it towards the atomic stuff, but in the meantime I think we can move forward with this stuff.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 50/89 drm/i915/skl: Read the pipe WM HW state
In reply to Damien LespiauFrom: Pradeep Bhat <[email protected]>
This patch provides the implementation for reading the pipe wm HW state.
v2: Incorporated Damien's review comments and also made modifications
to incorporate the plane/cursor split.
v3: No need to ident a line that was fitting 80 chars
Return early instead of indenting the remaining of a function (Damien)
v4: Rebase on top of nightly (minor conflect in intel_drv.h)
--- drivers/gpu/drm/i915/intel_display.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 104 +++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -13375,7 +13375,9 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, pll->on = false; } -if (HAS_PCH_SPLIT (dev)) +if (IS_GEN9 (dev)) +skl_wm_get_hw_state (dev); +else if (HAS_PCH_SPLIT (dev))ilk_wm_get_hw_state (dev);if (force_restore) {
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1102,6 +1102,7 @@ void intel_runtime_pm_put(struct drm_i915_private *dev_priv);void intel_init_runtime_pm (struct drm_i915_private *dev_priv);void intel_fini_runtime_pm (struct drm_i915_private *dev_priv);void ilk_wm_get_hw_state (struct drm_device *dev); +void skl_wm_get_hw_state (struct drm_device *dev);/* intel_sdvo.c */
drivers/gpu/drm/i915/intel_pm.c +104 -0
110 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 50/89] drm/i915/skl: Read the pipe WM HW state
Quoted 90 lines · Damien Lespiau
From: Pradeep Bhat <[email protected]>
This patch provides the implementation for reading the pipe wm HW state.
v2: Incorporated Damien's review comments and also made modifications
to incorporate the plane/cursor split.v3: No need to ident a line that was fitting 80 chars
Return early instead of indenting the remaining of a function (Damien)v4: Rebase on top of nightly (minor conflect in
intel_drv.h)Signed-off-by Pradeep Bhat <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 104 +++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +3
-1@@ -13375,7 +13375,9 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, pll->on = false; } -if (HAS_PCH_SPLIT (dev)) +if (IS_GEN9 (dev)) +skl_wm_get_hw_state (dev); +else if (HAS_PCH_SPLIT (dev))ilk_wm_get_hw_state (dev);if (force_restore) {drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1102,6 +1102,7 @@ void intel_runtime_pm_put(struct drm_i915_private *dev_priv);void intel_init_runtime_pm (struct drm_i915_private *dev_priv);void intel_fini_runtime_pm (struct drm_i915_private *dev_priv);void ilk_wm_get_hw_state (struct drm_device *dev); +void skl_wm_get_hw_state (struct drm_device *dev);/* intel_sdvo.c */ drivers/gpu/drm/i915/intel_pm.c +33
-0@@ -3591,6 +3591,110 @@ ilk_update_sprite_wm(struct drm_plane *plane,ilk_update_wm (crtc); } +static void skl_pipe_wm_active_state (uint32_t val, +struct skl_pipe_wm *active, +bool is_transwm, +bool is_cursor, +int i, +int level) +{ +bool is_enabled = (val &PLANE_WM_EN ) !=0 ; + +if (!is_transwm) { +if (!is_cursor) { + active->wm[level].plane_en[i] = is_enabled; + active->wm[level].plane_res_b[i] = + val &PLANE_WM_BLOCKS_MASK ; + active->wm[level].plane_res_l[i] = + (val >>PLANE_WM_LINES_SHIFT ) & +PLANE_WM_LINES_MASK ; + }else { + active->wm[level].cursor_en = is_enabled; + active->wm[level].cursor_res_b = + val &PLANE_WM_BLOCKS_MASK ; + active->wm[level].cursor_res_l = + (val >>PLANE_WM_LINES_SHIFT ) & +PLANE_WM_LINES_MASK ; + } + }else { +if (!is_cursor) { + active->trans_wm.plane_en[i] = is_enabled; + active->trans_wm.plane_res_b[i] = + val &PLANE_WM_BLOCKS_MASK ; + active->trans_wm.plane_res_l[i] = + (val >>PLANE_WM_LINES_SHIFT ) & +PLANE_WM_LINES_MASK ;
drivers/gpu/drm/i915/intel_pm.c ilk_update_sprite_wm(struct drm_plane *plane, · line 3636
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ }else { + active->trans_wm.cursor_en = is_enabled; + active->trans_wm.cursor_res_b = + val &PLANE_WM_BLOCKS_MASK ; + active->trans_wm.cursor_res_l = + (val >>PLANE_WM_LINES_SHIFT ) & +PLANE_WM_LINES_MASK ; + } + } +}
Am I imagining it or could this function be reduced to four lines if you would just pass the target struct as a parameter instead of the (is_transwm,is_cursor,i,level) tuple? Ah no, crap, SoA strikes back. So I think I mentioned it already during my first round of reviews that I'd like make a bunch of this stuff AoS instead. But that's a recipe for massive conflicts so let's get the current stuff in first before we go tearing into those structures.
Apart from that horror of a function this looks like it does what it's meant to so:
Quoted 70 lines
drivers/gpu/drm/i915/intel_pm.c +60
-0+static void skl_pipe_wm_get_hw_state (struct drm_crtc *crtc) +{ +struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct skl_wm_values *hw = &dev_priv->wm.skl_hw; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct skl_pipe_wm *active = &intel_crtc->wm.skl_active; +enum pipe pipe = intel_crtc->pipe; +int level, i, max_level; +uint32_t temp; + + max_level =ilk_wm_max_level (dev); + + hw->wm_linetime[pipe] =I915_READ (PIPE_WM_LINETIME (pipe)); + +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (intel_crtc); i++) + hw->plane[pipe][i][level] = +I915_READ (PLANE_WM (pipe, i, level)); + hw->cursor[pipe][level] =I915_READ (CUR_WM (pipe, level)); + } + +for (i =0 ; i <intel_num_planes (intel_crtc); i++) + hw->plane_trans[pipe][i] =I915_READ (PLANE_WM_TRANS (pipe, i)); + hw->cursor_trans[pipe] =I915_READ (CUR_WM_TRANS (pipe)); + +if (!intel_crtc_active (crtc)) +return ; + + hw->dirty[pipe] = true; + + active->linetime = hw->wm_linetime[pipe]; + +for (level =0 ; level <= max_level; level++) { +for (i =0 ; i <intel_num_planes (intel_crtc); i++) { + temp = hw->plane[pipe][i][level]; +skl_pipe_wm_active_state (temp, active, false, + false, i, level); + } + temp = hw->cursor[pipe][level]; +skl_pipe_wm_active_state (temp, active, false, true, i, level); + } + +for (i =0 ; i <intel_num_planes (intel_crtc); i++) { + temp = hw->plane_trans[pipe][i]; +skl_pipe_wm_active_state (temp, active, true, false, i,0 ); + } + + temp = hw->cursor_trans[pipe]; +skl_pipe_wm_active_state (temp, active, true, true, i,0 ); +} + +void skl_wm_get_hw_state (struct drm_device *dev) +{ +struct drm_crtc *crtc; + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) +skl_pipe_wm_get_hw_state (crtc); +} +static void ilk_pipe_wm_get_hw_state (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 50/89] drm/i915/skl: Read the pipe WM HW state
Quoted 7 lines · Ville Syrjälä
Am I imagining it or could this function be reduced to four lines if you would just pass the target struct as a parameter instead of the (is_transwm,is_cursor,i,level) tuple? Ah no, crap, SoA strikes back. So I think I mentioned it already during my first round of reviews that I'd like make a bunch of this stuff AoS instead. But that's a recipe for massive conflicts so let's get the current stuff in first before we go tearing into those structures.
I have to concur, it looks ugly. I also like the pragmatic r-b + list of improvements, thanks or that. We even have a Jira task for the rework now, things need to settle down a bit before I can address this (or we find someone else to do it).
Signature · 5 lines
Damien _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 51/89 drm/i915/gen9: Add 2us read latency to WM level
In reply to Damien LespiauFrom: Vandana Kannan <[email protected]>
According to the updated Bspec, The mailbox response data is not currently accounting for memory read latency. Add 2 microseconds to the result for each level.
This patch adds 2us to latency of level 0 for all cases and for all other levels (1-7) only if latency[level] > 0.
v2: Slightly rework the patch and add a big comment (Damien)
--- drivers/gpu/drm/i915/intel_pm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +18 -0
@@ -2254,6 +2254,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])if (IS_GEN9 (dev)) {uint32_t val;int ret; +int level, max_level =ilk_wm_max_level (dev);/* read the first set of memory latencies[0:3] */ val =0 ;/* data0 to be programmed to 0 for first set */
@@ -2267,6 +2268,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])DRM_ERROR ("SKL Mailbox read error = %d\n" , ret);return ; } + wm[0 ] = val &GEN9_MEM_LAT_LEVEL_MASK ; wm[1 ] = (val >>GEN9_MEM_LAT_LEVEL_1_5_SHIFT ) &GEN9_MEM_LAT_LEVEL_MASK ;
@@ -2293,6 +2295,22 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])GEN9_MEM_LAT_LEVEL_MASK ; wm[7 ] = (val >>GEN9_MEM_LAT_LEVEL_3_7_SHIFT ) &GEN9_MEM_LAT_LEVEL_MASK ; + +/* +* punit doesn't take into account the read latency so we need +* to add 2us to the various latency levels we retrieve from +* the punit. +* - W0 is a bit special in that it's the only level that +* can't be disabled if we want to have display working, so +* we always add 2us there. +* - For levels >=1, punit returns 0us latency when they are +* disabled, so we respect that and don't add 2us then +*/ + wm[0 ] +=2 ; +for (level =1 ; level <= max_level; level++) +if (wm[level] !=0 ) + wm[level] +=2 ; + }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD );
Signature · 1 line
1.8.3.1
Re: [PATCH 51/89] drm/i915/gen9: Add 2us read latency to WM level
Quoted 8 lines · Damien Lespiau
From: Vandana Kannan <[email protected]>
According to the updated Bspec, The mailbox response data is not currently accounting for memory read latency. Add 2 microseconds to the result for each level.
This patch adds 2us to latency of level 0 for all cases and for all other levels (1-7) only if latency[level] > 0.
Quoted 7 lines
v2: Slightly rework the patch and add a big comment (Damien)
Signed-off-by Vandana Kannan <[email protected]> (v1)Signed-off-by Damien Lespiau <[email protected]>Reviewed-by M, Satheeshakrishna <[email protected]> (v1)Cc Lespiau, Damien <[email protected]>Cc M, Satheeshakrishna <[email protected]>
Quoted 54 lines
--- drivers/gpu/drm/i915/intel_pm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/gpu/drm/i915/intel_pm.c +18
-0@@ -2254,6 +2254,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])if (IS_GEN9 (dev)) {uint32_t val;int ret; +int level, max_level =ilk_wm_max_level (dev);/* read the first set of memory latencies[0:3] */ val =0 ;/* data0 to be programmed to 0 for first set */ @@ -2267,6 +2268,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])DRM_ERROR ("SKL Mailbox read error = %d\n" , ret);return ; } + wm[0 ] = val &GEN9_MEM_LAT_LEVEL_MASK ; wm[1 ] = (val >>GEN9_MEM_LAT_LEVEL_1_5_SHIFT ) &GEN9_MEM_LAT_LEVEL_MASK ;@@ -2293,6 +2295,22 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])GEN9_MEM_LAT_LEVEL_MASK ; wm[7 ] = (val >>GEN9_MEM_LAT_LEVEL_3_7_SHIFT ) &GEN9_MEM_LAT_LEVEL_MASK ; + +/* +* punit doesn't take into account the read latency so we need +* to add 2us to the various latency levels we retrieve from +* the punit. +* - W0 is a bit special in that it's the only level that +* can't be disabled if we want to have display working, so +* we always add 2us there. +* - For levels >=1, punit returns 0us latency when they are +* disabled, so we respect that and don't add 2us then +*/ + wm[0 ] +=2 ; +for (level =1 ; level <= max_level; level++) +if (wm[level] !=0 ) + wm[level] +=2 ; + }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD );Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH 52/89 drm/i915/gen9: Disable WM if corresponding latency is 0
In reply to Damien LespiauFrom: Vandana Kannan <[email protected]>
According to updated BSpec, If level 1 or any higher level has a value of 0x00, that level and any higher levels are unused and the associated watermark registers must not be enabled.
This patch checks for latency 0 for level >=1 and does not enable WM corresponding to level m | m>=n, if level n (n != 0) has a 0us latency.
v2: Satheesh's review comments
- zero-out latency values (for all higher levels if latency of given level is zero ) in read_wm_latency() function itself
v3: removed redundant check as per Satheesh's observation.
v4: rebase on top before merging (Damien)
--- drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +12 -2
@@ -2253,7 +2253,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])if (IS_GEN9 (dev)) {uint32_t val; -int ret; +int ret, i;int level, max_level =ilk_wm_max_level (dev);/* read the first set of memory latencies[0:3] */
@@ -2305,12 +2305,22 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])* we always add 2us there. * - For levels >=1, punit returns 0us latency when they are * disabled, so we respect that and don't add 2us then +* +* Additionally, if a level n (n > 1) has a 0us latency, all +* levels m (m >= n) need to be disabled. We make sure to +* sanitize the values out of the punit to satisfy this +* requirement. */ wm[0 ] +=2 ;for (level =1 ; level <= max_level; level++)if (wm[level] !=0 ) wm[level] +=2 ; +else { +for (i = level +1 ; i <= max_level; i++) + wm[i] =0 ; +break ; + } }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD );
@@ -3253,7 +3263,7 @@ static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p,uint32_t method1, method2, plane_bytes_per_line;uint32_t result_bytes; -if (!p->active || !p_params->enabled) { +if (mem_value ==0 || !p->active || !p_params->enabled) { *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; *res_lines =PLANE_WM_LINES_DEFAULT ;return false;
Signature · 1 line
1.8.3.1
Re: [PATCH 52/89] drm/i915/gen9: Disable WM if corresponding latency is 0
Quoted 47 lines · Damien Lespiau
From: Vandana Kannan <[email protected]>
According to updated BSpec, If level 1 or any higher level has a value of
0x00, that level and any higher levels are unused and the associated watermark registers must not be enabled.This patch checks for latency 0 for level >=1 and does not enable WM corresponding to level m | m>=n, if level n (n != 0) has a 0us latency.
v2: Satheesh's review comments
- zero-out latency values (for all higher levels if latency of given level is zero ) inread_wm_latency()function itselfv3: removed redundant check as per Satheesh's observation.
v4: rebase on top before merging (Damien)Signed-off-by Damien Lespiau <[email protected]>Signed-off-by Vandana Kannan <[email protected]>Reviewed-by Satheeshakrishna M <[email protected]> (v3)Cc Satheeshakrishna M <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_pm.c +6
-1@@ -2253,7 +2253,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])if (IS_GEN9 (dev)) {uint32_t val; -int ret; +int ret, i;int level, max_level =ilk_wm_max_level (dev);/* read the first set of memory latencies[0:3] */ @@ -2305,12 +2305,22 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])* we always add 2us there. * - For levels >=1, punit returns 0us latency when they are * disabled, so we respect that and don't add 2us then +* +* Additionally, if a level n (n > 1) has a 0us latency, all +* levels m (m >= n) need to be disabled. We make sure to +* sanitize the values out of the punit to satisfy this +* requirement. */
drivers/gpu/drm/i915/intel_pm.c static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8]) · line 2323
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0wm[0 ] +=2 ;for (level =1 ; level <= max_level; level++)if (wm[level] !=0 ) wm[level] +=2 ; +else { +for (i = level +1 ; i <= max_level; i++) + wm[i] =0 ; +break ; + }
If we're going to be paranoid I think we should disable all higher WM levels whose latency is lower than any of the lower levels. And I think we'll want something like dev_priv->wm.max_wm_level instead of relying on the zero latency tricks. That thing has been on my TODO list since forever.
Quoted 19 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1}else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {uint64_t sskpd =I915_READ64 (MCH_SSKPD );@@ -3253,7 +3263,7 @@ static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p,uint32_t method1, method2, plane_bytes_per_line;uint32_t result_bytes; -if (!p->active || !p_params->enabled) { +if (mem_value ==0 || !p->active || !p_params->enabled) { *res_blocks =PLANE_WM_BLOCKS_DEFAULT ; *res_lines =PLANE_WM_LINES_DEFAULT ;return false;Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 52/89] drm/i915/gen9: Disable WM if corresponding latency is 0
Quoted 6 lines · Ville Syrjälä
If we're going to be paranoid I think we should disable all higher WM levels whose latency is lower than any of the lower levels. And I think we'll want something like
dev_priv->wm.max_wm_levelinstead of relying on the zero latency tricks. That thing has been on my TODO list since forever.
Can we go step by step? add this patch and then I noted this as a task for post merge work. No sure who will end up doing and and if the sanitazing code can be shared between platforms (probably yes?), but that can wait a bit longer?
Signature · 1 line
Damien
Ville Syrjälä
Reviewed-byRe: [PATCH 52/89] drm/i915/gen9: Disable WM if corresponding latency is 0
Quoted 8 lines · Damien Lespiau
Quoted 6 lines · Ville Syrjälä
If we're going to be paranoid I think we should disable all higher WM levels whose latency is lower than any of the lower levels. And I think we'll want something like
dev_priv->wm.max_wm_levelinstead of relying on the zero latency tricks. That thing has been on my TODO list since forever.
Quoted 4 lines
Can we go step by step? add this patch and then I noted this as a task for post merge work. No sure who will end up doing and and if the sanitazing code can be shared between platforms (probably yes?), but that can wait a bit longer?
Sure. This seems fine for now.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 53/89 drm/i915/skl: Gen9 Forcewake
In reply to Damien LespiauFrom: Zhe Wang <[email protected]>
Implement common forcewake functions shared by Gen9 features.
--- drivers/gpu/drm/i915/i915_drv.h | 5 +- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_uncore.c | 175 +++++++++++++++++++++++++++++++++++- 3 files changed, 184 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -1
@@ -535,6 +535,7 @@ struct intel_uncore {unsigned fw_rendercount;unsigned fw_mediacount; +unsigned fw_blittercount;struct timer_list force_wake_timer; };
@@ -2950,7 +2951,9 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);#define FORCEWAKE_RENDER (1 << 0)#define FORCEWAKE_MEDIA (1 << 1) -#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA) +#define FORCEWAKE_BLITTER (1 << 2) +#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ + FORCEWAKE_BLITTER)#define I915_READ8 (reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
drivers/gpu/drm/i915/i915_reg.h +6 -0
@@ -5738,6 +5738,12 @@ enum punit_power_well {#define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)#define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)#define FORCEWAKE_MT 0xa188/* multi-threaded */ +#define FORCEWAKE_MEDIA_GEN9 0xa270 +#define FORCEWAKE_RENDER_GEN9 0xa278 +#define FORCEWAKE_BLITTER_GEN9 0xa188 +#define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88 +#define FORCEWAKE_ACK_RENDER_GEN9 0x0D84 +#define FORCEWAKE_ACK_BLITTER_GEN9 0x130044#define FORCEWAKE_KERNEL 0x1#define FORCEWAKE_USER 0x2#define FORCEWAKE_MT_ACK 0x130040
drivers/gpu/drm/i915/intel_uncore.c +174 -1
211 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH 53/89] drm/i915/skl: Gen9 Forcewake
Quoted 141 lines · Damien Lespiau
From: Zhe Wang <[email protected]>
Implement common forcewake functions shared by Gen9 features.
Signed-off-by Zhe Wang <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 5 +- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_uncore.c | 175 +++++++++++++++++++++++++++++++++++- 3 files changed, 184 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-1@@ -535,6 +535,7 @@ struct intel_uncore {unsigned fw_rendercount;unsigned fw_mediacount; +unsigned fw_blittercount;struct timer_list force_wake_timer; };@@ -2950,7 +2951,9 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);#define FORCEWAKE_RENDER (1 << 0)#define FORCEWAKE_MEDIA (1 << 1) -#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA) +#define FORCEWAKE_BLITTER (1 << 2) +#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ + FORCEWAKE_BLITTER)#define I915_READ8 (reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)drivers/gpu/drm/i915/i915_reg.h +6
-0@@ -5738,6 +5738,12 @@ enum punit_power_well {#define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)#define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)#define FORCEWAKE_MT 0xa188/* multi-threaded */ +#define FORCEWAKE_MEDIA_GEN9 0xa270 +#define FORCEWAKE_RENDER_GEN9 0xa278 +#define FORCEWAKE_BLITTER_GEN9 0xa188 +#define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88 +#define FORCEWAKE_ACK_RENDER_GEN9 0x0D84 +#define FORCEWAKE_ACK_BLITTER_GEN9 0x130044#define FORCEWAKE_KERNEL 0x1#define FORCEWAKE_USER 0x2#define FORCEWAKE_MT_ACK 0x130040drivers/gpu/drm/i915/intel_uncore.c +81
-0@@ -299,6 +299,154 @@ static void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine)spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); } +static void __gen9_gt_force_wake_mt_reset (struct drm_i915_private *dev_priv) +{ +__raw_i915_write32 (dev_priv,FORCEWAKE_RENDER_GEN9 , +_MASKED_BIT_DISABLE (0xffff )); + +__raw_i915_write32 (dev_priv,FORCEWAKE_MEDIA_GEN9 , +_MASKED_BIT_DISABLE (0xffff )); + +__raw_i915_write32 (dev_priv,FORCEWAKE_BLITTER_GEN9 , +_MASKED_BIT_DISABLE (0xffff )); +} + +static void __gen9_force_wake_get (struct drm_i915_private *dev_priv, +int fw_engine) +{ +/* Check for Render Engine */ +if (FORCEWAKE_RENDER & fw_engine) { +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_RENDER_GEN9 ) & +FORCEWAKE_KERNEL ) ==0 , +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: Render forcewake old ack to clear.\n" ); + +__raw_i915_write32 (dev_priv,FORCEWAKE_RENDER_GEN9 , +_MASKED_BIT_ENABLE (FORCEWAKE_KERNEL )); + +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_RENDER_GEN9 ) & +FORCEWAKE_KERNEL ), +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: waiting for Render to ack.\n" ); + } + +/* Check for Media Engine */ +if (FORCEWAKE_MEDIA & fw_engine) { +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_MEDIA_GEN9 ) & +FORCEWAKE_KERNEL ) ==0 , +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: Media forcewake old ack to clear.\n" ); + +__raw_i915_write32 (dev_priv,FORCEWAKE_MEDIA_GEN9 , +_MASKED_BIT_ENABLE (FORCEWAKE_KERNEL )); + +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_MEDIA_GEN9 ) & +FORCEWAKE_KERNEL ), +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: waiting for Media to ack.\n" ); + } + +/* Check for Blitter Engine */ +if (FORCEWAKE_BLITTER & fw_engine) { +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_BLITTER_GEN9 ) & +FORCEWAKE_KERNEL ) ==0 , +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: Blitter forcewake old ack to clear.\n" ); + +__raw_i915_write32 (dev_priv,FORCEWAKE_BLITTER_GEN9 , +_MASKED_BIT_ENABLE (FORCEWAKE_KERNEL )); + +if (wait_for_atomic ((__raw_i915_read32 (dev_priv, +FORCEWAKE_ACK_BLITTER_GEN9 ) & +FORCEWAKE_KERNEL ), +FORCEWAKE_ACK_TIMEOUT_MS )) +DRM_ERROR ("Timed out: waiting for Blitter to ack.\n" ); + } +} + +static void __gen9_force_wake_put (struct drm_i915_private *dev_priv, +int fw_engine) +{ +/* Check for Render Engine */ +if (FORCEWAKE_RENDER & fw_engine) +__raw_i915_write32 (dev_priv,FORCEWAKE_RENDER_GEN9 , +_MASKED_BIT_DISABLE (FORCEWAKE_KERNEL )); + +/* Check for Media Engine */ +if (FORCEWAKE_MEDIA & fw_engine) + __raw_i915_write32(dev_priv, FORCEWAKE_MEDIA_GEN9,
drivers/gpu/drm/i915/intel_uncore.c static void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) · line 392
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +10
-0+ _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); + +/* Check for Blitter Engine */ +if (FORCEWAKE_BLITTER & fw_engine) +__raw_i915_write32 (dev_priv,FORCEWAKE_BLITTER_GEN9 , +_MASKED_BIT_DISABLE (FORCEWAKE_KERNEL )); +} + +void gen9_force_wake_get (struct drm_i915_private *dev_priv, +int fw_engine)
static missing
Quoted 18 lines
drivers/gpu/drm/i915/intel_uncore.c +18
-0+{ +unsigned long irqflags; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +if (FORCEWAKE_RENDER & fw_engine) { +if (dev_priv->uncore.fw_rendercount++ ==0 ) + dev_priv->uncore.funcs.force_wake_get (dev_priv, +FORCEWAKE_RENDER ); + } + +if (FORCEWAKE_MEDIA & fw_engine) { +if (dev_priv->uncore.fw_mediacount++ ==0 ) + dev_priv->uncore.funcs.force_wake_get (dev_priv, +FORCEWAKE_MEDIA ); + } + +if (FORCEWAKE_BLITTER & fw_engine) {
drivers/gpu/drm/i915/intel_uncore.c static void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) · line 420
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +10
-0+if (dev_priv->uncore.fw_blittercount++ ==0 ) + dev_priv->uncore.funcs.force_wake_get (dev_priv, +FORCEWAKE_BLITTER ); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +void gen9_force_wake_put (struct drm_i915_private *dev_priv, +int fw_engine)
static missing
above statics added it is:
Quoted 101 lines
drivers/gpu/drm/i915/intel_uncore.c +55
-1+{ +unsigned long irqflags; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +if (FORCEWAKE_RENDER & fw_engine) { +WARN_ON (dev_priv->uncore.fw_rendercount ==0 ); +if (--dev_priv->uncore.fw_rendercount ==0 ) + dev_priv->uncore.funcs.force_wake_put (dev_priv, +FORCEWAKE_RENDER ); + } + +if (FORCEWAKE_MEDIA & fw_engine) { +WARN_ON (dev_priv->uncore.fw_mediacount ==0 ); +if (--dev_priv->uncore.fw_mediacount ==0 ) + dev_priv->uncore.funcs.force_wake_put (dev_priv, +FORCEWAKE_MEDIA ); + } + +if (FORCEWAKE_BLITTER & fw_engine) { +WARN_ON (dev_priv->uncore.fw_blittercount ==0 ); +if (--dev_priv->uncore.fw_blittercount ==0 ) + dev_priv->uncore.funcs.force_wake_put (dev_priv, +FORCEWAKE_BLITTER ); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} +static void gen6_force_wake_timer (unsigned long arg) {struct drm_i915_private *dev_priv = (void *)arg;@@ -337,6 +485,9 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)if (IS_IVYBRIDGE (dev) ||IS_HASWELL (dev) ||IS_BROADWELL (dev))__gen7_gt_force_wake_mt_reset (dev_priv); +if (IS_GEN9 (dev)) +__gen9_gt_force_wake_mt_reset (dev_priv); +if (restore) {/* If reset with a user forcewake, try to restore */ unsigned fw =0 ;@@ -346,6 +497,15 @@ void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)if (dev_priv->uncore.fw_mediacount) fw |=FORCEWAKE_MEDIA ; + }else if (IS_GEN9 (dev)) { +if (dev_priv->uncore.fw_rendercount) + fw |=FORCEWAKE_RENDER ; + +if (dev_priv->uncore.fw_mediacount) + fw |=FORCEWAKE_MEDIA ; + +if (dev_priv->uncore.fw_blittercount) + fw |=FORCEWAKE_BLITTER ; }else {if (dev_priv->uncore.forcewake_count) fw =FORCEWAKE_ALL ;@@ -410,6 +570,10 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine)intel_runtime_pm_get (dev_priv); +/* Redirect to Gen9 specific routine */ +if (IS_GEN9 (dev_priv->dev)) +return gen9_force_wake_get (dev_priv, fw_engine); +/* Redirect to VLV specific routine */ if (IS_VALLEYVIEW (dev_priv->dev))return vlv_force_wake_get (dev_priv, fw_engine);@@ -431,6 +595,12 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine)if (!dev_priv->uncore.funcs.force_wake_put)return ; +/* Redirect to Gen9 specific routine */ +if (IS_GEN9 (dev_priv->dev)) { +gen9_force_wake_put (dev_priv, fw_engine); + goto out; + } +/* Redirect to VLV specific routine */ if (IS_VALLEYVIEW (dev_priv->dev)) {vlv_force_wake_put (dev_priv, fw_engine);@@ -835,7 +1005,10 @@ void intel_uncore_init(struct drm_device *dev)intel_uncore_early_sanitize (dev, false); -if (IS_VALLEYVIEW (dev)) { +if (IS_GEN9 (dev)) { + dev_priv->uncore.funcs.force_wake_get = __gen9_force_wake_get; + dev_priv->uncore.funcs.force_wake_put = __gen9_force_wake_put; + }else if (IS_VALLEYVIEW (dev)) { dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get; dev_priv->uncore.funcs.force_wake_put = __vlv_force_wake_put; }else if (IS_HASWELL (dev) ||IS_BROADWELL (dev)) {Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 53/89 drm/i915/skl: Gen9 Forcewake
From: Zhe Wang <[email protected]>
Implement common forcewake functions shared by Gen9 features.
v2: Make the focewake_{get,put} functions static (Mika)
Small coding style fix in the function definition (Damien)
--- drivers/gpu/drm/i915/i915_drv.h | 5 +- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_uncore.c | 175 +++++++++++++++++++++++++++++++++++- 3 files changed, 184 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -1
@@ -545,6 +545,7 @@ struct intel_uncore {unsigned fw_rendercount;unsigned fw_mediacount; +unsigned fw_blittercount;struct timer_list force_wake_timer; };
@@ -2969,7 +2970,9 @@ int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val);#define FORCEWAKE_RENDER (1 << 0)#define FORCEWAKE_MEDIA (1 << 1) -#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA) +#define FORCEWAKE_BLITTER (1 << 2) +#define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ + FORCEWAKE_BLITTER)#define I915_READ8 (reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true)
drivers/gpu/drm/i915/i915_reg.h +6 -0
@@ -5750,6 +5750,12 @@ enum punit_power_well {#define VLV_GTLC_PW_MEDIA_STATUS_MASK (1 << 5)#define VLV_GTLC_PW_RENDER_STATUS_MASK (1 << 7)#define FORCEWAKE_MT 0xa188/* multi-threaded */ +#define FORCEWAKE_MEDIA_GEN9 0xa270 +#define FORCEWAKE_RENDER_GEN9 0xa278 +#define FORCEWAKE_BLITTER_GEN9 0xa188 +#define FORCEWAKE_ACK_MEDIA_GEN9 0x0D88 +#define FORCEWAKE_ACK_RENDER_GEN9 0x0D84 +#define FORCEWAKE_ACK_BLITTER_GEN9 0x130044#define FORCEWAKE_KERNEL 0x1#define FORCEWAKE_USER 0x2#define FORCEWAKE_MT_ACK 0x130040
drivers/gpu/drm/i915/intel_uncore.c +174 -1
211 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 54/89 drm/i915/skl: Enable Gen9 RC6
In reply to Damien LespiauFrom: Zhe Wang <[email protected]>
Configure and enable RC6 for Gen9.
v2: Rebase on top of BDW rc6 support (Damien)
--- drivers/gpu/drm/i915/intel_pm.c | 52 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +51 -1
@@ -4332,6 +4332,13 @@ static void gen8_disable_rps_interrupts(struct drm_device *dev) } } +static void gen9_disable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +I915_WRITE (GEN6_RC_CONTROL ,0 ); +} +static void gen6_disable_rps_interrupts (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4579,6 +4586,45 @@ void bdw_software_turbo(struct drm_device *dev) ¤t_time, ¤t_c0); } +static void gen9_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +uint32_t rc6_mask =0 ; +int unused; + +/* 1a: Software RC state - RC0 */ +I915_WRITE (GEN6_RC_STATE ,0 ); + +/* 1b: Get forcewake during program sequence. Although the driver +* hasn't enabled a state yet where we need forcewake, BIOS may have.*/ +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); + +/* 2a: Disable RC states. */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +/* 2b: Program RC6 thresholds.*/ +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,54 <<16 ); +I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );/* 12500 * 1280ns */ +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );/* 25 * 1280ns */ +for_each_ring (ring, dev_priv, unused) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); +I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,37500 );/* 37.5/125ms per EI */ + +/* 3a: Enable RC6 */ +if (intel_enable_rc6 (dev) &INTEL_RC6_ENABLE ) + rc6_mask =GEN6_RC_CTL_RC6_ENABLE ; +DRM_INFO ("RC6 %s\n" , (rc6_mask &GEN6_RC_CTL_RC6_ENABLE ) ? +"on" :"off" ); +I915_WRITE (GEN6_RC_CONTROL ,GEN6_RC_CTL_HW_ENABLE | +GEN6_RC_CTL_EI_MODE (1 ) | + rc6_mask); + +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); + +} +static void gen8_enable_rps (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -6158,7 +6204,9 @@ void intel_disable_gt_powersave(struct drm_device *dev)intel_suspend_gt_powersave (dev);mutex_lock (&dev_priv->rps.hw_lock); -if (IS_CHERRYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) +gen9_disable_rps (dev); +else if (IS_CHERRYVIEW (dev))cherryview_disable_rps (dev);else if (IS_VALLEYVIEW (dev))valleyview_disable_rps (dev);
@@ -6184,6 +6232,8 @@ static void intel_gen6_powersave_work(struct work_struct *work)cherryview_enable_rps (dev); }else if (IS_VALLEYVIEW (dev)) {valleyview_enable_rps (dev); + }else if (INTEL_INFO (dev)->gen >=9 ) { +gen9_enable_rps (dev); }else if (IS_BROADWELL (dev)) {gen8_enable_rps (dev);__gen6_update_ring_freq (dev);
Signature · 1 line
1.8.3.1
Re: [PATCH 54/89] drm/i915/skl: Enable Gen9 RC6
Quoted 43 lines · Damien Lespiau
From: Zhe Wang <[email protected]>
Configure and enable RC6 for Gen9.
v2: Rebase on top of BDW rc6 support (Damien)
Signed-off-by Zhe Wang <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 52 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_pm.c +16
-0@@ -4332,6 +4332,13 @@ static void gen8_disable_rps_interrupts(struct drm_device *dev) } } +static void gen9_disable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +I915_WRITE (GEN6_RC_CONTROL ,0 ); +} +static void gen6_disable_rps_interrupts (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -4579,6 +4586,45 @@ void bdw_software_turbo(struct drm_device *dev) ¤t_time, ¤t_c0); } +static void gen9_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +uint32_t rc6_mask =0 ; +int unused; + +/* 1a: Software RC state - RC0 */ +I915_WRITE (GEN6_RC_STATE ,0 );
drivers/gpu/drm/i915/intel_pm.c void bdw_software_turbo(struct drm_device *dev) · line 4607
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +/* 1b: Get forcewake during program sequence. Although the driver +* hasn't enabled a state yet where we need forcewake, BIOS may have.*/ +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); + +/* 2a: Disable RC states. */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +/* 2b: Program RC6 thresholds.*/ +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,54 <<16 );
40 << 16
drivers/gpu/drm/i915/intel_pm.c void bdw_software_turbo(struct drm_device *dev) · line 4613
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );/* 12500 * 1280ns */ +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );/* 25 * 1280ns */ +for_each_ring (ring, dev_priv, unused) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); +I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,37500 );/* 37.5/125ms per EI */
50000 50ms/125ms per EI
Quoted 39 lines
drivers/gpu/drm/i915/intel_pm.c +19
-1+ +/* 3a: Enable RC6 */ +if (intel_enable_rc6 (dev) &INTEL_RC6_ENABLE ) + rc6_mask =GEN6_RC_CTL_RC6_ENABLE ; +DRM_INFO ("RC6 %s\n" , (rc6_mask &GEN6_RC_CTL_RC6_ENABLE ) ? +"on" :"off" ); +I915_WRITE (GEN6_RC_CONTROL ,GEN6_RC_CTL_HW_ENABLE | +GEN6_RC_CTL_EI_MODE (1 ) | + rc6_mask); + +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); + +} +static void gen8_enable_rps (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -6158,7 +6204,9 @@ void intel_disable_gt_powersave(struct drm_device *dev)intel_suspend_gt_powersave (dev);mutex_lock (&dev_priv->rps.hw_lock); -if (IS_CHERRYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) +gen9_disable_rps (dev); +else if (IS_CHERRYVIEW (dev))cherryview_disable_rps (dev);else if (IS_VALLEYVIEW (dev))valleyview_disable_rps (dev);@@ -6184,6 +6232,8 @@ static void intel_gen6_powersave_work(struct work_struct *work)cherryview_enable_rps (dev); }else if (IS_VALLEYVIEW (dev)) {valleyview_enable_rps (dev); + }else if (INTEL_INFO (dev)->gen >=9 ) { +gen9_enable_rps (dev); }else if (IS_BROADWELL (dev)) {gen8_enable_rps (dev);__gen6_update_ring_freq (dev);Signature · 1 line
1.8.3.1
I couldn't find out if those values suggested are newer than the values in this patch. We need to visit this are when we are wiser.
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 54/89] drm/i915/skl: Enable Gen9 RC6
Quoted 107 lines · Mika Kuoppala
Quoted 43 lines · Damien Lespiau
From: Zhe Wang <[email protected]>
Configure and enable RC6 for Gen9.
v2: Rebase on top of BDW rc6 support (Damien)
Signed-off-by Zhe Wang <[email protected]>Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 52 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_pm.c +16
-0@@ -4332,6 +4332,13 @@ static void gen8_disable_rps_interrupts(struct drm_device *dev) } } +static void gen9_disable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +I915_WRITE (GEN6_RC_CONTROL ,0 ); +} +static void gen6_disable_rps_interrupts (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -4579,6 +4586,45 @@ void bdw_software_turbo(struct drm_device *dev) ¤t_time, ¤t_c0); } +static void gen9_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +uint32_t rc6_mask =0 ; +int unused; + +/* 1a: Software RC state - RC0 */ +I915_WRITE (GEN6_RC_STATE ,0 );drivers/gpu/drm/i915/intel_pm.c void bdw_software_turbo(struct drm_device *dev) · line 4607
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ +/* 1b: Get forcewake during program sequence. Although the driver +* hasn't enabled a state yet where we need forcewake, BIOS may have.*/ +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); + +/* 2a: Disable RC states. */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +/* 2b: Program RC6 thresholds.*/ +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,54 <<16 );40 << 16
drivers/gpu/drm/i915/intel_pm.c void bdw_software_turbo(struct drm_device *dev) · line 4613
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );/* 12500 * 1280ns */ +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );/* 25 * 1280ns */ +for_each_ring (ring, dev_priv, unused) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); +I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,37500 );/* 37.5/125ms per EI */ 50000 50ms/125ms per EI
Quoted 39 lines
drivers/gpu/drm/i915/intel_pm.c +19
-1+ +/* 3a: Enable RC6 */ +if (intel_enable_rc6 (dev) &INTEL_RC6_ENABLE ) + rc6_mask =GEN6_RC_CTL_RC6_ENABLE ; +DRM_INFO ("RC6 %s\n" , (rc6_mask &GEN6_RC_CTL_RC6_ENABLE ) ? +"on" :"off" ); +I915_WRITE (GEN6_RC_CONTROL ,GEN6_RC_CTL_HW_ENABLE | +GEN6_RC_CTL_EI_MODE (1 ) | + rc6_mask); + +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); + +} +static void gen8_enable_rps (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -6158,7 +6204,9 @@ void intel_disable_gt_powersave(struct drm_device *dev)intel_suspend_gt_powersave (dev);mutex_lock (&dev_priv->rps.hw_lock); -if (IS_CHERRYVIEW (dev)) +if (INTEL_INFO (dev)->gen >=9 ) +gen9_disable_rps (dev); +else if (IS_CHERRYVIEW (dev))cherryview_disable_rps (dev);else if (IS_VALLEYVIEW (dev))valleyview_disable_rps (dev);@@ -6184,6 +6232,8 @@ static void intel_gen6_powersave_work(struct work_struct *work)cherryview_enable_rps (dev); }else if (IS_VALLEYVIEW (dev)) {valleyview_enable_rps (dev); + }else if (INTEL_INFO (dev)->gen >=9 ) { +gen9_enable_rps (dev); }else if (IS_BROADWELL (dev)) {gen8_enable_rps (dev);__gen6_update_ring_freq (dev);Signature · 1 line
1.8.3.1I couldn't find out if those values suggested are newer than the values in this patch. We need to visit this are when we are wiser.
Quoted 1 line
Reviewed-by Mika Kuoppala <[email protected]>
The new values are from power performance study on more recent platforms. So we decided to start with those as initial version.
We will definitely revisit these numbers and update if there are different numbers recommended from architecture team for Gen9.
Quoted 8 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 55/89 drm/i915/skl: Gen9 multi-engine forcewake
In reply to Damien LespiauFrom: Zhe Wang <[email protected]>
Enable multi-engine forcewake for Gen9.
v2: Rebase on top of nightly
Move the register range definitions to intel_uncore.c Whitespace fixes
(Damien)
--- drivers/gpu/drm/i915/intel_uncore.c | 120 ++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)
drivers/gpu/drm/i915/intel_uncore.c +120 -0
@@ -674,6 +674,34 @@ void assert_force_wake_inactive(struct drm_i915_private *dev_priv) REG_RANGE((reg), 0x14000, 0x14400) || \ REG_RANGE((reg), 0x22000, 0x24000)) +#define FORCEWAKE_GEN9_UNCORE_RANGE_OFFSET (reg) \ + ((reg) >= 0xC00 && (reg) < 0x2000) + +#define FORCEWAKE_GEN9_RENDER_RANGE_OFFSET (reg) \ + (((reg) >= 0x2000 && (reg) < 0x4000) || \ + ((reg) >= 0x5200 && (reg) < 0x8000) || \ + ((reg) >= 0x8300 && (reg) < 0x8500) || \ + ((reg) >= 0x8C00 && (reg) < 0x8D00) || \ + ((reg) >= 0xB000 && (reg) < 0xB480) || \ + ((reg) >= 0xE000 && (reg) < 0xE800)) + +#define FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET (reg) \ + (((reg) >= 0x8800 && (reg) < 0x8A00) || \ + ((reg) >= 0xD000 && (reg) < 0xD800) || \ + ((reg) >= 0x12000 && (reg) < 0x14000) || \ + ((reg) >= 0x1A000 && (reg) < 0x1EA00) || \ + ((reg) >= 0x30000 && (reg) < 0x40000)) + +#define FORCEWAKE_GEN9_COMMON_RANGE_OFFSET (reg) \ + ((reg) >= 0x9400 && (reg) < 0x9800) + +#define FORCEWAKE_GEN9_BLITTER_RANGE_OFFSET (reg) \ + ((reg) < 0x40000 &&\ + !FORCEWAKE_GEN9_UNCORE_RANGE_OFFSET(reg) && \ + !FORCEWAKE_GEN9_RENDER_RANGE_OFFSET(reg) && \ + !FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET(reg) && \ + !FORCEWAKE_GEN9_COMMON_RANGE_OFFSET(reg)) +static void ilk_dummy_write (struct drm_i915_private *dev_priv) {
@@ -804,6 +832,43 @@ chv_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \REG_READ_FOOTER ; \ } +#define __gen9_read (x) \ +static u##x \ +gen9_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \ + REG_READ_HEADER(x); \ + if (!NEEDS_FORCE_WAKE((dev_priv), (reg)) || \ + FORCEWAKE_GEN9_UNCORE_RANGE_OFFSET(reg)) { \ + val = __raw_i915_read##x(dev_priv, reg); \ + } else { \ + unsigned fwengine = 0; \ + if (FORCEWAKE_GEN9_RENDER_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_rendercount == 0) \ + fwengine = FORCEWAKE_RENDER; \ + } else if (FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_mediacount == 0) \ + fwengine = FORCEWAKE_MEDIA; \ + } else if (FORCEWAKE_GEN9_COMMON_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_rendercount == 0) \ + fwengine |= FORCEWAKE_RENDER; \ + if (dev_priv->uncore.fw_mediacount == 0) \ + fwengine |= FORCEWAKE_MEDIA; \ + } else { \ + if (dev_priv->uncore.fw_blittercount == 0) \ + fwengine = FORCEWAKE_BLITTER; \ + } \ + if (fwengine) \ + dev_priv->uncore.funcs.force_wake_get(dev_priv, fwengine); \ + val = __raw_i915_read##x(dev_priv, reg); \ + if (fwengine) \ + dev_priv->uncore.funcs.force_wake_put(dev_priv, fwengine); \ + } \ + REG_READ_FOOTER; \ +} + +__gen9_read(8) +__gen9_read(16) +__gen9_read(32) +__gen9_read(64) __chv_read(8) __chv_read(16)__chv_read (32 )
@@ -825,6 +890,7 @@ __gen4_read(16) __gen4_read(32) __gen4_read(64) +#undef __gen9_read#undef __chv_read#undef __vlv_read#undef __gen6_read
@@ -962,6 +1028,46 @@ chv_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, bool trace)REG_WRITE_FOOTER ; \ } +#define __gen9_write (x) \ +static void \ +gen9_write##x(struct drm_i915_private *dev_priv, off_t reg, u##x val, \ + bool trace) { \ + REG_WRITE_HEADER; \ + if (!NEEDS_FORCE_WAKE((dev_priv), (reg)) || \ + FORCEWAKE_GEN9_UNCORE_RANGE_OFFSET(reg)) { \ + __raw_i915_write##x(dev_priv, reg, val); \ + } else { \ + unsigned fwengine = 0; \ + if (FORCEWAKE_GEN9_RENDER_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_rendercount == 0) \ + fwengine = FORCEWAKE_RENDER; \ + } else if (FORCEWAKE_GEN9_MEDIA_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_mediacount == 0) \ + fwengine = FORCEWAKE_MEDIA; \ + } else if (FORCEWAKE_GEN9_COMMON_RANGE_OFFSET(reg)) { \ + if (dev_priv->uncore.fw_rendercount == 0) \ + fwengine |= FORCEWAKE_RENDER; \ + if (dev_priv->uncore.fw_mediacount == 0) \ + fwengine |= FORCEWAKE_MEDIA; \ + } else { \ + if (dev_priv->uncore.fw_blittercount == 0) \ + fwengine = FORCEWAKE_BLITTER; \ + } \ + if (fwengine) \ + dev_priv->uncore.funcs.force_wake_get(dev_priv, \ + fwengine); \ + __raw_i915_write##x(dev_priv, reg, val); \ + if (fwengine) \ + dev_priv->uncore.funcs.force_wake_put(dev_priv, \ + fwengine); \ + } \ + REG_WRITE_FOOTER; \ +} + +__gen9_write(8) +__gen9_write(16) +__gen9_write(32) +__gen9_write(64) __chv_write(8) __chv_write(16)__chv_write (32 )
@@ -987,6 +1093,7 @@ __gen4_write(16) __gen4_write(32) __gen4_write(64) +#undef __gen9_write#undef __chv_write#undef __gen8_write#undef __hsw_write
@@ -1054,6 +1161,19 @@ void intel_uncore_init(struct drm_device *dev)switch (INTEL_INFO (dev)->gen) {default : +WARN_ON (1 ); +return ; +case 9 : + dev_priv->uncore.funcs.mmio_writeb = gen9_write8; + dev_priv->uncore.funcs.mmio_writew = gen9_write16; + dev_priv->uncore.funcs.mmio_writel = gen9_write32; + dev_priv->uncore.funcs.mmio_writeq = gen9_write64; + dev_priv->uncore.funcs.mmio_readb = gen9_read8; + dev_priv->uncore.funcs.mmio_readw = gen9_read16; + dev_priv->uncore.funcs.mmio_readl = gen9_read32; + dev_priv->uncore.funcs.mmio_readq = gen9_read64; +break ; +case 8 :if (IS_CHERRYVIEW (dev)) { dev_priv->uncore.funcs.mmio_writeb = chv_write8; dev_priv->uncore.funcs.mmio_writew = chv_write16;
Signature · 1 line
1.8.3.1