summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-07 00:57:13 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-07 00:57:13 +0100
commitcf0a43b844b15444bc8e3b0be92ec76dd11c3614 (patch)
tree7fee9b94dfd9d05c02c510a8ef735688b386b2ba /src
parent74815ebc9b0ea19a006266e981f0ce48ccd1e63a (diff)
e randr - x - only apply/modify randr if xurrent config not the same
so if already the same - leave it as-is.
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_comp.h2
-rw-r--r--src/bin/e_comp_x_randr.c91
-rw-r--r--src/bin/e_comp_x_randr.h2
-rw-r--r--src/bin/e_randr2.c10
-rw-r--r--src/modules/wl_drm/e_mod_main.c2
5 files changed, 82 insertions, 25 deletions
diff --git a/src/bin/e_comp.h b/src/bin/e_comp.h
index ec8b80ea0..e07022b84 100644
--- a/src/bin/e_comp.h
+++ b/src/bin/e_comp.h
@@ -68,7 +68,7 @@ typedef struct E_Comp_Screen_Iface
68 /* gather screen info */ 68 /* gather screen info */
69 E_Randr2 *(*create)(void); 69 E_Randr2 *(*create)(void);
70 /* apply current config */ 70 /* apply current config */
71 void (*apply)(void); 71 void (*apply)(Eina_Bool can_skip);
72 /* set dpms (on, standby, suspend, off) */ 72 /* set dpms (on, standby, suspend, off) */
73 void (*dpms)(int); 73 void (*dpms)(int);
74 /* is key event eaten */ 74 /* is key event eaten */
diff --git a/src/bin/e_comp_x_randr.c b/src/bin/e_comp_x_randr.c
index da1b0759d..3b02af87b 100644
--- a/src/bin/e_comp_x_randr.c
+++ b/src/bin/e_comp_x_randr.c
@@ -478,7 +478,7 @@ e_comp_x_randr_shutdown(void)
478} 478}
479 479
480E_API void 480E_API void
481e_comp_x_randr_config_apply(void) 481e_comp_x_randr_config_apply(Eina_Bool can_skip)
482{ 482{
483 Eina_List *l; 483 Eina_List *l;
484 E_Randr2_Screen *s; 484 E_Randr2_Screen *s;
@@ -580,11 +580,13 @@ e_comp_x_randr_config_apply(void)
580 { 580 {
581 Ecore_X_Rectangle *scrs = alloca(crtcs_num * sizeof(Ecore_X_Rectangle)); 581 Ecore_X_Rectangle *scrs = alloca(crtcs_num * sizeof(Ecore_X_Rectangle));
582 int scrs_num; 582 int scrs_num;
583 Eina_Bool do_it;
583 584
584 scrs_num = 0; 585 scrs_num = 0;
585 // set up a crtc to drive each output (or not) 586 // set up a crtc to drive each output (or not)
586 for (i = 0; i < crtcs_num; i++) 587 for (i = 0; i < crtcs_num; i++)
587 { 588 {
589 do_it = EINA_FALSE;
588 // XXX: find clones and set them as outputs in an array 590 // XXX: find clones and set them as outputs in an array
589 if (outconf[i]) 591 if (outconf[i])
590 { 592 {
@@ -608,12 +610,6 @@ e_comp_x_randr_config_apply(void)
608 screenconf[i]->config.geom.w, 610 screenconf[i]->config.geom.w,
609 screenconf[i]->config.geom.h, 611 screenconf[i]->config.geom.h,
610 orient, mode, outconf[i]); 612 orient, mode, outconf[i]);
611 if (!ecore_x_randr_crtc_settings_set
612 (root, crtcs[i], &(outconf[i]), 1,
613 screenconf[i]->config.geom.x,
614 screenconf[i]->config.geom.y,
615 mode, orient))
616 printf("RRR: failed to set crtc!!!!!!\n");
617 if (E_INSIDE(px, py, 613 if (E_INSIDE(px, py,
618 screenconf[i]->config.geom.x, 614 screenconf[i]->config.geom.x,
619 screenconf[i]->config.geom.y, 615 screenconf[i]->config.geom.y,
@@ -624,12 +620,54 @@ e_comp_x_randr_config_apply(void)
624 (screenconf[i]->config.geom.w / 2); 620 (screenconf[i]->config.geom.w / 2);
625 py = screenconf[i]->config.geom.y + 621 py = screenconf[i]->config.geom.y +
626 (screenconf[i]->config.geom.h / 2); 622 (screenconf[i]->config.geom.h / 2);
627 ecore_x_randr_crtc_panning_area_set 623 if (!can_skip) do_it = EINA_TRUE;
628 (root, crtcs[i], 624 else
629 screenconf[i]->config.geom.x, 625 {
630 screenconf[i]->config.geom.y, 626 Ecore_X_Randr_Crtc_Info *inf;
631 screenconf[i]->config.geom.w, 627
632 screenconf[i]->config.geom.h); 628 inf = ecore_x_randr_crtc_info_get(root, crtcs[i]);
629 if (inf)
630 {
631 // current setup differs
632 if ((inf->noutput == 0) ||
633 (inf->mode != mode) ||
634 (inf->x != screenconf[i]->config.geom.x) ||
635 (inf->y != screenconf[i]->config.geom.y) ||
636 (inf->width != (unsigned int)screenconf[i]->config.geom.w) ||
637 (inf->height != (unsigned int)screenconf[i]->config.geom.h) ||
638 (inf->rotation != orient))
639 {
640 if (inf->noutput != 1)
641 do_it = EINA_TRUE;
642 else
643 {
644 if (inf->outputs[0] != outconf[0])
645 do_it = EINA_TRUE;
646 }
647 }
648 ecore_x_randr_crtc_info_free(inf);
649 }
650 else do_it = EINA_TRUE;
651 }
652 if (do_it)
653 {
654 printf("RRR: crtc configure: %i ...\n", i);
655 if (!ecore_x_randr_crtc_settings_set
656 (root, crtcs[i], &(outconf[i]), 1,
657 screenconf[i]->config.geom.x,
658 screenconf[i]->config.geom.y,
659 mode, orient))
660 printf("RRR: failed to set crtc!!!!!!\n");
661 ecore_x_randr_crtc_panning_area_set
662 (root, crtcs[i],
663 screenconf[i]->config.geom.x,
664 screenconf[i]->config.geom.y,
665 screenconf[i]->config.geom.w,
666 screenconf[i]->config.geom.h);
667 }
668 else
669 printf("RRR: (SKIP) crtc configure: %i\n", i);
670
633 if (screenconf[i]->config.priority == top_priority) 671 if (screenconf[i]->config.priority == top_priority)
634 { 672 {
635 ecore_x_randr_primary_output_set(root, outconf[i]); 673 ecore_x_randr_primary_output_set(root, outconf[i]);
@@ -643,10 +681,29 @@ e_comp_x_randr_config_apply(void)
643 } 681 }
644 else 682 else
645 { 683 {
646 printf("RRR: crtc off: %i\n", i); 684 if (!can_skip) do_it = EINA_TRUE;
647 ecore_x_randr_crtc_settings_set 685 else
648 (root, crtcs[i], NULL, 0, 0, 0, 0, 686 {
649 ECORE_X_RANDR_ORIENTATION_ROT_0); 687 Ecore_X_Randr_Crtc_Info *inf;
688
689 inf = ecore_x_randr_crtc_info_get(root, crtcs[i]);
690 if (inf)
691 {
692 // it's somehow on - we need to turn it off
693 if (inf->noutput != 0) do_it = EINA_TRUE;
694 ecore_x_randr_crtc_info_free(inf);
695 }
696 // else -> already nort enabled
697 }
698 if (do_it)
699 {
700 printf("RRR: crtc off: %i\n", i);
701 ecore_x_randr_crtc_settings_set
702 (root, crtcs[i], NULL, 0, 0, 0, 0,
703 ECORE_X_RANDR_ORIENTATION_ROT_0);
704 }
705 else
706 printf("RRR: (SKIP) crtc off: %i\n", i);
650 } 707 }
651 } 708 }
652 ecore_x_root_screen_barriers_set(scrs, scrs_num); 709 ecore_x_root_screen_barriers_set(scrs, scrs_num);
diff --git a/src/bin/e_comp_x_randr.h b/src/bin/e_comp_x_randr.h
index 41ca659a6..db18a1264 100644
--- a/src/bin/e_comp_x_randr.h
+++ b/src/bin/e_comp_x_randr.h
@@ -3,7 +3,7 @@
3 3
4E_API void e_comp_x_randr_init(void); 4E_API void e_comp_x_randr_init(void);
5E_API void e_comp_x_randr_shutdown(void); 5E_API void e_comp_x_randr_shutdown(void);
6E_API void e_comp_x_randr_config_apply(void); 6E_API void e_comp_x_randr_config_apply(Eina_Bool can_ckip);
7E_API Eina_Bool e_comp_x_randr_available(void); 7E_API Eina_Bool e_comp_x_randr_available(void);
8E_API E_Randr2 *e_comp_x_randr_create(void); 8E_API E_Randr2 *e_comp_x_randr_create(void);
9 9
diff --git a/src/bin/e_randr2.c b/src/bin/e_randr2.c
index 9b8f38357..474708a5e 100644
--- a/src/bin/e_randr2.c
+++ b/src/bin/e_randr2.c
@@ -9,7 +9,7 @@ static void _cb_delay_init_save(void *data);
9static Eina_Bool _cb_delay_timer(void *data); 9static Eina_Bool _cb_delay_timer(void *data);
10static Eina_Bool _cb_fade_animator(void *data); 10static Eina_Bool _cb_fade_animator(void *data);
11static void _animated_apply(void); 11static void _animated_apply(void);
12static void _do_apply(void); 12static void _do_apply(Eina_Bool at_init);
13static void _info_free(E_Randr2 *r); 13static void _info_free(E_Randr2 *r);
14static E_Config_Randr2 *_config_load(void); 14static E_Config_Randr2 *_config_load(void);
15static void _config_free(E_Config_Randr2 *cfg); 15static void _config_free(E_Config_Randr2 *cfg);
@@ -107,7 +107,7 @@ e_randr2_init(void)
107 if (_config_update(e_randr2, e_randr2_cfg, 1)) 107 if (_config_update(e_randr2, e_randr2_cfg, 1))
108 e_randr2_config_save(); 108 e_randr2_config_save();
109 } 109 }
110 _do_apply(); 110 _do_apply(EINA_TRUE);
111 } 111 }
112 else 112 else
113 { 113 {
@@ -226,7 +226,7 @@ _cb_fade_animator(void *data EINA_UNUSED)
226 if (_target_to == 255) 226 if (_target_to == 255)
227 { 227 {
228 _apply_delay = ecore_timer_loop_add(1.0, _cb_delay_timer, NULL); 228 _apply_delay = ecore_timer_loop_add(1.0, _cb_delay_timer, NULL);
229 _do_apply(); 229 _do_apply(EINA_FALSE);
230 } 230 }
231 else 231 else
232 { 232 {
@@ -263,7 +263,7 @@ _animated_apply(void)
263} 263}
264 264
265static void 265static void
266_do_apply(void) 266_do_apply(Eina_Bool at_init)
267{ 267{
268 // take current screen config and apply it to the driver 268 // take current screen config and apply it to the driver
269 printf("RRR: re-get info before applying..\n"); 269 printf("RRR: re-get info before applying..\n");
@@ -277,7 +277,7 @@ _do_apply(void)
277 printf("RRR: eval config...\n"); 277 printf("RRR: eval config...\n");
278 _screen_config_eval(); 278 _screen_config_eval();
279 printf("RRR: really apply config...\n"); 279 printf("RRR: really apply config...\n");
280 e_comp->screen->apply(); 280 e_comp->screen->apply(at_init);
281 printf("RRR: done config...\n"); 281 printf("RRR: done config...\n");
282} 282}
283 283
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index 45f589361..17e915ce5 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -574,7 +574,7 @@ _drm2_rotation_exists(Ecore_Drm2_Output *output, int rot)
574} 574}
575 575
576static void 576static void
577_drm2_randr_apply(void) 577_drm2_randr_apply(Eina_Bool can_skip EINA_UNUSED)
578{ 578{
579 Ecore_Drm2_Device *dev; 579 Ecore_Drm2_Device *dev;
580 Ecore_Drm2_Output **outconf, *out; 580 Ecore_Drm2_Output **outconf, *out;