Update DDL code to support sprite watermarks
Subsystems (2)
cover Update DDL code to support sprite watermarks
Hi,
These patches depend on few patches from Ville and have been rebased on top of them. Those pathes also need review and merge. Following are Ville's patches:
http://lists.freedesktop.org/archives/intel-gfx/2014-June/048150.html
http://lists.freedesktop.org/archives/intel-gfx/2014-June/048152.html
http://lists.freedesktop.org/archives/intel-gfx/2014-June/048153.html
Gajanan Bhat (3):
drm/i915: Update DDL only for current CRTC drm/i915: Generalize drain latency computation drm/i915: Add sprite watermark programming for VLV and CHV
drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 135 ++++++++++++++++++++++++++------------- 2 files changed, 92 insertions(+), 44 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 drm/i915: Update DDL only for current CRTC
Instead of looping through all CRTCs, update DDL for current CRTC for which watermark is being updated.
CHV is confirmed to have precision of 32/64 which is same as VLV.
--- drivers/gpu/drm/i915/intel_pm.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +9 -16
@@ -1307,24 +1307,17 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,* latency value. */ -static void vlv_update_drain_latency (struct drm_device *dev) +static void vlv_update_drain_latency (struct drm_crtc *crtc) { +struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; -enum pipe pipe; - -for_each_pipe (pipe) { -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; +enum pipe pipe =to_intel_crtc (crtc)->pipe; +int plane_prec, plane_dl; +int cursor_prec, cursor_dl; +int plane_prec_mult, cursor_prec_mult; -if (!vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) -continue ; - -/* -* FIXME CHV spec still lists 16 and 32 as the precision -* values. Need to figure out if spec is outdated or what. -*/ +if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, + &cursor_prec_mult, &cursor_dl)) { cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ?DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; plane_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_64) ?
@@ -1349,7 +1342,7 @@ static void valleyview_update_wm(struct drm_crtc *crtc)unsigned int enabled =0 ;bool cxsr_enabled; -vlv_update_drain_latency (dev); +vlv_update_drain_latency (crtc); if (g4x_compute_wm0(dev, PIPE_A, &valleyview_wm_info, latency_ns,
Signature · 1 line
1.7.9.5
Re: [PATCH 1/3] drm/i915: Update DDL only for current CRTC
Quoted 5 lines · Gajanan Bhat
Instead of looping through all CRTCs, update DDL for current CRTC for which watermark is being updated.
CHV is confirmed to have precision of 32/64 which is same as VLV.Signed-off-by Gajanan Bhat <[email protected]>
Looks ok to me:
Quoted 42 lines
--- drivers/gpu/drm/i915/intel_pm.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)drivers/gpu/drm/i915/intel_pm.c +8
-15@@ -1307,24 +1307,17 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,* latency value. */ -static void vlv_update_drain_latency (struct drm_device *dev) +static void vlv_update_drain_latency (struct drm_crtc *crtc) { +struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; -enum pipe pipe; - -for_each_pipe (pipe) { -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; +enum pipe pipe =to_intel_crtc (crtc)->pipe; +int plane_prec, plane_dl; +int cursor_prec, cursor_dl; +int plane_prec_mult, cursor_prec_mult; -if (!vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) -continue ; - -/* -* FIXME CHV spec still lists 16 and 32 as the precision -* values. Need to figure out if spec is outdated or what. -*/ +if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, + &cursor_prec_mult, &cursor_dl)) { cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ?DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; plane_prec = (plane_prec_mult == DRAIN_LATENCY_PRECISION_64) ?
drivers/gpu/drm/i915/intel_pm.c static void valleyview_update_wm(struct drm_crtc *crtc) · line 1348
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -1349,7 +1342,7 @@ static void valleyview_update_wm(struct drm_crtc *crtc)unsigned int enabled =0 ;bool cxsr_enabled; -vlv_update_drain_latency (dev); +vlv_update_drain_latency (crtc); if (g4x_compute_wm0(dev, PIPE_A, &valleyview_wm_info, latency_ns,
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915: Generalize drain latency computation
In reply to Gajanan BhatModify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 82 ++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3877,6 +3877,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MAX 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64
drivers/gpu/drm/i915/intel_pm.c +46 -36
103 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 2/3] drm/i915: Generalize drain latency computation
Quoted 14 lines · Gajanan Bhat
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
Signed-off-by Gajanan Bhat <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 82 ++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 36 deletions(-)drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h enum punit_power_well { · line 3880
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3877,6 +3877,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MAX 0x7f
_MASK is the standard postfix in the driver.
Quoted 20 lines
drivers/gpu/drm/i915/i915_reg.h +0
-0/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64drivers/gpu/drm/i915/intel_pm.c +3
-6@@ -1268,33 +1268,21 @@ static bool g4x_compute_srwm(struct drm_device *dev, display, cursor); } -static bool vlv_compute_drain_latency (struct drm_device *dev, -int plane, -int *plane_prec_mult, -int *plane_dl, -int *cursor_prec_mult, -int *cursor_dl) +static bool vlv_compute_drain_latency(struct drm_crtc *crtc, + int pixel_size, + int *prec_mult,
drivers/gpu/drm/i915/intel_pm.c static bool g4x_compute_srwm(struct drm_device *dev, · line 1279
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +3
-4+ int *drain_latency) { -struct drm_crtc *crtc; -int clock, pixel_size;int entries; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - crtc =intel_get_crtc_for_plane (dev, plane); -if (!intel_crtc_active (crtc)) +if (clock ==0 || pixel_size ==0 )
This would mean a driver bug, so needs to be wrapped in a WARN().
Quoted 35 lines
drivers/gpu/drm/i915/intel_pm.c +8
-17return false; - clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ - - entries = (clock /1000 ) * pixel_size; - *plane_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *plane_dl = (64 * (*plane_prec_mult) *4 ) / entries; - - entries = (clock /1000 ) *4 ;/* BPP is always 4 for cursor */ - *cursor_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *cursor_dl = (64 * (*cursor_prec_mult) *4 ) / entries; + entries =DIV_ROUND_UP (clock,1000 ) * pixel_size; + *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 : +DRAIN_LATENCY_PRECISION_32 ; + *drain_latency = (64 * (*prec_mult) *4 ) / entries;return true; }@@ -1309,24 +1297,46 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,static void vlv_update_drain_latency (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +int pixel_size; +int drain_latency;enum pipe pipe =to_intel_crtc (crtc)->pipe; -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; +int plane_prec, prec_mult, plane_dl;
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1308
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +3
-6-if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) { - cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; - plane_prec = (plane_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_PLANE_PRECISION_64 :DDL_PLANE_PRECISION_32 ; + plane_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_PLANE_PRECISION_64 & + ~DRAIN_LATENCY_MAX & ~DDL_CURSOR_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_CURSOR_SHIFT );
A tad simpler and more standard way for masking is ~(X | Y | Z).
Quoted 14 lines
drivers/gpu/drm/i915/intel_pm.c +10
-3-I915_WRITE (VLV_DDL (pipe), cursor_prec | - (cursor_dl <<DDL_CURSOR_SHIFT ) | - plane_prec | (plane_dl <<DDL_PLANE_SHIFT )); +if (!intel_crtc_active (crtc)) { +I915_WRITE (VLV_DDL (pipe), plane_dl); +return ; } + +/* Primary plane Drain Latency */ + pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_PLANE_PRECISION_64 : +DDL_PLANE_PRECISION_32 ;
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1330
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ plane_dl = plane_dl | plane_prec | drain_latency; + } + +/* Cursor Drain Latency +* BPP is always 4 for cursor +*/ + pixel_size =4 ; + +/* Program cursor DL only if it is enabled */ + if ((I915_READ(CURCNTR(pipe)) & CURSOR_MODE) &&
Checking intel_crtc->cursor_base would be cheaper.
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1336
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +6
-0+ vlv_compute_drain_latency(crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_CURSOR_PRECISION_64 : +DDL_CURSOR_PRECISION_32 ; + plane_dl = plane_dl | plane_prec | + drain_latency <<DDL_CURSOR_SHIFT ;
This would overwrite the above assignment of plane_dl.
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1342
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ } + +I915_WRITE (VLV_DDL (pipe), plane_dl); }#define single_plane_enabled (mask) is_power_of_2(mask)
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/3] drm/i915: Generalize drain latency computation
In reply to Gajanan BhatQuoted 53 lines · Gajanan Bhat
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
Signed-off-by Gajanan Bhat <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 82 ++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 36 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3877,6 +3877,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MAX 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64drivers/gpu/drm/i915/intel_pm.c +6
-13@@ -1268,33 +1268,21 @@ static bool g4x_compute_srwm(struct drm_device *dev, display, cursor); } -static bool vlv_compute_drain_latency (struct drm_device *dev, -int plane, -int *plane_prec_mult, -int *plane_dl, -int *cursor_prec_mult, -int *cursor_dl) +static bool vlv_compute_drain_latency (struct drm_crtc *crtc, +int pixel_size, +int *prec_mult, +int *drain_latency) { -struct drm_crtc *crtc; -int clock, pixel_size;int entries; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - crtc =intel_get_crtc_for_plane (dev, plane); -if (!intel_crtc_active (crtc)) +if (clock ==0 || pixel_size ==0 )return false; - clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ -
drivers/gpu/drm/i915/intel_pm.c static bool g4x_compute_srwm(struct drm_device *dev, · line 1282
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +1
-9- entries = (clock /1000 ) * pixel_size; - *plane_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *plane_dl = (64 * (*plane_prec_mult) *4 ) / entries; - - entries = (clock /1000 ) *4 ;/* BPP is always 4 for cursor */ - *cursor_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *cursor_dl = (64 * (*cursor_prec_mult) *4 ) / entries; + entries =DIV_ROUND_UP (clock,1000 ) * pixel_size;
Yeah rounding the clock up should be safe, rounding down not so much. But this change should really be a separate patch.
drivers/gpu/drm/i915/intel_pm.c static bool g4x_compute_srwm(struct drm_device *dev, · line 1285
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 : +DRAIN_LATENCY_PRECISION_32 ; + *drain_latency = (64 * (*prec_mult) *4 ) / entries;
Another thing you could fix is making sure the result is <=0x7f. It's quite possible we'd exceed that (all that's needed is a 16bpp fb and <32MHz pixel clock, which isn't all that far fetched). This could be part of the rounding fix patch since it's somewhat related.
Quoted 71 lines
drivers/gpu/drm/i915/intel_pm.c +36
-14return true; }@@ -1309,24 +1297,46 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,static void vlv_update_drain_latency (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +int pixel_size; +int drain_latency;enum pipe pipe =to_intel_crtc (crtc)->pipe; -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; +int plane_prec, prec_mult, plane_dl; -if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) { - cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; - plane_prec = (plane_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_PLANE_PRECISION_64 :DDL_PLANE_PRECISION_32 ; + plane_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_PLANE_PRECISION_64 & + ~DRAIN_LATENCY_MAX & ~DDL_CURSOR_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_CURSOR_SHIFT ); -I915_WRITE (VLV_DDL (pipe), cursor_prec | - (cursor_dl <<DDL_CURSOR_SHIFT ) | - plane_prec | (plane_dl <<DDL_PLANE_SHIFT )); +if (!intel_crtc_active (crtc)) { +I915_WRITE (VLV_DDL (pipe), plane_dl); +return ; } + +/* Primary plane Drain Latency */ + pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_PLANE_PRECISION_64 : +DDL_PLANE_PRECISION_32 ; + plane_dl = plane_dl | plane_prec | drain_latency; + } + +/* Cursor Drain Latency +* BPP is always 4 for cursor +*/ + pixel_size =4 ; + +/* Program cursor DL only if it is enabled */ +if ((I915_READ (CURCNTR (pipe)) &CURSOR_MODE ) && +vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_CURSOR_PRECISION_64 : +DDL_CURSOR_PRECISION_32 ; + plane_dl = plane_dl | plane_prec | + drain_latency <<DDL_CURSOR_SHIFT ; + } + +I915_WRITE (VLV_DDL (pipe), plane_dl); }#define single_plane_enabled (mask) is_power_of_2(mask)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v2 1/2 drm/i915: Generalize drain latency computation
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
v2: Adressed review comments by Imre and Ville.
- Moved clock round up in separate patch
- Added WARN check for clock and pixel size
- Simplified bit masking
- Use cursor_base instead of reg read
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 88 +++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -3904,6 +3904,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MASK 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64
drivers/gpu/drm/i915/intel_pm.c +51 -37
108 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 drm/i915: Round-up clock and limit drain latency
Round up clock computation and limit drain latency to maximum of 0x7F.
--- drivers/gpu/drm/i915/intel_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +4 -1
@@ -1285,11 +1285,14 @@ static bool vlv_compute_drain_latency(struct drm_crtc *crtc,if (WARN (pixel_size ==0 ,"Pixel size is zero!\n" ))return false; - entries = (clock /1000 ) * pixel_size; + entries =DIV_ROUND_UP (clock,1000 ) * pixel_size; *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; *drain_latency = (64 * (*prec_mult) *4 ) / entries; +if (*drain_latency >DRAIN_LATENCY_MASK ) + *drain_latency =DRAIN_LATENCY_MASK ; +return true; }
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2] drm/i915: Round-up clock and limit drain latency
Quoted 13 lines · Gajanan Bhat
Round up clock computation and limit drain latency to maximum of
0x7F.Signed-off-by Gajanan Bhat <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -1285,11 +1285,14 @@ static bool vlv_compute_drain_latency(struct drm_crtc *crtc,if (WARN (pixel_size ==0 ,"Pixel size is zero!\n" ))
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_crtc *crtc, · line 1294
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +3
-1return false; - entries = (clock /1000 ) * pixel_size; + entries =DIV_ROUND_UP (clock,1000 ) * pixel_size; *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; *drain_latency = (64 * (*prec_mult) *4 ) / entries; +if (*drain_latency >DRAIN_LATENCY_MASK ) + *drain_latency =DRAIN_LATENCY_MASK ;
I would have probably written this as:*drain_latency = min(..., DRAIN_LATENCY_MASK);
But that's just a style I like. The patch looks fine to me so:
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c +1
-0+return true; }Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH v2 1/2] drm/i915: Generalize drain latency computation
In reply to Gajanan BhatQuoted 110 lines · Gajanan Bhat
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
v2: Adressed review comments by Imre and Ville.
- Moved clock round up in separate patch
- Added WARN check for clock and pixel size
- Simplified bit masking
- Usecursor_baseinstead of reg readSigned-off-by Gajanan Bhat <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 88 +++++++++++++++++++++++---------------- 2 files changed, 52 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -3904,6 +3904,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MASK 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64drivers/gpu/drm/i915/intel_pm.c +24
-37@@ -1271,33 +1271,24 @@ static bool g4x_compute_srwm(struct drm_device *dev, display, cursor); } -static bool vlv_compute_drain_latency (struct drm_device *dev, -int plane, -int *plane_prec_mult, -int *plane_dl, -int *cursor_prec_mult, -int *cursor_dl) +static bool vlv_compute_drain_latency (struct drm_crtc *crtc, +int pixel_size, +int *prec_mult, +int *drain_latency) { -struct drm_crtc *crtc; -int clock, pixel_size;int entries; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - crtc =intel_get_crtc_for_plane (dev, plane); -if (!intel_crtc_active (crtc)) +if (WARN (clock ==0 ,"Pixel clock is zero!\n" ))return false; - clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (WARN (pixel_size ==0 ,"Pixel size is zero!\n" )) +return false; entries = (clock /1000 ) * pixel_size; - *plane_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *plane_dl = (64 * (*plane_prec_mult) *4 ) / entries; - - entries = (clock /1000 ) *4 ;/* BPP is always 4 for cursor */ - *cursor_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *cursor_dl = (64 * (*cursor_prec_mult) *4 ) / entries; + *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 : +DRAIN_LATENCY_PRECISION_32 ; + *drain_latency = (64 * (*prec_mult) *4 ) / entries;return true; }@@ -1312,24 +1303,47 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,static void vlv_update_drain_latency (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -enum pipe pipe =to_intel_crtc (crtc)->pipe; -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; - -if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) { - cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; - plane_prec = (plane_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_PLANE_PRECISION_64 :DDL_PLANE_PRECISION_32 ; - -I915_WRITE (VLV_DDL (pipe), cursor_prec | - (cursor_dl <<DDL_CURSOR_SHIFT ) | - plane_prec | (plane_dl <<DDL_PLANE_SHIFT )); +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int pixel_size; +int drain_latency; +enum pipe pipe = intel_crtc->pipe; +int plane_prec, prec_mult, plane_dl; + + plane_dl =I915_READ (VLV_DDL (pipe)) & ~(DDL_PLANE_PRECISION_64 | +DRAIN_LATENCY_MASK |DDL_CURSOR_PRECISION_64 | + (DRAIN_LATENCY_MASK <<DDL_CURSOR_SHIFT )); + +if (!intel_crtc_active (crtc)) { +I915_WRITE (VLV_DDL (pipe), plane_dl);
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1328
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+return ; + } + +/* Primary plane Drain Latency */ + pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_PLANE_PRECISION_64 : +DDL_PLANE_PRECISION_32 ; + plane_dl = plane_dl | plane_prec | drain_latency;
Could use the |= operator here. Using = and | makes my brain think there's something more subtle going on when there isn't.
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0} + +/* Cursor Drain Latency +* BPP is always 4 for cursor +*/
drivers/gpu/drm/i915/intel_pm.c static bool vlv_compute_drain_latency(struct drm_device *dev, · line 1343
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+ pixel_size =4 ; + +/* Program cursor DL only if it is enabled */ +if (intel_crtc->cursor_base && +vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_CURSOR_PRECISION_64 : +DDL_CURSOR_PRECISION_32 ; + plane_dl = plane_dl | plane_prec | + drain_latency <<DDL_CURSOR_SHIFT ;
Same here.
Also doesn't gcc warn about adding parenthesis here with | and << ? The code does the right thing here, but IIRC gcc likes to warn about these. We like to keep the code reasonably free of compiler and sparse warnings.
Quoted 13 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ } + +I915_WRITE (VLV_DDL (pipe), plane_dl); }#define single_plane_enabled (mask) is_power_of_2(mask)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
PATCH v3 1/1 drm/i915: Generalize drain latency computation
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
v2: Adressed review comments by Imre and Ville.
- Moved clock round up in separate patch
- Added WARN check for clock and pixel size
- Simplified bit masking
- Use cursor_base instead of reg read
v3: Changed to bitwise shorthand operator for plane_dl assignment.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 87 ++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -4009,6 +4009,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MASK 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64
drivers/gpu/drm/i915/intel_pm.c +50 -37
107 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v3] drm/i915: Generalize drain latency computation
Quoted 9 lines · Gajanan Bhat
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
v2: Adressed review comments by Imre and Ville.
- Moved clock round up in separate patch
- Added WARN check for clock and pixel size
- Simplified bit masking
- Usecursor_baseinstead of reg read
Quoted 3 lines
v3: Changed to bitwise shorthand operator for
plane_dlassignment.Signed-off-by Gajanan Bhat <[email protected]>
Quoted 137 lines
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 87 ++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -4009,6 +4009,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MASK 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64drivers/gpu/drm/i915/intel_pm.c +50
-37@@ -1277,33 +1277,24 @@ static bool g4x_compute_srwm(struct drm_device *dev, display, cursor); } -static bool vlv_compute_drain_latency (struct drm_device *dev, -int plane, -int *plane_prec_mult, -int *plane_dl, -int *cursor_prec_mult, -int *cursor_dl) +static bool vlv_compute_drain_latency (struct drm_crtc *crtc, +int pixel_size, +int *prec_mult, +int *drain_latency) { -struct drm_crtc *crtc; -int clock, pixel_size;int entries; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - crtc =intel_get_crtc_for_plane (dev, plane); -if (!intel_crtc_active (crtc)) +if (WARN (clock ==0 ,"Pixel clock is zero!\n" ))return false; - clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (WARN (pixel_size ==0 ,"Pixel size is zero!\n" )) +return false; entries = (clock /1000 ) * pixel_size; - *plane_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *plane_dl = (64 * (*plane_prec_mult) *4 ) / entries; - - entries = (clock /1000 ) *4 ;/* BPP is always 4 for cursor */ - *cursor_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *cursor_dl = (64 * (*cursor_prec_mult) *4 ) / entries; + *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 : +DRAIN_LATENCY_PRECISION_32 ; + *drain_latency = (64 * (*prec_mult) *4 ) / entries;return true; }@@ -1318,24 +1309,46 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,static void vlv_update_drain_latency (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -enum pipe pipe =to_intel_crtc (crtc)->pipe; -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; - -if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) { - cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; - plane_prec = (plane_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_PLANE_PRECISION_64 :DDL_PLANE_PRECISION_32 ; - -I915_WRITE (VLV_DDL (pipe), cursor_prec | - (cursor_dl <<DDL_CURSOR_SHIFT ) | - plane_prec | (plane_dl <<DDL_PLANE_SHIFT )); +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int pixel_size; +int drain_latency; +enum pipe pipe = intel_crtc->pipe; +int plane_prec, prec_mult, plane_dl; + + plane_dl =I915_READ (VLV_DDL (pipe)) & ~(DDL_PLANE_PRECISION_64 | +DRAIN_LATENCY_MASK |DDL_CURSOR_PRECISION_64 | + (DRAIN_LATENCY_MASK <<DDL_CURSOR_SHIFT )); + +if (!intel_crtc_active (crtc)) { +I915_WRITE (VLV_DDL (pipe), plane_dl); +return ; + } + +/* Primary plane Drain Latency */ + pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_PLANE_PRECISION_64 : +DDL_PLANE_PRECISION_32 ; + plane_dl |= plane_prec | drain_latency; } + +/* Cursor Drain Latency +* BPP is always 4 for cursor +*/ + pixel_size =4 ; + +/* Program cursor DL only if it is enabled */ +if (intel_crtc->cursor_base && +vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_CURSOR_PRECISION_64 : +DDL_CURSOR_PRECISION_32 ; + plane_dl |= plane_prec | (drain_latency <<DDL_CURSOR_SHIFT ); + } + +I915_WRITE (VLV_DDL (pipe), plane_dl); }#define single_plane_enabled (mask) is_power_of_2(mask)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH v3] drm/i915: Generalize drain latency computation
Quoted 10 lines · Ville Syrjälä
Quoted 9 lines · Gajanan Bhat
Modify drain latency computation to use it for any plane. Same function can be used for primary, cursor and sprite planes.
v2: Adressed review comments by Imre and Ville.
- Moved clock round up in separate patch
- Added WARN check for clock and pixel size
- Simplified bit masking
- Usecursor_baseinstead of reg read
Quoted 5 lines
Quoted 3 lines
v3: Changed to bitwise shorthand operator for
plane_dlassignment.Signed-off-by Gajanan Bhat <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>
Pulled in these two patches.
-Danil
Quoted 146 lines
Quoted 138 lines
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 87 ++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 37 deletions(-)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -4009,6 +4009,7 @@ enum punit_power_well {#define DDL_PLANE_PRECISION_64 (1<<7)#define DDL_PLANE_PRECISION_32 (0<<7)#define DDL_PLANE_SHIFT 0 +#define DRAIN_LATENCY_MASK 0x7f/* FIFO watermark sizes etc */ #define G4X_FIFO_LINE_SIZE 64drivers/gpu/drm/i915/intel_pm.c +50
-37@@ -1277,33 +1277,24 @@ static bool g4x_compute_srwm(struct drm_device *dev, display, cursor); } -static bool vlv_compute_drain_latency (struct drm_device *dev, -int plane, -int *plane_prec_mult, -int *plane_dl, -int *cursor_prec_mult, -int *cursor_dl) +static bool vlv_compute_drain_latency (struct drm_crtc *crtc, +int pixel_size, +int *prec_mult, +int *drain_latency) { -struct drm_crtc *crtc; -int clock, pixel_size;int entries; +int clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - crtc =intel_get_crtc_for_plane (dev, plane); -if (!intel_crtc_active (crtc)) +if (WARN (clock ==0 ,"Pixel clock is zero!\n" ))return false; - clock =to_intel_crtc (crtc)->config.adjusted_mode.crtc_clock; - pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (WARN (pixel_size ==0 ,"Pixel size is zero!\n" )) +return false; entries = (clock /1000 ) * pixel_size; - *plane_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *plane_dl = (64 * (*plane_prec_mult) *4 ) / entries; - - entries = (clock /1000 ) *4 ;/* BPP is always 4 for cursor */ - *cursor_prec_mult = (entries >128 ) ? -DRAIN_LATENCY_PRECISION_64 :DRAIN_LATENCY_PRECISION_32 ; - *cursor_dl = (64 * (*cursor_prec_mult) *4 ) / entries; + *prec_mult = (entries >128 ) ?DRAIN_LATENCY_PRECISION_64 : +DRAIN_LATENCY_PRECISION_32 ; + *drain_latency = (64 * (*prec_mult) *4 ) / entries;return true; }@@ -1318,24 +1309,46 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,static void vlv_update_drain_latency (struct drm_crtc *crtc) { -struct drm_device *dev = crtc->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -enum pipe pipe =to_intel_crtc (crtc)->pipe; -int plane_prec, plane_dl; -int cursor_prec, cursor_dl; -int plane_prec_mult, cursor_prec_mult; - -if (vlv_compute_drain_latency (dev, pipe, &plane_prec_mult, &plane_dl, - &cursor_prec_mult, &cursor_dl)) { - cursor_prec = (cursor_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_CURSOR_PRECISION_64 :DDL_CURSOR_PRECISION_32 ; - plane_prec = (plane_prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? -DDL_PLANE_PRECISION_64 :DDL_PLANE_PRECISION_32 ; - -I915_WRITE (VLV_DDL (pipe), cursor_prec | - (cursor_dl <<DDL_CURSOR_SHIFT ) | - plane_prec | (plane_dl <<DDL_PLANE_SHIFT )); +struct drm_i915_private *dev_priv = crtc->dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int pixel_size; +int drain_latency; +enum pipe pipe = intel_crtc->pipe; +int plane_prec, prec_mult, plane_dl; + + plane_dl =I915_READ (VLV_DDL (pipe)) & ~(DDL_PLANE_PRECISION_64 | +DRAIN_LATENCY_MASK |DDL_CURSOR_PRECISION_64 | + (DRAIN_LATENCY_MASK <<DDL_CURSOR_SHIFT )); + +if (!intel_crtc_active (crtc)) { +I915_WRITE (VLV_DDL (pipe), plane_dl); +return ; + } + +/* Primary plane Drain Latency */ + pixel_size = crtc->primary->fb->bits_per_pixel /8 ;/* BPP */ +if (vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_PLANE_PRECISION_64 : +DDL_PLANE_PRECISION_32 ; + plane_dl |= plane_prec | drain_latency; } + +/* Cursor Drain Latency +* BPP is always 4 for cursor +*/ + pixel_size =4 ; + +/* Program cursor DL only if it is enabled */ +if (intel_crtc->cursor_base && +vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, &drain_latency)) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_CURSOR_PRECISION_64 : +DDL_CURSOR_PRECISION_32 ; + plane_dl |= plane_prec | (drain_latency <<DDL_CURSOR_SHIFT ); + } + +I915_WRITE (VLV_DDL (pipe), plane_dl); }#define single_plane_enabled (mask) is_power_of_2(mask)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ 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
PATCH 3/3 drm/i915: Add sprite watermark programming for VLV and CHV
In reply to Gajanan BhatProgram DDL register as part sprite watermark programming for CHV and VLV.
--- drivers/gpu/drm/i915/intel_pm.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +44 -0
@@ -1405,6 +1405,48 @@ static void valleyview_update_wm(struct drm_crtc *crtc)intel_set_memory_cxsr (dev_priv, true); } +static void valleyview_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 drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +int pipe =to_intel_plane (plane)->pipe; +int drain_latency; +int plane_prec; +int sprite_dl; +int prec_mult; + +if (to_intel_plane (plane)->plane ==0 ) + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE0_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE0_SHIFT ); +else + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE1_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE1_SHIFT ); + +if (enabled &&vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, + &drain_latency)) { +if (to_intel_plane (plane)->plane ==0 ) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE0_PRECISION_64 : +DDL_SPRITE0_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE0_SHIFT ; + }else { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE1_PRECISION_64 : +DDL_SPRITE1_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE1_SHIFT ; + } + } + +I915_WRITE (VLV_DDL (pipe), sprite_dl); +} +static void g4x_update_wm (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;
@@ -6851,10 +6893,12 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = gen8_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = cherryview_init_clock_gating; }else if (IS_VALLEYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = valleyview_init_clock_gating; }else if (IS_PINEVIEW (dev)) {
Signature · 1 line
1.7.9.5
Re: [PATCH 3/3] drm/i915: Add sprite watermark programming for VLV and CHV
Quoted 3 lines · Gajanan Bhat
Program DDL register as part sprite watermark programming for CHV and VLV.
Signed-off-by Gajanan Bhat <[email protected]>
This looks ok, but could you confirm, ideally referencing some document, that we don't need to program any of the sprite watermark level registers along with the DDL values? Specifically I mean the FW7, FW8 registers.
--Imre
Quoted 60 lines
--- drivers/gpu/drm/i915/intel_pm.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/gpu/drm/i915/intel_pm.c +42
-0@@ -1405,6 +1405,48 @@ static void valleyview_update_wm(struct drm_crtc *crtc)intel_set_memory_cxsr (dev_priv, true); } +static void valleyview_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 drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +int pipe =to_intel_plane (plane)->pipe; +int drain_latency; +int plane_prec; +int sprite_dl; +int prec_mult; + +if (to_intel_plane (plane)->plane ==0 ) + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE0_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE0_SHIFT ); +else + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE1_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE1_SHIFT ); + +if (enabled &&vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, + &drain_latency)) { +if (to_intel_plane (plane)->plane ==0 ) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE0_PRECISION_64 : +DDL_SPRITE0_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE0_SHIFT ; + }else { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE1_PRECISION_64 : +DDL_SPRITE1_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE1_SHIFT ; + } + } + +I915_WRITE (VLV_DDL (pipe), sprite_dl); +} +static void g4x_update_wm (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;@@ -6851,10 +6893,12 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = gen8_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) {
drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6904
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = cherryview_init_clock_gating; }else if (IS_VALLEYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = valleyview_init_clock_gating; }else if (IS_PINEVIEW (dev)) {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Add sprite watermark programming for VLV and CHV
Quoted 10 lines · Imre Deak
Quoted 3 lines · Gajanan Bhat
Program DDL register as part sprite watermark programming for CHV and VLV.
Signed-off-by Gajanan Bhat <[email protected]>This looks ok, but could you confirm, ideally referencing some document, that we don't need to program any of the sprite watermark level registers along with the DDL values? Specifically I mean the FW7, FW8 registers.
--Imre
I have looked at the B-spec to again confirm my understanding. The chicken bit in CBR1 specifies which mechanism (PND or watermark) to be used. In our case we are using only the PND with DDL. I couldn't find any reference which explicitly tells that both DDL and watermarks should be programmed together. Also we have tested this code and so far it has not caused any problem. -Gajanan
Quoted 70 lines
Quoted 70 lines
--- drivers/gpu/drm/i915/intel_pm.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/gpu/drm/i915/intel_pm.c +44
-0@@ -1405,6 +1405,48 @@ static void valleyview_update_wm(struct drm_crtc *crtc)intel_set_memory_cxsr (dev_priv, true); } +static void valleyview_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 drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +int pipe =to_intel_plane (plane)->pipe; +int drain_latency; +int plane_prec; +int sprite_dl; +int prec_mult; + +if (to_intel_plane (plane)->plane ==0 ) + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE0_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE0_SHIFT ); +else + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE1_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE1_SHIFT ); + +if (enabled &&vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, + &drain_latency)) { +if (to_intel_plane (plane)->plane ==0 ) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE0_PRECISION_64 : +DDL_SPRITE0_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE0_SHIFT ; + }else { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE1_PRECISION_64 : +DDL_SPRITE1_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE1_SHIFT ; + } + } + +I915_WRITE (VLV_DDL (pipe), sprite_dl); +} +static void g4x_update_wm (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;@@ -6851,10 +6893,12 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = gen8_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = cherryview_init_clock_gating; }else if (IS_VALLEYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = valleyview_init_clock_gating; }else if (IS_PINEVIEW (dev)) {
Re: [PATCH 3/3] drm/i915: Add sprite watermark programming for VLV and CHV
Quoted 10 lines · Gajanan
Quoted 9 lines · Imre Deak
Quoted 3 lines · Gajanan Bhat
Program DDL register as part sprite watermark programming for CHV and VLV.
Signed-off-by Gajanan Bhat <[email protected]>This looks ok, but could you confirm, ideally referencing some document, that we don't need to program any of the sprite watermark level registers along with the DDL values? Specifically I mean the FW7, FW8 registers.
Quoted 6 lines
I have looked at the B-spec to again confirm my understanding. The chicken bit in CBR1 specifies which mechanism (PND or watermark) to be used. In our case we are using only the PND with DDL. I couldn't find any reference which explicitly tells that both DDL and watermarks should be programmed together. Also we have tested this code and so far it has not caused any problem.
Thanks for clarifying this, the docs on this are fuzzy to me. Earlier Cesar and Ville also pointed out that the PND mechanism depends on the MI_ARB[trickle feed] flag being enabled, which is afaics disabled on VLV. But based on what you say I understand that the DDL values are not used in the 'watermark mode', so I'm ok with your change. Perhaps a comment about this could be added.
--Imre
Quoted 64 lines
-Gajanan
Quoted 62 lines
Quoted 62 lines
--- drivers/gpu/drm/i915/intel_pm.c | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)drivers/gpu/drm/i915/intel_pm.c +43
-0@@ -1405,6 +1405,48 @@ static void valleyview_update_wm(struct drm_crtc *crtc)intel_set_memory_cxsr (dev_priv, true); } +static void valleyview_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 drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +int pipe =to_intel_plane (plane)->pipe; +int drain_latency; +int plane_prec; +int sprite_dl; +int prec_mult; + +if (to_intel_plane (plane)->plane ==0 ) + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE0_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE0_SHIFT ); +else + sprite_dl =I915_READ (VLV_DDL (pipe)) & ~DDL_SPRITE1_PRECISION_64 & + ~(DRAIN_LATENCY_MAX <<DDL_SPRITE1_SHIFT ); + +if (enabled &&vlv_compute_drain_latency (crtc, pixel_size, &prec_mult, + &drain_latency)) { +if (to_intel_plane (plane)->plane ==0 ) { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE0_PRECISION_64 : +DDL_SPRITE0_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE0_SHIFT ; + }else { + plane_prec = (prec_mult ==DRAIN_LATENCY_PRECISION_64 ) ? +DDL_SPRITE1_PRECISION_64 : +DDL_SPRITE1_PRECISION_32 ; + sprite_dl = sprite_dl | plane_prec | + drain_latency <<DDL_SPRITE1_SHIFT ; + } + } + +I915_WRITE (VLV_DDL (pipe), sprite_dl); +} +static void g4x_update_wm (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;@@ -6851,10 +6893,12 @@ void intel_init_pm(struct drm_device *dev) dev_priv->display.init_clock_gating = gen8_init_clock_gating; }else if (IS_CHERRYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm;
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 6904
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1
-0dev_priv->display.init_clock_gating = cherryview_init_clock_gating; }else if (IS_VALLEYVIEW (dev)) { dev_priv->display.update_wm = valleyview_update_wm; + dev_priv->display.update_sprite_wm = valleyview_update_sprite_wm; dev_priv->display.init_clock_gating = valleyview_init_clock_gating; }else if (IS_PINEVIEW (dev)) {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx