diff mbox

[1/7] drm/i915/skl+: Use proper bytes_per_pixel during WM calculation

Message ID 1452772968-24772-2-git-send-email-shobhit.kumar@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kumar, Shobhit Jan. 14, 2016, 12:02 p.m. UTC
From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>

Don't always use bytes_per_pixel using y_plane=0, instead use it
according to pixel format. If NV12 use y_plane eqal to 1

Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Matt Roper Jan. 14, 2016, 7:07 p.m. UTC | #1
On Thu, Jan 14, 2016 at 05:32:42PM +0530, Shobhit Kumar wrote:
> From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>
> 
> Don't always use bytes_per_pixel using y_plane=0, instead use it
> according to pixel format. If NV12 use y_plane eqal to 1
> 
> Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>

The second parameter to drm_format_plane_cpp() is the plane index
(0 => Y = 1bpp, 1 => UV = 2bpp), so I think passing 0 actually was what
we wanted, right?


Matt

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 9df9e9a..68f21b9 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3185,7 +3185,9 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>  	if (latency == 0 || !cstate->base.active || !fb)
>  		return false;
>  
> -	bytes_per_pixel = drm_format_plane_cpp(fb->pixel_format, 0);
> +	bytes_per_pixel = (fb->pixel_format == DRM_FORMAT_NV12) ?
> +				drm_format_plane_cpp(fb->pixel_format, 1) :
> +				drm_format_plane_cpp(fb->pixel_format, 0);
>  	method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate),
>  				 bytes_per_pixel,
>  				 latency);
> -- 
> 2.4.3
>
Shobhit Kumar Jan. 19, 2016, 9:56 a.m. UTC | #2
On 01/15/2016 12:37 AM, Matt Roper wrote:
> On Thu, Jan 14, 2016 at 05:32:42PM +0530, Shobhit Kumar wrote:
>> From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>
>>
>> Don't always use bytes_per_pixel using y_plane=0, instead use it
>> according to pixel format. If NV12 use y_plane eqal to 1
>>
>> Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>
>
> The second parameter to drm_format_plane_cpp() is the plane index
> (0 => Y = 1bpp, 1 => UV = 2bpp), so I think passing 0 actually was what
> we wanted, right?
>

Yes, I guess it was an oversight. Might have to test again for NV12 but 
for now we can drop this patch.

Regards
Shobhit

>
> Matt
>
>> ---
>>   drivers/gpu/drm/i915/intel_pm.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
>> index 9df9e9a..68f21b9 100644
>> --- a/drivers/gpu/drm/i915/intel_pm.c
>> +++ b/drivers/gpu/drm/i915/intel_pm.c
>> @@ -3185,7 +3185,9 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>>   	if (latency == 0 || !cstate->base.active || !fb)
>>   		return false;
>>
>> -	bytes_per_pixel = drm_format_plane_cpp(fb->pixel_format, 0);
>> +	bytes_per_pixel = (fb->pixel_format == DRM_FORMAT_NV12) ?
>> +				drm_format_plane_cpp(fb->pixel_format, 1) :
>> +				drm_format_plane_cpp(fb->pixel_format, 0);
>>   	method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate),
>>   				 bytes_per_pixel,
>>   				 latency);
>> --
>> 2.4.3
>>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9df9e9a..68f21b9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3185,7 +3185,9 @@  static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 	if (latency == 0 || !cstate->base.active || !fb)
 		return false;
 
-	bytes_per_pixel = drm_format_plane_cpp(fb->pixel_format, 0);
+	bytes_per_pixel = (fb->pixel_format == DRM_FORMAT_NV12) ?
+				drm_format_plane_cpp(fb->pixel_format, 1) :
+				drm_format_plane_cpp(fb->pixel_format, 0);
 	method1 = skl_wm_method1(skl_pipe_pixel_rate(cstate),
 				 bytes_per_pixel,
 				 latency);