forked from enlightenment/enlightenment
e randr - x - only apply/modify randr if xurrent config not the same
so if already the same - leave it as-is.
This commit is contained in:
parent
74815ebc9b
commit
cf0a43b844
|
@ -68,7 +68,7 @@ typedef struct E_Comp_Screen_Iface
|
||||||
/* gather screen info */
|
/* gather screen info */
|
||||||
E_Randr2 *(*create)(void);
|
E_Randr2 *(*create)(void);
|
||||||
/* apply current config */
|
/* apply current config */
|
||||||
void (*apply)(void);
|
void (*apply)(Eina_Bool can_skip);
|
||||||
/* set dpms (on, standby, suspend, off) */
|
/* set dpms (on, standby, suspend, off) */
|
||||||
void (*dpms)(int);
|
void (*dpms)(int);
|
||||||
/* is key event eaten */
|
/* is key event eaten */
|
||||||
|
|
|
@ -478,7 +478,7 @@ e_comp_x_randr_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
E_API void
|
E_API void
|
||||||
e_comp_x_randr_config_apply(void)
|
e_comp_x_randr_config_apply(Eina_Bool can_skip)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
E_Randr2_Screen *s;
|
E_Randr2_Screen *s;
|
||||||
|
@ -580,11 +580,13 @@ e_comp_x_randr_config_apply(void)
|
||||||
{
|
{
|
||||||
Ecore_X_Rectangle *scrs = alloca(crtcs_num * sizeof(Ecore_X_Rectangle));
|
Ecore_X_Rectangle *scrs = alloca(crtcs_num * sizeof(Ecore_X_Rectangle));
|
||||||
int scrs_num;
|
int scrs_num;
|
||||||
|
Eina_Bool do_it;
|
||||||
|
|
||||||
scrs_num = 0;
|
scrs_num = 0;
|
||||||
// set up a crtc to drive each output (or not)
|
// set up a crtc to drive each output (or not)
|
||||||
for (i = 0; i < crtcs_num; i++)
|
for (i = 0; i < crtcs_num; i++)
|
||||||
{
|
{
|
||||||
|
do_it = EINA_FALSE;
|
||||||
// XXX: find clones and set them as outputs in an array
|
// XXX: find clones and set them as outputs in an array
|
||||||
if (outconf[i])
|
if (outconf[i])
|
||||||
{
|
{
|
||||||
|
@ -608,12 +610,6 @@ e_comp_x_randr_config_apply(void)
|
||||||
screenconf[i]->config.geom.w,
|
screenconf[i]->config.geom.w,
|
||||||
screenconf[i]->config.geom.h,
|
screenconf[i]->config.geom.h,
|
||||||
orient, mode, outconf[i]);
|
orient, mode, outconf[i]);
|
||||||
if (!ecore_x_randr_crtc_settings_set
|
|
||||||
(root, crtcs[i], &(outconf[i]), 1,
|
|
||||||
screenconf[i]->config.geom.x,
|
|
||||||
screenconf[i]->config.geom.y,
|
|
||||||
mode, orient))
|
|
||||||
printf("RRR: failed to set crtc!!!!!!\n");
|
|
||||||
if (E_INSIDE(px, py,
|
if (E_INSIDE(px, py,
|
||||||
screenconf[i]->config.geom.x,
|
screenconf[i]->config.geom.x,
|
||||||
screenconf[i]->config.geom.y,
|
screenconf[i]->config.geom.y,
|
||||||
|
@ -624,12 +620,54 @@ e_comp_x_randr_config_apply(void)
|
||||||
(screenconf[i]->config.geom.w / 2);
|
(screenconf[i]->config.geom.w / 2);
|
||||||
py = screenconf[i]->config.geom.y +
|
py = screenconf[i]->config.geom.y +
|
||||||
(screenconf[i]->config.geom.h / 2);
|
(screenconf[i]->config.geom.h / 2);
|
||||||
ecore_x_randr_crtc_panning_area_set
|
if (!can_skip) do_it = EINA_TRUE;
|
||||||
(root, crtcs[i],
|
else
|
||||||
screenconf[i]->config.geom.x,
|
{
|
||||||
screenconf[i]->config.geom.y,
|
Ecore_X_Randr_Crtc_Info *inf;
|
||||||
screenconf[i]->config.geom.w,
|
|
||||||
screenconf[i]->config.geom.h);
|
inf = ecore_x_randr_crtc_info_get(root, crtcs[i]);
|
||||||
|
if (inf)
|
||||||
|
{
|
||||||
|
// current setup differs
|
||||||
|
if ((inf->noutput == 0) ||
|
||||||
|
(inf->mode != mode) ||
|
||||||
|
(inf->x != screenconf[i]->config.geom.x) ||
|
||||||
|
(inf->y != screenconf[i]->config.geom.y) ||
|
||||||
|
(inf->width != (unsigned int)screenconf[i]->config.geom.w) ||
|
||||||
|
(inf->height != (unsigned int)screenconf[i]->config.geom.h) ||
|
||||||
|
(inf->rotation != orient))
|
||||||
|
{
|
||||||
|
if (inf->noutput != 1)
|
||||||
|
do_it = EINA_TRUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inf->outputs[0] != outconf[0])
|
||||||
|
do_it = EINA_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ecore_x_randr_crtc_info_free(inf);
|
||||||
|
}
|
||||||
|
else do_it = EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (do_it)
|
||||||
|
{
|
||||||
|
printf("RRR: crtc configure: %i ...\n", i);
|
||||||
|
if (!ecore_x_randr_crtc_settings_set
|
||||||
|
(root, crtcs[i], &(outconf[i]), 1,
|
||||||
|
screenconf[i]->config.geom.x,
|
||||||
|
screenconf[i]->config.geom.y,
|
||||||
|
mode, orient))
|
||||||
|
printf("RRR: failed to set crtc!!!!!!\n");
|
||||||
|
ecore_x_randr_crtc_panning_area_set
|
||||||
|
(root, crtcs[i],
|
||||||
|
screenconf[i]->config.geom.x,
|
||||||
|
screenconf[i]->config.geom.y,
|
||||||
|
screenconf[i]->config.geom.w,
|
||||||
|
screenconf[i]->config.geom.h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("RRR: (SKIP) crtc configure: %i\n", i);
|
||||||
|
|
||||||
if (screenconf[i]->config.priority == top_priority)
|
if (screenconf[i]->config.priority == top_priority)
|
||||||
{
|
{
|
||||||
ecore_x_randr_primary_output_set(root, outconf[i]);
|
ecore_x_randr_primary_output_set(root, outconf[i]);
|
||||||
|
@ -643,10 +681,29 @@ e_comp_x_randr_config_apply(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("RRR: crtc off: %i\n", i);
|
if (!can_skip) do_it = EINA_TRUE;
|
||||||
ecore_x_randr_crtc_settings_set
|
else
|
||||||
(root, crtcs[i], NULL, 0, 0, 0, 0,
|
{
|
||||||
ECORE_X_RANDR_ORIENTATION_ROT_0);
|
Ecore_X_Randr_Crtc_Info *inf;
|
||||||
|
|
||||||
|
inf = ecore_x_randr_crtc_info_get(root, crtcs[i]);
|
||||||
|
if (inf)
|
||||||
|
{
|
||||||
|
// it's somehow on - we need to turn it off
|
||||||
|
if (inf->noutput != 0) do_it = EINA_TRUE;
|
||||||
|
ecore_x_randr_crtc_info_free(inf);
|
||||||
|
}
|
||||||
|
// else -> already nort enabled
|
||||||
|
}
|
||||||
|
if (do_it)
|
||||||
|
{
|
||||||
|
printf("RRR: crtc off: %i\n", i);
|
||||||
|
ecore_x_randr_crtc_settings_set
|
||||||
|
(root, crtcs[i], NULL, 0, 0, 0, 0,
|
||||||
|
ECORE_X_RANDR_ORIENTATION_ROT_0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("RRR: (SKIP) crtc off: %i\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ecore_x_root_screen_barriers_set(scrs, scrs_num);
|
ecore_x_root_screen_barriers_set(scrs, scrs_num);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
E_API void e_comp_x_randr_init(void);
|
E_API void e_comp_x_randr_init(void);
|
||||||
E_API void e_comp_x_randr_shutdown(void);
|
E_API void e_comp_x_randr_shutdown(void);
|
||||||
E_API void e_comp_x_randr_config_apply(void);
|
E_API void e_comp_x_randr_config_apply(Eina_Bool can_ckip);
|
||||||
E_API Eina_Bool e_comp_x_randr_available(void);
|
E_API Eina_Bool e_comp_x_randr_available(void);
|
||||||
E_API E_Randr2 *e_comp_x_randr_create(void);
|
E_API E_Randr2 *e_comp_x_randr_create(void);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ static void _cb_delay_init_save(void *data);
|
||||||
static Eina_Bool _cb_delay_timer(void *data);
|
static Eina_Bool _cb_delay_timer(void *data);
|
||||||
static Eina_Bool _cb_fade_animator(void *data);
|
static Eina_Bool _cb_fade_animator(void *data);
|
||||||
static void _animated_apply(void);
|
static void _animated_apply(void);
|
||||||
static void _do_apply(void);
|
static void _do_apply(Eina_Bool at_init);
|
||||||
static void _info_free(E_Randr2 *r);
|
static void _info_free(E_Randr2 *r);
|
||||||
static E_Config_Randr2 *_config_load(void);
|
static E_Config_Randr2 *_config_load(void);
|
||||||
static void _config_free(E_Config_Randr2 *cfg);
|
static void _config_free(E_Config_Randr2 *cfg);
|
||||||
|
@ -107,7 +107,7 @@ e_randr2_init(void)
|
||||||
if (_config_update(e_randr2, e_randr2_cfg, 1))
|
if (_config_update(e_randr2, e_randr2_cfg, 1))
|
||||||
e_randr2_config_save();
|
e_randr2_config_save();
|
||||||
}
|
}
|
||||||
_do_apply();
|
_do_apply(EINA_TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ _cb_fade_animator(void *data EINA_UNUSED)
|
||||||
if (_target_to == 255)
|
if (_target_to == 255)
|
||||||
{
|
{
|
||||||
_apply_delay = ecore_timer_loop_add(1.0, _cb_delay_timer, NULL);
|
_apply_delay = ecore_timer_loop_add(1.0, _cb_delay_timer, NULL);
|
||||||
_do_apply();
|
_do_apply(EINA_FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ _animated_apply(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_do_apply(void)
|
_do_apply(Eina_Bool at_init)
|
||||||
{
|
{
|
||||||
// take current screen config and apply it to the driver
|
// take current screen config and apply it to the driver
|
||||||
printf("RRR: re-get info before applying..\n");
|
printf("RRR: re-get info before applying..\n");
|
||||||
|
@ -277,7 +277,7 @@ _do_apply(void)
|
||||||
printf("RRR: eval config...\n");
|
printf("RRR: eval config...\n");
|
||||||
_screen_config_eval();
|
_screen_config_eval();
|
||||||
printf("RRR: really apply config...\n");
|
printf("RRR: really apply config...\n");
|
||||||
e_comp->screen->apply();
|
e_comp->screen->apply(at_init);
|
||||||
printf("RRR: done config...\n");
|
printf("RRR: done config...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -574,7 +574,7 @@ _drm2_rotation_exists(Ecore_Drm2_Output *output, int rot)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_drm2_randr_apply(void)
|
_drm2_randr_apply(Eina_Bool can_skip EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ecore_Drm2_Device *dev;
|
Ecore_Drm2_Device *dev;
|
||||||
Ecore_Drm2_Output **outconf, *out;
|
Ecore_Drm2_Output **outconf, *out;
|
||||||
|
|
Loading…
Reference in New Issue