Re: [patch] drm: sysfs files error handling
, Dan Carpenter wrote: In the original code we used j as an iterator but we used i as an index. - for (j = 0; j i; j++) - device_remove_file(connector-kdev, -connector_attrs[i]); I guess this really should be a attribute group anyways? Typically when there's such a open coded loop it means the wrong interfaces are being used. -Andi -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: intel graphic card hanging (Hangcheck timer elapsed... GPU hung)
On Sa, 27 Mär 2010, Maciej Rutecki wrote: http://marc.info/?l=linux-kernelm=126954749618319w=2 Yes, I am using modeset, too. I am running 2.6.34-rc2 + git 01e7770 commit (yesterday) with KMS on Debian/sid: xserver-xorg: 7.5+5 video-intel: 2.9.1-3 Running D2X-xl (self compiled) (descent2 open source code) X suddenly died, and after that gdm could not be restarted because after a few secs it went dead again. In the logs I see: kernel: [ 2486.341227] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2486.341240] render error detected, EIR: 0x kernel: [ 2486.341278] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113671 at 113604) kernel: [ 2486.669008] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2486.669012] render error detected, EIR: 0x kernel: [ 2486.669522] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113672 at 113604) kernel: [ 2487.524230] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2487.524243] render error detected, EIR: 0x kernel: [ 2487.524284] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113673 at 113604) kernel: [ 2487.912237] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2487.916175] render error detected, EIR: 0x kernel: [ 2487.920137] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113674 at 113604) Stopping gdm and restarting didn't help to get the graphics card back to normal. If you have any ideas how to fix/track/debug that please let me know, same if you need more information. Best wishes Norbert Norbert Preiningprein...@{jaist.ac.jp, logic.at, debian.org} JAIST, JapanTU Wien, Austria Debian TeX Task Force DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094 `How do you feel?' he asked him. bits of me keep passing out.' `We're safe,' he said. `Oh good,' said Arthur. in one of the spaceships of the Vogon Constructor Fleet.' this is obviously some strange usage of the word safe that I wasn't previously aware of.' --- Arthur after his first ever teleport ride. --- Douglas Adams, The Hitchhikers Guide to the Galaxy -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: Signalling no-audio for HDMI
2010/3/27 Hendrik Sattler p...@hendrik-sattler.de: I got this working previously but it somehow stopped working. My setup: - Acer TravelMate 6592 - DVI output with DVI-HDMI converter - Philips Full-HD LCD-TV The laptop runs Debian testing with a self-compiled linux-2.6.33 with radeon+firmware compiled-in. The laptop cannot do audio over the HDMI line, I use a seperate stereo cable for this. This is the proposed way from the TV manual when audio-over-hdmi is not possible. And that used to work just fine (at the time of 2.6.33-rc8, I wrote to this list at that time) but fails with latest version of libdrm (2.4.18) and xserver-xorg-vide-radeon (6.12.192 + patches up to git 5c256808, the current Debian package). I use the following kernel command line: radeon.modeset=1 radeon.audio=0 radeon.dynclks=1 Especially, audio=0 signals the TV that the audio comes over the seperate cable. This is what was working and is not working anymore. Strangely, the available resolutions changed: the old drivers didn't find the 1080p resolutions when the TV was connected while X was running. This is now working with even more refresh rates (50/60/24). There was also a resolution of 1366x768 which is not in the list anymore, only 1360x765. Working combination (but DRI disabled due to massive instabilities): linux-2.6.33-rc8, libdrm-2.4.16, radeon from git20101011 Not working: linux-2.6.33, libdrm-2.4.18, radeon-6.12.192 It seems your TV refuses to use audio from analog stereo cable, when it detects audio enabled over/in HDMI (just enabled, even purely silent as in your case). And it seems we enable HDMI mode even when you use radeon.audio=0. I've no idea what could affect this between 2.6.33-rc8 and 2.6.33 (stable). The list of changes for drm/radeon taken from http://lkml.org/lkml/2010/2/24/301 : Adam Jackson (1): drm/edid: Fix interlaced detailed timings to be frame size, not field. Alex Deucher (3): drm/radeon/kms/rs600: add connector quirk drm/radeon/kms: fix shared ddc detection drm/radeon/rv740: fix backend setup Dave Airlie (3): drm/radeon/kms: make sure retry count increases. drm/radeon/kms: use udelay for short delays drm/radeon: bump the UMS driver version number to indicate rv740 fix Jerome Glisse (3): drm/radeon/kms: fix indirect buffer management V2 drm/radeon/kms: fix bo's fence association drm/radeon/kms: free fence IB if it wasn't emited at IB free time Matt Turner (1): drm/radeon/kms/atom: use get_unaligned_le32() for ctx-ps Can you provide lspci output by the way? As for this bug, I'll try to prepare something for you to test. However provide also output of dmesg | grep drm please. -- Rafał -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 15276] latest git kernel: general protection fault: 0000 [#1]
https://bugzilla.kernel.org/show_bug.cgi?id=15276 --- Comment #62 from Jérôme Glisse gli...@freedesktop.org 2010-03-29 09:39:12 --- Andreas please avoid mixing issue, last issue you report is userspace bug. See: https://bugs.freedesktop.org/show_bug.cgi?id=27284 On the lockup side patch should hopefully soon hit Linus' tree. Note those patch don't fix the root issue of the lockup which is hopefully incorrect command stream but they are first to fixing the userspace issue. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 26043] Graphics corruption in Sauerbraten
http://bugs.freedesktop.org/show_bug.cgi?id=26043 Jon Severinsson j...@severinsson.net changed: What|Removed |Added Attachment #32638|0 |1 is obsolete|| --- Comment #2 from Jon Severinsson j...@severinsson.net 2010-03-29 03:58:26 PST --- Created an attachment (id=34530) -- (http://bugs.freedesktop.org/attachment.cgi?id=34530) Somewhat less ugly patch for Mesa 7.8 When upgrading to mesa 7.8 I had to update my patch to get it to apply. I took the opportunity to see if I could clean up the patch while I was at it. Essentially I tried to find what current code was the equivalent to the old code my patch re-introduced, and modify that instead. The new patch is still no beauty, but much better than the old one and now weights at a somewhat more modest 372 lines (removing 97 lines and adding 77 lines) Trying to analyse the changes I find three major ones, as well as some minor ones following from those, but as I'm no expert on Mesa I don't fully understand what impact they have, other than what I see on screen (Sauerbraten starting to work). 1) With the patch applied r700TryDrawPrims is called as a first stage of r600_pipeline instead of being called through the vbo_context(ctx)-draw_prims callback from the other stages. 2) In several places the patch replaces use of context-stream_desc with use of context-radeon.tcl.aos. 3) After doing the other changes, r700RunRenderPrimitiveImmediate have to use data from vb-Elts when calling R600_OUT_BATCH() or the graphic cards borks and requires a restart to output anything. I hope this work will help someone more knowledgeable to figure out how to fix the problem properly. -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 15276] latest git kernel: general protection fault: 0000 [#1]
https://bugzilla.kernel.org/show_bug.cgi?id=15276 --- Comment #63 from Andreas Wallberg andreas.wallb...@gmail.com 2010-03-29 13:17:37 --- (In reply to comment #62) Andreas please avoid mixing issue, last issue you report is userspace bug. See: https://bugs.freedesktop.org/show_bug.cgi?id=27284 On the lockup side patch should hopefully soon hit Linus' tree. Note those patch don't fix the root issue of the lockup which is hopefully incorrect command stream but they are first to fixing the userspace issue. Yeah, sorry. I posted too soon. I noticed this too when I started downgrading packages. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 26994] xf86-video-openchrome does not build against =libdrm-2.4.17
http://bugs.freedesktop.org/show_bug.cgi?id=26994 Mart Raudsepp l...@gentoo.org changed: What|Removed |Added CC||l...@gentoo.org --- Comment #4 from Mart Raudsepp l...@gentoo.org 2010-03-29 08:19:51 PST --- Looks like some other headers might have this issue as well, according to Bug 25881 -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 25881] drm.h , drm_mode.h and driver_drm.h use types defined stdint.h but do not include stdint.h
http://bugs.freedesktop.org/show_bug.cgi?id=25881 Mart Raudsepp l...@gentoo.org changed: What|Removed |Added CC||l...@gentoo.org --- Comment #1 from Mart Raudsepp l...@gentoo.org 2010-03-29 08:20:19 PST --- Bug 26994 has a patch for the drm_mode.h case -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 2/7] drm: delay vblank cleanup until after driver unload
On Mon, 29 Mar 2010 10:02:04 +1000 Dave Airlie airl...@gmail.com wrote: 2010/3/29 Kristian Høgsberg k...@bitplanet.net: On Fri, Mar 26, 2010 at 7:07 PM, Jesse Barnes jbar...@virtuousgeek.org wrote: Drivers may use vblank calls now (e.g. drm_vblank_off) in their unload paths, so don't clean up the vblank related structures until after driver unload. I haven't tested this specific patch on a recent DRM, but I made the same patch a while ago, and it fixed module unload for me. I sent it to the list and it fell through the cracks, because vblank is hard or something. Reviewed-by: Kristian Høgsberg k...@bitplanet.net I didn't apply it because from what I can see non-kms drivers need to free the vbl stuff on lastclose not unload. I'm nearly sure I said that at the time to. This patch seems to suffer from the same problem from what I can see. And really someone should already have cleaned up the insanity that is vbl struct allocations, vblank might not be hard, but it sure has some ugly. Arg, yeah I didn't consider non-kms drivers. And we had a patch to bunch all the vbl info into a single struct, but iirc it came along as we were still adding fields so never got applied. Anyway I'll fix up this patch and re-post. -- Jesse Barnes, Intel Open Source Technology Center -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: intel graphic card hanging (Hangcheck timer elapsed... GPU hung)
On Sun, 28 Mar 2010 01:11:05 +0900 Norbert Preining prein...@logic.at wrote: Dear all, (please Cc) I am running 2.6.34-rc2 + git 01e7770 commit (yesterday) with KMS on Debian/sid: xserver-xorg: 7.5+5 video-intel: 2.9.1-3 Running D2X-xl (self compiled) (descent2 open source code) X suddenly died, and after that gdm could not be restarted because after a few secs it went dead again. In the logs I see: kernel: [ 2486.341227] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2486.341240] render error detected, EIR: 0x kernel: [ 2486.341278] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113671 at 113604) kernel: [ 2486.669008] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2486.669012] render error detected, EIR: 0x kernel: [ 2486.669522] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113672 at 113604) kernel: [ 2487.524230] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2487.524243] render error detected, EIR: 0x kernel: [ 2487.524284] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113673 at 113604) kernel: [ 2487.912237] [drm:i915_hangcheck_elapsed] *ERROR* Hangcheck timer elapsed... GPU hung kernel: [ 2487.916175] render error detected, EIR: 0x kernel: [ 2487.920137] [drm:i915_do_wait_request] *ERROR* i915_do_wait_request returns -5 (awaiting 113674 at 113604) Stopping gdm and restarting didn't help to get the graphics card back to normal. If you have any ideas how to fix/track/debug that please let me know, same if you need more information. I was seeing something similar on my 945, can you try this patchset? It seems to make things much more stable for me. http://lists.freedesktop.org/archives/intel-gfx/2010-March/006387.html There are 7 patches starting with that one. -- Jesse Barnes, Intel Open Source Technology Center -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 27314] output not working on dell m6500
http://bugs.freedesktop.org/show_bug.cgi?id=27314 Alex Deucher ag...@yahoo.com changed: What|Removed |Added Attachment #34528|text/x-log |text/plain mime type|| Attachment #34528|0 |1 is patch|| -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 27314] output not working on dell m6500
http://bugs.freedesktop.org/show_bug.cgi?id=27314 Alex Deucher ag...@yahoo.com changed: What|Removed |Added Attachment #34526|text/x-log |text/plain mime type|| Attachment #34526|0 |1 is patch|| -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH] drm/radeon/kms/dp: remove extraneous training complete call
From 68d4af64689277ca1d71ff160022e17b482b07d4 Mon Sep 17 00:00:00 2001 From: Alex Deucher alexdeuc...@gmail.com Date: Mon, 29 Mar 2010 14:06:10 -0400 Subject: [PATCH] drm/radeon/kms/dp: remove extraneous training complete call Looks like a copy/paste typo from when evergreen support was added. Signed-off-by: Alex Deucher alexdeuc...@gmail.com --- drivers/gpu/drm/radeon/atombios_dp.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 8a133bd..ca776b2 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c @@ -750,9 +750,6 @@ void dp_link_train(struct drm_encoder *encoder, else radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE, dig_connector-dp_clock, enc_id, 0); - - radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE, - dig_connector-dp_clock, enc_id, 0); } int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, -- 1.5.6.3 0001-drm-radeon-kms-dp-remove-extraneous-training-comple.patch Description: application/mbox -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 27314] output not working on dell m6500
http://bugs.freedesktop.org/show_bug.cgi?id=27314 --- Comment #7 from Alex Deucher ag...@yahoo.com 2010-03-29 11:19:53 PST --- Created an attachment (id=34531) -- (http://bugs.freedesktop.org/attachment.cgi?id=34531) possible link training fix Does this kms patch help? Try applying this other patch as well: http://marc.info/?l=dri-develm=126988624220184w=2 although it shouldn't be necessary. -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[Bug 27314] output not working on dell m6500
http://bugs.freedesktop.org/show_bug.cgi?id=27314 --- Comment #8 from Travis Glenn Hansen travisghan...@yahoo.com 2010-03-29 14:25:43 PST --- Created an attachment (id=34535) -- (http://bugs.freedesktop.org/attachment.cgi?id=34535) dmesg dmesg with attachment 34531 applied. With the patch applied the monitor no longer goes into 'power save' mode and appears to think something is being sent to it. However I still get no picture. -- Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH] drm/radeon/kms/atom: minor fixes to transmitter setup
From c3b9aba0e276d7113155462f46608599cdecc937 Mon Sep 17 00:00:00 2001 From: Alex Deucher alexdeuc...@gmail.com Date: Mon, 29 Mar 2010 17:39:44 -0400 Subject: [PATCH] drm/radeon/kms/atom: minor fixes to transmitter setup - 8 lane links are not valid for DP - remove unused num var Signed-off-by: Alex Deucher alexdeuc...@gmail.com --- drivers/gpu/drm/radeon/radeon_encoders.c | 54 +++-- 1 files changed, 21 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 3330e11..6d6fbd1 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c @@ -708,7 +708,7 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action) struct radeon_connector_atom_dig *dig_connector = radeon_get_atom_connector_priv_from_encoder(encoder); union dig_encoder_control args; - int index = 0, num = 0; + int index = 0; uint8_t frev, crev; if (!dig || !dig_connector) @@ -724,7 +724,6 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action) else index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl); } - num = dig-dig_encoder + 1; if (!atom_parse_cmd_header(rdev-mode_info.atom_context, index, frev, crev)) return; @@ -786,7 +785,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t struct drm_connector *connector; struct radeon_connector *radeon_connector; union dig_transmitter_control args; - int index = 0, num = 0; + int index = 0; uint8_t frev, crev; bool is_dp = false; int pll_id = 0; @@ -862,15 +861,12 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t switch (radeon_encoder-encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: args.v3.acConfig.ucTransmitterSel = 0; - num = 0; break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: args.v3.acConfig.ucTransmitterSel = 1; - num = 1; break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: args.v3.acConfig.ucTransmitterSel = 2; - num = 2; break; } @@ -881,23 +877,19 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t args.v3.acConfig.fCoherentMode = 1; } } else if (ASIC_IS_DCE32(rdev)) { - if (dig-dig_encoder == 1) - args.v2.acConfig.ucEncoderSel = 1; + args.v2.acConfig.ucEncoderSel = dig-dig_encoder; if (dig_connector-linkb) args.v2.acConfig.ucLinkSel = 1; switch (radeon_encoder-encoder_id) { case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: args.v2.acConfig.ucTransmitterSel = 0; - num = 0; break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: args.v2.acConfig.ucTransmitterSel = 1; - num = 1; break; case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: args.v2.acConfig.ucTransmitterSel = 2; - num = 2; break; } @@ -915,31 +907,25 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t else args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER; - switch (radeon_encoder-encoder_id) { - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: - if (rdev-flags RADEON_IS_IGP) { - if (radeon_encoder-pixel_clock 165000) { - if (dig_connector-igp_lane_info 0x3) - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_7; - else if (dig_connector-igp_lane_info 0xc) - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_15; - } else { - if (dig_connector-igp_lane_info 0x1) - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_3; - else if (dig_connector-igp_lane_info 0x2) - args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_4_7; - else if (dig_connector-igp_lane_info 0x4) -
[PATCH 02/14] drm/edid: Remove some misleading comments
Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8e3bd50..7707a6a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -34,11 +34,6 @@ #include drm_edid.h /* - * TODO: - * - support EDID 1.4 (incl. CE blocks) - */ - -/* * EDID blocks out in the wild have a variety of bugs, try to collect * them here (note that userspace may work around broken monitors first, * but fixes should make their way here so that the kernel just works @@ -697,9 +692,6 @@ bad_std_timing(u8 a, u8 b) * * Take the standard timing params (in this case width, aspect, and refresh) * and convert them into a real mode using CVT/GTF/DMT. - * - * Punts for now, but should eventually use the FB layer's CVT based mode - * generation code. */ struct drm_display_mode *drm_mode_std(struct drm_device *dev, struct std_timing *t, -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 01/14] drm/edid: Fix secondary block fetch.
This makes fetching the second EDID block on HDMI monitors actually work. DDC can't transfer more than 128 bytes at a time. Also, rearrange the code so the pure DDC bits are separate from block parse. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 337 +--- include/drm/drm_crtc.h |2 - 2 files changed, 192 insertions(+), 147 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f97e7c4..8e3bd50 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2,6 +2,7 @@ * Copyright (c) 2006 Luc Verhaegen (quirks list) * Copyright (c) 2007-2008 Intel Corporation * Jesse Barnes jesse.bar...@intel.com + * Copyright 2010 Red Hat, Inc. * * DDC probing routines (drm_ddc_read drm_do_probe_ddc_edid) originally from * FB layer. @@ -106,36 +107,39 @@ static struct edid_quirk { { SAM, 638, EDID_QUIRK_PREFER_LARGE_60 }, }; +/*** DDC fetch and block validation ***/ -/* Valid EDID header has these bytes */ static const u8 edid_header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; -/** - * drm_edid_is_valid - sanity check EDID data - * @edid: EDID data - * - * Sanity check the EDID block by looking at the header, the version number - * and the checksum. Return 0 if the EDID doesn't check out, or 1 if it's - * valid. +/* + * Sanity check the EDID block (base or extension). Return 0 if the block + * doesn't check out, or 1 if it's valid. */ -bool drm_edid_is_valid(struct edid *edid) +static bool +drm_edid_block_valid(u8 *raw_edid) { - int i, score = 0; + int i; u8 csum = 0; - u8 *raw_edid = (u8 *)edid; - - for (i = 0; i sizeof(edid_header); i++) - if (raw_edid[i] == edid_header[i]) - score++; - - if (score == 8) ; - else if (score = 6) { - DRM_DEBUG(Fixing EDID header, your hardware may be failing\n); - memcpy(raw_edid, edid_header, sizeof(edid_header)); - } else - goto bad; + struct edid *edid = (struct edid *)raw_edid; + + if (raw_edid[0] == 0x00) { + int score = 0; + + for (i = 0; i sizeof(edid_header); i++) + if (raw_edid[i] == edid_header[i]) + score++; + + if (score == 8) ; + else if (score = 6) { + DRM_DEBUG(Fixing EDID header, + your hardware may be failing\n); + memcpy(raw_edid, edid_header, sizeof(edid_header)); + } else { + goto bad; + } + } for (i = 0; i EDID_LENGTH; i++) csum += raw_edid[i]; @@ -144,13 +148,23 @@ bool drm_edid_is_valid(struct edid *edid) goto bad; } - if (edid-version != 1) { - DRM_ERROR(EDID has major version %d, instead of 1\n, edid-version); - goto bad; - } + /* per-block-type checks */ + switch (raw_edid[0]) { + case 0: /* base */ + if (edid-version != 1) { + DRM_ERROR(EDID has major version %d, + instead of 1\n, edid-version); + goto bad; + } - if (edid-revision 4) - DRM_DEBUG(EDID minor 4, assuming backward compatibility\n); + if (edid-revision 4) + DRM_DEBUG(EDID minor 4, + assuming backward compatibility\n); + break; + + default: + break; + } return 1; @@ -162,8 +176,158 @@ bad: } return 0; } + +/** + * drm_edid_is_valid - sanity check EDID data + * @edid: EDID data + * + * Sanity-check an entire EDID record (including extensions) + */ +bool drm_edid_is_valid(struct edid *edid) +{ + int i; + u8 *raw = (u8 *)edid; + + if (!edid) + return false; + + for (i = 0; i = edid-extensions; i++) + if (!drm_edid_block_valid(raw + i * EDID_LENGTH)) + return false; + + return true; +} EXPORT_SYMBOL(drm_edid_is_valid); +#define DDC_ADDR 0x50 +#define DDC_SEGMENT_ADDR 0x30 +/** + * Get EDID information via I2C. + * + * \param adapter : i2c device adaptor + * \param buf : EDID data buffer to be filled + * \param len : EDID data buffer length + * \return 0 on success or -1 on failure. + * + * Try to fetch EDID information by calling i2c driver function. + */ +static int +drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, + int block, int len) +{ + unsigned char start = block * EDID_LENGTH; + struct i2c_msg msgs[] = { + { + .addr = DDC_ADDR, + .flags = 0, +
[PATCH 03/14] drm/edid: Remove a redundant check
Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7707a6a..a465c1d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1028,10 +1028,6 @@ static int add_standard_modes(struct drm_connector *connector, struct edid *edid struct std_timing *t = edid-standard_timings[i]; struct drm_display_mode *newmode; - /* If std timings bytes are 1, 1 it's empty */ - if (t-hsize == 1 t-vfreq_aspect == 1) - continue; - newmode = drm_mode_std(dev, edid-standard_timings[i], edid-revision, timing_level); if (newmode) { -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 05/14] drm/edid: Add modes for Established Timings III section
Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 91 1 files changed, 91 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3ecddbb..e0c37fb 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1146,6 +1146,94 @@ static int drm_cvt_modes(struct drm_connector *connector, return modes; } +static const struct { + short w; + short h; + short r; + short rb; +} est3_modes[] = { + /* byte 6 */ + { 640, 350, 85, 0 }, + { 640, 400, 85, 0 }, + { 720, 400, 85, 0 }, + { 640, 480, 85, 0 }, + { 848, 480, 60, 0 }, + { 800, 600, 85, 0 }, + { 1024, 768, 85, 0 }, + { 1152, 864, 75, 0 }, + /* byte 7 */ + { 1280, 768, 60, 1 }, + { 1280, 768, 60, 0 }, + { 1280, 768, 75, 0 }, + { 1280, 768, 85, 0 }, + { 1280, 960, 60, 0 }, + { 1280, 960, 85, 0 }, + { 1280, 1024, 60, 0 }, + { 1280, 1024, 85, 0 }, + /* byte 8 */ + { 1360, 768, 60, 0 }, + { 1440, 900, 60, 1 }, + { 1440, 900, 60, 0 }, + { 1440, 900, 75, 0 }, + { 1440, 900, 85, 0 }, + { 1400, 1050, 60, 1 }, + { 1400, 1050, 60, 0 }, + { 1400, 1050, 75, 0 }, + /* byte 9 */ + { 1400, 1050, 85, 0 }, + { 1680, 1050, 60, 1 }, + { 1680, 1050, 60, 0 }, + { 1680, 1050, 75, 0 }, + { 1680, 1050, 85, 0 }, + { 1600, 1200, 60, 0 }, + { 1600, 1200, 65, 0 }, + { 1600, 1200, 70, 0 }, + /* byte 10 */ + { 1600, 1200, 75, 0 }, + { 1600, 1200, 85, 0 }, + { 1792, 1344, 60, 0 }, + { 1792, 1344, 85, 0 }, + { 1856, 1392, 60, 0 }, + { 1856, 1392, 75, 0 }, + { 1920, 1200, 60, 1 }, + { 1920, 1200, 60, 0 }, + /* byte 11 */ + { 1920, 1200, 75, 0 }, + { 1920, 1200, 85, 0 }, + { 1920, 1440, 60, 0 }, + { 1920, 1440, 75, 0 }, +}; +static const int num_est3_modes = sizeof(est3_modes) / sizeof(est3_modes[0]); + +static int +drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) +{ + int i, j, m, modes = 0; + struct drm_display_mode *mode; + u8 *est = ((u8 *)timing) + 5; + + for (i = 0; i 6; i++) { + for (j = 7; j 0; j--) { + m = (i * 8) + (7 - j); + if (m num_est3_modes) + break; + if (est[i] (1 j)) { + mode = drm_find_dmt(connector-dev, + est3_modes[m].w, + est3_modes[m].h, + est3_modes[m].r + /*, est3_modes[m].rb */); + if (mode) { + drm_mode_probed_add(connector, mode); + modes++; + } + } + } + } + + return modes; +} + static int add_detailed_modes(struct drm_connector *connector, struct detailed_timing *timing, struct edid *edid, u32 quirks, int preferred) @@ -1193,6 +1281,9 @@ static int add_detailed_modes(struct drm_connector *connector, case EDID_DETAIL_CVT_3BYTE: modes += drm_cvt_modes(connector, timing); break; + case EDID_DETAIL_EST_TIMINGS: + modes += drm_est3_modes(connector, timing); + break; default: break; } -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 04/14] drm/edid: Reshuffle mode list construction to closer match the spec
Also, document what the spec says to do. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 18 -- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index a465c1d..3ecddbb 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1389,10 +1389,24 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) quirks = edid_get_quirks(edid); - num_modes += add_established_modes(connector, edid); - num_modes += add_standard_modes(connector, edid); + /* +* EDID spec says modes should be preferred in this order: +* - preferred detailed mode +* - other detailed modes from base block +* - detailed modes from extension blocks +* - CVT 3-byte code modes +* - standard timing codes +* - established timing codes +* - modes inferred from GTF or CVT range information +* +* We don't quite implement this yet, but we're close. +* +* XXX order for additional mode types in extension blocks? +*/ num_modes += add_detailed_info(connector, edid, quirks); num_modes += add_detailed_info_eedid(connector, edid, quirks); + num_modes += add_standard_modes(connector, edid); + num_modes += add_established_modes(connector, edid); if (quirks (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) edid_fixup_preferred(connector, quirks); -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 06/14] drm/edid: Remove arbitrary EDID extension limit
Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_crtc.c |7 +-- drivers/gpu/drm/drm_edid.c | 19 +-- drivers/gpu/drm/drm_sysfs.c |2 +- drivers/gpu/drm/radeon/radeon_combios.c |8 include/drm/drm_edid.h |3 --- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d91fb8c..aa24f2f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -33,6 +33,7 @@ #include drm.h #include drmP.h #include drm_crtc.h +#include drm_edid.h struct drm_prop_enum_list { int type; @@ -2349,7 +2350,7 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, struct edid *edid) { struct drm_device *dev = connector-dev; - int ret = 0; + int ret = 0, size; if (connector-edid_blob_ptr) drm_property_destroy_blob(dev, connector-edid_blob_ptr); @@ -2361,7 +2362,9 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, return ret; } - connector-edid_blob_ptr = drm_property_create_blob(connector-dev, 128, edid); + size = EDID_LENGTH * (1 + edid-extensions); + connector-edid_blob_ptr = drm_property_create_blob(connector-dev, + size, edid); ret = drm_connector_property_set_value(connector, dev-mode_config.edid_property, diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index e0c37fb..9974638 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1337,7 +1337,6 @@ static int add_detailed_info_eedid(struct drm_connector *connector, int i, modes = 0; char *edid_ext = NULL; struct detailed_timing *timing; - int edid_ext_num; int start_offset, end_offset; int timing_level; @@ -1354,19 +1353,15 @@ static int add_detailed_info_eedid(struct drm_connector *connector, return 0; } - /* Chose real EDID extension number */ - edid_ext_num = edid-extensions DRM_MAX_EDID_EXT_NUM ? - DRM_MAX_EDID_EXT_NUM : edid-extensions; - /* Find CEA extension */ - for (i = 0; i edid_ext_num; i++) { + for (i = 0; i edid-extensions; i++) { edid_ext = (char *)edid + EDID_LENGTH * (i + 1); /* This block is CEA extension */ if (edid_ext[0] == 0x02) break; } - if (i == edid_ext_num) { + if (i == edid-extensions) { /* if there is no additional timing EDID block, return */ return 0; } @@ -1405,7 +1400,7 @@ static int add_detailed_info_eedid(struct drm_connector *connector, bool drm_detect_hdmi_monitor(struct edid *edid) { char *edid_ext = NULL; - int i, hdmi_id, edid_ext_num; + int i, hdmi_id; int start_offset, end_offset; bool is_hdmi = false; @@ -1413,19 +1408,15 @@ bool drm_detect_hdmi_monitor(struct edid *edid) if (edid == NULL || edid-extensions == 0) goto end; - /* Chose real EDID extension number */ - edid_ext_num = edid-extensions DRM_MAX_EDID_EXT_NUM ? - DRM_MAX_EDID_EXT_NUM : edid-extensions; - /* Find CEA extension */ - for (i = 0; i edid_ext_num; i++) { + for (i = 0; i edid-extensions; i++) { edid_ext = (char *)edid + EDID_LENGTH * (i + 1); /* This block is CEA extension */ if (edid_ext[0] == 0x02) break; } - if (i == edid_ext_num) + if (i == edid-extensions) goto end; /* Data block offset in CEA extension block */ diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 014ce24..7b7c83f 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -332,7 +332,7 @@ static struct device_attribute connector_attrs_opt1[] = { static struct bin_attribute edid_attr = { .attr.name = edid, .attr.mode = 0444, - .size = 128, + .size = 0, .read = edid_show, }; diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index e9ea38e..9949ae7 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c @@ -450,17 +450,17 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev) { int edid_info; struct edid *edid; + unsigned char *raw; edid_info = combios_get_table_offset(rdev-ddev, COMBIOS_HARDCODED_EDID_TABLE); if (!edid_info) return false; - edid = kmalloc(EDID_LENGTH * (DRM_MAX_EDID_EXT_NUM + 1), -
[PATCH 07/14] drm/edid: Remove some silly comments
Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 17 +++-- 1 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 9974638..c052623 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1340,31 +1340,20 @@ static int add_detailed_info_eedid(struct drm_connector *connector, int start_offset, end_offset; int timing_level; - if (edid-version == 1 edid-revision 3) { - /* If the EDID version is less than 1.3, there is no -* extension EDID. -*/ + if (edid-version == 1 edid-revision 3) return 0; - } - if (!edid-extensions) { - /* if there is no extension EDID, it is unnecessary to -* parse the E-EDID to get detailed info -*/ + if (!edid-extensions) return 0; - } /* Find CEA extension */ for (i = 0; i edid-extensions; i++) { edid_ext = (char *)edid + EDID_LENGTH * (i + 1); - /* This block is CEA extension */ if (edid_ext[0] == 0x02) break; } - if (i == edid-extensions) { - /* if there is no additional timing EDID block, return */ + if (i == edid-extensions) return 0; - } /* Get the start offset of detailed timing block */ start_offset = edid_ext[2]; -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 08/14] drm/edid: Fix preferred mode parse for EDID 1.4
In 1.4, the first detailed mode is always the preferred mode. The bit that used to mean that, now means this mode is the physical size in pixels. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c052623..fb7c2fc 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1307,7 +1307,10 @@ static int add_detailed_info(struct drm_connector *connector, for (i = 0; i EDID_DETAILED_TIMINGS; i++) { struct detailed_timing *timing = edid-detailed_timings[i]; - int preferred = (i == 0) (edid-features DRM_EDID_FEATURE_PREFERRED_TIMING); + int preferred = (i == 0); + + if (preferred edid-version == 1 edid-revision 4) + preferred = (edid-features DRM_EDID_FEATURE_PREFERRED_TIMING); /* In 1.0, only timings are allowed */ if (!timing-pixel_clock edid-version == 1 -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 10/14] drm/edid: Extend range-based mode addition for EDID 1.4
1.4 adds better pixel clock precision, explicit reduced blanking awareness, and extended sync ranges. It's almost like a real spec. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 101 ++-- 1 files changed, 78 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ead57ab..5ba470e 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1078,36 +1078,89 @@ static int add_standard_modes(struct drm_connector *connector, struct edid *edid return modes; } -/* - * XXX fix this for: - * - GTF secondary curve formula - * - EDID 1.4 range offsets - * - CVT extended bits - */ static bool -mode_in_range(struct drm_display_mode *mode, struct detailed_timing *timing) +mode_is_rb(struct drm_display_mode *mode) { - struct detailed_data_monitor_range *range; - int hsync, vrefresh; - - range = timing-data.other_data.data.range; + return (mode-htotal - mode-hdisplay == 160) + (mode-hsync_end - mode-hdisplay == 80) + (mode-hsync_end - mode-hsync_start == 32) + (mode-vsync_start - mode-vdisplay == 3); +} +static bool +mode_in_hsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t) +{ + int hsync, hmin, hmax; + + hmin = t[7]; + if (edid-revision = 4) + hmin += ((t[4] 0x04) ? 255 : 0); + hmax = t[8]; + if (edid-revision = 4) + hmax += ((t[4] 0x08) ? 255 : 0); hsync = drm_mode_hsync(mode); - vrefresh = drm_mode_vrefresh(mode); - if (hsync range-min_hfreq_khz || hsync range-max_hfreq_khz) + return (hsync = hmax hsync = hmin); +} + +static bool +mode_in_vsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t) +{ + int vsync, vmin, vmax; + + vmin = t[5]; + if (edid-revision = 4) + vmin += ((t[4] 0x01) ? 255 : 0); + vmax = t[6]; + if (edid-revision = 4) + vmax += ((t[4] 0x02) ? 255 : 0); + vsync = drm_mode_vrefresh(mode); + + return (vsync = vmax vsync = vmin); +} + +static u32 +range_pixel_clock(struct edid *edid, u8 *t) +{ + /* unspecified */ + if (t[9] == 0 || t[9] == 255) + return 0; + + /* 1.4 with CVT support gives us real precision, yay */ + if (edid-revision = 4 t[10] == 0x04) + return (t[9] * 1) - ((t[12] 2) * 250); + + /* 1.3 is pathetic, so fuzz up a bit */ + return t[9] * 1 + 5001; +} + +/* + * XXX fix this for GTF secondary curve formula + */ +static bool +mode_in_range(struct drm_display_mode *mode, struct edid *edid, + struct detailed_timing *timing) +{ + u32 max_clock; + u8 *t = (u8 *)timing; + + if (!mode_in_hsync_range(mode, edid, t)) return false; - if (vrefresh range-min_vfreq || vrefresh range-max_vfreq) + if (!mode_in_vsync_range(mode, edid, t)) return false; - if (range-pixel_clock_mhz range-pixel_clock_mhz != 0xff) { - /* be forgiving since it's in units of 10MHz */ - int max_clock = range-pixel_clock_mhz * 10 + 9; - max_clock *= 1000; + if ((max_clock = range_pixel_clock(edid, t))) if (mode-clock max_clock) return false; - } + + /* 1.4 max horizontal check */ + if (edid-revision = 4 t[10] == 0x04) + if (t[13] mode-hdisplay 8 * (t[13] + (256 * (t[12]0x3 + return false; + + if (mode_is_rb(mode) !drm_monitor_supports_rb(edid)) + return false; return true; } @@ -1116,15 +1169,16 @@ mode_in_range(struct drm_display_mode *mode, struct detailed_timing *timing) * XXX If drm_dmt_modes ever regrows the CVT-R modes (and it will) this will * need to account for them. */ -static int drm_gtf_modes_for_range(struct drm_connector *connector, - struct detailed_timing *timing) +static int +drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, + struct detailed_timing *timing) { int i, modes = 0; struct drm_display_mode *newmode; struct drm_device *dev = connector-dev; for (i = 0; i drm_num_dmt_modes; i++) { - if (mode_in_range(drm_dmt_modes + i, timing)) { + if (mode_in_range(drm_dmt_modes + i, edid, timing)) { newmode = drm_mode_duplicate(dev, drm_dmt_modes[i]); if (newmode) { drm_mode_probed_add(connector, newmode); @@ -1300,7 +1354,8 @@ static int add_detailed_modes(struct drm_connector *connector, switch (data-type) { case EDID_DETAIL_MONITOR_RANGE: if (gtf) - modes += drm_gtf_modes_for_range(connector, timing); +
[PATCH 09/14] drm/edid: Add test for monitor reduced blanking support.
The generic block walk callback looks like overkill, but we'll need it for other detailed block walks in the future. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 47 --- 1 files changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index fb7c2fc..ead57ab 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -33,6 +33,10 @@ #include drmP.h #include drm_edid.h +#define EDID_EST_TIMINGS 16 +#define EDID_STD_TIMINGS 8 +#define EDID_DETAILED_TIMINGS 4 + /* * EDID blocks out in the wild have a variety of bugs, try to collect * them here (note that userspace may work around broken monitors first, @@ -673,6 +677,45 @@ static struct drm_display_mode *drm_find_dmt(struct drm_device *dev, return mode; } +typedef void detailed_cb(struct detailed_timing *timing, void *closure); + +static void +drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) +{ + int i; + struct edid *edid = (struct edid *)raw_edid; + + if (edid == NULL) + return; + + for (i = 0; i EDID_DETAILED_TIMINGS; i++) + cb((edid-detailed_timings[i]), closure); + + /* XXX extension block walk */ +} + +static void +is_rb(struct detailed_timing *t, void *data) +{ + u8 *r = (u8 *)t; + if (r[3] == EDID_DETAIL_MONITOR_RANGE) + if (r[15] 0x10) + *(bool *)data = true; +} + +/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ +static bool +drm_monitor_supports_rb(struct edid *edid) +{ + if (edid-revision = 4) { + bool ret; + drm_for_each_detailed_block((u8 *)edid, is_rb, ret); + return ret; + } + + return ((edid-input DRM_EDID_INPUT_DIGITAL) != 0); +} + /* * 0 is reserved. The spec says 0x01 fill for unused timings. Some old * monitors fill with ascii space (0x20) instead. @@ -964,10 +1007,6 @@ static struct drm_display_mode edid_est_modes[] = { DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x...@75hz */ }; -#define EDID_EST_TIMINGS 16 -#define EDID_STD_TIMINGS 8 -#define EDID_DETAILED_TIMINGS 4 - /** * add_established_modes - get est. modes from EDID and add them * @edid: EDID block to scan -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 11/14] drm/edid: Fix the HDTV hack.
Standard timings don't let you say 1366. Both 1360 and 1368 have been seen in the wild. So invent a CVT timing for it. CVT will round 1366 up to 1368; we'll then manually underscan it. Split this into two parts, since we need to do something sneaky between them in the future. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 16 +--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5ba470e..93ddc9a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -768,15 +768,25 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, vsize = (hsize * 4) / 5; else vsize = (hsize * 9) / 16; - /* HDTV hack */ - if (hsize == 1360 vsize == 765 vrefresh_rate == 60) { - mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0, + + /* HDTV hack, part 1 */ + if (vrefresh_rate == 60 + ((hsize == 1360 vsize == 765) || +(hsize == 1368 vsize == 769))) { + hsize = 1366; + vsize = 768; + } + + /* HDTV hack, part 2 */ + if (hsize == 1366 vsize == 768 vrefresh_rate == 60) { + mode = drm_cvt_mode(dev, 1366, 768, vrefresh_rate, 0, 0, false); mode-hdisplay = 1366; mode-vsync_start = mode-vsync_start - 1; mode-vsync_end = mode-vsync_end - 1; return mode; } + mode = NULL; /* check whether it can be found in default mode table */ mode = drm_find_dmt(dev, hsize, vsize, vrefresh_rate); -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 13/14] drm/edid: Add secondary GTF curve support
Before CVT-R, some monitors would advertise support for an alternative GTF formula with lower blanking intervals. Correctly identify such monitors, and use the alternative formula when generating modes for them. Note that we only do this for standard timing descriptors (tuples of hsize in characters / aspect ratio / vertical refresh). Range-based mode lists still only refer to the primary GTF curve. It would be possible to do better for the latter case, but monitors are required to support the primary curve over the entire advertised range, so all it would win you is a lower pixel clock and therefore possibly better image quality on analog links. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 119 +-- drivers/gpu/drm/drm_modes.c | 81 +++-- include/drm/drm_crtc.h |4 ++ 3 files changed, 150 insertions(+), 54 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8c8acfe..1b1c9d2 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -64,7 +64,8 @@ #define LEVEL_DMT 0 #define LEVEL_GTF 1 -#define LEVEL_CVT 2 +#define LEVEL_GTF2 2 +#define LEVEL_CVT 3 static struct edid_quirk { char *vendor; @@ -716,6 +717,71 @@ drm_monitor_supports_rb(struct edid *edid) return ((edid-input DRM_EDID_INPUT_DIGITAL) != 0); } +static void +find_gtf2(struct detailed_timing *t, void *data) +{ + u8 *r = (u8 *)t; + if (r[3] == EDID_DETAIL_MONITOR_RANGE r[10] == 0x02) + *(u8 **)data = r; +} + +/* Secondary GTF curve kicks in above some break frequency */ +static int +drm_gtf2_hbreak(struct edid *edid) +{ + u8 *r = NULL; + drm_for_each_detailed_block((u8 *)edid, find_gtf2, r); + return r ? (r[12] * 2) : 0; +} + +static int +drm_gtf2_2c(struct edid *edid) +{ + u8 *r = NULL; + drm_for_each_detailed_block((u8 *)edid, find_gtf2, r); + return r ? r[13] : 0; +} + +static int +drm_gtf2_m(struct edid *edid) +{ + u8 *r = NULL; + drm_for_each_detailed_block((u8 *)edid, find_gtf2, r); + return r ? (r[15] 8) + r[14] : 0; +} + +static int +drm_gtf2_k(struct edid *edid) +{ + u8 *r = NULL; + drm_for_each_detailed_block((u8 *)edid, find_gtf2, r); + return r ? r[16] : 0; +} + +static int +drm_gtf2_2j(struct edid *edid) +{ + u8 *r = NULL; + drm_for_each_detailed_block((u8 *)edid, find_gtf2, r); + return r ? r[17] : 0; +} + +/** + * standard_timing_level - get std. timing level(CVT/GTF/DMT) + * @edid: EDID block to scan + */ +static int standard_timing_level(struct edid *edid) +{ + if (edid-revision = 2) { + if (edid-revision = 4 (edid-features DRM_EDID_FEATURE_DEFAULT_GTF)) + return LEVEL_CVT; + if (drm_gtf2_hbreak(edid)) + return LEVEL_GTF2; + return LEVEL_GTF; + } + return LEVEL_DMT; +} + /* * 0 is reserved. The spec says 0x01 fill for unused timings. Some old * monitors fill with ascii space (0x20) instead. @@ -737,8 +803,8 @@ bad_std_timing(u8 a, u8 b) * and convert them into a real mode using CVT/GTF/DMT. */ static struct drm_display_mode * -drm_mode_std(struct drm_connector *connector, struct std_timing *t, -int revision, int timing_level) +drm_mode_std(struct drm_connector *connector, struct edid *edid, +struct std_timing *t, int revision) { struct drm_device *dev = connector-dev; struct drm_display_mode *m, *mode = NULL; @@ -748,6 +814,7 @@ drm_mode_std(struct drm_connector *connector, struct std_timing *t, EDID_TIMING_ASPECT_SHIFT; unsigned vfreq = (t-vfreq_aspect EDID_TIMING_VFREQ_MASK) EDID_TIMING_VFREQ_SHIFT; + int timing_level = standard_timing_level(edid); if (bad_std_timing(t-hsize, t-vfreq_aspect)) return NULL; @@ -809,6 +876,23 @@ drm_mode_std(struct drm_connector *connector, struct std_timing *t, case LEVEL_GTF: mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); break; + case LEVEL_GTF2: + /* +* This is potentially wrong if there's ever a monitor with +* more than one ranges section, each claiming a different +* secondary GTF curve. Please don't do that. +*/ + mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); + if (drm_mode_hsync(mode) drm_gtf2_hbreak(edid)) { + kfree(mode); + mode = drm_gtf_mode_complex(dev, hsize, vsize, + vrefresh_rate, 0, 0, + drm_gtf2_m(edid), + drm_gtf2_2c(edid), +
[PATCH 12/14] drm/edid: Strengthen the algorithm for standard mode codes
If you have 1920x1200 in both detailed (probably RB) and standard variants, you probably only want the RB version. But we have no way of guessing that from standard mode parse. So, if a mode already exists for a given w/h/r, skip adding it. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c | 28 ++-- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 93ddc9a..8c8acfe 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -736,12 +736,12 @@ bad_std_timing(u8 a, u8 b) * Take the standard timing params (in this case width, aspect, and refresh) * and convert them into a real mode using CVT/GTF/DMT. */ -struct drm_display_mode *drm_mode_std(struct drm_device *dev, - struct std_timing *t, - int revision, - int timing_level) +static struct drm_display_mode * +drm_mode_std(struct drm_connector *connector, struct std_timing *t, +int revision, int timing_level) { - struct drm_display_mode *mode; + struct drm_device *dev = connector-dev; + struct drm_display_mode *m, *mode = NULL; int hsize, vsize; int vrefresh_rate; unsigned aspect_ratio = (t-vfreq_aspect EDID_TIMING_ASPECT_MASK) @@ -777,6 +777,17 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, vsize = 768; } + /* +* If this connector already has a mode for this size and refresh +* rate (because it came from detailed or CVT info), use that +* instead. This way we don't have to guess at interlace or +* reduced blanking. +*/ + list_for_each_entry(m, connector-modes, head) + if (m-hdisplay == hsize m-vdisplay == vsize + drm_mode_vrefresh(m) == vrefresh_rate) + return NULL; + /* HDTV hack, part 2 */ if (hsize == 1366 vsize == 768 vrefresh_rate == 60) { mode = drm_cvt_mode(dev, 1366, 768, vrefresh_rate, 0, 0, @@ -787,7 +798,6 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, return mode; } - mode = NULL; /* check whether it can be found in default mode table */ mode = drm_find_dmt(dev, hsize, vsize, vrefresh_rate); if (mode) @@ -1067,17 +1077,15 @@ static int standard_timing_level(struct edid *edid) */ static int add_standard_modes(struct drm_connector *connector, struct edid *edid) { - struct drm_device *dev = connector-dev; int i, modes = 0; int timing_level; timing_level = standard_timing_level(edid); for (i = 0; i EDID_STD_TIMINGS; i++) { - struct std_timing *t = edid-standard_timings[i]; struct drm_display_mode *newmode; - newmode = drm_mode_std(dev, edid-standard_timings[i], + newmode = drm_mode_std(connector, edid-standard_timings[i], edid-revision, timing_level); if (newmode) { drm_mode_probed_add(connector, newmode); @@ -1374,7 +1382,7 @@ static int add_detailed_modes(struct drm_connector *connector, struct drm_display_mode *newmode; std = data-data.timings[i]; - newmode = drm_mode_std(dev, std, edid-revision, + newmode = drm_mode_std(connector, std, edid-revision, timing_level); if (newmode) { drm_mode_probed_add(connector, newmode); -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 14/14] drm/modes: Fix interlaced mode names
Height in frame size, not field size, and trailed with an 'i'. Matches the X server behaviour. Signed-off-by: Adam Jackson a...@redhat.com --- drivers/gpu/drm/drm_edid.c |4 ++-- drivers/gpu/drm/drm_modes.c | 21 - 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1b1c9d2..a2a0873 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1025,10 +1025,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, if (mode-vsync_end mode-vtotal) mode-vtotal = mode-vsync_end + 1; - drm_mode_set_name(mode); - drm_mode_do_interlace_quirk(mode, pt); + drm_mode_set_name(mode); + if (quirks EDID_QUIRK_DETAILED_SYNC_PP) { pt-misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE; } diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index d460b6c..8840066 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -258,8 +258,10 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, drm_mode-clock -= drm_mode-clock % CVT_CLOCK_STEP; /* 18/16. Find actual vertical frame frequency */ /* ignore - just set the mode flag for interlaced */ - if (interlaced) + if (interlaced) { drm_mode-vtotal *= 2; + drm_mode-flags |= DRM_MODE_FLAG_INTERLACE; + } /* Fill the mode line name */ drm_mode_set_name(drm_mode); if (reduced) @@ -268,10 +270,8 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, else drm_mode-flags |= (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NHSYNC); - if (interlaced) - drm_mode-flags |= DRM_MODE_FLAG_INTERLACE; -return drm_mode; + return drm_mode; } EXPORT_SYMBOL(drm_cvt_mode); @@ -446,14 +446,14 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, int vdisplay, drm_mode-clock = pixel_freq; - drm_mode_set_name(drm_mode); - drm_mode-flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC; - if (interlaced) { drm_mode-vtotal *= 2; drm_mode-flags |= DRM_MODE_FLAG_INTERLACE; } + drm_mode_set_name(drm_mode); + drm_mode-flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC; + return drm_mode; } EXPORT_SYMBOL(drm_gtf_mode_complex); @@ -509,8 +509,11 @@ EXPORT_SYMBOL(drm_gtf_mode); */ void drm_mode_set_name(struct drm_display_mode *mode) { - snprintf(mode-name, DRM_DISPLAY_MODE_LEN, %dx%d, mode-hdisplay, -mode-vdisplay); + bool interlaced = !!(mode-flags DRM_MODE_FLAG_INTERLACE); + + snprintf(mode-name, DRM_DISPLAY_MODE_LEN, %dx%d%s, +mode-hdisplay, mode-vdisplay, +interlaced ? i : ); } EXPORT_SYMBOL(drm_mode_set_name); -- 1.6.6.1 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] drm/radeon/kms: minor fixes for eDP with LCD* device tags
Fix a typo in the last patch. new version attached. Alex On Fri, Mar 26, 2010 at 2:04 AM, Alex Deucher alexdeuc...@gmail.com wrote: From 6ff965f44f6c0540e29e616621abac627b506436 Mon Sep 17 00:00:00 2001 From: Alex Deucher alexdeuc...@gmail.com Date: Fri, 26 Mar 2010 01:57:34 -0400 Subject: [PATCH] drm/radeon/kms: minor fixes for eDP with LCD* device tags Some systems have LCD* rather than DFP* device tags in the bios for eDP connectors; notably the new apple iMac. This fixes things up so eDP connectors with either tag will work. Signed-off-by: Alex Deucher alexdeuc...@gmail.com --- drivers/gpu/drm/radeon/atombios_crtc.c | 13 + drivers/gpu/drm/radeon/radeon_encoders.c | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 791db2e..6300675 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -577,11 +577,16 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, } } else if (radeon_encoder-devices (ATOM_DEVICE_LCD_SUPPORT)) { /* may want to enable SS on DP/eDP eventually */ - args.v3.sInput.ucDispPllConfig |= - DISPPLL_CONFIG_SS_ENABLE; - if (mode-clock 165000) + /*args.v3.sInput.ucDispPllConfig |= + DISPPLL_CONFIG_SS_ENABLE;*/ + if (encoder_mode == ATOM_ENCODER_MODE_DP) args.v3.sInput.ucDispPllConfig |= - DISPPLL_CONFIG_DUAL_LINK; + DISPPLL_CONFIG_COHERENT_MODE; + else { + if (mode-clock 165000) + args.v3.sInput.ucDispPllConfig |= + DISPPLL_CONFIG_DUAL_LINK; + } } atom_execute_table(rdev-mode_info.atom_context, index, (uint32_t *)args); diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index fd4052f..3330e11 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c @@ -302,7 +302,7 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, } if (ASIC_IS_DCE3(rdev) - (radeon_encoder-active_device (ATOM_DEVICE_DFP_SUPPORT))) { + (radeon_encoder-active_device (ATOM_DEVICE_DFP_SUPPORT || ATOM_DEVICE_LCD_SUPPORT))) { struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); radeon_dp_set_link_config(connector, mode); } -- 1.5.6.3 0001-drm-radeon-kms-minor-fixes-for-eDP-with-LCD-device.patch Description: application/mbox -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[git pull] drm fixes
[re-pull request] Original pull req below + reverts the fallback placement change which had a side effect of causing more lockups on some AGP systems (this is a bug in the AGP drivers that needs to be tracked down), adds some further fixes from Alex for radeon. Also in case you are wondering why this has a v2.6.34-rc2 merge in the middle of it, one of the radeon changes needed an i2c change before I could test it. original pull text: Some nouveau updates + misc drm core fixes, radeon kms: mostly fixes, however a cleanup to the ugly asic tables to avoid drift between C prototypes moves some stuff around, and I've merged Jerome's GPU recovery code, as I'd much rather users had some of hope of recovering from their GPU locking up than a dead box. It seems to work for quite a lot of people that have tested it, and it won't make a GPU lockup problem worse. This also finally fixes HDMI audio on rv7xx cards. The following changes since commit 220bf991b0366cc50a94feede3d7341fa5710ee4: Linus Torvalds (1): Linux 2.6.34-rc2 are available in the git repository at: ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git drm-linus Alex Deucher (32): drm/radeon: add new RS880 pci id drm/radeon/kms/atom: spread spectrum fix drm/radeon/kms: use lcd pll limits when available drm/radeon/kms: further spread spectrum fixes drm/radeon/kms: fix pal tv-out support on legacy IGP chips drm/radeon/kms: fix for hw i2c drm/radeon/kms: fix i2c prescale calc on older radeons drm/radeon/kms/r1xx: enable hw i2c drm/radeon/kms/rs4xx: make sure crtcs are enabled when setting timing drm/radeon/r600: add missing license and comments to r600_blit_shaders.c drm/radeon/kms: expose thermal/fan i2c buses drm/radeon/kms/pm: fix segfault in clock code drm/radeon/kms: gfx init fixes for r6xx/r7xx drm/radeon/kms/pm: fix typo in power table parsing drm/radeon/kms: init rdev-num_crtc at asic init drm/radeon/kms: display watermark fixes drm/radeon/kms: never treat rs4xx as AGP drm/radeon/kms: fix display bandwidth setup on rs4xx drm/radeon/kms: remove lvds quirks drm/radeon/kms/atom: make sure tables are valid (v2) drm/radeon/kms: use new pre/post_xfer i2c bit algo hooks drm/radeon/kms: add hw_i2c module option drm/radeon/r600: remove some regs are not safe regs for command buffers drm/radeon/kms: fix some typos in r6xx/r7xx hpd setup drm/radeon/r6xx/r7xx: CS parser fixes drm/radeon/kms: bump the version for r6xx/r7xx const buffer support drm/radeon: bump the UMS driver version for r6xx/r7xx const buffer support drm/radeon/r6xx/r7xx: further safe reg clean up drm/radeon/kms: fix macbookpro connector quirk drm/radeon/kms/atom: minor fixes to transmitter setup drm/radeon/kms/dp: remove extraneous training complete call drm/radeon/kms: minor fixes for eDP with LCD* device tags (v2) Ben Skeggs (5): drm/nouveau: add option to allow override of dcb connector table types drm/nouveau: Gigabyte NX85T connector table lies, it has DVI-I not HDMI drm/nv50: fix connector table parsing for some cards drm/nouveau: add module option to disable TV detection drm/edid: allow certain bogus edids to hit a fixup path rather than fail Chris Wilson (1): drm: Return ENODEV if the inode mapping changes Daniel Vetter (5): drm/radeon: create radeon_asic.c drm/radeon: move asic structs to radeon_asic.c drm/radeon: unconfuse return value of radeon_asic-clear_surface_reg drm/radeon: include radeon_asic.h in the asic specific files drm/radeon: collect r100 asic related declarations in radeon_asic.h Dave Airlie (8): drm/ttm: use drm calloc large and free large Merge remote branch 'nouveau/for-airlied' into drm-linus Merge branch 'radeon-for-airlied' of ../linux-2.6 into drm-linus drm/radeon/bo: add some fallback placements for VRAM only objects. drm/radeon/kms: don't print error on -ERESTARTSYS. Merge branch 'v2.6.34-rc2' into HEAD Merge branch 'drm-radeon-fixes' into HEAD Revert drm/radeon/bo: add some fallback placements for VRAM only objects. Francisco Jerez (2): drm/nv04-nv40: Fix up the programmed horizontal sync pulse delay. drm/nouveau: Never evict VRAM buffers to system. Jerome Glisse (6): drm/radeon/kms: catch atombios infinite loop and break out of it drm/radeon/kms: fence cleanup + more reliable GPU lockup detection V4 drm/radeon/kms: rename gpu_reset to asic_reset drm/radeon/kms: simplify improve GPU reset V2 drm/radeon/kms: fix typo in r520 asic functions drm/radeon/kms: avoid possible oops (call gart_fini before gart_disable) Maarten Maathuis (2): drm/nouveau: print a message very early during suspend drm/nv50: add a memory barrier to pushbuf submission Marcin
drm/kms/fb: clean up fbdev integration + add fbcon polling/hotplug
This series of 6 patches attempts to clean up the KMS fbdev helper layer, and add support for two features I'd like to see for some use cases. The first 3 patches are mainly cleanup and moving code around, the main idea being to better abstract the fbdev helper layer from the main kms core. This is done by trying to make fbdev into a kms user not reliant on any information stored in kms especially for it, it also makes the fbdev layer own the initial crtc/mode programming. The second set of 3 patches add the features: a) default to making 1024x768 framebuffer if we detect nothing plugged in b) if nothing is plugged in and the driver wants it, poll ever 5 seconds for something, until you find something plugged in, stop polling then. c) fbcon hotplug, if you have hot plug detect on irqs and you are at the console, it will redetect when you hotplug something. It also deals properly when X or something else is running and delays reprobing until next set_par. Dave. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 3/6] drm/kms/fb: separate fbdev connector list from core drm connectors
From: Dave Airlie airl...@redhat.com This breaks the connection between the core drm connector list and the fbdev connector usage, and allows them to become disjoint in the future. It also removes the untype void* that was in the connector struct to support this. All connectors are added to the fbdev now but this could be changed in the future. Signed-off-by: Dave Airlie airl...@redhat.com --- drivers/gpu/drm/drm_crtc.c |1 - drivers/gpu/drm/drm_fb_helper.c| 196 +++- drivers/gpu/drm/i915/intel_fb.c|1 + drivers/gpu/drm/nouveau/nouveau_fbcon.c|2 + drivers/gpu/drm/radeon/radeon_connectors.c | 50 ++-- drivers/gpu/drm/radeon/radeon_fb.c |5 +- include/drm/drm_crtc.h |1 - include/drm/drm_crtc_helper.h |5 +- include/drm/drm_fb_helper.h|6 +- 9 files changed, 126 insertions(+), 141 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 6a472d5..e8cd683 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -493,7 +493,6 @@ void drm_connector_cleanup(struct drm_connector *connector) list_for_each_entry_safe(mode, t, connector-user_modes, head) drm_mode_remove(connector, mode); - kfree(connector-fb_helper_private); mutex_lock(dev-mode_config.mutex); drm_mode_object_put(dev, connector-base); list_del(connector-head); diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 3d6f417..a1724af 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -41,15 +41,33 @@ MODULE_LICENSE(GPL and additional rights); static LIST_HEAD(kernel_fb_helper_list); -int drm_fb_helper_add_connector(struct drm_connector *connector) +/* simple single crtc case helper function */ +int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) { - connector-fb_helper_private = kzalloc(sizeof(struct drm_fb_helper_connector), GFP_KERNEL); - if (!connector-fb_helper_private) - return -ENOMEM; + struct drm_device *dev = fb_helper-dev; + struct drm_connector *connector; + int i; + + list_for_each_entry(connector, dev-mode_config.connector_list, head) { + struct drm_fb_helper_connector *fb_helper_connector; + + fb_helper_connector = kzalloc(sizeof(struct drm_fb_helper_connector), GFP_KERNEL); + if (!fb_helper_connector) + goto fail; + fb_helper_connector-connector = connector; + fb_helper-connector_info[fb_helper-connector_count++] = fb_helper_connector; + } return 0; +fail: + for (i = 0; i fb_helper-connector_count; i++) { + kfree(fb_helper-connector_info[i]); + fb_helper-connector_info[i] = NULL; + } + fb_helper-connector_count = 0; + return -ENOMEM; } -EXPORT_SYMBOL(drm_fb_helper_add_connector); +EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors); /** * drm_fb_helper_connector_parse_command_line - parse command line for connector @@ -64,7 +82,7 @@ EXPORT_SYMBOL(drm_fb_helper_add_connector); * * enable/enable Digital/disable bit at the end */ -static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *connector, +static bool drm_fb_helper_connector_parse_command_line(struct drm_fb_helper_connector *fb_helper_conn, const char *mode_option) { const char *name; @@ -74,13 +92,13 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *con int yres_specified = 0, cvt = 0, rb = 0, interlace = 0, margins = 0; int i; enum drm_connector_force force = DRM_FORCE_UNSPECIFIED; - struct drm_fb_helper_connector *fb_help_conn = connector-fb_helper_private; struct drm_fb_helper_cmdline_mode *cmdline_mode; + struct drm_connector *connector = fb_helper_conn-connector; - if (!fb_help_conn) + if (!fb_helper_conn) return false; - cmdline_mode = fb_help_conn-cmdline_mode; + cmdline_mode = fb_helper_conn-cmdline_mode; if (!mode_option) mode_option = fb_mode_option; @@ -203,18 +221,21 @@ done: return true; } -int drm_fb_helper_parse_command_line(struct drm_device *dev) +static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper) { - struct drm_connector *connector; + struct drm_fb_helper_connector *fb_helper_conn; + int i; - list_for_each_entry(connector, dev-mode_config.connector_list, head) { + for (i = 0; i fb_helper-connector_count; i++) { char *option = NULL; + fb_helper_conn = fb_helper-connector_info[i]; + /* do something on return - turn off connector maybe
[PATCH 2/6] drm/kms/fb: move to using fb helper crtc grouping instead of core crtc list
From: Dave Airlie airl...@redhat.com This move to using the list of crtcs in the fb helper and cleans up the whole picking code, now we store the crtc/connectors we want directly into the modeset and we use the modeset directly to set the mode. Fixes from James Simmons and Ben Skeggs. Signed-off-by: Dave Airlie airl...@redhat.com --- drivers/gpu/drm/drm_crtc_helper.c |4 - drivers/gpu/drm/drm_fb_helper.c | 329 +-- drivers/gpu/drm/i915/i915_drv.h |5 +- drivers/gpu/drm/i915/intel_fb.c | 93 - drivers/gpu/drm/nouveau/nouveau_drv.h |4 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 121 ++-- drivers/gpu/drm/nouveau/nouveau_fbcon.h |2 +- drivers/gpu/drm/nouveau/nv04_fbcon.c| 16 +- drivers/gpu/drm/nouveau/nv50_fbcon.c| 16 +- drivers/gpu/drm/radeon/radeon_fb.c | 240 -- drivers/gpu/drm/radeon/radeon_mode.h|4 +- include/drm/drm_crtc.h |5 - include/drm/drm_fb_helper.h | 21 ++- 13 files changed, 411 insertions(+), 449 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 9d23f54..b142ac2 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c @@ -625,10 +625,6 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ret = -EINVAL; goto fail; } - /* TODO are these needed? */ - set-crtc-desired_x = set-x; - set-crtc-desired_y = set-y; - set-crtc-desired_mode = set-mode; } drm_helper_disable_unused_functions(dev); } else if (fb_changed) { diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index d6f9f94..3d6f417 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -290,6 +290,7 @@ static void drm_fb_helper_on(struct fb_info *info) struct drm_fb_helper *fb_helper = info-par; struct drm_device *dev = fb_helper-dev; struct drm_crtc *crtc; + struct drm_crtc_helper_funcs *crtc_funcs; struct drm_encoder *encoder; int i; @@ -297,33 +298,28 @@ static void drm_fb_helper_on(struct fb_info *info) * For each CRTC in this fb, turn the crtc on then, * find all associated encoders and turn them on. */ + mutex_lock(dev-mode_config.mutex); for (i = 0; i fb_helper-crtc_count; i++) { - list_for_each_entry(crtc, dev-mode_config.crtc_list, head) { - struct drm_crtc_helper_funcs *crtc_funcs = - crtc-helper_private; + crtc = fb_helper-crtc_info[i].mode_set.crtc; + crtc_funcs = crtc-helper_private; - /* Only mess with CRTCs in this fb */ - if (crtc-base.id != fb_helper-crtc_info[i].crtc_id || - !crtc-enabled) - continue; + if (!crtc-enabled) + continue; + + crtc_funcs-dpms(crtc, DRM_MODE_DPMS_ON); - mutex_lock(dev-mode_config.mutex); - crtc_funcs-dpms(crtc, DRM_MODE_DPMS_ON); - mutex_unlock(dev-mode_config.mutex); - /* Found a CRTC on this fb, now find encoders */ - list_for_each_entry(encoder, dev-mode_config.encoder_list, head) { - if (encoder-crtc == crtc) { - struct drm_encoder_helper_funcs *encoder_funcs; + /* Found a CRTC on this fb, now find encoders */ + list_for_each_entry(encoder, dev-mode_config.encoder_list, head) { + if (encoder-crtc == crtc) { + struct drm_encoder_helper_funcs *encoder_funcs; - encoder_funcs = encoder-helper_private; - mutex_lock(dev-mode_config.mutex); - encoder_funcs-dpms(encoder, DRM_MODE_DPMS_ON); - mutex_unlock(dev-mode_config.mutex); - } + encoder_funcs = encoder-helper_private; + encoder_funcs-dpms(encoder, DRM_MODE_DPMS_ON); } } } + mutex_unlock(dev-mode_config.mutex); } static void drm_fb_helper_off(struct fb_info *info, int dpms_mode) @@ -331,6 +327,7 @@ static void drm_fb_helper_off(struct fb_info *info, int dpms_mode) struct drm_fb_helper *fb_helper = info-par; struct drm_device *dev = fb_helper-dev; struct drm_crtc *crtc; + struct
[PATCH 4/6] drm/kms/fb: provide a 1024x768 fbcon if no outputs found.
From: Dave Airlie airl...@redhat.com If we get no outputs setup provide a 1024x768 fbcon, with this + radeon hotplug stuff I can plug a monitor in after startup and get to see stuff. Last thing is to add some sort of timer for non-hpd outputs like VGA etc. Signed-off-by: Dave Airlie airl...@redhat.com --- drivers/gpu/drm/drm_fb_helper.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index a1724af..8192a56 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -819,7 +819,9 @@ int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) { /* hmm everyone went away - assume VGA cable just fell out and will come back later. */ - return 0; + DRM_ERROR(Cannot find any crtc or sizes - going 1024x768\n); + sizes.fb_width = sizes.surface_width = 1024; + sizes.fb_height = sizes.surface_height = 768; } /* push down into drivers */ -- 1.6.5.2 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH 5/6] drm/kms/fb: add polling support for when nothing is connected.
From: Dave Airlie airl...@redhat.com When we are running in a headless environment we have no idea what output the user might plug in later, we only have hotplug detect from the digital outputs. So if we detect no connected outputs at initialisation, start a slow work operation to poll every 5 seconds for an output. this is only hooked up for radeon so far, on hw where we have full hotplug detection there is no need for this. Signed-off-by: Dave Airlie airl...@redhat.com --- drivers/gpu/drm/Kconfig |1 + drivers/gpu/drm/drm_fb_helper.c | 82 -- drivers/gpu/drm/radeon/radeon_fb.c | 14 +- drivers/gpu/drm/radeon/radeon_irq_kms.c |2 +- drivers/gpu/drm/radeon/radeon_mode.h|2 +- include/drm/drm_fb_helper.h | 12 - 6 files changed, 101 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 305c590..be5aa7d 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -23,6 +23,7 @@ config DRM_KMS_HELPER depends on DRM select FB select FRAMEBUFFER_CONSOLE if !EMBEDDED + select SLOW_WORK help FB and CRTC helpers for KMS drivers. diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 8192a56..f879b3a 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1306,9 +1306,14 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper) /* * we shouldn't end up with no modes here. */ - if (count == 0) - printk(KERN_INFO No connectors reported connected with modes\n); - + if (count == 0) { + if (fb_helper-poll_enabled) { + delayed_slow_work_enqueue(fb_helper-output_poll_slow_work, + 5*HZ); + printk(KERN_INFO No connectors reported connected with modes - started polling\n); + } else + printk(KERN_INFO No connectors reported connected with modes\n); + } drm_setup_crtcs(fb_helper); return 0; @@ -1316,15 +1321,80 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper) EXPORT_SYMBOL(drm_fb_helper_initial_config); bool drm_helper_fb_hotplug_event(struct drm_fb_helper *fb_helper, -u32 max_width, u32 max_height) +u32 max_width, u32 max_height, bool polled) { + int count = 0; + int ret; DRM_DEBUG_KMS(\n); - drm_fb_helper_probe_connector_modes(fb_helper, max_width, + count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, max_height); - + if (fb_helper-poll_enabled !polled) { + if (count) { + delayed_slow_work_cancel(fb_helper-output_poll_slow_work); + } else { + ret = delayed_slow_work_enqueue(fb_helper-output_poll_slow_work, 5*HZ); + } + } drm_setup_crtcs(fb_helper); return true; } EXPORT_SYMBOL(drm_helper_fb_hotplug_event); + +static void output_poll_execute(struct slow_work *work) +{ + struct delayed_slow_work *delayed_work = container_of(work, struct delayed_slow_work, work); + struct drm_fb_helper *fb_helper = container_of(delayed_work, struct drm_fb_helper, output_poll_slow_work); + struct drm_device *dev = fb_helper-dev; + struct drm_connector *connector; + enum drm_connector_status old_status, status; + bool repoll = true, changed = false; + int ret; + + list_for_each_entry(connector, dev-mode_config.connector_list, head) { + old_status = connector-status; + status = connector-funcs-detect(connector); + if (old_status != status) { + changed = true; + /* something changed */ + } + if (status == connector_status_connected) { + DRM_DEBUG(%s is connected - stop polling\n, drm_get_connector_name(connector)); + repoll = false; + } + } + + if (repoll) { + ret = delayed_slow_work_enqueue(delayed_work, 5*HZ); + if (ret) + DRM_ERROR(delayed enqueue failed %d\n, ret); + } + + if (changed) { + if (fb_helper-fb_poll_changed) + fb_helper-fb_poll_changed(fb_helper); + } +} + +struct slow_work_ops output_poll_ops = { + .execute = output_poll_execute, +}; + +void drm_fb_helper_poll_init(struct drm_fb_helper *fb_helper) +{ + int ret; + + ret = slow_work_register_user(THIS_MODULE); + + delayed_slow_work_init(fb_helper-output_poll_slow_work, output_poll_ops); + fb_helper-poll_enabled = true;
[PATCH 6/6] drm/kms/fb: use slow work mechanism for normal hotplug also.
From: Dave Airlie airl...@redhat.com a) slow work is always used now for any fbcon hotplug, as its not a fast task and is more suited to being ran under slow work. b) attempt to not do any fbdev changes when X is running as we'll just mess it up. This hooks set_par to hopefully do the changes once X hands control to fbdev. This also adds the nouveau/intel hotplug support. Signed-off-by: Dave Airlie airl...@redhat.com --- drivers/gpu/drm/drm_fb_helper.c | 209 ++ drivers/gpu/drm/i915/i915_irq.c |1 + drivers/gpu/drm/i915/intel_drv.h|2 + drivers/gpu/drm/i915/intel_fb.c | 42 --- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 47 +--- drivers/gpu/drm/nouveau/nouveau_fbcon.h |2 + drivers/gpu/drm/nouveau/nv50_display.c |3 + drivers/gpu/drm/radeon/radeon_fb.c | 74 +-- include/drm/drm_fb_helper.h | 47 --- 9 files changed, 243 insertions(+), 184 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index f879b3a..3757a25 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -41,6 +41,8 @@ MODULE_LICENSE(GPL and additional rights); static LIST_HEAD(kernel_fb_helper_list); +static struct slow_work_ops output_status_change_ops; + /* simple single crtc case helper function */ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper) { @@ -418,54 +420,81 @@ static void drm_fb_helper_crtc_free(struct drm_fb_helper *helper) kfree(helper-crtc_info); } -int drm_fb_helper_init_crtc_count(struct drm_device *dev, - struct drm_fb_helper *helper, - int crtc_count, int max_conn_count) +int drm_fb_helper_init(struct drm_device *dev, + struct drm_fb_helper *fb_helper, + int crtc_count, int max_conn_count, + bool polled) { struct drm_crtc *crtc; int ret = 0; int i; - INIT_LIST_HEAD(helper-kernel_fb_list); - helper-dev = dev; - helper-crtc_info = kcalloc(crtc_count, sizeof(struct drm_fb_helper_crtc), GFP_KERNEL); - if (!helper-crtc_info) + fb_helper-dev = dev; + fb_helper-poll_enabled = polled; + + slow_work_register_user(THIS_MODULE); + delayed_slow_work_init(fb_helper-output_status_change_slow_work, + output_status_change_ops); + + INIT_LIST_HEAD(fb_helper-kernel_fb_list); + + fb_helper-crtc_info = kcalloc(crtc_count, sizeof(struct drm_fb_helper_crtc), GFP_KERNEL); + if (!fb_helper-crtc_info) return -ENOMEM; - helper-crtc_count = crtc_count; - helper-connector_info = kcalloc(dev-mode_config.num_connector, sizeof(struct drm_fb_helper_connector *), GFP_KERNEL); - if (!helper-connector_info) { - kfree(helper-crtc_info); + fb_helper-crtc_count = crtc_count; + fb_helper-connector_info = kcalloc(dev-mode_config.num_connector, sizeof(struct drm_fb_helper_connector *), GFP_KERNEL); + if (!fb_helper-connector_info) { + kfree(fb_helper-crtc_info); return -ENOMEM; } - helper-connector_count = 0; + fb_helper-connector_count = 0; for (i = 0; i crtc_count; i++) { - helper-crtc_info[i].mode_set.connectors = + fb_helper-crtc_info[i].mode_set.connectors = kcalloc(max_conn_count, sizeof(struct drm_connector *), GFP_KERNEL); - if (!helper-crtc_info[i].mode_set.connectors) { + if (!fb_helper-crtc_info[i].mode_set.connectors) { ret = -ENOMEM; goto out_free; } - helper-crtc_info[i].mode_set.num_connectors = 0; + fb_helper-crtc_info[i].mode_set.num_connectors = 0; } i = 0; list_for_each_entry(crtc, dev-mode_config.crtc_list, head) { - helper-crtc_info[i].crtc_id = crtc-base.id; - helper-crtc_info[i].mode_set.crtc = crtc; + fb_helper-crtc_info[i].crtc_id = crtc-base.id; + fb_helper-crtc_info[i].mode_set.crtc = crtc; i++; } - helper-conn_limit = max_conn_count; + fb_helper-conn_limit = max_conn_count; return 0; out_free: - drm_fb_helper_crtc_free(helper); + drm_fb_helper_crtc_free(fb_helper); return -ENOMEM; } -EXPORT_SYMBOL(drm_fb_helper_init_crtc_count); +EXPORT_SYMBOL(drm_fb_helper_init); + +void drm_fb_helper_fini(struct drm_fb_helper *fb_helper) +{ + if (!list_empty(fb_helper-kernel_fb_list)) { + list_del(fb_helper-kernel_fb_list); + if (list_empty(kernel_fb_helper_list)) { + printk(KERN_INFO