* [PATCH xf86-video-intel] uxa: fix possible_clones computation
@ 2012-10-11 21:10 Paulo Zanoni
2012-10-12 8:49 ` Chris Wilson
0 siblings, 1 reply; 2+ messages in thread
From: Paulo Zanoni @ 2012-10-11 21:10 UTC (permalink / raw)
To: intel-gfx; +Cc: Paulo Zanoni
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
Libdrm's possible_clones is a mask of encoders. Xorg's possible_clones
is a mask of outputs, so we just can't do the following:
output->possible_clones = kencoder->possible_clones;
This is a problem on Haswell because, at least with the current
patches floating on the mailing list, there is more than one connector
per encoder.
This patch writes the code to properly translate libdrm's encoder mask
into Xorg's output mask.
Still need an SNA version.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
src/intel_display.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/src/intel_display.c b/src/intel_display.c
index b2a5904..d58e6e0 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1435,7 +1435,6 @@ intel_output_init(ScrnInfoPtr scrn, struct intel_mode *mode, int num)
intel_output_backlight_init(output);
output->possible_crtcs = kencoder->possible_crtcs;
- output->possible_clones = kencoder->possible_clones;
output->interlaceAllowed = TRUE;
intel_output->output = output;
@@ -1680,6 +1679,60 @@ drm_wakeup_handler(pointer data, int err, pointer p)
drmHandleEvent(mode->fd, &mode->event_context);
}
+static drmModeEncoderPtr
+intel_get_kencoder(struct intel_mode *mode, int num)
+{
+ struct intel_output *iterator;
+ int id = mode->mode_res->encoders[num];
+
+ list_for_each_entry(iterator, &mode->outputs, link)
+ if (iterator->mode_encoder->encoder_id == id)
+ return iterator->mode_encoder;
+
+ return NULL;
+}
+
+/*
+ * Libdrm's possible_clones is a mask of encoders, Xorg's possible_clones is a
+ * mask of outputs. This function sets Xorg's possible_clones based on the
+ * values read from libdrm.
+ */
+static void
+intel_compute_possible_clones(ScrnInfoPtr scrn, struct intel_mode *mode)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ struct intel_output *intel_output, *clone;
+ drmModeEncoderPtr cloned_encoder;
+ uint32_t mask;
+ int i, j, k;
+ CARD32 possible_clones;
+
+ for (i = 0; i < config->num_output; i++) {
+ possible_clones = 0;
+ intel_output = config->output[i]->driver_private;
+
+ mask = intel_output->mode_encoder->possible_clones;
+ for (j = 0; mask != 0; j++, mask >>= 1) {
+
+ if ((mask & 1) == 0)
+ continue;
+
+ cloned_encoder = intel_get_kencoder(mode, j);
+ if (!cloned_encoder)
+ continue;
+
+ for (k = 0; k < config->num_output; k++) {
+ clone = config->output[k]->driver_private;
+ if (clone->mode_encoder->encoder_id ==
+ cloned_encoder->encoder_id)
+ possible_clones |= (1 << k);
+ }
+ }
+
+ config->output[i]->possible_clones = possible_clones;
+ }
+}
+
Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -1716,6 +1769,8 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp)
for (i = 0; i < mode->mode_res->count_connectors; i++)
intel_output_init(scrn, mode, i);
+ intel_compute_possible_clones(scrn, mode);
+
#ifdef INTEL_PIXMAP_SHARING
xf86ProviderSetup(scrn, NULL, "Intel");
#endif
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH xf86-video-intel] uxa: fix possible_clones computation
2012-10-11 21:10 [PATCH xf86-video-intel] uxa: fix possible_clones computation Paulo Zanoni
@ 2012-10-12 8:49 ` Chris Wilson
0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2012-10-12 8:49 UTC (permalink / raw)
To: Paulo Zanoni, intel-gfx; +Cc: Paulo Zanoni
On Thu, 11 Oct 2012 18:10:17 -0300, Paulo Zanoni <przanoni@gmail.com> wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>
> Libdrm's possible_clones is a mask of encoders. Xorg's possible_clones
> is a mask of outputs, so we just can't do the following:
>
> output->possible_clones = kencoder->possible_clones;
>
> This is a problem on Haswell because, at least with the current
> patches floating on the mailing list, there is more than one connector
> per encoder.
>
> This patch writes the code to properly translate libdrm's encoder mask
> into Xorg's output mask.
>
> Still need an SNA version.
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Done and pushed, thanks.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-12 8:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-11 21:10 [PATCH xf86-video-intel] uxa: fix possible_clones computation Paulo Zanoni
2012-10-12 8:49 ` Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox