diff mbox

[01/22] drm/i915: Shrink cxsr_latency_table

Message ID 1475670829-14025-2-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Oct. 5, 2016, 12:33 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

unsigned long is too wide - use smaller types in
struct cxsr_latency to save 800-something bytes of .rodata.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--------
 drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Ville Syrjälä Oct. 5, 2016, 5:01 p.m. UTC | #1
On Wed, Oct 05, 2016 at 01:33:28PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> unsigned long is too wide - use smaller types in
> struct cxsr_latency to save 800-something bytes of .rodata.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--------
>  drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index f48e79ae2ac6..c52b1d3a7ba0 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -807,14 +807,14 @@ struct intel_watermark_params {
>  };
>  
>  struct cxsr_latency {
> -	int is_desktop;
> -	int is_ddr3;
> -	unsigned long fsb_freq;
> -	unsigned long mem_freq;
> -	unsigned long display_sr;
> -	unsigned long display_hpll_disable;
> -	unsigned long cursor_sr;
> -	unsigned long cursor_hpll_disable;
> +	bool is_desktop : 1;
> +	bool is_ddr3 : 1;
> +	unsigned int fsb_freq;
> +	unsigned int mem_freq;
> +	unsigned int display_sr;
> +	unsigned int display_hpll_disable;
> +	unsigned int cursor_sr;
> +	unsigned int cursor_hpll_disable;

Am I blind or would all of the values fit even in u16?

>  };
>  
>  #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 7f1748a1e614..3b1f0b40ccb9 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -252,8 +252,8 @@ static const struct cxsr_latency cxsr_latency_table[] = {
>  	{0, 1, 400, 800, 6042, 36042, 6584, 36584},    /* DDR3-800 SC */
>  };
>  
> -static const struct cxsr_latency *intel_get_cxsr_latency(int is_desktop,
> -							 int is_ddr3,
> +static const struct cxsr_latency *intel_get_cxsr_latency(bool is_desktop,
> +							 bool is_ddr3,
>  							 int fsb,
>  							 int mem)
>  {
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tvrtko Ursulin Oct. 6, 2016, 7:35 a.m. UTC | #2
On 05/10/2016 18:01, Ville Syrjälä wrote:
> On Wed, Oct 05, 2016 at 01:33:28PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> unsigned long is too wide - use smaller types in
>> struct cxsr_latency to save 800-something bytes of .rodata.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++--------
>>   drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
>>   2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index f48e79ae2ac6..c52b1d3a7ba0 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -807,14 +807,14 @@ struct intel_watermark_params {
>>   };
>>   
>>   struct cxsr_latency {
>> -	int is_desktop;
>> -	int is_ddr3;
>> -	unsigned long fsb_freq;
>> -	unsigned long mem_freq;
>> -	unsigned long display_sr;
>> -	unsigned long display_hpll_disable;
>> -	unsigned long cursor_sr;
>> -	unsigned long cursor_hpll_disable;
>> +	bool is_desktop : 1;
>> +	bool is_ddr3 : 1;
>> +	unsigned int fsb_freq;
>> +	unsigned int mem_freq;
>> +	unsigned int display_sr;
>> +	unsigned int display_hpll_disable;
>> +	unsigned int cursor_sr;
>> +	unsigned int cursor_hpll_disable;
> Am I blind or would all of the values fit even in u16?

No you are right, I'll improve it accordingly. :)

Regards,

Tvrtko
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f48e79ae2ac6..c52b1d3a7ba0 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -807,14 +807,14 @@  struct intel_watermark_params {
 };
 
 struct cxsr_latency {
-	int is_desktop;
-	int is_ddr3;
-	unsigned long fsb_freq;
-	unsigned long mem_freq;
-	unsigned long display_sr;
-	unsigned long display_hpll_disable;
-	unsigned long cursor_sr;
-	unsigned long cursor_hpll_disable;
+	bool is_desktop : 1;
+	bool is_ddr3 : 1;
+	unsigned int fsb_freq;
+	unsigned int mem_freq;
+	unsigned int display_sr;
+	unsigned int display_hpll_disable;
+	unsigned int cursor_sr;
+	unsigned int cursor_hpll_disable;
 };
 
 #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 7f1748a1e614..3b1f0b40ccb9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -252,8 +252,8 @@  static const struct cxsr_latency cxsr_latency_table[] = {
 	{0, 1, 400, 800, 6042, 36042, 6584, 36584},    /* DDR3-800 SC */
 };
 
-static const struct cxsr_latency *intel_get_cxsr_latency(int is_desktop,
-							 int is_ddr3,
+static const struct cxsr_latency *intel_get_cxsr_latency(bool is_desktop,
+							 bool is_ddr3,
 							 int fsb,
 							 int mem)
 {