~ubuntu-branches/ubuntu/precise/xserver-xorg-video-intel-lts-quantal/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fix-possible-clones-computation.patch

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2013-10-04 12:10:36 UTC
  • Revision ID: package-import@ubuntu.com-20131004121036-5msjsxpuz2a6ic81
Tags: 2:2.20.9-0ubuntu2.3~precise1
Sync from -intel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- a/src/intel_display.c
 
2
+++ b/src/intel_display.c
 
3
@@ -1435,7 +1435,6 @@
 
4
                intel_output_backlight_init(output);
 
5
 
 
6
        output->possible_crtcs = kencoder->possible_crtcs;
 
7
-       output->possible_clones = kencoder->possible_clones;
 
8
        output->interlaceAllowed = TRUE;
 
9
 
 
10
        intel_output->output = output;
 
11
@@ -1680,6 +1679,60 @@
 
12
                drmHandleEvent(mode->fd, &mode->event_context);
 
13
 }
 
14
 
 
15
+static drmModeEncoderPtr
 
16
+intel_get_kencoder(struct intel_mode *mode, int num)
 
17
+{
 
18
+       struct intel_output *iterator;
 
19
+       int id = mode->mode_res->encoders[num];
 
20
+
 
21
+       list_for_each_entry(iterator, &mode->outputs, link)
 
22
+               if (iterator->mode_encoder->encoder_id == id)
 
23
+                       return iterator->mode_encoder;
 
24
+
 
25
+       return NULL;
 
26
+}
 
27
+
 
28
+/*
 
29
+ * Libdrm's possible_clones is a mask of encoders, Xorg's possible_clones is a
 
30
+ * mask of outputs. This function sets Xorg's possible_clones based on the
 
31
+ * values read from libdrm.
 
32
+ */
 
33
+static void
 
34
+intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode)
 
35
+{
 
36
+       xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 
37
+       struct intel_output *intel_output, *clone;
 
38
+       drmModeEncoderPtr cloned_encoder;
 
39
+       uint32_t mask;
 
40
+       int i, j, k;
 
41
+       CARD32 possible_clones;
 
42
+
 
43
+       for (i = 0; i < config->num_output; i++) {
 
44
+               possible_clones = 0;
 
45
+               intel_output = config->output[i]->driver_private;
 
46
+
 
47
+               mask = intel_output->mode_encoder->possible_clones;
 
48
+               for (j = 0; mask != 0; j++, mask >>= 1) {
 
49
+
 
50
+                       if ((mask & 1) == 0)
 
51
+                               continue;
 
52
+
 
53
+                       cloned_encoder = intel_get_kencoder(mode, j);
 
54
+                       if (!cloned_encoder)
 
55
+                               continue;
 
56
+
 
57
+                       for (k = 0; k < config->num_output; k++) {
 
58
+                               clone = config->output[k]->driver_private;
 
59
+                               if (clone->mode_encoder->encoder_id ==
 
60
+                                       cloned_encoder->encoder_id)
 
61
+                                       possible_clones |= (1 << k);
 
62
+                       }
 
63
+               }
 
64
+
 
65
+               config->output[i]->possible_clones = possible_clones;
 
66
+       }
 
67
+}
 
68
+
 
69
 Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp)
 
70
 {
 
71
        intel_screen_private *intel = intel_get_screen_private(scrn);
 
72
@@ -1715,6 +1768,7 @@
 
73
 
 
74
        for (i = 0; i < mode->mode_res->count_connectors; i++)
 
75
                intel_output_init(scrn, mode, i);
 
76
+               intel_compute_possible_clones(scrn, mode);
 
77
 
 
78
 #ifdef INTEL_PIXMAP_SHARING
 
79
        xf86ProviderSetup(scrn, NULL, "Intel");
 
80
--- a/src/sna/sna_display.c
 
81
+++ b/src/sna/sna_display.c
 
82
@@ -2291,6 +2291,35 @@
 
83
        drmModeFreeConnector(koutput);
 
84
 }
 
85
 
 
86
+/* The kernel reports possible encoder clones, whereas X uses a list of
 
87
+ * possible connector clones. This is works when we have a 1:1 mapping
 
88
+ * between encoders and connectors, but breaks for Haswell which has a pair
 
89
+ * of DP/HDMI connectors hanging off a single encoder.
 
90
+ */
 
91
+static void
 
92
+sna_mode_compute_possible_clones(ScrnInfoPtr scrn)
 
93
+{
 
94
+       xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
 
95
+       unsigned clones[32] = { 0 };
 
96
+       int i, j;
 
97
+
 
98
+       assert(config->num_output <= 32);
 
99
+
 
100
+       /* Convert from encoder numbering to output numbering */
 
101
+       for (i = 0; i < config->num_output; i++) {
 
102
+               unsigned mask = config->output[i]->possible_clones;
 
103
+               for (j = 0; mask != 0; j++, mask >>= 1) {
 
104
+                       if ((mask & 1) == 0)
 
105
+                               continue;
 
106
+
 
107
+                       clones[j] |= 1 << i;
 
108
+               }
 
109
+       }
 
110
+
 
111
+       for (i = 0; i < config->num_output; i++)
 
112
+               config->output[i]->possible_clones = clones[i];
 
113
+}
 
114
+
 
115
 struct sna_visit_set_pixmap_window {
 
116
        PixmapPtr old, new;
 
117
 };
 
118
@@ -2573,6 +2602,8 @@
 
119
 
 
120
        for (i = 0; i < mode->kmode->count_connectors; i++)
 
121
                sna_output_init(scrn, mode, i);
 
122
+       if (!xf86IsEntityShared(scrn->entityList[0]))
 
123
+               sna_mode_compute_possible_clones(scrn);
 
124
 
 
125
 #if HAS_PIXMAP_SHARING
 
126
        xf86ProviderSetup(scrn, NULL, "Intel");