From cf91a2561aba838cae320dc9d74ca3d283d3d302 Mon Sep 17 00:00:00 2001 From: Leif Middelschulte Date: Sun, 22 Aug 2010 03:49:34 +0000 Subject: [PATCH] From: Leif Middelschulte this is a little patch for e_randr related stuff. - replace the saving of a monitor's EDID with a hash of it. - rename a variable name SVN revision: 51508 --- src/bin/e_config.c | 14 ++++++++++++-- src/bin/e_config.h | 2 +- src/bin/e_randr.c | 8 +++++--- src/bin/e_randr.h | 17 ++++++++++++----- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 7900faccd..a4159f2bd 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -70,6 +70,7 @@ static E_Config_DD *_e_config_eina_rectangle_edd = NULL; static E_Config_DD *_e_config_screen_info_edd = NULL; static E_Config_DD *_e_config_screen_restore_info_11_edd = NULL; static E_Config_DD *_e_config_screen_restore_info_12_edd = NULL; +static E_Config_DD *_e_config_screen_output_edid_hash_edd = NULL; static E_Config_DD *_e_config_screen_output_restore_info_edd = NULL; static E_Config_DD *_e_config_screen_crtc_restore_info_edd = NULL; @@ -540,15 +541,22 @@ e_config_init(void) E_CONFIG_VAL(D, T, w, INT); E_CONFIG_VAL(D, T, h, INT); + _e_config_screen_output_edid_hash_edd = E_CONFIG_DD_NEW("E_Randr_Output_Edid_Hash", E_Randr_Output_Edid_Hash); +#undef T +#undef D +#define T E_Randr_Output_Edid_Hash +#define D _e_config_screen_output_edid_hash_edd + E_CONFIG_VAL(D, T, hash, INT); + // FIXME: need to totally re-do this randr config stuff - remove the // union stuff. do this differently to not use unions really. not // intended for how it is used here really. - _e_config_screen_output_restore_info_edd = E_CONFIG_DD_NEW("E_Randr_Output_Restore_Info", Eina_Rectangle); + _e_config_screen_output_restore_info_edd = E_CONFIG_DD_NEW("E_Randr_Output_Restore_Info", E_Randr_Output_Restore_Info); #undef T #undef D #define T E_Randr_Output_Restore_Info #define D _e_config_screen_output_restore_info_edd - E_CONFIG_VAL(D, T, edid, STR); + E_CONFIG_SUB(D, T, edid_hash, _e_config_screen_output_edid_hash_edd); E_CONFIG_VAL(D, T, backlight_level, DOUBLE); _e_config_screen_crtc_restore_info_edd = E_CONFIG_DD_NEW("E_Randr_Crtc_Restore_Info", E_Randr_Crtc_Restore_Info); @@ -566,6 +574,8 @@ e_config_init(void) #define T E_Randr_Screen_Restore_Info_12 #define D _e_config_screen_restore_info_12_edd E_CONFIG_LIST(D, T, crtcs, _e_config_screen_crtc_restore_info_edd); + E_CONFIG_LIST(D, T, outputs_edid_hashes, _e_config_screen_output_edid_hash_edd); + E_CONFIG_VAL(D, T, noutputs, INT); E_CONFIG_VAL(D, T, output_policy, INT); E_CONFIG_VAL(D, T, alignment, INT); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 1880c5aab..5c7172b7c 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -32,7 +32,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme; /* increment this whenever a new set of config values are added but the users * config doesn't need to be wiped - simply new values need to be put in */ -#define E_CONFIG_FILE_GENERATION 0x0140 +#define E_CONFIG_FILE_GENERATION 0x0141 #define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION) #define E_EVAS_ENGINE_DEFAULT 0 diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c index ee1da2244..d0d3cdc69 100644 --- a/src/bin/e_randr.c +++ b/src/bin/e_randr.c @@ -447,7 +447,7 @@ _e_randr_output_info_new(int nrequested) .possible_crtcs = NULL, .preferred_modes = NULL, .max_backlight = Ecore_X_Randr_Unset, - .current_backlight = Ecore_X_Randr_Unset, + .backlight_level = 0.0, .edid = NULL, .edid_length = 0, .size_mm = {Ecore_X_Randr_Unset, Ecore_X_Randr_Unset}, @@ -1058,7 +1058,8 @@ _e_randr_config_find_suiting_config_11(E_Randr_Screen_Restore_Info_11 **restore_ EINA_LIST_FOREACH(e_config->screen_info, cfg_screen_restore_info_iter, screen_restore_info) { - if (!screen_restore_info) continue ; + /* 'screen_restore_info' should _never_ be NULL, since this functions shouldn't be called due to randr init failing. */ + if (!screen_restore_info) continue; if (screen_restore_info->randr_version != ECORE_X_RANDR_1_1) continue; restore_info_11 = screen_restore_info->rrvd_restore_info.restore_info_11; if((sizes = ecore_x_randr_screen_primary_output_sizes_get(e_randr_screen_info->root, &nsizes))) @@ -1135,7 +1136,8 @@ _e_randr_outputs_to_array(Eina_List *outputs_info) if (!outputs_info || !(ret = malloc(sizeof(Ecore_X_Randr_Output) * eina_list_count(outputs_info)))) return NULL; EINA_LIST_FOREACH(outputs_info, output_iter, output_info) - ret[i++] = output_info ? output_info->xid : 0; + /* output_info == NULL should _not_ be possible! */ + ret[i++] = output_info ? output_info->xid : Ecore_X_Randr_None; return ret; } diff --git a/src/bin/e_randr.h b/src/bin/e_randr.h index 7fca68dc6..b4bdffb11 100644 --- a/src/bin/e_randr.h +++ b/src/bin/e_randr.h @@ -6,6 +6,7 @@ typedef struct _E_Randr_Screen_Info_11 E_Randr_Screen_Info_11; typedef struct _E_Randr_Screen_Info_12 E_Randr_Screen_Info_12; typedef union _E_Randr_Screen_RRVD_Info E_Randr_Screen_RRVD_Info; typedef struct _E_Randr_Screen_Info E_Randr_Screen_Info; +typedef struct _E_Randr_Output_Edid_Hash E_Randr_Output_Edid_Hash; typedef struct _E_Randr_Output_Restore_Info E_Randr_Output_Restore_Info; typedef struct _E_Randr_Crtc_Restore_Info E_Randr_Crtc_Restore_Info; typedef struct _E_Randr_Screen_Restore_Info_11 E_Randr_Screen_Restore_Info_11; @@ -56,12 +57,12 @@ struct _E_Randr_Output_Info unsigned char *edid; unsigned long edid_length; int max_backlight; - double current_backlight; + double backlight_level; Ecore_X_Render_Subpixel_Order subpixel_order; Eina_List *compatible_outputs; }; -struct _E_Randr_Screen_Info_11 +struct _E_Randr_Screen_Info_11 { //List of Ecore_X_Randr_Screen_Size_MM* Eina_List *sizes; @@ -101,13 +102,17 @@ struct _E_Randr_Screen_Info }; //Following stuff is just for configuration purposes -struct _E_Randr_Output_Restore_Info +struct _E_Randr_Output_Edid_Hash { + int hash; +}; + +struct _E_Randr_Output_Restore_Info { - const char *edid; + E_Randr_Output_Edid_Hash edid_hash; double backlight_level; }; -struct _E_Randr_Crtc_Restore_Info +struct _E_Randr_Crtc_Restore_Info { Eina_Rectangle geometry; Ecore_X_Randr_Orientation orientation; @@ -124,6 +129,8 @@ struct _E_Randr_Screen_Restore_Info_11 struct _E_Randr_Screen_Restore_Info_12 { + Eina_List *outputs_edid_hashes; + int noutputs; Eina_List *crtcs; Ecore_X_Randr_Output_Policy output_policy; Ecore_X_Randr_Relative_Alignment alignment;