Revert "e randr - x - only apply/modify randr if xurrent config not the same"

This reverts commit cf0a43b844.

This seems to cause some issues on restore at startup.
This commit is contained in:
Carsten Haitzler 2020-06-13 20:49:16 +01:00
parent b519c44c67
commit 18c522fb24
5 changed files with 25 additions and 82 deletions

View File

@ -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)(Eina_Bool can_skip); void (*apply)(void);
/* 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 */

View File

@ -478,7 +478,7 @@ e_comp_x_randr_shutdown(void)
} }
E_API void E_API void
e_comp_x_randr_config_apply(Eina_Bool can_skip) e_comp_x_randr_config_apply(void)
{ {
Eina_List *l; Eina_List *l;
E_Randr2_Screen *s; E_Randr2_Screen *s;
@ -580,13 +580,11 @@ e_comp_x_randr_config_apply(Eina_Bool can_skip)
{ {
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])
{ {
@ -610,6 +608,12 @@ e_comp_x_randr_config_apply(Eina_Bool can_skip)
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,
@ -620,54 +624,12 @@ e_comp_x_randr_config_apply(Eina_Bool can_skip)
(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);
if (!can_skip) do_it = EINA_TRUE;
else
{
Ecore_X_Randr_Crtc_Info *inf;
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 ecore_x_randr_crtc_panning_area_set
(root, crtcs[i], (root, crtcs[i],
screenconf[i]->config.geom.x, screenconf[i]->config.geom.x,
screenconf[i]->config.geom.y, screenconf[i]->config.geom.y,
screenconf[i]->config.geom.w, screenconf[i]->config.geom.w,
screenconf[i]->config.geom.h); 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]);
@ -680,31 +642,12 @@ e_comp_x_randr_config_apply(Eina_Bool can_skip)
scrs_num++; scrs_num++;
} }
else else
{
if (!can_skip) do_it = EINA_TRUE;
else
{
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); printf("RRR: crtc off: %i\n", i);
ecore_x_randr_crtc_settings_set ecore_x_randr_crtc_settings_set
(root, crtcs[i], NULL, 0, 0, 0, 0, (root, crtcs[i], NULL, 0, 0, 0, 0,
ECORE_X_RANDR_ORIENTATION_ROT_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);
} }

View File

@ -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(Eina_Bool can_ckip); E_API void e_comp_x_randr_config_apply(void);
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);

View File

@ -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(Eina_Bool at_init); static void _do_apply(void);
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(EINA_TRUE); _do_apply();
} }
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(EINA_FALSE); _do_apply();
} }
else else
{ {
@ -263,7 +263,7 @@ _animated_apply(void)
} }
static void static void
_do_apply(Eina_Bool at_init) _do_apply(void)
{ {
// 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(Eina_Bool at_init)
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(at_init); e_comp->screen->apply();
printf("RRR: done config...\n"); printf("RRR: done config...\n");
} }

View File

@ -574,7 +574,7 @@ _drm2_rotation_exists(Ecore_Drm2_Output *output, int rot)
} }
static void static void
_drm2_randr_apply(Eina_Bool can_skip EINA_UNUSED) _drm2_randr_apply(void)
{ {
Ecore_Drm2_Device *dev; Ecore_Drm2_Device *dev;
Ecore_Drm2_Output **outconf, *out; Ecore_Drm2_Output **outconf, *out;