linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree
Hi all, Today's linux-next merge of the drm-intel tree got a conflict in drivers/gpu/drm/i915/intel_display.c between commit f37b5c2be897 ("drm/i915: Align initial plane backing objects correctly") from the drm-intel-fixes tree and commit 6bf129df6ffa ("drm/i915: Use an intermediate variable to avoid repeating ourselves") from the drm-intel tree. I fixed it up (see below) and can carry the fix as necessary (no action is required). -- Cheers, Stephen Rothwellsfr at canb.auug.org.au diff --cc drivers/gpu/drm/i915/intel_display.c index bf19a5cce4a8,2ac93909cfc5.. --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@@ -2371,11 -2376,8 +2376,12 @@@ intel_alloc_plane_obj(struct intel_crt struct drm_device *dev = crtc->base.dev; struct drm_i915_gem_object *obj = NULL; struct drm_mode_fb_cmd2 mode_cmd = { 0 }; + struct drm_framebuffer *fb = &plane_config->fb->base; - u32 base = plane_config->base; + u32 base_aligned = round_down(plane_config->base, PAGE_SIZE); + u32 size_aligned = round_up(plane_config->base + plane_config->size, + PAGE_SIZE); + + size_aligned -= base_aligned; if (plane_config->size == 0) return false; @@@ -6640,9 -6678,10 +6693,10 @@@ i9xx_get_initial_plane_config(struct in fb->pitches[0] = val & 0xffc0; aligned_height = intel_fb_align_height(dev, fb->height, - plane_config->tiling); + fb->pixel_format, + fb->modifier[0]); - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); + plane_config->size = fb->pitches[0] * aligned_height; DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", pipe_name(pipe), plane, fb->width, fb->height, @@@ -7677,9 -7721,10 +7736,10 @@@ skylake_get_initial_plane_config(struc fb->pitches[0] = (val & 0x3ff) * stride_mult; aligned_height = intel_fb_align_height(dev, fb->height, - plane_config->tiling); + fb->pixel_format, + fb->modifier[0]); - plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE); + plane_config->size = fb->pitches[0] * aligned_height; DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", pipe_name(pipe), fb->width, fb->height, @@@ -7768,9 -7818,10 +7833,10 @@@ ironlake_get_initial_plane_config(struc fb->pitches[0] = val & 0xffc0; aligned_height = intel_fb_align_height(dev, fb->height, - plane_config->tiling); + fb->pixel_format, + fb->modifier[0]); - plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); + plane_config->size = fb->pitches[0] * aligned_height; DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", pipe_name(pipe), fb->width, fb->height, -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/707ef97c/attachment.sig>
r600 - NI/Turks: flickering with 'geom-outlining-150'
Am 20.02.2015 17:29, schrieb Alex Deucher: > On Fri, Feb 20, 2015 at 10:54 AM, Dieter Nützel > wrote: >> Hello Alex, >> >> I get _today_ flickering with Mesa-demo 'geom-outlining-150'. >> It worked OK last night and I've reseted Mesa git back to 5c1aac1 but >> NO >> success. >> Only thing is I've used LLVM git of today, too and for GOOD result >> LLVM >> from 18th. >> Any hints? >> > > Please narrow it down to what update caused the issue and then use git > to bisect. > > Alex Couldn't find a GOOD version (Mesa/LLVM) for bisect start so far. I've to search further. -Dieter >> For the record: >> >> 'geom-outlining-150' >> 'gsraytrace' (both Mesa-demo) >> and >> 'gl-320-primitive-shading' (ogl-samples) >> >> GS stuff works on r600 - NI/Turks nearly perfect (only the above >> flickering) >> which show corruption (first and last) or crash 'gsraytrace' with r600 >> - >> RV730 (AGP). >> >> Maybe I've to add this on the open bug reports... >> >> Great 'experience' with Evergreen+ on PCIE (Xeon X3430/16GB/all >> SSD/Fujitsu >> PRIMERGY TX150 S7 server-workstation) ;-) >> >> -Dieter >> >> PS I use ccache linked to /dev/shm/.ccache for LLVM as Michel >> suggested.
drm-next-4.1-wip: NI/Turks *ERROR* chosen encoder in use 4
Hello Alex, I get this in dmesg: [ 26.001926] [drm:radeon_atom_pick_dig_encoder [radeon]] *ERROR* chosen encoder in use 4 What do you need? -Dieter -- next part -- A non-text attachment was scrubbed... Name: dmesg-4.1-wip.log.xz Type: application/x-xz Size: 14832 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/54cc23bb/attachment-0001.bin>
r600 - NI/Turks: flickering with 'geom-outlining-150'
On 25.02.2015 13:04, Dieter Nützel wrote: > Am 20.02.2015 17:29, schrieb Alex Deucher: >> On Fri, Feb 20, 2015 at 10:54 AM, Dieter Nützel >> wrote: >>> Hello Alex, >>> >>> I get _today_ flickering with Mesa-demo 'geom-outlining-150'. >>> It worked OK last night and I've reseted Mesa git back to 5c1aac1 but NO >>> success. >>> Only thing is I've used LLVM git of today, too and for GOOD result LLVM >>> from 18th. >>> Any hints? >>> >> >> Please narrow it down to what update caused the issue and then use git >> to bisect. >> >> Alex > > Couldn't find a GOOD version (Mesa/LLVM) for bisect start so far. > I've to search further. Note that the r600g driver doesn't use LLVM for graphics shader compilation, so you should only need to search in Mesa and maybe the kernel or libdrm. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #34 from Michel Dänzer --- (In reply to smoki from comment #33) > glsl-fs-min is one of the random failing tests actually, it sometimes pass > sometimes fail with or without subreg liveness, so that is not problem here > i think. I can't reproduce random failures with glsl-fs-min nor any piglit regressions with sub-register liveness enabled, but sub-register liveness doesn't seem to result in any code difference for glsl-fs-min anyway. Can you find another test which consistently passes without sub-register liveness and fails with it *and* shows a difference between them in the R600_DEBUG=vs,ps stderr output, and attach the latter for both cases? -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/67e26c85/attachment.html>
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #35 from smoki --- Created attachment 113809 --> https://bugs.freedesktop.org/attachment.cgi?id=113809&action=edit subreg_disabled.txt (In reply to Michel Dänzer from comment #34) > > I can't reproduce random failures with glsl-fs-min nor any piglit > regressions with sub-register liveness enabled, but sub-register liveness > doesn't seem to result in any code difference for glsl-fs-min anyway. > I can't too if i run it alone, so there is no difference, it just fail sometimes in full piglit run. > > Can you find another test which consistently passes without sub-register > liveness and fails with it *and* shows a difference between them in the > R600_DEBUG=vs,ps stderr output, and attach the latter for both cases? As i said yesterday comment 33 i trimmed down only ones which shows this regression, you can pick any of those 136 test which shows difference. Let say: R600_DEBUG=vs,ps ./bin/copy-pixels -samples=8 -auto Outputs attached, first without... -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/c47a2acf/attachment.html>
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #36 from smoki --- Created attachment 113810 --> https://bugs.freedesktop.org/attachment.cgi?id=113810&action=edit subreg_enabled.txt ...second with subreg liveness enabled. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/501c4edb/attachment.html>
[Bug 83226] Allow use of ColorRange and ColorSpace in xorg.conf.d files
https://bugs.freedesktop.org/show_bug.cgi?id=83226 --- Comment #17 from John --- I'm not sure if it is because of these patches, or 4.0-rc1 (I moved the 2 of them together), but now when my screen goes off (energy saving stuff), I lose the hdmi audio, but when I move the mouse the screen is back but not the audio. Switching it back on with xrandr works though. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/cf0671ed/attachment.html>
eDP display control registers in Linux kernel
On Mon, 23 Feb 2015, Michael Leuchtenburg wrote: > I'm certain that it has dynamic backlight control of some sort, as the > brightness varies based on content. I'm also sure it has an eDP panel, and > an Intel graphics adapter. I'm not certain that DPCD will let me adjust it, > or how to check, though the ChromeOS patch seems to assume that intel + edp > -> DBC adjustable via DPCD. I just sent a patch to dump the DPCD in debugfs [1]. Please apply that on top of v4.0-rc1 or drm-intel-nightly, *and* add the following patch on top. Please share the contents of /sys/kernel/debug/dri/0/eDP-1/i915_dpcd running that (I assume the name will be eDP-1). BR, Jani. [1] http://patchwork.freedesktop.org/patch/43332 diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 451ef456c25f..c66b0679d6e2 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -4672,6 +4672,9 @@ static const struct dpcd_block i915_dpcd_debug[] = { { .offset = DP_SINK_COUNT, .end = DP_ADJUST_REQUEST_LANE2_3 }, { .offset = DP_SET_POWER }, { .offset = DP_EDP_DPCD_REV }, + { .offset = 0x701, .end = 0x704 }, + { .offset = 0x720, .end = 0x72f }, + { .offset = 0x732, .end = 0x733 }, }; static int i915_dpcd_show(struct seq_file *m, void *data) -- Jani Nikula, Intel Open Source Technology Center
[PATCH 1/4] drm/dp: indentation and ordering cleanups
Keep the DPCD macros ordered by address, and make indentation conform to the rest of the file. commit e045d20bef41707dbba676e58624b54f9f39e172 Author: Sonika Jindal Date: Thu Feb 19 13:16:44 2015 +0530 drm: Adding edp1.4 specific dpcd macros Signed-off-by: Jani Nikula --- Daniel, this might be squashed into the above commit in the drm-misc tree. --- include/drm/drm_dp_helper.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index d4803224028f..98fefe45d158 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -92,9 +92,6 @@ # define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */ # define DP_OUI_SUPPORT(1 << 7) -#define DP_SUPPORTED_LINK_RATES0x010 /*eDP 1.4*/ -#define DP_MAX_SUPPORTED_RATES 0x8 - #define DP_I2C_SPEED_CAP 0x00c/* DPI */ # define DP_I2C_SPEED_1K 0x01 # define DP_I2C_SPEED_5K 0x02 @@ -105,8 +102,12 @@ #define DP_EDP_CONFIGURATION_CAP0x00d /* XXX 1.2? */ # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */ + #define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ +#define DP_SUPPORTED_LINK_RATES0x010 /* eDP 1.4 */ +# define DP_MAX_SUPPORTED_RATES 8 /* 16-bit little-endian */ + /* Multiple stream transport */ #define DP_FAUX_CAP0x020 /* 1.2 */ # define DP_FAUX_CAP_1 (1 << 0) @@ -225,7 +226,7 @@ # define DP_UP_REQ_EN (1 << 1) # define DP_UPSTREAM_IS_SRC(1 << 2) -#define DP_LINK_RATE_SET 0x115 +#define DP_LINK_RATE_SET 0x115 /* eDP 1.4 */ #define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ # define DP_PSR_ENABLE (1 << 0) @@ -338,7 +339,7 @@ # define DP_SET_POWER_D30x2 # define DP_SET_POWER_MASK 0x3 -#define DP_EDP_DPCD_REV 0x700 +#define DP_EDP_DPCD_REV0x700/* eDP 1.2 */ #define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ #define DP_SIDEBAND_MSG_UP_REP_BASE0x1200 /* 1.2 MST */ -- 2.1.4
[PATCH 4/4] drm/dp: add DPCD definitions from eDP 1.4
Signed-off-by: Jani Nikula --- include/drm/drm_dp_helper.h | 37 + 1 file changed, 37 insertions(+) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index cc96024e8776..07d94faa9255 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -168,10 +168,18 @@ #define DP_AUD_DEL_INS20x02d /* End of AV_SYNC_DATA_BLOCK */ +#define DP_RECEIVER_ALPM_CAP 0x02e /* eDP 1.4 */ +# define DP_ALPM_CAP (1 << 0) + +#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP 0x02f /* eDP 1.4 */ +# define DP_AUX_FRAME_SYNC_CAP (1 << 0) + #define DP_GUID0x030 /* 1.2 */ #define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ # define DP_PSR_IS_SUPPORTED1 +# define DP_PSR2_IS_SUPPORTED 2 /* eDP 1.4 */ + #define DP_PSR_CAPS 0x071 /* XXX 1.2? */ # define DP_PSR_NO_TRAIN_ON_EXIT1 # define DP_PSR_SETUP_TIME_330 (0 << 1) @@ -211,6 +219,7 @@ /* link configuration */ #defineDP_LINK_BW_SET 0x100 +# define DP_LINK_RATE_TABLE0x00/* eDP 1.4 */ # define DP_LINK_BW_1_62 0x06 # define DP_LINK_BW_2_70x0a # define DP_LINK_BW_5_40x14/* 1.2 */ @@ -309,15 +318,30 @@ #define DP_AUDIO_DELAY20x114 #define DP_LINK_RATE_SET 0x115 /* eDP 1.4 */ +# define DP_LINK_RATE_SET_SHIFT0 +# define DP_LINK_RATE_SET_MASK (7 << 0) + +#define DP_RECEIVER_ALPM_CONFIG0x116 /* eDP 1.4 */ +# define DP_ALPM_ENABLE(1 << 0) +# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE (1 << 1) + +#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF 0x117 /* eDP 1.4 */ +# define DP_AUX_FRAME_SYNC_ENABLE (1 << 0) +# define DP_IRQ_HPD_ENABLE (1 << 1) #define DP_UPSTREAM_DEVICE_DP_PWR_NEED 0x118 /* 1.2 */ # define DP_PWR_NOT_NEEDED (1 << 0) +#define DP_AUX_FRAME_SYNC_VALUE0x15c /* eDP 1.4 */ +# define DP_AUX_FRAME_SYNC_VALID (1 << 0) + #define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ # define DP_PSR_ENABLE (1 << 0) # define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) # define DP_PSR_CRC_VERIFICATION (1 << 2) # define DP_PSR_FRAME_CAPTURE (1 << 3) +# define DP_PSR_SELECTIVE_UPDATE (1 << 4) +# define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS (1 << 5) #define DP_ADAPTER_CTRL0x1a0 # define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) @@ -425,6 +449,10 @@ # define DP_SET_POWER_MASK 0x3 #define DP_EDP_DPCD_REV0x700/* eDP 1.2 */ +# define DP_EDP_11 0x00 +# define DP_EDP_12 0x01 +# define DP_EDP_13 0x02 +# define DP_EDP_14 0x03 #define DP_EDP_GENERAL_CAP_1 0x701 @@ -432,6 +460,8 @@ #define DP_EDP_GENERAL_CAP_2 0x703 +#define DP_EDP_GENERAL_CAP_3 0x704/* eDP 1.4 */ + #define DP_EDP_DISPLAY_CONTROL_REGISTER 0x720 #define DP_EDP_BACKLIGHT_MODE_SET_REGISTER 0x721 @@ -458,6 +488,9 @@ #define DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET 0x732 #define DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET 0x733 +#define DP_EDP_REGIONAL_BACKLIGHT_BASE 0x740/* eDP 1.4 */ +#define DP_EDP_REGIONAL_BACKLIGHT_00x741/* eDP 1.4 */ + #define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ #define DP_SIDEBAND_MSG_UP_REP_BASE0x1200 /* 1.2 MST */ #define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */ @@ -476,6 +509,7 @@ #define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ # define DP_PSR_LINK_CRC_ERROR (1 << 0) # define DP_PSR_RFB_STORAGE_ERROR (1 << 1) +# define DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR (1 << 2) /* eDP 1.4 */ #define DP_PSR_ESI 0x2007 /* XXX 1.2? */ # define DP_PSR_CAPS_CHANGE (1 << 0) @@ -489,6 +523,9 @@ # define DP_PSR_SINK_INTERNAL_ERROR 7 # define DP_PSR_SINK_STATE_MASK 0x07 +#define DP_RECEIVER_ALPM_STATUS0x200b /* eDP 1.4 */ +# define DP_ALPM_LOCK_TIMEOUT_ERROR_STATUS (1 << 0) + /* DP 1.2 Sideband message defines */ /* peer device type - DP 1.2a Table 2-92 */ #define DP_PEER_DEVICE_NONE0x0 -- 2.1.4
[PATCH 2/4] drm/dp: add DPCD definitions from DP 1.2a
Signed-off-by: Jani Nikula --- include/drm/drm_dp_helper.h | 95 ++--- 1 file changed, 90 insertions(+), 5 deletions(-) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 98fefe45d158..209c5b91b0e8 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -92,6 +92,15 @@ # define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */ # define DP_OUI_SUPPORT(1 << 7) +#define DP_RECEIVE_PORT_0_CAP_00x008 /* XXX 1.2? */ +# define DP_LOCAL_EDID_PRESENT (1 << 1) +# define DP_ASSOCIATED_TO_PRECEDING_PORT(1 << 2) + +#define DP_RECEIVE_PORT_0_BUFFER_SIZE 0x009 + +#define DP_RECEIVE_PORT_1_CAP_00x00a +#define DP_RECEIVE_PORT_1_BUFFER_SIZE 0x00b + #define DP_I2C_SPEED_CAP 0x00c/* DPI */ # define DP_I2C_SPEED_1K 0x01 # define DP_I2C_SPEED_5K 0x02 @@ -101,10 +110,16 @@ # define DP_I2C_SPEED_1M 0x20 #define DP_EDP_CONFIGURATION_CAP0x00d /* XXX 1.2? */ +# define DP_ALTERNATE_SCRAMBLER_RESET_CAP (1 << 0) +# define DP_FRAMING_CHANGE_CAP (1 << 1) # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */ #define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ +#define DP_ADAPTER_CAP 0x00f /* 1.2 */ +# define DP_FORCE_LOAD_SENSE_CAP (1 << 0) +# define DP_ALTERNATE_I2C_PATTERN_CAP (1 << 1) + #define DP_SUPPORTED_LINK_RATES0x010 /* eDP 1.4 */ # define DP_MAX_SUPPORTED_RATES 8 /* 16-bit little-endian */ @@ -115,6 +130,44 @@ #define DP_MSTM_CAP0x021 /* 1.2 */ # define DP_MST_CAP(1 << 0) +#define DP_NUMBER_OF_AUDIO_ENDPOINTS 0x022 /* 1.2 */ + +/* AV_SYNC_DATA_BLOCK 1.2 */ +#define DP_AV_GRANULARITY 0x023 +# define DP_AG_FACTOR_MASK (0xf << 0) +# define DP_AG_FACTOR_3MS (0 << 0) +# define DP_AG_FACTOR_2MS (1 << 0) +# define DP_AG_FACTOR_1MS (2 << 0) +# define DP_AG_FACTOR_500US(3 << 0) +# define DP_AG_FACTOR_200US(4 << 0) +# define DP_AG_FACTOR_100US(5 << 0) +# define DP_AG_FACTOR_10US (6 << 0) +# define DP_AG_FACTOR_1US (7 << 0) +# define DP_VG_FACTOR_MASK (0xf << 4) +# define DP_VG_FACTOR_3MS (0 << 4) +# define DP_VG_FACTOR_2MS (1 << 4) +# define DP_VG_FACTOR_1MS (2 << 4) +# define DP_VG_FACTOR_500US(3 << 4) +# define DP_VG_FACTOR_200US(4 << 4) +# define DP_VG_FACTOR_100US(5 << 4) + +#define DP_AUD_DEC_LAT00x024 +#define DP_AUD_DEC_LAT10x025 + +#define DP_AUD_PP_LAT0 0x026 +#define DP_AUD_PP_LAT1 0x027 + +#define DP_VID_INTER_LAT 0x028 + +#define DP_VID_PROG_LAT0x029 + +#define DP_REP_LAT 0x02a + +#define DP_AUD_DEL_INS00x02b +#define DP_AUD_DEL_INS10x02c +#define DP_AUD_DEL_INS20x02d +/* End of AV_SYNC_DATA_BLOCK */ + #define DP_GUID0x030 /* 1.2 */ #define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ @@ -173,11 +226,12 @@ # define DP_TRAINING_PATTERN_3 3 /* 1.2 */ # define DP_TRAINING_PATTERN_MASK 0x3 -# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) -# define DP_LINK_QUAL_PATTERN_D10_2(1 << 2) -# define DP_LINK_QUAL_PATTERN_ERROR_RATE(2 << 2) -# define DP_LINK_QUAL_PATTERN_PRBS7(3 << 2) -# define DP_LINK_QUAL_PATTERN_MASK (3 << 2) +/* DPCD 1.1 only. For DPCD >= 1.2 see per-lane DP_LINK_QUAL_LANEn_SET */ +# define DP_LINK_QUAL_PATTERN_11_DISABLE(0 << 2) +# define DP_LINK_QUAL_PATTERN_11_D10_2 (1 << 2) +# define DP_LINK_QUAL_PATTERN_11_ERROR_RATE (2 << 2) +# define DP_LINK_QUAL_PATTERN_11_PRBS7 (3 << 2) +# define DP_LINK_QUAL_PATTERN_11_MASK (3 << 2) # define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) # define DP_LINK_SCRAMBLING_DISABLE(1 << 5) @@ -220,14 +274,45 @@ /* bitmask as for DP_I2C_SPEED_CAP */ #define DP_EDP_CONFIGURATION_SET0x10a /* XXX 1.2? */ +# define DP_ALTERNATE_SCRAMBLER_RESET_ENABLE (1 << 0) +# define DP_FRAMING_CHANGE_ENABLE (1 << 1) +# define DP_PANEL_SELF_TEST_ENABLE (1 << 7) + +#define DP_LINK_QUAL_LANE0_SET 0x10b /* DPCD >= 1.2 */ +#define DP_LINK_QUAL_LANE1_SET 0x10c +#define DP_LINK_QUAL_LANE2_SET 0x10d +#define DP_LINK_QUAL_LANE3_SET 0x10e +# define DP_LINK
[PATCH 3/4] drm/dp: add DPCD definitions from eDP 1.2
Mostly display control related DPCD addresses. Signed-off-by: Jani Nikula --- include/drm/drm_dp_helper.h | 32 1 file changed, 32 insertions(+) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 209c5b91b0e8..cc96024e8776 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -426,6 +426,38 @@ #define DP_EDP_DPCD_REV0x700/* eDP 1.2 */ +#define DP_EDP_GENERAL_CAP_1 0x701 + +#define DP_EDP_BACKLIGHT_ADJUSTMENT_CAP 0x702 + +#define DP_EDP_GENERAL_CAP_2 0x703 + +#define DP_EDP_DISPLAY_CONTROL_REGISTER 0x720 + +#define DP_EDP_BACKLIGHT_MODE_SET_REGISTER 0x721 + +#define DP_EDP_BACKLIGHT_BRIGHTNESS_MSB 0x722 +#define DP_EDP_BACKLIGHT_BRIGHTNESS_LSB 0x723 + +#define DP_EDP_PWMGEN_BIT_COUNT 0x724 +#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725 +#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726 + +#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727 + +#define DP_EDP_BACKLIGHT_FREQ_SET 0x728 + +#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a +#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b +#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_LSB 0x72c + +#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MSB 0x72d +#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MID 0x72e +#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_LSB 0x72f + +#define DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET 0x732 +#define DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET 0x733 + #define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ #define DP_SIDEBAND_MSG_UP_REP_BASE0x1200 /* 1.2 MST */ #define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */ -- 2.1.4
[patch] drm/i915: cleanup some indenting
Static checkers complain that we should probably add curly braces because, from the indenting, it looks like seq_printf() should be inside the list_for_each_entry() loop. But the code is actually correct, it's just the indenting which is off. Besides fixing the indenting on seq_printf(), I did add curly braces, because generally mult-line indents should have curly braces to make them more readable. Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 26e9c7b..a76b2ed 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -139,10 +139,11 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) obj->madv == I915_MADV_DONTNEED ? " purgeable" : ""); if (obj->base.name) seq_printf(m, " (name: %d)", obj->base.name); - list_for_each_entry(vma, &obj->vma_list, vma_link) + list_for_each_entry(vma, &obj->vma_list, vma_link) { if (vma->pin_count > 0) pin_count++; - seq_printf(m, " (pinned x %d)", pin_count); + } + seq_printf(m, " (pinned x %d)", pin_count); if (obj->pin_display) seq_printf(m, " (display)"); if (obj->fence_reg != I915_FENCE_REG_NONE)
Problems with DRI on Acube Sam460 AMCC 460ex board
2.463814] [drm] radeon kernel modesetting enabled. >>>> [2.469870] [drm] initializing kernel modesetting (TURKS 0x1002:0x6758 >>>> 0x1682:0x318B). >>>> [2.478007] [drm] register mmio base: 0xe9000 >>>> [2.482774] [drm] register mmio size: 131072 >>>> [2.665432] ATOM BIOS: TURKS >>>> [2.668602] radeon 0001:81:00.0: VRAM: 1024M 0x - >>>> 0x3FFF (1024M used) >>>> [2.677521] radeon 0001:81:00.0: GTT: 1024M 0x4000 - >>>> 0x7FFF >>>> [2.685201] [drm] Detected VRAM RAM=1024M, BAR=256M >>>> [2.690094] [drm] RAM width 128bits DDR >>>> [2.694109] [TTM] Zone kernel: Available graphics memory: 379192 kiB >>>> [2.700596] [TTM] Zone highmem: Available graphics memory: 1034552 kiB >>>> [2.707147] [TTM] Initializing pool allocator >>>> [2.711540] [TTM] Initializing DMA pool allocator >>>> [2.716359] [drm] radeon: 1024M of VRAM memory ready >>>> [2.721355] [drm] radeon: 1024M of GTT memory ready. >>>> [2.726395] [drm] Loading TURKS Microcode >>>> [2.730457] [drm] Internal thermal controller with fan control >>>> [2.741697] [drm] radeon: dpm initialized >>>> [2.745907] [drm] GART: num cpu pages 262144, num gpu pages 262144 >>>> [2.787690] [drm] PCIE GART of 1024M enabled (table at >>>> 0x00274000). >>>> [2.794953] radeon 0001:81:00.0: WB enabled >>>> [2.799182] radeon 0001:81:00.0: fence driver on ring 0 use gpu addr >>>> 0x4c00 and cpu addr 0xffc01c00 >>>> [2.809300] radeon 0001:81:00.0: fence driver on ring 3 use gpu addr >>>> 0x4c0c and cpu addr 0xffc01c0c >>>> [2.839260] radeon 0001:81:00.0: fence driver on ring 5 use gpu addr >>>> 0x00072118 and cpu addr 0xf9032118 >>>> [2.849411] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). >>>> [2.856067] [drm] Driver supports precise vblank timestamp query. >>>> [2.862183] radeon 0001:81:00.0: radeon: MSI limited to 32-bit >>>> [2.868058] ppc4xx_setup_msi_irqs: fail allocating msi interrupt >>>> [2.874153] [drm] radeon: irq initialized. >>>> [3.103973] [drm:r600_ring_test] *ERROR* radeon: ring 0 test failed >>>> (scratch(0x8504)=0xCAFEDEAD) >>>> [ 3.112806] radeon 0001:81:00.0: disabling GPU acceleration >>>> [3.128627] [drm] Radeon Display Connectors >>>> [3.133369] [drm] Connector 0: >>>> [3.136481] [drm] DP-1 >>>> [3.139089] [drm] HPD1 >>>> [3.141665] [drm] DDC: 0x6470 0x6470 0x6474 0x6474 0x6478 0x6478 >>>> 0x647c 0x647c >>>> [3.149146] [drm] Encoders: >>>> [3.152157] [drm] DFP1: INTERNAL_UNIPHY2 >>>> [3.156473] [drm] Connector 1: >>>> [3.159570] [drm] HDMI-A-1 >>>> [3.162469] [drm] HPD5 >>>> [3.165019] [drm] DDC: 0x6480 0x6480 0x6484 0x6484 0x6488 0x6488 >>>> 0x648c 0x648c >>>> [3.172436] [drm] Encoders: >>>> [3.175415] [drm] DFP2: INTERNAL_UNIPHY2 >>>> [3.179703] [drm] Connector 2: >>>> [3.182766] [drm] DVI-I-1 >>>> [3.185570] [drm] HPD4 >>>> [3.188117] [drm] DDC: 0x6450 0x6450 0x6454 0x6454 0x6458 0x6458 >>>> 0x645c 0x645c >>>> [3.195535] [drm] Encoders: >>>> [3.198513] [drm] DFP3: INTERNAL_UNIPHY >>>> [3.202706] [drm] CRT1: INTERNAL_KLDSCP_DAC1 >>>> [3.352245] [drm] fb mappable at 0x80475000 >>>> [3.356458] [drm] vram apper at 0x8000 >>>> [3.360570] [drm] size 8294400 >>>> [3.363634] [drm] fb depth is 24 >>>> [3.366873] [drm]pitch is 7680 >>>> [3.575080] Console: switching to colour frame buffer device 240x67 >>>> [3.649278] radeon 0001:81:00.0: fb0: radeondrmfb frame buffer device >>>> [3.656071] radeon 0001:81:00.0: registered panic notifier >>>> [3.666472] [drm] Initialized radeon 2.40.0 20080528 for 0001:81:00.0 >>>> on minor 0 >>>> >>>> >>> >>> Problems with the Gib bisect >>> Kernel wont compile after 10th bisect . >>> >>> drivers/built-in.o: In function `drm_mode_atomic_ioctl': >>> (.text+0x865dc): undefined reference to `__get_user_bad' >>> make: *** [vmlinux] Error 1 >>> root at julian-VirtualBox:/usr/src/linux# git bisect log >>> git bisect start >>> # bad: [c517d838eb7d07bbe9507871fab3931deccff539] Linux 4.0-rc1 >>> git bisect bad c517d838eb7d07bbe9507871fab3931deccff539 >>> # good: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19 >>> git bisect good bfa76d49576599a4b9f9b7a71f23d73d6dcff735 >>> # good: [02f1f2170d2831b3233e91091c60a66622f29e82] kernel.h: remove ancient >>> __FUNCTION__ hack >>> git bisect good 02f1f2170d2831b3233e91091c60a66622f29e82 >>> # bad: [796e1c55717e9a6ff5c81b12289ffa1ffd919b6f] Merge branch 'drm-next' >>> of git://people.freedesktop.org/~airlied/linux >>> git bisect bad 796e1c55717e9a6ff5c81b12289ffa1ffd919b6f >>> # good: [9682ec9692e5ac11c6caebd079324e727b19e7ce] Merge tag >>> 'driver-core-3.20-rc1' of >>> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core >>> git bisect good 9682ec9692e5ac11c6caebd079324e727b19e7ce >>> # good: [a9724125ad014decf008d782e60447c811391326] Merge tag 'tty-3.20-rc1' >>> of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty >>> git bisect good a9724125ad014decf008d782e60447c811391326 >>> # good: [f43dff0ee00a259f524ce17ba4f8030553c66590] Merge tag >>> 'drm-amdkfd-next-fixes-2015-01-25' of >>> git://people.freedesktop.org/~gabbayo/linux into drm-next >>> git bisect good f43dff0ee00a259f524ce17ba4f8030553c66590 >>> # bad: [cffe1e89dc9bf541a39d9287ced7c5addff07084] drm: sti: HDMI add audio >>> infoframe >>> git bisect bad cffe1e89dc9bf541a39d9287ced7c5addff07084 >>> # good: [2f5b4ef15c60bc5292a3f006c018acb3da53737b] Merge tag >>> 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into >>> drm-next >>> git bisect good 2f5b4ef15c60bc5292a3f006c018acb3da53737b >>> # bad: [86588ce80ccd714793e9ba4140d7ae214229] drm/udl: optimize >>> udl_compress_hline16 (v2) >>> git bisect bad 86588ce80ccd714793e9ba4140d7ae214229 >>> # bad: [d47df63393ed81977e0f6435988d9cbd70c867f7] drm/panel: simple: Add >>> AVIC TM070DDH03 panel support >>> git bisect bad d47df63393ed81977e0f6435988d9cbd70c867f7 >>> # bad: [9469244d869623e8b54d9f3d4d00737e377af273] drm/atomic: Fix potential >>> use of state after free >>> git bisect bad 9469244d869623e8b54d9f3d4d00737e377af273 >>> >>> >> Kernel 4.0.0-rc1 boots when DVI output used but not when HDMI output >> used. > > > git bisect skip > There are only 'skip'ped commits left to test. > The first bad commit could be any of: > b486e0e6d599b9ca8667fb9a7d49b7383ee963c7 > eab3bbeffd152125ae0f90863b8e9bc8eef49423 > 960cd9d4fef6dd9e235c0e5c0d4ed027f8a48025 > f02ad907cd9e7fe3a6405d2d005840912f1ed258 > 6a425c2a9b37ca3d2c37e3c1cdf973dba53eaa79 > ee0a89cf3c2c550e6d877dda21dd2947afb90cb6 > 92890583627ee2a0518e55b063fcff86826fef96 > 95d6eb3b134e1826ed04cc92b224d93de13e281f > 9469244d869623e8b54d9f3d4d00737e377af273 > We cannot bisect more! > Verified that the problems with the radeon: ring 0 test failed error go back to at least Kernel 3.0.1 -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/11ebc373/attachment-0001.html>
[patch] drm/i915: cleanup some indenting
On Wed, 25 Feb 2015, Dan Carpenter wrote: > Static checkers complain that we should probably add curly braces > because, from the indenting, it looks like seq_printf() should be inside > the list_for_each_entry() loop. But the code is actually correct, it's > just the indenting which is off. > > Besides fixing the indenting on seq_printf(), I did add curly braces, > because generally mult-line indents should have curly braces to make > them more readable. > > Signed-off-by: Dan Carpenter The unintended indent was left behind and not unindented in commit d7f46fc4e7323887494db13f063a8e59861fefb0 Author: Ben Widawsky Date: Fri Dec 6 14:10:55 2013 -0800 drm/i915: Make pin count per VMA Reviewed-by: Jani Nikula > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c > b/drivers/gpu/drm/i915/i915_debugfs.c > index 26e9c7b..a76b2ed 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -139,10 +139,11 @@ describe_obj(struct seq_file *m, struct > drm_i915_gem_object *obj) > obj->madv == I915_MADV_DONTNEED ? " purgeable" : ""); > if (obj->base.name) > seq_printf(m, " (name: %d)", obj->base.name); > - list_for_each_entry(vma, &obj->vma_list, vma_link) > + list_for_each_entry(vma, &obj->vma_list, vma_link) { > if (vma->pin_count > 0) > pin_count++; > - seq_printf(m, " (pinned x %d)", pin_count); > + } > + seq_printf(m, " (pinned x %d)", pin_count); > if (obj->pin_display) > seq_printf(m, " (display)"); > if (obj->fence_reg != I915_FENCE_REG_NONE) -- Jani Nikula, Intel Open Source Technology Center
Problems with DRI on Acube Sam460 AMCC 460ex board
.858974] [eeb13f20] [c00d0e9c] SyS_ioctl+0x40/0x68 >>>>>> [ 35.864307] [eeb13f40] [c000ab04] ret_from_syscall+0x0/0x3c >>>>>> [ 35.870196] --- interrupt: c01 at 0x6fb1b8dc >>>>>> [ 35.870196] LR = 0x6fb1b800 >>>>>> [ 35.877971] Instruction dump: >>>>>> [ 35.881106] 8129012c 806a0018 2f89 419e0018 81290004 2f89 >>>>>> 419e000c 7d2903a6 >>>>>> [ 35.889403] 4e800420 3860 4e800020 81231c70 <81290008> 2f89 >>>>>> 4d9e0020 7d2903a6 >>>>>> [ 36.042121] ---[ end trace 3e83f5fa0d05c678 ]--- >>>>>> [ 36.046739] >>>>>> >>>>> With Kernel 3.19 >>>>> [2.454668] Linux agpgart interface v0.103 >>>>> [2.458979] [drm] Initialized drm 1.1.0 20060810 >>>>> [2.463814] [drm] radeon kernel modesetting enabled. >>>>> [2.469870] [drm] initializing kernel modesetting (TURKS 0x1002:0x6758 >>>>> 0x1682:0x318B). >>>>> [2.478007] [drm] register mmio base: 0xe9000 >>>>> [2.482774] [drm] register mmio size: 131072 >>>>> [2.665432] ATOM BIOS: TURKS >>>>> [2.668602] radeon 0001:81:00.0: VRAM: 1024M 0x - >>>>> 0x3FFF (1024M used) >>>>> [2.677521] radeon 0001:81:00.0: GTT: 1024M 0x4000 - >>>>> 0x7FFF >>>>> [2.685201] [drm] Detected VRAM RAM=1024M, BAR=256M >>>>> [2.690094] [drm] RAM width 128bits DDR >>>>> [2.694109] [TTM] Zone kernel: Available graphics memory: 379192 kiB >>>>> [2.700596] [TTM] Zone highmem: Available graphics memory: 1034552 kiB >>>>> [2.707147] [TTM] Initializing pool allocator >>>>> [2.711540] [TTM] Initializing DMA pool allocator >>>>> [2.716359] [drm] radeon: 1024M of VRAM memory ready >>>>> [2.721355] [drm] radeon: 1024M of GTT memory ready. >>>>> [2.726395] [drm] Loading TURKS Microcode >>>>> [2.730457] [drm] Internal thermal controller with fan control >>>>> [2.741697] [drm] radeon: dpm initialized >>>>> [2.745907] [drm] GART: num cpu pages 262144, num gpu pages 262144 >>>>> [2.787690] [drm] PCIE GART of 1024M enabled (table at >>>>> 0x00274000). >>>>> [2.794953] radeon 0001:81:00.0: WB enabled >>>>> [2.799182] radeon 0001:81:00.0: fence driver on ring 0 use gpu addr >>>>> 0x4c00 and cpu addr 0xffc01c00 >>>>> [2.809300] radeon 0001:81:00.0: fence driver on ring 3 use gpu addr >>>>> 0x4c0c and cpu addr 0xffc01c0c >>>>> [2.839260] radeon 0001:81:00.0: fence driver on ring 5 use gpu addr >>>>> 0x00072118 and cpu addr 0xf9032118 >>>>> [2.849411] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). >>>>> [2.856067] [drm] Driver supports precise vblank timestamp query. >>>>> [2.862183] radeon 0001:81:00.0: radeon: MSI limited to 32-bit >>>>> [2.868058] ppc4xx_setup_msi_irqs: fail allocating msi interrupt >>>>> [2.874153] [drm] radeon: irq initialized. >>>>> [3.103973] [drm:r600_ring_test] *ERROR* radeon: ring 0 test failed >>>>> (scratch(0x8504)=0xCAFEDEAD) >>>>> [3.112806] radeon 0001:81:00.0: disabling GPU acceleration >>>>> [3.128627] [drm] Radeon Display Connectors >>>>> [3.133369] [drm] Connector 0: >>>>> [3.136481] [drm] DP-1 >>>>> [3.139089] [drm] HPD1 >>>>> [3.141665] [drm] DDC: 0x6470 0x6470 0x6474 0x6474 0x6478 0x6478 >>>>> 0x647c 0x647c >>>>> [3.149146] [drm] Encoders: >>>>> [3.152157] [drm] DFP1: INTERNAL_UNIPHY2 >>>>> [3.156473] [drm] Connector 1: >>>>> [3.159570] [drm] HDMI-A-1 >>>>> [3.162469] [drm] HPD5 >>>>> [3.165019] [drm] DDC: 0x6480 0x6480 0x6484 0x6484 0x6488 0x6488 >>>>> 0x648c 0x648c >>>>> [3.172436] [drm] Encoders: >>>>> [3.175415] [drm] DFP2: INTERNAL_UNIPHY2 >>>>> [3.179703] [drm] Connector 2: >>>>> [3.182766] [drm] DVI-I-1 >>>>> [3.185570] [drm] HPD4 >>>>> [3.188117] [drm] DDC: 0x6450 0x6450 0x6454 0x6454 0x6458 0x6458 >>>>> 0x645c 0x645c >>>>> [3.195535] [drm] Encoders: >>>>> [3.198513] [drm] DFP3: INTERNAL_UNIPHY >>>>> [3.202706] [drm] CRT1: INTERNAL_KLDSCP_DAC1 >>>>> [3.352245] [drm] fb mappable at 0x80475000 >>>>> [3.356458] [drm] vram apper at 0x8000 >>>>> [3.360570] [drm] size 8294400 >>>>> [3.363634] [drm] fb depth is 24 >>>>> [3.366873] [drm]pitch is 7680 >>>>> [3.575080] Console: switching to colour frame buffer device 240x67 >>>>> [3.649278] radeon 0001:81:00.0: fb0: radeondrmfb frame buffer device >>>>> [3.656071] radeon 0001:81:00.0: registered panic notifier >>>>> [3.666472] [drm] Initialized radeon 2.40.0 20080528 for 0001:81:00.0 >>>>> on minor 0 >>>>> >>>>> >>>> >>>> Problems with the Gib bisect >>>> Kernel wont compile after 10th bisect . >>>> >>>> drivers/built-in.o: In function `drm_mode_atomic_ioctl': >>>> (.text+0x865dc): undefined reference to `__get_user_bad' >>>> make: *** [vmlinux] Error 1 >>>> root at julian-VirtualBox:/usr/src/linux# git bisect log >>>> git bisect start >>>> # bad: [c517d838eb7d07bbe9507871fab3931deccff539] Linux 4.0-rc1 >>>> git bisect bad c517d838eb7d07bbe9507871fab3931deccff539 >>>> # good: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19 >>>> git bisect good bfa76d49576599a4b9f9b7a71f23d73d6dcff735 >>>> # good: [02f1f2170d2831b3233e91091c60a66622f29e82] kernel.h: remove >>>> ancient __FUNCTION__ hack >>>> git bisect good 02f1f2170d2831b3233e91091c60a66622f29e82 >>>> # bad: [796e1c55717e9a6ff5c81b12289ffa1ffd919b6f] Merge branch 'drm-next' >>>> of git://people.freedesktop.org/~airlied/linux >>>> git bisect bad 796e1c55717e9a6ff5c81b12289ffa1ffd919b6f >>>> # good: [9682ec9692e5ac11c6caebd079324e727b19e7ce] Merge tag >>>> 'driver-core-3.20-rc1' of >>>> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core >>>> git bisect good 9682ec9692e5ac11c6caebd079324e727b19e7ce >>>> # good: [a9724125ad014decf008d782e60447c811391326] Merge tag >>>> 'tty-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty >>>> git bisect good a9724125ad014decf008d782e60447c811391326 >>>> # good: [f43dff0ee00a259f524ce17ba4f8030553c66590] Merge tag >>>> 'drm-amdkfd-next-fixes-2015-01-25' of >>>> git://people.freedesktop.org/~gabbayo/linux into drm-next >>>> git bisect good f43dff0ee00a259f524ce17ba4f8030553c66590 >>>> # bad: [cffe1e89dc9bf541a39d9287ced7c5addff07084] drm: sti: HDMI add audio >>>> infoframe >>>> git bisect bad cffe1e89dc9bf541a39d9287ced7c5addff07084 >>>> # good: [2f5b4ef15c60bc5292a3f006c018acb3da53737b] Merge tag >>>> 'drm/tegra/for-3.20-rc1' of git://anongit.freedesktop.org/tegra/linux into >>>> drm-next >>>> git bisect good 2f5b4ef15c60bc5292a3f006c018acb3da53737b >>>> # bad: [86588ce80ccd714793e9ba4140d7ae214229] drm/udl: optimize >>>> udl_compress_hline16 (v2) >>>> git bisect bad 86588ce80ccd714793e9ba4140d7ae214229 >>>> # bad: [d47df63393ed81977e0f6435988d9cbd70c867f7] drm/panel: simple: Add >>>> AVIC TM070DDH03 panel support >>>> git bisect bad d47df63393ed81977e0f6435988d9cbd70c867f7 >>>> # bad: [9469244d869623e8b54d9f3d4d00737e377af273] drm/atomic: Fix >>>> potential use of state after free >>>> git bisect bad 9469244d869623e8b54d9f3d4d00737e377af273 >>>> >>>> >>> Kernel 4.0.0-rc1 boots when DVI output used but not when HDMI >>> output used. >> >> >> git bisect skip >> There are only 'skip'ped commits left to test. >> The first bad commit could be any of: >> b486e0e6d599b9ca8667fb9a7d49b7383ee963c7 >> eab3bbeffd152125ae0f90863b8e9bc8eef49423 >> 960cd9d4fef6dd9e235c0e5c0d4ed027f8a48025 >> f02ad907cd9e7fe3a6405d2d005840912f1ed258 >> 6a425c2a9b37ca3d2c37e3c1cdf973dba53eaa79 >> ee0a89cf3c2c550e6d877dda21dd2947afb90cb6 >> 92890583627ee2a0518e55b063fcff86826fef96 >> 95d6eb3b134e1826ed04cc92b224d93de13e281f >> 9469244d869623e8b54d9f3d4d00737e377af273 >> We cannot bisect more! >> > > Verified that the problems with the > radeon: ring 0 test failed error > go back to at least Kernel 3.0.1 > Problem also seems to exist with P1022 based board as well . https://community.freescale.com/thread/339022 -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/42c57ddb/attachment-0001.html>
[PATCH] drm: Don't assign fbs for universal cursor support to files
The internal framebuffers we create to remap legacy cursor ioctls to plane operations for the universal plane support shouldn't be linke to the file like normal userspace framebuffers. This bug goes back to the original universal cursor plane support introduced in commit 161d0dc1dccb17ff7a38f462c7c0d4ef8bcc5662 Author: Matt Roper Date: Tue Jun 10 08:28:10 2014 -0700 drm: Support legacy cursor ioctls via universal planes when possible (v4) The isn't too disastrous since fbs are small, we only create one when the cursor bo gets changed and ultimately they'll be reaped when the window server restarts. Conceptually we'd want to just pass NULL for file_priv when creating it, but the driver needs the file to lookup the underlying buffer object for cursor id. Instead let's move the file_priv linking out of add_framebuffer_internal() into the addfb ioctl implementation, which is the only place it is needed. And also rename the function for a more accurate since it only creates the fb, but doesn't add it anywhere. Signed-off-by: Daniel Vetter (fix & commit msg) Signed-off-by: Chris Wilson (provider of lipstick) Cc: Ville Syrjälä Cc: Matt Roper Cc: Rob Clark Cc: Dave Airlie Cc: stable at vger.kernel.org --- drivers/gpu/drm/drm_crtc.c | 35 +++ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 927f3445ff38..4c78d12c5418 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -43,9 +43,10 @@ #include "drm_crtc_internal.h" #include "drm_internal.h" -static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, - struct drm_mode_fb_cmd2 *r, - struct drm_file *file_priv); +static struct drm_framebuffer * +internal_framebuffer_create(struct drm_device *dev, + struct drm_mode_fb_cmd2 *r, + struct drm_file *file_priv); /* Avoid boilerplate. I'm tired of typing. */ #define DRM_ENUM_NAME_FN(fnname, list) \ @@ -2919,13 +2920,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc, */ if (req->flags & DRM_MODE_CURSOR_BO) { if (req->handle) { - fb = add_framebuffer_internal(dev, &fbreq, file_priv); + fb = internal_framebuffer_create(dev, &fbreq, file_priv); if (IS_ERR(fb)) { DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n"); return PTR_ERR(fb); } - - drm_framebuffer_reference(fb); } else { fb = NULL; } @@ -3284,9 +3283,10 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r) return 0; } -static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, - struct drm_mode_fb_cmd2 *r, - struct drm_file *file_priv) +static struct drm_framebuffer * +internal_framebuffer_create(struct drm_device *dev, + struct drm_mode_fb_cmd2 *r, + struct drm_file *file_priv) { struct drm_mode_config *config = &dev->mode_config; struct drm_framebuffer *fb; @@ -3324,12 +3324,6 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, return fb; } - mutex_lock(&file_priv->fbs_lock); - r->fb_id = fb->base.id; - list_add(&fb->filp_head, &file_priv->fbs); - DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); - mutex_unlock(&file_priv->fbs_lock); - return fb; } @@ -3351,15 +3345,24 @@ static struct drm_framebuffer *add_framebuffer_internal(struct drm_device *dev, int drm_mode_addfb2(struct drm_device *dev, void *data, struct drm_file *file_priv) { + struct drm_mode_fb_cmd2 *r = data; struct drm_framebuffer *fb; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; - fb = add_framebuffer_internal(dev, data, file_priv); + fb = internal_framebuffer_create(dev, r, file_priv); if (IS_ERR(fb)) return PTR_ERR(fb); + /* Transfer ownership to the filp for reaping on close */ + + DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); + mutex_lock(&file_priv->fbs_lock); + r->fb_id = fb->base.id; + list_add(&fb->filp_head, &file_priv->fbs); + mutex_unlock(&file_priv->fbs_lock); + return 0; } -- 2.1.4
[Intel-gfx] [patch] drm/i915: cleanup some indenting
On Wed, Feb 25, 2015 at 03:29:05PM +0200, Jani Nikula wrote: > On Wed, 25 Feb 2015, Dan Carpenter wrote: > > Static checkers complain that we should probably add curly braces > > because, from the indenting, it looks like seq_printf() should be inside > > the list_for_each_entry() loop. But the code is actually correct, it's > > just the indenting which is off. > > > > Besides fixing the indenting on seq_printf(), I did add curly braces, > > because generally mult-line indents should have curly braces to make > > them more readable. > > > > Signed-off-by: Dan Carpenter > > The unintended indent was left behind and not unindented in > > commit d7f46fc4e7323887494db13f063a8e59861fefb0 > Author: Ben Widawsky > Date: Fri Dec 6 14:10:55 2013 -0800 > > drm/i915: Make pin count per VMA Added to the commit message. > > Reviewed-by: Jani Nikula Queued for -next, thanks for the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH libdrm 2/5] configure: omap, freedreno and tegra require atomics
They have used them since day one, but the check was never there. Cc: Rob Clark Cc: Thierry Reding Signed-off-by: Emil Velikov --- configure.ac | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8afee83..ac1bf8f 100644 --- a/configure.ac +++ b/configure.ac @@ -214,7 +214,12 @@ if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev installed]) fi -if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then +if test "x$INTEL" != "xno" -o \ + "x$RADEON" != "xno" -o \ + "x$NOUVEAU" != "xno" -o \ + "x$OMAP" != "xno" -o \ + "x$FREEDRENO" != "xno" -o \ + "x$TEGRA" != "xno"; then if test "x$drm_cv_atomic_primitives" = "xnone"; then if test "x$INTEL" != "xauto"; then if test "x$INTEL" != "xno"; then @@ -240,6 +245,15 @@ if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then AC_MSG_WARN([Disabling libdrm_nouveau. It depends on atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package.]) NOUVEAU=no fi + if test "x$OMAP" != "xauto"; then + AC_MSG_ERROR([libdrm_omap depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for OMAP GPUs by passing --disable-omap-experimental-api to ./configure]) + fi + if test "x$FREEDRENO" != "xauto"; then + AC_MSG_ERROR([libdrm_freedreno depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for QCOM's Adreno GPUs by passing --disable-freedreno-experimental-api to ./configure]) + fi + if test "x$TEGRA" != "xauto"; then + AC_MSG_ERROR([libdrm_tegra depends upon atomic operations, which were not found for your compiler/cpu. Try compiling with -march=native, or install the libatomics-op-dev package, or, failing both of those, disable support for NVIDIA's Tegra GPUs by passing --disable-tegra-experimental-api to ./configure]) + fi else if test "x$INTEL" != "xno"; then case $host_cpu in -- 2.1.3
[PATCH libdrm 1/5] automake: wrap an insanely long line
Signed-off-by: Emil Velikov --- Makefile.am | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3cb516c..e9a041d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,7 +57,18 @@ if HAVE_TEGRA TEGRA_SUBDIR = tegra endif -SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) $(TEGRA_SUBDIR) tests man +SUBDIRS = \ + . \ + $(LIBKMS_SUBDIR) \ + $(INTEL_SUBDIR) \ + $(NOUVEAU_SUBDIR) \ + $(RADEON_SUBDIR) \ + $(OMAP_SUBDIR) \ + $(EXYNOS_SUBDIR) \ + $(FREEDRENO_SUBDIR) \ + $(TEGRA_SUBDIR) \ + tests \ + man libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir) -- 2.1.3
[PATCH libdrm 3/5] automake: drop the NULL variable from the makefile
Signed-off-by: Emil Velikov --- tests/Makefile.am | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 37b8d3a..e0281aa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,3 @@ -NULL:=# - AM_CPPFLAGS = \ -I $(top_srcdir)/include/drm \ -I $(top_srcdir) @@ -53,10 +51,9 @@ TESTS = \ getstats\ setversion \ updatedraw \ - name_from_fd\ - $(NULL) + name_from_fd -SUBDIRS += vbltest $(NULL) +SUBDIRS += vbltest check_PROGRAMS += $(TESTS) -- 2.1.3
[PATCH libdrm 5/5] tests: automake: keep the libs link at the final stage
Currently the static archive libdrmtest.la links against libdrm.la. Only to have both added to the executables' LDADD. Simplify things a bit, by doing the link in the final module (the executables/tests in this case). Signed-off-by: Emil Velikov --- tests/Makefile.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 90f6405..f008c06 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,11 +38,10 @@ libdrmtest_la_SOURCES = \ drmtest.c \ drmtest.h -libdrmtest_la_LIBADD = \ - $(top_builddir)/libdrm.la \ +LDADD += \ + libdrmtest.la \ $(LIBUDEV_LIBS) -LDADD += libdrmtest.la XFAIL_TESTS = \ auth\ -- 2.1.3
[PATCH libdrm 4/5] tests: move the SUBDIR at the top of the makefile
None of the subdirs require the modules built in the local makefile, so moving them at the top makes things a hell lot easier to read. Signed-off-by: Emil Velikov --- tests/Makefile.am | 26 ++ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index e0281aa..90f6405 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,13 +1,3 @@ -AM_CPPFLAGS = \ - -I $(top_srcdir)/include/drm \ - -I $(top_srcdir) - -LDADD = $(top_builddir)/libdrm.la - -check_PROGRAMS = \ - dristat \ - drmstat - SUBDIRS = modeprint proptest if HAVE_LIBKMS @@ -27,6 +17,20 @@ SUBDIRS += tegra endif if HAVE_LIBUDEV +SUBDIRS += vbltest +endif + +AM_CPPFLAGS = \ + -I $(top_srcdir)/include/drm \ + -I $(top_srcdir) + +LDADD = $(top_builddir)/libdrm.la + +check_PROGRAMS = \ + dristat \ + drmstat + +if HAVE_LIBUDEV check_LTLIBRARIES = libdrmtest.la @@ -53,8 +57,6 @@ TESTS = \ updatedraw \ name_from_fd -SUBDIRS += vbltest - check_PROGRAMS += $(TESTS) endif -- 2.1.3
[PATCH 0/8] Fix struct clk pointer comparing
On the first day back from Chinese new year holiday, I got a regression report from rmk, saying Ethernet stops working on HimmingBoard with v4.0-rc1. I read through the thread [1] and found a couple of i.MX audio drivers are also affected per Stephen's Coccinelle report. That's why I came up with this series based on Quentin's structclk.cocci, Stephen's result and Mike's input (thanks all). The first two patches are run-time tested and all others are compile-tested only. [1] http://thread.gmane.org/gmane.linux.kernel/1872604/focus=1880862 Shawn Guo (8): clk: add helper function clk_is_match() ARM: imx: fix struct clk pointer comparing drm: armada: fix struct clk pointer comparing pwm: atmel-hlcdc: fix struct clk pointer comparing serial: samsung: fix struct clk pointer comparing ASoC: fsl_esai: fix struct clk pointer comparing ASoC: fsl_spdif: fix struct clk pointer comparing ASoC: kirkwood: fix struct clk pointer comparing arch/arm/mach-imx/mach-imx6q.c | 5 +++-- drivers/clk/clk.c | 6 ++ drivers/gpu/drm/armada/armada_510.c | 2 +- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- drivers/tty/serial/samsung.c| 2 +- include/linux/clk.h | 16 sound/soc/fsl/fsl_esai.c| 2 +- sound/soc/fsl/fsl_spdif.c | 4 ++-- sound/soc/kirkwood/kirkwood-i2s.c | 2 +- 9 files changed, 32 insertions(+), 9 deletions(-) -- 1.9.1
[PATCH 1/8] clk: add helper function clk_is_match()
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. A number of client drivers detecting if two struct clk pointers point to the same one hardware clock by comparing the pointers are broken now. As a stop-gap solution, this patch adds a helper function clk_is_match() to test if two struct clk pointers point to the same hardware clock, so that these client drivers can use to fix the regression. Signed-off-by: Shawn Guo --- drivers/clk/clk.c | 6 ++ include/linux/clk.h | 16 2 files changed, 22 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index eb0152961d3c..7df4826d9c7b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -597,6 +597,12 @@ struct clk *__clk_get_parent(struct clk *clk) } EXPORT_SYMBOL_GPL(__clk_get_parent); +bool clk_is_match(struct clk *clk1, struct clk *clk2) +{ + return __clk_get_hw(clk1) == __clk_get_hw(clk2) ? true : false; +} +EXPORT_SYMBOL_GPL(clk_is_match); + static struct clk_core *clk_core_get_parent_by_index(struct clk_core *clk, u8 index) { diff --git a/include/linux/clk.h b/include/linux/clk.h index 8381bbfbc308..f8a8a6dd6a98 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -376,6 +376,17 @@ struct clk *clk_get_parent(struct clk *clk); */ struct clk *clk_get_sys(const char *dev_id, const char *con_id); +/** + * clk_is_match - test if two given struct clk pointers point to the same + * hardware clock, i.e. struct clk_hw. + * @clk1: the first clk + * @clk2: the second clk + * + * Returns true if two clk pointers point to the same hardware clock, + * or false otherwise. + */ +bool clk_is_match(struct clk *clk1, struct clk *clk2); + #else /* !CONFIG_HAVE_CLK */ static inline struct clk *clk_get(struct device *dev, const char *id) @@ -429,6 +440,11 @@ static inline struct clk *clk_get_parent(struct clk *clk) return NULL; } +static inline bool clk_is_match(struct clk *clk1, struct clk *clk2) +{ + return clk1 == clk2 ? true : false; +} + #endif /* clk_prepare_enable helps cases using clk_enable in non-atomic context. */ -- 1.9.1
[PATCH 2/8] ARM: imx: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- arch/arm/mach-imx/mach-imx6q.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 4ad6e473cf83..9de3412af406 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -211,8 +211,9 @@ static void __init imx6q_1588_init(void) * set bit IOMUXC_GPR1[21]. Or the PTP clock must be from pad * (external OSC), and we need to clear the bit. */ - clksel = ptp_clk == enet_ref ? IMX6Q_GPR1_ENET_CLK_SEL_ANATOP : - IMX6Q_GPR1_ENET_CLK_SEL_PAD; + clksel = clk_is_match(ptp_clk, enet_ref) ? + IMX6Q_GPR1_ENET_CLK_SEL_ANATOP : + IMX6Q_GPR1_ENET_CLK_SEL_PAD; gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); if (!IS_ERR(gpr)) regmap_update_bits(gpr, IOMUXC_GPR1, -- 1.9.1
[PATCH 3/8] drm: armada: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- drivers/gpu/drm/armada/armada_510.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/armada/armada_510.c b/drivers/gpu/drm/armada/armada_510.c index ad3d2ebf95c9..862deafe8b24 100644 --- a/drivers/gpu/drm/armada/armada_510.c +++ b/drivers/gpu/drm/armada/armada_510.c @@ -53,7 +53,7 @@ static int armada510_crtc_compute_clock(struct armada_crtc *dcrtc, if (IS_ERR(clk)) return PTR_ERR(clk); - if (dcrtc->clk != clk) { + if (!clk_is_match(dcrtc->clk, clk)) { ret = clk_prepare_enable(clk); if (ret) return ret; -- 1.9.1
[PATCH 4/8] pwm: atmel-hlcdc: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index 522f7075bb1a..36475949b829 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c @@ -97,7 +97,7 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c, pwmcfg = ATMEL_HLCDC_PWMPS(pres); - if (new_clk != chip->cur_clk) { + if (!clk_is_match(new_clk, chip->cur_clk)) { u32 gencfg = 0; int ret; -- 1.9.1
[PATCH 5/8] serial: samsung: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- drivers/tty/serial/samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index af821a908720..b747066247df 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -1277,7 +1277,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, /* check to see if we need to change clock source */ - if (ourport->baudclk != clk) { + if (!clk_is_match(ourport->baudclk, clk)) { s3c24xx_serial_setsource(port, clk_sel); if (!IS_ERR(ourport->baudclk)) { -- 1.9.1
[PATCH 6/8] ASoC: fsl_esai: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- sound/soc/fsl/fsl_esai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 5c7597191e3f..6e00e51b98c2 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -269,7 +269,7 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, } /* Only EXTAL source can be output directly without using PSR and PM */ - if (ratio == 1 && clksrc == esai_priv->extalclk) { + if (ratio == 1 && clk_is_match(clksrc, esai_priv->extalclk)) { /* Bypass all the dividers if not being needed */ ecr |= tx ? ESAI_ECR_ETO : ESAI_ECR_ERO; goto out; -- 1.9.1
[PATCH 7/8] ASoC: fsl_spdif: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- sound/soc/fsl/fsl_spdif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 75870c0ea2c9..91eb3aef7f02 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1049,7 +1049,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index, bool round) { const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; - bool is_sysclk = clk == spdif_priv->sysclk; + bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk); u64 rate_ideal, rate_actual, sub; u32 sysclk_dfmin, sysclk_dfmax; u32 txclk_df, sysclk_df, arate; @@ -1143,7 +1143,7 @@ static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, spdif_priv->txclk_src[index], rate[index]); dev_dbg(&pdev->dev, "use txclk df %d for %dHz sample rate\n", spdif_priv->txclk_df[index], rate[index]); - if (spdif_priv->txclk[index] == spdif_priv->sysclk) + if (clk_is_match(spdif_priv->txclk[index], spdif_priv->sysclk)) dev_dbg(&pdev->dev, "use sysclk df %d for %dHz sample rate\n", spdif_priv->sysclk_df[index], rate[index]); dev_dbg(&pdev->dev, "the best rate for %dHz sample rate is %dHz\n", -- 1.9.1
[PATCH 8/8] ASoC: kirkwood: fix struct clk pointer comparing
Since commit 035a61c314eb ("clk: Make clk API return per-user struct clk instances"), clk API users can no longer check if two struct clk pointers are pointing to the same hardware clock, i.e. struct clk_hw, by simply comparing two pointers. That's because with the per-user clk change, a brand new struct clk is created whenever clients try to look up the clock by calling clk_get() or sister functions like clk_get_sys() and of_clk_get(). This changes the original behavior where the struct clk is only created for once when clock driver registers the clock to CCF in the first place. The net change here is before commit 035a61c314eb the struct clk pointer is unique for given hardware clock, while after the commit the pointers returned by clk lookup calls become different for the same hardware clock. That said, the struct clk pointer comparing in the code doesn't work any more. Call helper function clk_is_match() instead to fix the problem. Signed-off-by: Shawn Guo --- sound/soc/kirkwood/kirkwood-i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index def7d8260c4e..d19483081f9b 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -579,7 +579,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) if (PTR_ERR(priv->extclk) == -EPROBE_DEFER) return -EPROBE_DEFER; } else { - if (priv->extclk == priv->clk) { + if (clk_is_match(priv->extclk, priv->clk)) { devm_clk_put(&pdev->dev, priv->extclk); priv->extclk = ERR_PTR(-EINVAL); } else { -- 1.9.1
[PATCH 0/8] Fix struct clk pointer comparing
On Wed, Feb 25, 2015 at 10:53:30PM +0800, Shawn Guo wrote: > On the first day back from Chinese new year holiday, I got a regression > report from rmk, saying Ethernet stops working on HimmingBoard with > v4.0-rc1. > > I read through the thread [1] and found a couple of i.MX audio drivers > are also affected per Stephen's Coccinelle report. That's why I came up > with this series based on Quentin's structclk.cocci, Stephen's result > and Mike's input (thanks all). Not all places need to be fixed in this way. There are two broad cases: 1. Where we are trying to determine if two clocks obtained from clk_get() are the same clock. IOW: probe() { clk1 = clk_get(dev, ...); clk2 = clk_get(dev, ...); if (clk1 == clk2) do_something(); } 2. Where we are trying to determine if a clock selected from a set of previously obtained clk_get()'d clocks is the same as a one of those clocks. IOW: probe() { clk1 = clk_get(dev, ...); clk2 = clk_get(dev, ...); } ... some_fn() { clk = select_best_clock(clk1, clk2); if (clk == previously_selected_clk) { previously_selected_clk = clk; do_something(); } } Case 1 applies in places like the Kirkwood I2S driver, and the iMX6 ethernet code, and it's these cases which need to be fixed. Case 2 applies in the Armada DRM driver, and these cases need not be "fixed". To put it a different way: case 1 is when you're testing to see whether two clocks refer to the same clock. case 2 is when you're testing whether the cached clk cookie is the same. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
[Bug 83226] Allow use of ColorRange and ColorSpace in xorg.conf.d files
https://bugs.freedesktop.org/show_bug.cgi?id=83226 --- Comment #18 from Alex Deucher --- (In reply to John from comment #17) > I'm not sure if it is because of these patches, or 4.0-rc1 (I moved the 2 of > them together), but now when my screen goes off (energy saving stuff), I > lose the hdmi audio, but when I move the mouse the screen is back but not > the audio. > Switching it back on with xrandr works though. Not likely related. Please file a separate bug for that. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/ac831a5c/attachment.html>
[PATCH 00/04 libdrm] The rocky road to building with -Wextra
On 23 February 2015 at 13:57, Emil Velikov wrote: > Hi all, > > A few small patches, that handle the initial step of building the whole > of libdrm with WARN_CFLAGS (-Wall -Wextra and friends). > > The first patch makes sure we build everything at make distcheck time, > followed by a couple of warnings-turned-errors, and finally adding the > cflags everywhere in the project. > > Individual fixes for the 66 warnings will follow up in due time :-) > Hi Jan, Slightly forgot that you're not subscribed to the list. Considering your earlier work on this can you take a look at the series please. This lays the groundwork, and a later one [1] nukes some of the warnings. Thank Emil [1] http://lists.freedesktop.org/archives/dri-devel/2015-February/077976.html
[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst
https://bugs.freedesktop.org/show_bug.cgi?id=73338 --- Comment #83 from r.andersen --- Hi, maybe this question is a bit silly, but how do I enable fan control? I just compiled and installed 4.0.0-rc1, but my fan is still spinning rather loudly. I'm using a Sapphire 7850 OC. Is the following the correct path for fan manipulations? /sys/class/drm/card0/device/hwmon/hwmon2 Below, I find the following pwm1/temp1 nodes: pwm1, pwm1_enable, pwm1_max, pwm1_min and temp1_input. cat pwm1_enable crashes my system. cat pwm1 -> 86 cat pwm1_max -> 255 cat pwm1_min -> 0 cat temp1_input -> 27000 Same result with 3.19 with patches applied mentioned in Comment #80 Do I have to set special kernel features or did I set special features I should not? Many thanks for your help. Raimund -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/27b00944/attachment.html>
[PATCH] drm: exynos: clean up dma_addr_t use
dma_addr_t may be 32 or 64 bits long on 32-bit CPUs, so we cannot cast it to a pointer without getting a compiler warning: drivers/gpu/drm/exynos/exynos_drm_buf.c: In function 'lowlevel_buffer_allocate': drivers/gpu/drm/exynos/exynos_drm_buf.c:109:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] buf->dma_addr = (dma_addr_t)NULL; ^ The use of pointers is wrong here anyway, and so is the cast to the same type, and printing the value as a 32-bit instance. This patch tries for address all these issues in the exynos drm driver, by printing the values as %pad and removing the bogus type casts. I've added '& 0x' masks in a few places I found where a dma_addr_t is assigned to a 32-bit value, as a reminder that this code will not work with 64-bit dma addresses. There should not be any change in the generated code here. Signed-off-by: Arnd Bergmann --- diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 63f02e2380ae..0512157b065f 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -335,7 +335,7 @@ static void decon_win_mode_set(struct exynos_drm_crtc *crtc, win_data->offset_x, win_data->offset_y); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", win_data->ovl_width, win_data->ovl_height); - DRM_DEBUG_KMS("paddr = 0x%lx\n", (unsigned long)win_data->dma_addr); + DRM_DEBUG_KMS("paddr = %pad\n", &win_data->dma_addr); DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", plane->fb_width, plane->crtc_width); } @@ -490,7 +490,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos) decon_shadow_protect_win(ctx, win, true); /* buffer start address */ - val = (unsigned long)win_data->dma_addr; + val = win_data->dma_addr & 0x; writel(val, ctx->regs + VIDW_BUF_START(win)); /* buffer size */ @@ -501,8 +501,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos) writel(win_data->offset_x, ctx->regs + VIDW_OFFSET_X(win)); writel(win_data->offset_y, ctx->regs + VIDW_OFFSET_Y(win)); - DRM_DEBUG_KMS("start addr = 0x%lx\n", - (unsigned long)win_data->dma_addr); + DRM_DEBUG_KMS("start addr = %pad\n", &win_data->dma_addr); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", win_data->ovl_width, win_data->ovl_height); diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 24994ba10e28..935157e65236 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -97,16 +97,15 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, goto err_free_attrs; } - DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", - (unsigned long)buf->dma_addr, - buf->size); + DRM_DEBUG_KMS("dma_addr(%pad), size(0x%lx)\n", + &buf->dma_addr, buf->size); return ret; err_free_attrs: dma_free_attrs(dev->dev, buf->size, buf->pages, - (dma_addr_t)buf->dma_addr, &buf->dma_attrs); - buf->dma_addr = (dma_addr_t)NULL; + buf->dma_addr, &buf->dma_attrs); + buf->dma_addr = 0; err_free: if (!is_drm_iommu_supported(dev)) drm_free_large(buf->pages); @@ -122,9 +121,8 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, return; } - DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", - (unsigned long)buf->dma_addr, - buf->size); + DRM_DEBUG_KMS("dma_addr(%pad), size(0x%lx)\n", + &buf->dma_addr, buf->size); sg_free_table(buf->sgt); @@ -133,13 +131,13 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, if (!is_drm_iommu_supported(dev)) { dma_free_attrs(dev->dev, buf->size, buf->cookie, - (dma_addr_t)buf->dma_addr, &buf->dma_attrs); + buf->dma_addr, &buf->dma_attrs); drm_free_large(buf->pages); } else dma_free_attrs(dev->dev, buf->size, buf->pages, - (dma_addr_t)buf->dma_addr, &buf->dma_attrs); + buf->dma_addr, &buf->dma_attrs); - buf->dma_addr = (dma_addr_t)NULL; + buf->dma_addr = 0; } struct exynos_drm_gem_buf *exynos_drm_init_buf(struct drm_device *dev, diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index d346d1e6eda0..b259c1bf8752 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -290,7 +290,7 @@ struct exynos_drm_gem_buf *e
[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst
https://bugs.freedesktop.org/show_bug.cgi?id=73338 --- Comment #84 from r.andersen --- ... and I should add echo "50" > pwm1 also makes my computer hang. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/15db1871/attachment.html>
[v3] libdrm: improvements to userspace exynos component
On 24 February 2015 at 14:20, Tobias Jakobi wrote: > Hello, > > here are some miscellaneous improvements (small features, bugfixes, spelling > fixes, etc.) for the exynos component of libdrm. The general idea is to let > userspace use the G2D engine functionality more > efficiently. > > If someone is interested in an application that actually makes use of this, > the RetroArch frontend has a custom video backend: > https://github.com/libretro/RetroArch/blob/master/gfx/drivers/exynos_gfx.c > > > Please review and let me know what I can improve. > > v2: > - Mention value of G2D scaling normalization factor (02/15). > - Moved patch (04/15) description from commit message to source itself, like > suggested by Joonyoung Shim. > > v3: > I integrated the suggestions by Emil Velikov and added two additional patches > to the series. One doing the header cleanup that Emil point out, another one > just a trivial whitespace thing. I'm resending > the whole series, since number of patches and order changed. > Thanks for the update. For the future please add the tags (tested-by,etc.) when resending patches. Don't worry about these I'll add them before pushing. The two extra patches look good imho. Inki, This cleanup series has been around for a little while now. v3 can be found at http://lists.freedesktop.org/archives/dri-devel/2015-February/078111.html Do you mind if we apply the trivial and tested* patches within the next week or so ? The more serious patches hw specific, etc are lacking preview and can be committed at a later stage. Thanks Emil [*] Patches 2-4, 6, 8, 10, 12, 14-17, out of which Joonyoung Shim has tested all but 12 and 17.
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #37 from Tom Stellard --- After examining the shader dumps one thing that looks suspicious to me is that in the good dump, we have several instructions like this: image_load v[9:12], 15, 0, 0, 0, 0, 0, 0, 0, v[4:7], s[8:15] But nothing is ever written to the last component of vaddr: v7 However, in the bad dumps we have: image_load v[8:11], 15, 0, 0, 0, 0, 0, 0, 0, v[1:4], s[8:15] And a value is stored in the last component of vaddr: v4 before every image load. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/a9e67a30/attachment.html>
[PATCH] drm: Remove redundant code in the getencoder ioctl
When enabling atomic state object for this ioctl in commit abd69c55dd8f1f71b33b8c6165217f4329db8f25 Author: Daniel Vetter Date: Tue Nov 25 23:50:05 2014 +0100 drm: Handle atomic state properly in kms getfoo ioctl I've forgotten to remove this hunk in one of the later revisions. drm_encoder_get_crtc already does this. Cc: Rob Clark Cc: Sean Paul Reviewed-by: Rob Clark Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_crtc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 4dacee645153..cc548ecd3634 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2284,8 +2284,6 @@ int drm_mode_getencoder(struct drm_device *dev, void *data, crtc = drm_encoder_get_crtc(encoder); if (crtc) enc_resp->crtc_id = crtc->base.id; - else if (encoder->crtc) - enc_resp->crtc_id = encoder->crtc->base.id; else enc_resp->crtc_id = 0; drm_modeset_unlock(&dev->mode_config.connection_mutex); -- 2.1.4
[PATCH 00/04 libdrm] The rocky road to building with -Wextra
On Wed, 2015-02-25 at 15:25 +, Emil Velikov wrote: > On 23 February 2015 at 13:57, Emil Velikov > wrote: > > Hi all, > > > > A few small patches, that handle the initial step of building the whole > > of libdrm with WARN_CFLAGS (-Wall -Wextra and friends). > > > > The first patch makes sure we build everything at make distcheck time, > > followed by a couple of warnings-turned-errors, and finally adding the > > cflags everywhere in the project. > > > > Individual fixes for the 66 warnings will follow up in due time :-) > > > Hi Jan, > > Slightly forgot that you're not subscribed to the list. > Considering your earlier work on this can you take a look at the series > please. > > This lays the groundwork, and a later one [1] nukes some of the warnings. Hi, I'm now subscribed to the list, but I somehow missed the series. The changes are pretty straightforward. You can add Reviewed-by: Jan Vesely I'll try to find some time to take a look at the other series too. jan > > Thank > Emil > > [1] http://lists.freedesktop.org/archives/dri-devel/2015-February/077976.html -- Jan Vesely -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/3c2a99f2/attachment.sig>
[PATCH libdrm 00/04] Silence compiler warnings
Hi, you can add Reviewed-by: Jan Vesely to 1,2, and 4. I think 3 needs someone from exynos to say whether the function should not be used somewhere (just to be on the safe side). jan On Mon, 2015-02-23 at 14:56 +, Emil Velikov wrote: > Short follow up to my earlier series "The rocky road to building with > -Wextra". This gets rid of ~20 warnings, with ~45 remainig. > > -Emil > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Jan Vesely -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/7e3f8e25/attachment.sig>
[libdrm][PATCH 3/2] Fix always true comparison.
gentle ping On Mon, 2015-02-09 at 19:10 -0500, Jan Vesely wrote: > The only user I found is xserver, it can return -1 under certain conditions. > So check for -1 explicitly. > > Signed-off-by: Jan Vesely > --- > > I could not find whether it's actually legal to return encoded negative values > in get_perm. This is a quick fix to detect the one case that I found. > > xf86drm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xf86drm.c b/xf86drm.c > index fb673b5..8e54ac9 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -335,7 +335,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type) > drm_server_info->get_perms(&serv_group, &serv_mode); > devmode = serv_mode ? serv_mode : DRM_DEV_MODE; > devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); > - group = (serv_group >= 0) ? serv_group : DRM_DEV_GID; > + group = (serv_group != ~0U) ? serv_group : DRM_DEV_GID; > } > > #if !defined(UDEV) -- Jan Vesely -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/90cbc774/attachment-0001.sig>
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #38 from Tom Stellard --- Created attachment 113825 --> https://bugs.freedesktop.org/attachment.cgi?id=113825&action=edit Possible fix Can you try this patch and see if it helps? -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/0fef6874/attachment.html>
[Bug 89034] Firefox crashing xserver and some major rendering bugs
https://bugs.freedesktop.org/show_bug.cgi?id=89034 --- Comment #39 from smoki --- Created attachment 113826 --> https://bugs.freedesktop.org/attachment.cgi?id=113826&action=edit subreg_enabled2.txt (In reply to Tom Stellard from comment #38) > Created attachment 113825 [details] [review] > Possible fix > > Can you try this patch and see if it helps? Still fail, as dump is now very different i attached it. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/7e7c2991/attachment.html>
[PATCH] drm/i915: fix failure to power off after hibernate
On ti, 2015-02-24 at 20:00 +0100, Bjørn Mork wrote: > Imre Deak writes: > > > The poweroff handlers undo the actions of the thaw handlers. As the > > original commit stated saving the registers is not needed there, but > > it's also not a big overhead and there should be no problem doing it. We > > are planning to optimize the hibernation sequence by for example not > > shutting down the display between freeze and thaw, and also getting rid > > of unnecessary steps at the power off phase. But before that we want to > > actually unify things rather than having special cases, as maintaining > > the special code paths caused already quite a lot of problems for us so > > far. > > That sounds like a worthy goal. I don't understand what you hope to > achieve by having a poweroff_late hook, since there aren't really > anything useful left to do at the point it is called, but if you want a > dummy callback there for code structure reasons then fine. There are the following reasons for shutting down the device properly during hibernation: - ACPI mandates that the OSPM (the kernel in our case) puts all devices into D3 that are not wake-up sources (i915 is not) (Kudos to Ville for pointing this out) - Embedded panels have a well defined shutdown sequence. We don't have any good reason to not follow this, in fact for some panels the subsequent reinitialization could be problematic in case of a hard power-off. (Thanks to Jani for this info) In fact the only reason why we didn't put the device into PCI D3 before the patch you bisected, is kind of arbitrary. The PCI core puts every device into D3 unless its driver saves the device's PCI state on its own. Since before that patch we did save the state, but haven't put the device into D3 it stayed in D0. That was definitely not intentional and as such we depended on the BIOS to correct this for us afterwards. > But you cannot just run around breaking stuff while slowly moving > towards this goal over multiple releases... v3.19 is currently broken > and that seems totally unnecessary. > > In any case: You should have noticed this problem while testing your > patches. The breakage is 100% reproducible. Unfortunately I had to do a > bisect to realize what you had done to the i915 driver, something I > unfortunately didn't find time to do before v3.19 was released. But I > do find it unnecessary to release with such bugs. Any attempt to > exercise the code path you modified would have revealed the bug. We tested these patches on numerous platforms and haven't seen the issue you reported. Based on your feedback the current assumption is that this is a bug in your BIOS, which tries to access the device despite it being powered down. We're trying our best to test each change we commit on a big set of platforms, but - especially on older hardware with random BIOS versions/configurations - full coverage is not possible. So we depend on reports like yours a lot to fill in the gaps. > > Reverting the commit may hide some other issue, so before doing that > > could you try the following patch: > > http://lists.freedesktop.org/archives/intel-gfx/2015-February/060529.html > > Makes no difference. I assume that patch fixes an unrelated bug? The > age and reported symptoms indicates so. Note that I am reporting a > regression introduced after v3.18, while that seems to fix a bug > introduced in v3.17. Both v3.17 and v3.18 (including v3.18.6), as > well as earlier releases, work fine for me. Ok, thanks for trying. > > If with that you still get the hang could you try on top of that the > > patch below, first having only pci_set_power_state uncommented, then > > both pci_set_power_state and pci_disable_device uncommented? > > That patch fixes the problem, with only pci_set_power_state commented > out. Do you still want me to try with pci_disable_device() commented > out as well? No, but it would help if you could still try the two attached patch separately, without any of the previous workarounds. Based on the result, we'll follow up with a fix that adds for your specific platform either of the attached workarounds or simply avoids putting the device into D3 (corresponding to the patch you already tried). Thanks, Imre -- next part -- A non-text attachment was scrubbed... Name: 0001-drm-i915-zero-PCI_COMMAND-at-the-end-of-hibernation.patch Type: text/x-patch Size: 783 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/59ff0ced/attachment.bin> -- next part -- A non-text attachment was scrubbed... Name: 0002-drm-i915-use-D3cold-instead-of-D3hot-during-suspend-.patch Type: text/x-patch Size: 804 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/59ff0ced/attachment-0001.bin>
[libdrm][PATCH 3/2] Fix always true comparison.
On 25/02/15 17:11, Jan Vesely wrote: > gentle ping > Afaics it's very had to get in this code nowadays - drm_server_info is set only via the legacy (?) function drmSetServerInfo. With the latter only(?) used by the xserver when working with dri1 modules. So testing this is likely to be very painful :-( This code hasn't changed since before 2007, so I doubt there are many people that know the details about it, so we might as well leave it for now ? -Emil > > On Mon, 2015-02-09 at 19:10 -0500, Jan Vesely wrote: >> The only user I found is xserver, it can return -1 under certain conditions. >> So check for -1 explicitly. >> >> Signed-off-by: Jan Vesely >> --- >> >> I could not find whether it's actually legal to return encoded negative >> values >> in get_perm. This is a quick fix to detect the one case that I found. >> >> xf86drm.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/xf86drm.c b/xf86drm.c >> index fb673b5..8e54ac9 100644 >> --- a/xf86drm.c >> +++ b/xf86drm.c >> @@ -335,7 +335,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type) >> drm_server_info->get_perms(&serv_group, &serv_mode); >> devmode = serv_mode ? serv_mode : DRM_DEV_MODE; >> devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); >> -group = (serv_group >= 0) ? serv_group : DRM_DEV_GID; >> +group = (serv_group != ~0U) ? serv_group : DRM_DEV_GID; >> } >> >> #if !defined(UDEV) >
[PATCH libdrm 00/04] Silence compiler warnings
On 25/02/15 17:09, Jan Vesely wrote: > Hi, > > you can add > Reviewed-by: Jan Vesely > to 1,2, and 4. > I think 3 needs someone from exynos to say whether the function should > not be used somewhere (just to be on the safe side). > Great, thanks. For anyone interested I will give it a few days, and I'll push both series (minus patch 3 here). -Emil
Fwd: drm-next-4.1-wip: NI/Turks *ERROR* chosen encoder in use 4
Hello Dave, latest change comes from you. author Dave Airlie 2015-02-23 23:24:03 (GMT) committer Alex Deucher 2015-02-24 19:52:03 (GMT) commit 8eeefdc92b7e0b05a627ec7e3cb3ce31c03362ab (patch) Any idea? Thanks, Dieter Originalnachricht Betreff: drm-next-4.1-wip: NI/Turks *ERROR* chosen encoder in use 4 Datum: 25.02.2015 05:20 Von: Dieter Nützel An: Alex Deucher Kopie: Dri Devel Hello Alex, I get this in dmesg: [ 26.001926] [drm:radeon_atom_pick_dig_encoder [radeon]] *ERROR* chosen encoder in use 4 What do you need? -Dieter ___ dri-devel mailing list dri-devel at lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel -- next part -- A non-text attachment was scrubbed... Name: dmesg-4.1-wip.log.xz Type: application/x-xz Size: 14832 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/0f436fd5/attachment-0001.bin>
drm-next-4.1-wip: NI/Turks *ERROR* chosen encoder in use 4
On Tue, Feb 24, 2015 at 11:20 PM, Dieter Nützel wrote: > Hello Alex, > > I get this in dmesg: > > [ 26.001926] [drm:radeon_atom_pick_dig_encoder [radeon]] *ERROR* chosen > encoder in use 4 > > What do you need? The message is harmless I think. It's just debugging output from the DP MST patches. I think what's happening is that when you change the mode on an encoder that is already enabled, it see that the encoder is already in use (by itself). I think the fix would be to call radeon_atom_release_dig_encoder() in the encoder prepare callback, but I'm not sure if that will negatively affect MST or not. Dave? Alex > > -Dieter
[pull] radeon drm-fixes-4.0
Hi Dave, Radeon fixes for 4.0, all over the place. The following changes since commit 5b49afd60a850acca321a87eb83ab0c387725206: Merge tag 'drm-amdkfd-fixes-2015-02-23' of git://people.freedesktop.org/~gabbayo/linux into drm-fixes (2015-02-24 11:10:14 +1000) are available in the git repository at: git://people.freedesktop.org/~agd5f/linux drm-fixes-4.0 for you to fetch changes up to 3473f542ab707afbb6e6057ddb6f3b40ef22e093: drm/radeon: only enable DP audio if the monitor supports it (2015-02-25 16:06:10 -0500) Alex Deucher (6): drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh drm/radeon: disable mclk switching with 120hz+ monitors drm/radeon: dump full IB if we hit a packet error drm/radeon: fix 1 RB harvest config setup for TN/RL drm/radeon: fix atom aux payload size check for writes (v2) drm/radeon: only enable DP audio if the monitor supports it Christian König (2): drm/radeon: enable SRBM timeout interrupt on SI drm/radeon: enable SRBM timeout interrupt on EG/NI Leo Liu (1): drm/radeon: enable SRBM timeout interrupt on CIK v2 Nathan-J. Hirschauer (1): drm/radeon: enable native backlight control on old macs drivers/gpu/drm/radeon/atombios_dp.c | 7 +++ drivers/gpu/drm/radeon/atombios_encoders.c | 21 +++-- drivers/gpu/drm/radeon/cik.c | 8 drivers/gpu/drm/radeon/cikd.h | 4 drivers/gpu/drm/radeon/evergreen.c | 7 +++ drivers/gpu/drm/radeon/evergreend.h| 4 drivers/gpu/drm/radeon/ni.c| 10 ++ drivers/gpu/drm/radeon/nid.h | 4 drivers/gpu/drm/radeon/r600_dpm.c | 2 +- drivers/gpu/drm/radeon/radeon_cs.c | 16 ++-- drivers/gpu/drm/radeon/radeon_encoders.c | 3 +++ drivers/gpu/drm/radeon/radeon_pm.c | 6 ++ drivers/gpu/drm/radeon/si.c| 22 +++--- drivers/gpu/drm/radeon/sid.h | 4 14 files changed, 98 insertions(+), 20 deletions(-)
r600 - NI/Turks: flickering with 'geom-outlining-150'
Am 25.02.2015 09:31, schrieb Michel Dänzer: > On 25.02.2015 13:04, Dieter Nützel wrote: >> Am 20.02.2015 17:29, schrieb Alex Deucher: >>> On Fri, Feb 20, 2015 at 10:54 AM, Dieter Nützel >>> >>> wrote: Hello Alex, I get _today_ flickering with Mesa-demo 'geom-outlining-150'. It worked OK last night and I've reseted Mesa git back to 5c1aac1 but NO success. Only thing is I've used LLVM git of today, too and for GOOD result LLVM from 18th. Any hints? >>> >>> Please narrow it down to what update caused the issue and then use >>> git >>> to bisect. >>> >>> Alex >> >> Couldn't find a GOOD version (Mesa/LLVM) for bisect start so far. >> I've to search further. > > Note that the r600g driver doesn't use LLVM for graphics shader > compilation, so you should only need to search in Mesa and maybe the > kernel or libdrm. Thanks for the hint Michel. But, ughhh... ...in the minute it WORKS without a hitch! I'm running a new LLVM compilation with 4 cores and thought try it. System spec: Mesa 10.6.0-devel (git-cb25087) libdrm-2.4.59 (minor distro update on 24th) Linux 4.0.0-rc1-2.g1133f88-desktop+ (drm-next-4.1, 50c7535, 23 hours ago) I'll freeze LLVM (do not install latest compile) and try to bisect Mesa (?) 'cause kernel and libdrm did NOT changed compared to tests last night. -Dieter
[PATCH 01/38] drm/atomic: Rename drm_atomic_helper_commit_pre_planes() state argument
The argument contains a pointer to the old state, rename it to old_state like in all other commit helper functions. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/drm_atomic_helper.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 7e3a52b97c7d..6c5bfa2bd18a 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -770,18 +770,18 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) /** * drm_atomic_helper_commit_pre_planes - modeset commit before plane updates * @dev: DRM device - * @state: atomic state + * @old_state: atomic state object with old state structures * * This function commits the modeset changes that need to be committed before * updating planes. It shuts down all the outputs that need to be shut down and * prepares them (if required) with the new mode. */ void drm_atomic_helper_commit_pre_planes(struct drm_device *dev, -struct drm_atomic_state *state) +struct drm_atomic_state *old_state) { - disable_outputs(dev, state); - set_routing_links(dev, state); - crtc_set_mode(dev, state); + disable_outputs(dev, old_state); + set_routing_links(dev, old_state); + crtc_set_mode(dev, old_state); } EXPORT_SYMBOL(drm_atomic_helper_commit_pre_planes); -- 2.0.5
[PATCH 00/38] Renesas R-Car DU atomic updates support
Hello, This patch series implements atomic updates support for the rcar-du driver. The series starts with four core atomic helpers fixes/cleanups (two from Daniel that I have included here for completeness). It then follows with two fixes for the adv7511 driver and height fixes for the rcar-du driver. It finally gets to work by slowly reworking rcar-du until atomic updates are fully implemented and the transitional helpers gone. The patches are based on Dave's 'next' branch and available at git://linuxtv.org/pinchartl/fbdev.git drm/next/atomic The last patch contains a hardware plane allocator based solely on state objects, which could be useful as a base implementation should other drivers experience similar needs. Daniel Vetter (2): drm/atomic-helper: Rename commmit_post/pre_planes drm/atomic-helpers: make mode_set hooks optional Laurent Pinchart (36): drm/atomic: Rename drm_atomic_helper_commit_pre_planes() state argument drm/atomic-helpers: Fix documentation typos and wrong copy&paste drm: adv7511: Fix DDC error interrupt handling drm: adv7511: Fix nested sleep when reading EDID drm: rcar-du: Don't disable unused functions at init time drm: rcar-du: Remove drm_fbdev_cma_restore_mode() call at init time drm: rcar-du: Don't set connector->encoder at init time drm: rcar-du: Reorder CRTC functions drm: rcar-du: Wait for page flip completion when turning the CRTC off drm: rcar-du: Turn vblank on/off when enabling/disabling CRTC drm: rcar-du: Disable fbdev emulation when no connector is present drm: rcar-du: Define macros for the max number of groups, CRTCs and LVDS drm: rcar-du: Implement universal plane support drm: rcar-du: Fix hardware plane allocation drm: rcar-du: Implement planes atomic operations drm: rcar-du: Handle primary plane config through atomic plane ops drm: rcar-du: Wire up atomic state object scaffolding drm: rcar-du: Remove private copy of plane size and position drm: rcar-du: Replace LVDS encoder DPMS by enable/disable drm: rcar-du: Rework encoder enable/disable for atomic updates drm: rcar-du: Rework HDMI encoder enable/disable for atomic updates drm: rcar-du: Rework CRTC enable/disable for atomic updates drm: rcar-du: Switch plane update to atomic helpers drm: rcar-du: Switch mode config to atomic helpers drm: rcar-du: Switch connector DPMS to atomic helpers drm: rcar-du: Replace encoder mode_fixup with atomic_check drm: rcar-du: Implement asynchronous commit support drm: rcar-du: Switch page flip to atomic helpers drm: rcar-du: Switch plane set_property to atomic helpers drm: rcar-du: Rework plane setup code drm: rcar-du: Replace plane crtc and enabled fields by plane state drm: rcar-du: Remove unneeded rcar_du_crtc plane field drm: rcar-du: Move plane format to plane state drm: rcar-du: Move plane commit code from CRTC start to CRTC resume drm: rcar-du: Move group locking inside rcar_du_crtc_update_planes() drm: rcar-du: Fix race condition in hardware plane allocator drivers/gpu/drm/drm_atomic_helper.c | 68 +++-- drivers/gpu/drm/i2c/adv7511.c | 102 drivers/gpu/drm/i915/intel_atomic.c | 4 +- drivers/gpu/drm/msm/msm_atomic.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 400 +--- drivers/gpu/drm/rcar-du/rcar_du_crtc.h| 8 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 17 +- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 16 +- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 71 ++--- drivers/gpu/drm/rcar-du/rcar_du_group.h | 5 + drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 9 +- drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 65 +++-- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 333 ++-- drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 9 +- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 18 +- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h | 8 +- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 419 -- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 69 +++-- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 9 +- include/drm/drm_atomic_helper.h | 6 +- include/drm/drm_crtc_helper.h | 3 +- 21 files changed, 924 insertions(+), 719 deletions(-) -- Regards, Laurent Pinchart
[PATCH 02/38] drm/atomic-helper: Rename commmit_post/pre_planes
From: Daniel Vetter These names only make sense because of backwards compatability with the order used by the crtc helper library. There's not really any real requirement in the ordering here. So rename them to something more descriptive and update the kerneldoc a bit. Motivated in a discussion with Laurent about how to restore plane state for dpms for drivers with runtime pm. Signed-off-by: Daniel Vetter Acked-by: Laurent Pinchart --- drivers/gpu/drm/drm_atomic_helper.c | 40 +++-- drivers/gpu/drm/i915/intel_atomic.c | 4 ++-- drivers/gpu/drm/msm/msm_atomic.c| 4 ++-- include/drm/drm_atomic_helper.h | 6 +++--- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 6c5bfa2bd18a..0a203a7a9a17 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -768,34 +768,44 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) } /** - * drm_atomic_helper_commit_pre_planes - modeset commit before plane updates + * drm_atomic_helper_commit_modeset_disables - modeset commit to disable outputs * @dev: DRM device * @old_state: atomic state object with old state structures * - * This function commits the modeset changes that need to be committed before - * updating planes. It shuts down all the outputs that need to be shut down and + * This function shuts down all the outputs that need to be shut down and * prepares them (if required) with the new mode. + * + * For compatability with legacy crtc helpers this should be called before + * drm_atomic_helper_commit_planes(), which is what the default commit function + * does. But drivers with different needs can group the modeset commits together + * and do the plane commits at the end. This is useful for drivers doing runtime + * PM since planes updates then only happen when the CRTC is actually enabled. */ -void drm_atomic_helper_commit_pre_planes(struct drm_device *dev, -struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev, + struct drm_atomic_state *old_state) { disable_outputs(dev, old_state); set_routing_links(dev, old_state); crtc_set_mode(dev, old_state); } -EXPORT_SYMBOL(drm_atomic_helper_commit_pre_planes); +EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_disables); /** - * drm_atomic_helper_commit_post_planes - modeset commit after plane updates + * drm_atomic_helper_commit_modeset_enables - modeset commit to enable outputs * @dev: DRM device * @old_state: atomic state object with old state structures * - * This function commits the modeset changes that need to be committed after - * updating planes: It enables all the outputs with the new configuration which - * had to be turned off for the update. + * This function enables all the outputs with the new configuration which had to + * be turned off for the update. + * + * For compatability with legacy crtc helpers this should be called after + * drm_atomic_helper_commit_planes(), which is what the default commit function + * does. But drivers with different needs can group the modeset commits together + * and do the plane commits at the end. This is useful for drivers doing runtime + * PM since planes updates then only happen when the CRTC is actually enabled. */ -void drm_atomic_helper_commit_post_planes(struct drm_device *dev, - struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, + struct drm_atomic_state *old_state) { int ncrtcs = old_state->dev->mode_config.num_crtc; int i; @@ -861,7 +871,7 @@ void drm_atomic_helper_commit_post_planes(struct drm_device *dev, encoder->bridge->funcs->enable(encoder->bridge); } } -EXPORT_SYMBOL(drm_atomic_helper_commit_post_planes); +EXPORT_SYMBOL(drm_atomic_helper_commit_modeset_enables); static void wait_for_fences(struct drm_device *dev, struct drm_atomic_state *state) @@ -1030,11 +1040,11 @@ int drm_atomic_helper_commit(struct drm_device *dev, wait_for_fences(dev, state); - drm_atomic_helper_commit_pre_planes(dev, state); + drm_atomic_helper_commit_modeset_disables(dev, state); drm_atomic_helper_commit_planes(dev, state); - drm_atomic_helper_commit_post_planes(dev, state); + drm_atomic_helper_commit_modeset_enables(dev, state); drm_atomic_helper_wait_for_vblanks(dev, state); diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 19a9dd5408f3..011b8960fd75 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -134,9 +134,9 @@ int intel_atomic_c
[PATCH 03/38] drm/atomic-helpers: make mode_set hooks optional
From: Daniel Vetter With runtime PM the hw might still be off while doing the ->mode_set callbacks - runtime PM get/put should only happen in the enable/disable hooks to properly support DPMS. Which essentially makes these callbacks useless for drivers support runtime PM, so make them optional. Again motivated by discussions with Laurent. Signed-off-by: Daniel Vetter Acked-by: Laurent Pinchart --- drivers/gpu/drm/drm_atomic_helper.c | 5 +++-- include/drm/drm_crtc_helper.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 0a203a7a9a17..caafc237c28b 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -723,7 +723,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) funcs = crtc->helper_private; - if (crtc->state->enable) { + if (crtc->state->enable && funcs->mode_set_nofb) { DRM_DEBUG_KMS("modeset on [CRTC:%d]\n", crtc->base.id); @@ -759,7 +759,8 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) * Each encoder has at most one connector (since we always steal * it away), so we won't call call mode_set hooks twice. */ - funcs->mode_set(encoder, mode, adjusted_mode); + if (funcs->mode_set) + funcs->mode_set(encoder, mode, adjusted_mode); if (encoder->bridge && encoder->bridge->funcs->mode_set) encoder->bridge->funcs->mode_set(encoder->bridge, diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index c250a22b39ab..92d5135b55d2 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h @@ -89,6 +89,7 @@ struct drm_crtc_helper_funcs { int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode, int x, int y, struct drm_framebuffer *old_fb); + /* Actually set the mode for atomic helpers, optional */ void (*mode_set_nofb)(struct drm_crtc *crtc); /* Move the crtc on the current fb to the given position *optional* */ @@ -119,7 +120,7 @@ struct drm_crtc_helper_funcs { * @mode_fixup: try to fixup proposed mode for this connector * @prepare: part of the disable sequence, called before the CRTC modeset * @commit: called after the CRTC modeset - * @mode_set: set this mode + * @mode_set: set this mode, optional for atomic helpers * @get_crtc: return CRTC that the encoder is currently attached to * @detect: connection status detection * @disable: disable encoder when not in use (overrides DPMS off) -- 2.0.5
[PATCH 05/38] drm: adv7511: Fix DDC error interrupt handling
The DDC error interrupt bit is located in REG_INT1, not REG_INT0. Update both the interrupt wait code and the interrupt sources reset code accordingly. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/i2c/adv7511.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c index fa140e04d5fa..5109c215018e 100644 --- a/drivers/gpu/drm/i2c/adv7511.c +++ b/drivers/gpu/drm/i2c/adv7511.c @@ -467,14 +467,16 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, block); ret = adv7511_wait_for_interrupt(adv7511, ADV7511_INT0_EDID_READY | - ADV7511_INT1_DDC_ERROR, 200); + (ADV7511_INT1_DDC_ERROR << 8), 200); if (!(ret & ADV7511_INT0_EDID_READY)) return -EIO; } regmap_write(adv7511->regmap, ADV7511_REG_INT(0), -ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR); +ADV7511_INT0_EDID_READY); + regmap_write(adv7511->regmap, ADV7511_REG_INT(1), +ADV7511_INT1_DDC_ERROR); /* Break this apart, hopefully more I2C controllers will * support 64 byte transfers than 256 byte transfers @@ -528,7 +530,9 @@ static int adv7511_get_modes(struct drm_encoder *encoder, /* Reading the EDID only works if the device is powered */ if (adv7511->dpms_mode != DRM_MODE_DPMS_ON) { regmap_write(adv7511->regmap, ADV7511_REG_INT(0), -ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR); +ADV7511_INT0_EDID_READY); + regmap_write(adv7511->regmap, ADV7511_REG_INT(1), +ADV7511_INT1_DDC_ERROR); regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, ADV7511_POWER_POWER_DOWN, 0); adv7511->current_edid_segment = -1; @@ -563,7 +567,9 @@ static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode) adv7511->current_edid_segment = -1; regmap_write(adv7511->regmap, ADV7511_REG_INT(0), -ADV7511_INT0_EDID_READY | ADV7511_INT1_DDC_ERROR); +ADV7511_INT0_EDID_READY); + regmap_write(adv7511->regmap, ADV7511_REG_INT(1), +ADV7511_INT1_DDC_ERROR); regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER, ADV7511_POWER_POWER_DOWN, 0); /* -- 2.0.5
dri-devel@lists.freedesktop.org
The kerneldoc blocks for the drm_atomic_helper_*_set_property() functions seem to have been copied from the plane disable handler without being properly updated. Fix them. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/drm_atomic_helper.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index caafc237c28b..df13c70d7899 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1689,12 +1689,13 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_set_config); /** - * drm_atomic_helper_crtc_set_property - helper for crtc prorties + * drm_atomic_helper_crtc_set_property - helper for crtc properties * @crtc: DRM crtc * @property: DRM property * @val: value of property * - * Provides a default plane disablle handler using the atomic driver interface. + * Provides a default crtc set_property handler using the atomic driver + * interface. * * RETURNS: * Zero on success, error code on failure @@ -1748,12 +1749,13 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_crtc_set_property); /** - * drm_atomic_helper_plane_set_property - helper for plane prorties + * drm_atomic_helper_plane_set_property - helper for plane properties * @plane: DRM plane * @property: DRM property * @val: value of property * - * Provides a default plane disable handler using the atomic driver interface. + * Provides a default plane set_property handler using the atomic driver + * interface. * * RETURNS: * Zero on success, error code on failure @@ -1807,12 +1809,13 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_plane_set_property); /** - * drm_atomic_helper_connector_set_property - helper for connector prorties + * drm_atomic_helper_connector_set_property - helper for connector properties * @connector: DRM connector * @property: DRM property * @val: value of property * - * Provides a default plane disablle handler using the atomic driver interface. + * Provides a default connector set_property handler using the atomic driver + * interface. * * RETURNS: * Zero on success, error code on failure -- 2.0.5
[PATCH 06/38] drm: adv7511: Fix nested sleep when reading EDID
The EDID read code waits for the read completion interrupt to occur using wait_event_interruptible(). The condition passed to the macro reads I2C registers. This results in sleeping with the task state set to TASK_INTERRUPTIBLE, triggering a WARN_ON() introduced in commit 8eb23b9f35aae ("sched: Debug nested sleeps"). Fix this by reworking the EDID read code. Instead of checking whether the read is complete through I2C reads, handle the interrupt registers in the interrupt handler and update a new edid_read flag accordingly. As a side effect both the IRQ and polling code paths now process the interrupt sources through the same code path, simplifying the code. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/i2c/adv7511.c | 96 +-- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c index 5109c215018e..60ab1f75d58e 100644 --- a/drivers/gpu/drm/i2c/adv7511.c +++ b/drivers/gpu/drm/i2c/adv7511.c @@ -33,6 +33,7 @@ struct adv7511 { unsigned int current_edid_segment; uint8_t edid_buf[256]; + bool edid_read; wait_queue_head_t wq; struct drm_encoder *encoder; @@ -379,69 +380,71 @@ static bool adv7511_hpd(struct adv7511 *adv7511) return false; } -static irqreturn_t adv7511_irq_handler(int irq, void *devid) -{ - struct adv7511 *adv7511 = devid; - - if (adv7511_hpd(adv7511)) - drm_helper_hpd_irq_event(adv7511->encoder->dev); - - wake_up_all(&adv7511->wq); - - return IRQ_HANDLED; -} - -static unsigned int adv7511_is_interrupt_pending(struct adv7511 *adv7511, -unsigned int irq) +static int adv7511_irq_process(struct adv7511 *adv7511) { unsigned int irq0, irq1; - unsigned int pending; int ret; ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(0), &irq0); if (ret < 0) - return 0; + return ret; + ret = regmap_read(adv7511->regmap, ADV7511_REG_INT(1), &irq1); if (ret < 0) - return 0; + return ret; + + regmap_write(adv7511->regmap, ADV7511_REG_INT(0), irq0); + regmap_write(adv7511->regmap, ADV7511_REG_INT(1), irq1); + + if (irq0 & ADV7511_INT0_HDP) + drm_helper_hpd_irq_event(adv7511->encoder->dev); + + if (irq0 & ADV7511_INT0_EDID_READY || irq1 & ADV7511_INT1_DDC_ERROR) { + adv7511->edid_read = true; - pending = (irq1 << 8) | irq0; + if (adv7511->i2c_main->irq) + wake_up_all(&adv7511->wq); + } - return pending & irq; + return 0; } -static int adv7511_wait_for_interrupt(struct adv7511 *adv7511, int irq, - int timeout) +static irqreturn_t adv7511_irq_handler(int irq, void *devid) +{ + struct adv7511 *adv7511 = devid; + int ret; + + ret = adv7511_irq_process(adv7511); + return ret < 0 ? IRQ_NONE : IRQ_HANDLED; +} + +/* - + * EDID retrieval + */ + +static int adv7511_wait_for_edid(struct adv7511 *adv7511, int timeout) { - unsigned int pending; int ret; if (adv7511->i2c_main->irq) { ret = wait_event_interruptible_timeout(adv7511->wq, - adv7511_is_interrupt_pending(adv7511, irq), - msecs_to_jiffies(timeout)); - if (ret <= 0) - return 0; - pending = adv7511_is_interrupt_pending(adv7511, irq); + adv7511->edid_read, msecs_to_jiffies(timeout)); } else { - if (timeout < 25) - timeout = 25; - do { - pending = adv7511_is_interrupt_pending(adv7511, irq); - if (pending) + for (; timeout > 0; timeout -= 25) { + ret = adv7511_irq_process(adv7511); + if (ret < 0) + break; + + if (adv7511->edid_read) break; + msleep(25); - timeout -= 25; - } while (timeout >= 25); + } } - return pending; + return adv7511->edid_read ? 0 : -EIO; } -/* - - * EDID retrieval - */ - static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) { @@ -463,21 +466,14 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, return ret; if (status != 2) { + adv7511->edid_read = false; regmap_write(adv7511->r
[PATCH 10/38] drm: rcar-du: Reorder CRTC functions
The next commit will need functions to be reordered to avoid forward declarations. Do it separately to help review. This only moves functions without any change to the code. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 142 +++-- 1 file changed, 83 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 25c7a998fc2c..e0562f2b3261 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -99,6 +99,10 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc) clk_disable_unprepare(rcrtc->clock); } +/* - + * Hardware Setup + */ + static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) { const struct drm_display_mode *mode = &rcrtc->crtc.mode; @@ -256,6 +260,55 @@ void rcar_du_crtc_update_planes(struct drm_crtc *crtc) dspr); } +/* - + * Page Flip + */ + +void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc, + struct drm_file *file) +{ + struct drm_pending_vblank_event *event; + struct drm_device *dev = rcrtc->crtc.dev; + unsigned long flags; + + /* Destroy the pending vertical blanking event associated with the +* pending page flip, if any, and disable vertical blanking interrupts. +*/ + spin_lock_irqsave(&dev->event_lock, flags); + event = rcrtc->event; + if (event && event->base.file_priv == file) { + rcrtc->event = NULL; + event->base.destroy(&event->base); + drm_vblank_put(dev, rcrtc->index); + } + spin_unlock_irqrestore(&dev->event_lock, flags); +} + +static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) +{ + struct drm_pending_vblank_event *event; + struct drm_device *dev = rcrtc->crtc.dev; + unsigned long flags; + + spin_lock_irqsave(&dev->event_lock, flags); + event = rcrtc->event; + rcrtc->event = NULL; + spin_unlock_irqrestore(&dev->event_lock, flags); + + if (event == NULL) + return; + + spin_lock_irqsave(&dev->event_lock, flags); + drm_send_vblank_event(dev, rcrtc->index, event); + spin_unlock_irqrestore(&dev->event_lock, flags); + + drm_vblank_put(dev, rcrtc->index); +} + +/* - + * Start/Stop and Suspend/Resume + */ + static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) { struct drm_crtc *crtc = &rcrtc->crtc; @@ -350,6 +403,10 @@ static void rcar_du_crtc_update_base(struct rcar_du_crtc *rcrtc) rcar_du_plane_update_base(rcrtc->plane); } +/* - + * CRTC Functions + */ + static void rcar_du_crtc_dpms(struct drm_crtc *crtc, int mode) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); @@ -485,65 +542,6 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .disable = rcar_du_crtc_disable, }; -void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc, - struct drm_file *file) -{ - struct drm_pending_vblank_event *event; - struct drm_device *dev = rcrtc->crtc.dev; - unsigned long flags; - - /* Destroy the pending vertical blanking event associated with the -* pending page flip, if any, and disable vertical blanking interrupts. -*/ - spin_lock_irqsave(&dev->event_lock, flags); - event = rcrtc->event; - if (event && event->base.file_priv == file) { - rcrtc->event = NULL; - event->base.destroy(&event->base); - drm_vblank_put(dev, rcrtc->index); - } - spin_unlock_irqrestore(&dev->event_lock, flags); -} - -static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) -{ - struct drm_pending_vblank_event *event; - struct drm_device *dev = rcrtc->crtc.dev; - unsigned long flags; - - spin_lock_irqsave(&dev->event_lock, flags); - event = rcrtc->event; - rcrtc->event = NULL; - spin_unlock_irqrestore(&dev->event_lock, flags); - - if (event == NULL) - return; - - spin_lock_irqsave(&dev->event_lock, flags); - drm_send_vblank_event(dev, rcrtc->index, event); - spin_unlock_irqrestore(&dev->event_lock, flags); - - drm_vblank_put(dev, rcrtc->index); -} - -static irqreturn_t rcar_du_crtc_irq(int irq, void *arg) -{ - struct rcar_du_crtc *rcrtc = arg; - irqreturn_t ret = IRQ_NONE; - u32 status; - - status = rcar_du_crtc_read(rcrtc, DSSR); - rcar_du_crtc_write(rcrtc, DSRCR, status & DSRCR_MASK); - -
[PATCH 11/38] drm: rcar-du: Wait for page flip completion when turning the CRTC off
Turning a CRTC off will prevent a queued page flip from ever completing, potentially confusing userspace. Wait for queued page flips to complete before turning the CRTC off to avoid this. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 35 ++ drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index e0562f2b3261..7f5ae0269a61 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -300,11 +300,39 @@ static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) spin_lock_irqsave(&dev->event_lock, flags); drm_send_vblank_event(dev, rcrtc->index, event); + wake_up(&rcrtc->flip_wait); spin_unlock_irqrestore(&dev->event_lock, flags); drm_vblank_put(dev, rcrtc->index); } +static bool rcar_du_crtc_page_flip_pending(struct rcar_du_crtc *rcrtc) +{ + struct drm_device *dev = rcrtc->crtc.dev; + unsigned long flags; + bool pending; + + spin_lock_irqsave(&dev->event_lock, flags); + pending = rcrtc->event != NULL; + spin_unlock_irqrestore(&dev->event_lock, flags); + + return pending; +} + +static void rcar_du_crtc_wait_page_flip(struct rcar_du_crtc *rcrtc) +{ + struct rcar_du_device *rcdu = rcrtc->group->dev; + + if (wait_event_timeout(rcrtc->flip_wait, + !rcar_du_crtc_page_flip_pending(rcrtc), + msecs_to_jiffies(50))) + return; + + dev_warn(rcdu->dev, "page flip timeout\n"); + + rcar_du_crtc_finish_page_flip(rcrtc); +} + /* - * Start/Stop and Suspend/Resume */ @@ -365,6 +393,11 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc) if (!rcrtc->started) return; + /* Wait for page flip completion before stopping the CRTC as userspace +* excepts page flips to eventually complete. +*/ + rcar_du_crtc_wait_page_flip(rcrtc); + mutex_lock(&rcrtc->group->planes.lock); rcrtc->plane->enabled = false; rcar_du_crtc_update_planes(crtc); @@ -644,6 +677,8 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) return -EPROBE_DEFER; } + init_waitqueue_head(&rcrtc->flip_wait); + rcrtc->group = rgrp; rcrtc->mmio_offset = mmio_offsets[index]; rcrtc->index = index; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index d2f89f7d2e5e..fb39e040f17b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -15,6 +15,7 @@ #define __RCAR_DU_CRTC_H__ #include +#include #include #include @@ -32,6 +33,8 @@ struct rcar_du_crtc { bool started; struct drm_pending_vblank_event *event; + wait_queue_head_t flip_wait; + unsigned int outputs; int dpms; -- 2.0.5
[PATCH 14/38] drm: rcar-du: Define macros for the max number of groups, CRTCs and LVDS
Let's avoid magic constants. Beside increasing code readability, it will also ensure that no location will be forgotten when raising the maximum number of groups, CRTCs or LVDS encoders Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index c5b9ea6a7eaa..d1ede13cb1d5 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h @@ -64,6 +64,10 @@ struct rcar_du_device_info { unsigned int num_lvds; }; +#define RCAR_DU_MAX_CRTCS 3 +#define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2) +#define RCAR_DU_MAX_LVDS 2 + struct rcar_du_device { struct device *dev; const struct rcar_du_device_info *info; @@ -73,13 +77,13 @@ struct rcar_du_device { struct drm_device *ddev; struct drm_fbdev_cma *fbdev; - struct rcar_du_crtc crtcs[3]; + struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS]; unsigned int num_crtcs; - struct rcar_du_group groups[2]; + struct rcar_du_group groups[RCAR_DU_MAX_GROUPS]; unsigned int dpad0_source; - struct rcar_du_lvdsenc *lvds[2]; + struct rcar_du_lvdsenc *lvds[RCAR_DU_MAX_LVDS]; }; static inline bool rcar_du_has(struct rcar_du_device *rcdu, -- 2.0.5
[PATCH 15/38] drm: rcar-du: Implement universal plane support
Explicitly create the CRTC primary plane instead of relying on the core helpers to do so. This simplifies the plane logic by merging the KMS and software planes. Reject plane API operations on the primary planes for now, as that code will anyway be refactored when implementing support for atomic updates. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 3 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 7 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 65 +++-- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 17 - 4 files changed, 40 insertions(+), 52 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 5cf2cac75146..c2ca2a302f44 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -692,7 +692,8 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) rcrtc->plane->crtc = crtc; - ret = drm_crtc_init(rcdu->ddev, crtc, &crtc_funcs); + ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, &rcrtc->plane->plane, + NULL, &crtc_funcs); if (ret < 0) return ret; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 888df404932e..413145de3db3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -439,13 +439,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) encoder->possible_clones = (1 << num_encoders) - 1; } - /* Now that the CRTCs have been initialized register the planes. */ - for (i = 0; i < num_groups; ++i) { - ret = rcar_du_planes_register(&rcdu->groups[i]); - if (ret < 0) - return ret; - } - drm_kms_helper_poll_init(dev); if (dev->mode_config.num_connector) { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 50f2f2b20d39..242db1e1a1e4 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -26,14 +26,9 @@ #define RCAR_DU_COLORKEY_SOURCE(1 << 24) #define RCAR_DU_COLORKEY_MASK (1 << 24) -struct rcar_du_kms_plane { - struct drm_plane plane; - struct rcar_du_plane *hwplane; -}; - static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane) { - return container_of(plane, struct rcar_du_kms_plane, plane)->hwplane; + return container_of(plane, struct rcar_du_plane, plane); } static u32 rcar_du_plane_read(struct rcar_du_group *rgrp, @@ -299,6 +294,9 @@ rcar_du_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int nplanes; int ret; + if (plane->type != DRM_PLANE_TYPE_OVERLAY) + return -EINVAL; + format = rcar_du_format_info(fb->pixel_format); if (format == NULL) { dev_dbg(rcdu->dev, "%s: unsupported format %08x\n", __func__, @@ -348,6 +346,9 @@ static int rcar_du_plane_disable(struct drm_plane *plane) { struct rcar_du_plane *rplane = to_rcar_plane(plane); + if (plane->type != DRM_PLANE_TYPE_OVERLAY) + return -EINVAL; + if (!rplane->enabled) return 0; @@ -453,7 +454,11 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) { struct rcar_du_planes *planes = &rgrp->planes; struct rcar_du_device *rcdu = rgrp->dev; + unsigned int num_planes; + unsigned int num_crtcs; + unsigned int crtcs; unsigned int i; + int ret; mutex_init(&planes->lock); planes->free = 0xff; @@ -478,45 +483,35 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) if (planes->zpos == NULL) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(planes->planes); ++i) { +/* Create one primary plane per in this group CRTC and seven overlay + * planes. + */ + num_crtcs = min(rcdu->num_crtcs - 2 * rgrp->index, 2U); + num_planes = num_crtcs + 7; + + crtcs = ((1 << rcdu->num_crtcs) - 1) & (3 << (2 * rgrp->index)); + + for (i = 0; i < num_planes; ++i) { + enum drm_plane_type type = i < num_crtcs +? DRM_PLANE_TYPE_PRIMARY +: DRM_PLANE_TYPE_OVERLAY; struct rcar_du_plane *plane = &planes->planes[i]; plane->group = rgrp; plane->hwindex = -1; plane->alpha = 255; plane->colorkey = RCAR_DU_COLORKEY_NONE; - plane->zpos = 0; - } - - return 0; -} + plane->zpos = type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1; -int rcar_du_planes_register(struct rcar_du_group *rgrp) -{ - struct rcar_du_planes *planes = &rgrp->planes; - struct rcar_du_device *rcdu
[PATCH 18/38] drm: rcar-du: Handle primary plane config through atomic plane ops
Use the new CRTC atomic transitional helpers drm_helper_crtc_mode_set() and drm_helper_crtc_mode_set_base() to implement the CRTC .mode_set and .mode_set_base operations. This delegates primary plane configuration to the plane .atomic_update and .atomic_disable operations, removing duplicate code from the CRTC implementation. There is now no code path available to the driver in which to drop the reference to the CRTC acquired in the .prepare() operation if an error then occurs. The driver thus now leaks a reference if an error occurs during mode set. So be it, this will be fixed in a further step of the atomic update transition. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 81 + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 8 ++-- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 3 -- 3 files changed, 14 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 3d862a894b17..169558a3ab40 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -105,7 +105,7 @@ static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc) static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) { - const struct drm_display_mode *mode = &rcrtc->crtc.mode; + const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode; unsigned long mode_clock = mode->clock * 1000; unsigned long clk; u32 value; @@ -368,7 +368,6 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) * switching to atomic updates completely. */ mutex_lock(&rcrtc->group->planes.lock); - rcrtc->plane->enabled = true; rcar_du_crtc_update_planes(crtc); mutex_unlock(&rcrtc->group->planes.lock); @@ -412,11 +411,6 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc) rcar_du_crtc_wait_page_flip(rcrtc); drm_crtc_vblank_off(crtc); - mutex_lock(&rcrtc->group->planes.lock); - rcrtc->plane->enabled = false; - rcar_du_crtc_update_planes(crtc); - mutex_unlock(&rcrtc->group->planes.lock); - /* Select switch sync mode. This stops display operation and configures * the HSYNC and VSYNC signals as inputs. */ @@ -492,58 +486,20 @@ static void rcar_du_crtc_mode_prepare(struct drm_crtc *crtc) */ rcar_du_crtc_get(rcrtc); - /* Stop the CRTC and release the plane. Force the DPMS mode to off as a -* result. -*/ + /* Stop the CRTC, force the DPMS mode to off as a result. */ rcar_du_crtc_stop(rcrtc); - rcar_du_plane_release(rcrtc->plane); rcrtc->dpms = DRM_MODE_DPMS_OFF; + rcrtc->outputs = 0; } -static int rcar_du_crtc_mode_set(struct drm_crtc *crtc, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode, -int x, int y, -struct drm_framebuffer *old_fb) +static void rcar_du_crtc_mode_set_nofb(struct drm_crtc *crtc) { - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - struct rcar_du_device *rcdu = rcrtc->group->dev; - const struct rcar_du_format_info *format; - int ret; - - format = rcar_du_format_info(crtc->primary->fb->pixel_format); - if (format == NULL) { - dev_dbg(rcdu->dev, "mode_set: unsupported format %08x\n", - crtc->primary->fb->pixel_format); - ret = -EINVAL; - goto error; - } - - ret = rcar_du_plane_reserve(rcrtc->plane, format); - if (ret < 0) - goto error; - - rcrtc->plane->format = format; - - rcrtc->plane->src_x = x; - rcrtc->plane->src_y = y; - rcrtc->plane->width = mode->hdisplay; - rcrtc->plane->height = mode->vdisplay; - - rcar_du_plane_compute_base(rcrtc->plane, crtc->primary->fb); - - rcrtc->outputs = 0; - - return 0; - -error: - /* There's no rollback/abort operation to clean up in case of error. We -* thus need to release the reference to the CRTC acquired in prepare() -* here. + /* No-op. We should configure the display timings here, but as we're +* called with the CRTC disabled clocks might be off, and we thus can't +* access the hardware. Let's just configure everything when enabling +* the CRTC. */ - rcar_du_crtc_put(rcrtc); - return ret; } static void rcar_du_crtc_mode_commit(struct drm_crtc *crtc) @@ -558,25 +514,9 @@ static void rcar_du_crtc_mode_commit(struct drm_crtc *crtc) rcrtc->dpms = DRM_MODE_DPMS_ON; } -static int rcar_du_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, - struct drm_framebuffer *old_fb) -{ - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - -
[PATCH 21/38] drm: rcar-du: Replace LVDS encoder DPMS by enable/disable
The LVDS encoder doesn't support DPMS states, replace the DPMS operation by enable/disable to avoid propagating DPMS states down to the encoder code. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 12 drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 6 -- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 18 +- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h | 8 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 279167f783f6..6243af310368 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -46,11 +46,9 @@ static void rcar_du_encoder_dpms(struct drm_encoder *encoder, int mode) { struct rcar_du_encoder *renc = to_rcar_encoder(encoder); - if (mode != DRM_MODE_DPMS_ON) - mode = DRM_MODE_DPMS_OFF; - if (renc->lvds) - rcar_du_lvdsenc_dpms(renc->lvds, encoder->crtc, mode); + rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, + mode == DRM_MODE_DPMS_ON); } static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, @@ -110,8 +108,7 @@ static void rcar_du_encoder_mode_prepare(struct drm_encoder *encoder) struct rcar_du_encoder *renc = to_rcar_encoder(encoder); if (renc->lvds) - rcar_du_lvdsenc_dpms(renc->lvds, encoder->crtc, -DRM_MODE_DPMS_OFF); + rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, false); } static void rcar_du_encoder_mode_commit(struct drm_encoder *encoder) @@ -119,8 +116,7 @@ static void rcar_du_encoder_mode_commit(struct drm_encoder *encoder) struct rcar_du_encoder *renc = to_rcar_encoder(encoder); if (renc->lvds) - rcar_du_lvdsenc_dpms(renc->lvds, encoder->crtc, -DRM_MODE_DPMS_ON); + rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); } static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c index 221f0a17fd6a..89a7c0ecc935 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c @@ -44,13 +44,15 @@ static void rcar_du_hdmienc_dpms(struct drm_encoder *encoder, int mode) return; if (mode == DRM_MODE_DPMS_ON && hdmienc->renc->lvds) - rcar_du_lvdsenc_dpms(hdmienc->renc->lvds, encoder->crtc, mode); + rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc, + true); if (sfuncs->dpms) sfuncs->dpms(encoder, mode); if (mode != DRM_MODE_DPMS_ON && hdmienc->renc->lvds) - rcar_du_lvdsenc_dpms(hdmienc->renc->lvds, encoder->crtc, mode); + rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc, + false); hdmienc->dpms = mode; } diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c index 7cfb48ce1791..85043c5bad03 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c @@ -28,7 +28,7 @@ struct rcar_du_lvdsenc { unsigned int index; void __iomem *mmio; struct clk *clock; - int dpms; + bool enabled; enum rcar_lvds_input input; }; @@ -48,7 +48,7 @@ static int rcar_du_lvdsenc_start(struct rcar_du_lvdsenc *lvds, u32 pllcr; int ret; - if (lvds->dpms == DRM_MODE_DPMS_ON) + if (lvds->enabled) return 0; ret = clk_prepare_enable(lvds->clock); @@ -110,13 +110,13 @@ static int rcar_du_lvdsenc_start(struct rcar_du_lvdsenc *lvds, lvdcr0 |= LVDCR0_LVRES; rcar_lvds_write(lvds, LVDCR0, lvdcr0); - lvds->dpms = DRM_MODE_DPMS_ON; + lvds->enabled = true; return 0; } static void rcar_du_lvdsenc_stop(struct rcar_du_lvdsenc *lvds) { - if (lvds->dpms == DRM_MODE_DPMS_OFF) + if (!lvds->enabled) return; rcar_lvds_write(lvds, LVDCR0, 0); @@ -124,13 +124,13 @@ static void rcar_du_lvdsenc_stop(struct rcar_du_lvdsenc *lvds) clk_disable_unprepare(lvds->clock); - lvds->dpms = DRM_MODE_DPMS_OFF; + lvds->enabled = false; } -int rcar_du_lvdsenc_dpms(struct rcar_du_lvdsenc *lvds, -struct drm_crtc *crtc, int mode) +int rcar_du_lvdsenc_enable(struct rcar_du_lvdsenc *lvds, struct drm_crtc *crtc, + bool enable) { - if (mode == DRM_MODE_DPMS_OFF) { + if (!enable) { rcar_du_lvdsenc_stop(lvds); return 0; } else if (crtc) { @@ -179,7 +179,7 @@ int rcar_du_lvdsenc_init(struct rcar_du_device *rcdu)
[PATCH 22/38] drm: rcar-du: Rework encoder enable/disable for atomic updates
When using atomic updates the encoder .enable() and .disable() helper operations are preferred over the (then legacy) .prepare() and .commit() operations. Implement .enable() and .disable() and rework .prepare(), .commit() and .dpms() as wrappers around .enable() and .disable(), easing their future removal. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 33 --- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 6243af310368..74a744f5dfdb 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -42,13 +42,28 @@ rcar_du_connector_best_encoder(struct drm_connector *connector) * Encoder */ -static void rcar_du_encoder_dpms(struct drm_encoder *encoder, int mode) +static void rcar_du_encoder_disable(struct drm_encoder *encoder) { struct rcar_du_encoder *renc = to_rcar_encoder(encoder); if (renc->lvds) - rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, - mode == DRM_MODE_DPMS_ON); + rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, false); +} + +static void rcar_du_encoder_enable(struct drm_encoder *encoder) +{ + struct rcar_du_encoder *renc = to_rcar_encoder(encoder); + + if (renc->lvds) + rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); +} + +static void rcar_du_encoder_dpms(struct drm_encoder *encoder, int mode) +{ + if (mode == DRM_MODE_DPMS_ON) + rcar_du_encoder_enable(encoder); + else + rcar_du_encoder_disable(encoder); } static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, @@ -105,18 +120,12 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, static void rcar_du_encoder_mode_prepare(struct drm_encoder *encoder) { - struct rcar_du_encoder *renc = to_rcar_encoder(encoder); - - if (renc->lvds) - rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, false); + rcar_du_encoder_disable(encoder); } static void rcar_du_encoder_mode_commit(struct drm_encoder *encoder) { - struct rcar_du_encoder *renc = to_rcar_encoder(encoder); - - if (renc->lvds) - rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); + rcar_du_encoder_enable(encoder); } static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, @@ -134,6 +143,8 @@ static const struct drm_encoder_helper_funcs encoder_helper_funcs = { .prepare = rcar_du_encoder_mode_prepare, .commit = rcar_du_encoder_mode_commit, .mode_set = rcar_du_encoder_mode_set, + .disable = rcar_du_encoder_disable, + .enable = rcar_du_encoder_enable, }; static const struct drm_encoder_funcs encoder_funcs = { -- 2.0.5
[PATCH 08/38] drm: rcar-du: Remove drm_fbdev_cma_restore_mode() call at init time
The function is meant to restore the fbdev mode in the lastclose handler, not to be called at init time. Remove the call. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 1ea2c1e9cb79..aebbcde82ddf 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -453,10 +453,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) if (IS_ERR(fbdev)) return PTR_ERR(fbdev); -#ifndef CONFIG_FRAMEBUFFER_CONSOLE - drm_fbdev_cma_restore_mode(fbdev); -#endif - rcdu->fbdev = fbdev; return 0; -- 2.0.5
[PATCH 09/38] drm: rcar-du: Don't set connector->encoder at init time
The drm_connector encoder field points to the encoder driving the connector. No such association exists at init time, as all pipelines are disabled. Don't set the field. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 1 - drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c index ca94b029ac80..3896cb20ad51 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c @@ -116,7 +116,6 @@ int rcar_du_hdmi_connector_init(struct rcar_du_device *rcdu, if (ret < 0) return ret; - connector->encoder = encoder; rcon->encoder = renc; return 0; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index 6d9811c052c4..7c0b08fe0774 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c @@ -125,7 +125,6 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, if (ret < 0) return ret; - connector->encoder = encoder; lvdscon->connector.encoder = renc; return 0; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c index 9d4879921cc7..ae8b304e6fea 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c @@ -84,7 +84,6 @@ int rcar_du_vga_connector_init(struct rcar_du_device *rcdu, if (ret < 0) return ret; - connector->encoder = encoder; rcon->encoder = renc; return 0; -- 2.0.5
[PATCH 13/38] drm: rcar-du: Disable fbdev emulation when no connector is present
fbdev emulation requires at least one connector, and will fail to initialize if no connector has been successfully instantiated. Disable it in that case and print an informational message instead of failing probe with a confusing fbdev emulation error message. It could be argued that probe should fail when no connector is present, but the DU could still be useful in that case with the to-be-implemented memory write-back support. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index aebbcde82ddf..888df404932e 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -448,12 +448,17 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) drm_kms_helper_poll_init(dev); - fbdev = drm_fbdev_cma_init(dev, 32, dev->mode_config.num_crtc, - dev->mode_config.num_connector); - if (IS_ERR(fbdev)) - return PTR_ERR(fbdev); + if (dev->mode_config.num_connector) { + fbdev = drm_fbdev_cma_init(dev, 32, dev->mode_config.num_crtc, + dev->mode_config.num_connector); + if (IS_ERR(fbdev)) + return PTR_ERR(fbdev); - rcdu->fbdev = fbdev; + rcdu->fbdev = fbdev; + } else { + dev_info(rcdu->dev, +"no connector found, disabling fbdev emulation\n"); + } return 0; } -- 2.0.5
[PATCH 12/38] drm: rcar-du: Turn vblank on/off when enabling/disabling CRTC
The DRM core vblank handling mechanism requires drivers to forcefully turn vblank reporting off when disabling the CRTC, and to restore the vblank reporting status when enabling the CRTC. Implement this using the drm_crtc_vblank_on/off helpers. When disabling vblank we must first wait for page flips to complete, so implement page flip completion wait as well. Finally, drm_crtc_vblank_off() must be called at startup to synchronize the state of the vblank core code with the hardware, which is initially disabled. This is performed at CRTC creation time, requiring vertical blanking to be initialized before creating CRTCs. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 18 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 14 -- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 7f5ae0269a61..5cf2cac75146 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -279,7 +279,7 @@ void rcar_du_crtc_cancel_page_flip(struct rcar_du_crtc *rcrtc, if (event && event->base.file_priv == file) { rcrtc->event = NULL; event->base.destroy(&event->base); - drm_vblank_put(dev, rcrtc->index); + drm_crtc_vblank_put(&rcrtc->crtc); } spin_unlock_irqrestore(&dev->event_lock, flags); } @@ -303,7 +303,7 @@ static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc) wake_up(&rcrtc->flip_wait); spin_unlock_irqrestore(&dev->event_lock, flags); - drm_vblank_put(dev, rcrtc->index); + drm_crtc_vblank_put(&rcrtc->crtc); } static bool rcar_du_crtc_page_flip_pending(struct rcar_du_crtc *rcrtc) @@ -383,6 +383,9 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) rcar_du_group_start_stop(rcrtc->group, true); + /* Turn vertical blanking interrupt reporting back on. */ + drm_crtc_vblank_on(crtc); + rcrtc->started = true; } @@ -393,10 +396,12 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc) if (!rcrtc->started) return; - /* Wait for page flip completion before stopping the CRTC as userspace -* excepts page flips to eventually complete. + /* Disable vertical blanking interrupt reporting. We first need to wait +* for page flip completion before stopping the CRTC as userspace +* expects page flips to eventually complete. */ rcar_du_crtc_wait_page_flip(rcrtc); + drm_crtc_vblank_off(crtc); mutex_lock(&rcrtc->group->planes.lock); rcrtc->plane->enabled = false; @@ -596,7 +601,7 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, if (event) { event->pipe = rcrtc->index; - drm_vblank_get(dev, rcrtc->index); + drm_crtc_vblank_get(crtc); spin_lock_irqsave(&dev->event_lock, flags); rcrtc->event = event; spin_unlock_irqrestore(&dev->event_lock, flags); @@ -693,6 +698,9 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) drm_crtc_helper_add(crtc, &crtc_helper_funcs); + /* Start with vertical blanking interrupt reporting disabled. */ + drm_crtc_vblank_off(crtc); + /* Register the interrupt handler. */ if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_IRQ_CLOCK)) { irq = platform_get_irq(pdev, index); diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index e0d74f821416..8ab4c69c599b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -175,17 +175,19 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags) if (IS_ERR(rcdu->mmio)) return PTR_ERR(rcdu->mmio); - /* DRM/KMS objects */ - ret = rcar_du_modeset_init(rcdu); + /* Initialize vertical blanking interrupts handling. Start with vblank +* disabled for all CRTCs. +*/ + ret = drm_vblank_init(dev, (1 << rcdu->info->num_crtcs) - 1); if (ret < 0) { - dev_err(&pdev->dev, "failed to initialize DRM/KMS\n"); + dev_err(&pdev->dev, "failed to initialize vblank\n"); goto done; } - /* vblank handling */ - ret = drm_vblank_init(dev, (1 << rcdu->num_crtcs) - 1); + /* DRM/KMS objects */ + ret = rcar_du_modeset_init(rcdu); if (ret < 0) { - dev_err(&pdev->dev, "failed to initialize vblank\n"); + dev_err(&pdev->dev, "failed to initialize DRM/KMS\n"); goto done; } -- 2.0.5
[PATCH 16/38] drm: rcar-du: Fix hardware plane allocation
The hardware plane allocator loops over all planes to find free candidates. However, instead of looping over the number of hardware planes, it loops over the number of software planes, which happens to be larger by one unit. This has no effect in practise as the extra plane is always cleared in the mask of free planes, but it should still be fixed for correctness. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 242db1e1a1e4..4a0669fd8176 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -54,7 +54,7 @@ int rcar_du_plane_reserve(struct rcar_du_plane *plane, mutex_lock(&rgrp->planes.lock); - for (i = 0; i < ARRAY_SIZE(rgrp->planes.planes); ++i) { + for (i = 0; i < RCAR_DU_NUM_HW_PLANES; ++i) { if (!(rgrp->planes.free & (1 << i))) continue; @@ -63,7 +63,7 @@ int rcar_du_plane_reserve(struct rcar_du_plane *plane, break; } - if (i == ARRAY_SIZE(rgrp->planes.planes)) + if (i == RCAR_DU_NUM_HW_PLANES) goto done; rgrp->planes.free &= ~(1 << i); -- 2.0.5
[PATCH 17/38] drm: rcar-du: Implement planes atomic operations
Implement the CRTC .atomic_begin() and .atomic_flush() operations, the plane .atomic_check(), .atomic_update() and operations, and use the transitional atomic helpers to implement the plane update and disable operations on top of the new atomic operations. The plane setup code can't be moved out of the CRTC start function completely yet, as the atomic code paths are not taken every time the CRTC needs to be started. This results in some code duplication that will be fixed after switching to atomic updates completely. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 37 +++- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 152 ++-- 2 files changed, 141 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index c2ca2a302f44..3d862a894b17 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -357,12 +357,21 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) rcar_du_crtc_set_display_timing(rcrtc); rcar_du_group_set_routing(rcrtc->group); + /* FIXME: Commit the planes state. This is required here as the CRTC can +* be started from the DPMS and system resume handler, which don't go +* through .atomic_plane_update() and .atomic_flush() to commit plane +* state. Similarly a mode set operation without any update to planes +* will not go through atomic plane configuration either. Additionally, +* given that the plane state atomic commit occurs between CRTC disable +* and enable, the hardware state could also be lost due to runtime PM, +* requiring a full commit here. This will be fixed later after +* switching to atomic updates completely. +*/ mutex_lock(&rcrtc->group->planes.lock); rcrtc->plane->enabled = true; rcar_du_crtc_update_planes(crtc); mutex_unlock(&rcrtc->group->planes.lock); - /* Setup planes. */ for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) { struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; @@ -570,6 +579,30 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc) rcar_du_plane_release(rcrtc->plane); } +static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + + /* We need to access the hardware during atomic update, acquire a +* reference to the CRTC. +*/ + rcar_du_crtc_get(rcrtc); +} + +static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + + /* We're done, apply the configuration and drop the reference acquired +* in .atomic_begin(). +*/ + mutex_lock(&rcrtc->group->planes.lock); + rcar_du_crtc_update_planes(crtc); + mutex_unlock(&rcrtc->group->planes.lock); + + rcar_du_crtc_put(rcrtc); +} + static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .dpms = rcar_du_crtc_dpms, .mode_fixup = rcar_du_crtc_mode_fixup, @@ -578,6 +611,8 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .mode_set = rcar_du_crtc_mode_set, .mode_set_base = rcar_du_crtc_mode_set_base, .disable = rcar_du_crtc_disable, + .atomic_begin = rcar_du_crtc_atomic_begin, + .atomic_flush = rcar_du_crtc_atomic_flush, }; static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 4a0669fd8176..03995c15bbe3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "rcar_du_drv.h" #include "rcar_du_kms.h" @@ -45,6 +46,38 @@ static void rcar_du_plane_write(struct rcar_du_group *rgrp, data); } +static int rcar_du_plane_reserve_check(struct rcar_du_plane *plane, + const struct rcar_du_format_info *format) +{ + struct rcar_du_group *rgrp = plane->group; + unsigned int free; + unsigned int i; + int ret; + + mutex_lock(&rgrp->planes.lock); + + free = rgrp->planes.free; + + if (plane->hwindex != -1) { + free |= 1 << plane->hwindex; + if (plane->format->planes == 2) + free |= 1 << ((plane->hwindex + 1) % 8); + } + + for (i = 0; i < ARRAY_SIZE(rgrp->planes.planes); ++i) { + if (!(free & (1 << i))) + continue; + + if (format->planes == 1 || free & (1 << ((i + 1) % 8))) + break; + } + + ret = i == ARRAY_SIZE(rgrp->planes.planes) ? -EBUSY : 0; + + mutex_unlock(&rgrp->planes.lock); + return ret; +} + int rcar_du_plane_reserv
[PATCH 19/38] drm: rcar-du: Wire up atomic state object scaffolding
Hook up the default .reset(), .atomic_duplicate_state() and .atomic_free_state() helpers to ensure that state objects are properly created and destroyed, and call drm_mode_config_reset() at init time to create the initial state objects. Framebuffer reference count also gets maintained automatically by the transitional helpers except for the legacy page flip operation. Maintain it explicitly there. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 7 +++ drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 4 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 ++ drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 4 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 4 6 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 169558a3ab40..6e7266c1a47b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include #include @@ -572,6 +574,8 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, } spin_unlock_irqrestore(&dev->event_lock, flags); + drm_atomic_set_fb_for_plane(crtc->primary->state, fb); + crtc->primary->fb = fb; rcar_du_crtc_update_base(rcrtc); @@ -587,9 +591,12 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, } static const struct drm_crtc_funcs crtc_funcs = { + .reset = drm_atomic_helper_crtc_reset, .destroy = drm_crtc_cleanup, .set_config = drm_crtc_helper_set_config, .page_flip = rcar_du_crtc_page_flip, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; /* - diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c index 3896cb20ad51..9378c283cb58 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -75,9 +76,12 @@ rcar_du_hdmi_connector_detect(struct drm_connector *connector, bool force) static const struct drm_connector_funcs connector_funcs = { .dpms = drm_helper_connector_dpms, + .reset = drm_atomic_helper_connector_reset, .detect = rcar_du_hdmi_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = rcar_du_hdmi_connector_destroy, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; int rcar_du_hdmi_connector_init(struct rcar_du_device *rcdu, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 413145de3db3..94ff8fcc7268 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -439,6 +439,8 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) encoder->possible_clones = (1 << num_encoders) - 1; } + drm_mode_config_reset(dev); + drm_kms_helper_poll_init(dev); if (dev->mode_config.num_connector) { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index 7c0b08fe0774..4bfa3ce34ab3 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c @@ -12,6 +12,7 @@ */ #include +#include #include #include @@ -75,9 +76,12 @@ rcar_du_lvds_connector_detect(struct drm_connector *connector, bool force) static const struct drm_connector_funcs connector_funcs = { .dpms = drm_helper_connector_dpms, + .reset = drm_atomic_helper_connector_reset, .detect = rcar_du_lvds_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = rcar_du_lvds_connector_destroy, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index d4682ac7db03..c4e4fd293eee 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -486,8 +487,11 @@ static int rcar_du_plane_set_property(struct drm_plane *plane, static const struct drm_plane_funcs rcar_du_plane_funcs = { .update_plane = drm_plane_helper_update, .disable_plane = drm_plane_helper_disable, + .reset = drm_atomic_helper_plane_reset, .set_property = rcar_du_plane_set_property, .destroy = d
[PATCH 20/38] drm: rcar-du: Remove private copy of plane size and position
The plane source and destination size and positions are stored in the plane state, and a private copy is kept in the rcar_du_plane objects. Remove the private copy as it just duplicates the state. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 25 ++--- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 8 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index c4e4fd293eee..f247b1fcf791 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -132,6 +132,8 @@ static void rcar_du_plane_release(struct rcar_du_plane *plane) void rcar_du_plane_update_base(struct rcar_du_plane *plane) { struct rcar_du_group *rgrp = plane->group; + unsigned int src_x = plane->plane.state->src_x >> 16; + unsigned int src_y = plane->plane.state->src_y >> 16; unsigned int index = plane->hwindex; bool interlaced; u32 mwr; @@ -163,8 +165,8 @@ void rcar_du_plane_update_base(struct rcar_du_plane *plane) * require a halved Y position value, in both progressive and interlaced * modes. */ - rcar_du_plane_write(rgrp, index, PnSPXR, plane->src_x); - rcar_du_plane_write(rgrp, index, PnSPYR, plane->src_y * + rcar_du_plane_write(rgrp, index, PnSPXR, src_x); + rcar_du_plane_write(rgrp, index, PnSPYR, src_y * (!interlaced && plane->format->bpp == 32 ? 2 : 1)); rcar_du_plane_write(rgrp, index, PnDSA0R, plane->dma[0]); @@ -173,8 +175,8 @@ void rcar_du_plane_update_base(struct rcar_du_plane *plane) rcar_du_plane_write(rgrp, index, PnMWR, plane->pitch); - rcar_du_plane_write(rgrp, index, PnSPXR, plane->src_x); - rcar_du_plane_write(rgrp, index, PnSPYR, plane->src_y * + rcar_du_plane_write(rgrp, index, PnSPXR, src_x); + rcar_du_plane_write(rgrp, index, PnSPYR, src_y * (plane->format->bpp == 16 ? 2 : 1) / 2); rcar_du_plane_write(rgrp, index, PnDSA0R, plane->dma[1]); } @@ -294,10 +296,10 @@ static void __rcar_du_plane_setup(struct rcar_du_plane *plane, rcar_du_plane_write(rgrp, index, PnDDCR4, ddcr4); /* Destination position and size */ - rcar_du_plane_write(rgrp, index, PnDSXR, plane->width); - rcar_du_plane_write(rgrp, index, PnDSYR, plane->height); - rcar_du_plane_write(rgrp, index, PnDPXR, plane->dst_x); - rcar_du_plane_write(rgrp, index, PnDPYR, plane->dst_y); + rcar_du_plane_write(rgrp, index, PnDSXR, plane->plane.state->crtc_w); + rcar_du_plane_write(rgrp, index, PnDSYR, plane->plane.state->crtc_h); + rcar_du_plane_write(rgrp, index, PnDPXR, plane->plane.state->crtc_x); + rcar_du_plane_write(rgrp, index, PnDPYR, plane->plane.state->crtc_y); /* Wrap-around and blinking, disabled */ rcar_du_plane_write(rgrp, index, PnWASPR, 0); @@ -399,13 +401,6 @@ static void rcar_du_plane_atomic_update(struct drm_plane *plane, rplane->crtc = state->crtc; rplane->format = format; - rplane->src_x = state->src_x >> 16; - rplane->src_y = state->src_y >> 16; - rplane->dst_x = state->crtc_x; - rplane->dst_y = state->crtc_y; - rplane->width = state->crtc_w; - rplane->height = state->crtc_h; - rcar_du_plane_compute_base(rplane, state->fb); rcar_du_plane_setup(rplane); diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index 55d2f55faece..3420ff07f2c6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -47,14 +47,6 @@ struct rcar_du_plane { unsigned long dma[2]; unsigned int pitch; - - unsigned int width; - unsigned int height; - - unsigned int src_x; - unsigned int src_y; - unsigned int dst_x; - unsigned int dst_y; }; struct rcar_du_planes { -- 2.0.5
[PATCH 23/38] drm: rcar-du: Rework HDMI encoder enable/disable for atomic updates
When using atomic updates the encoder .enable() and .disable() helper operations are preferred over the (then legacy) .prepare() and .commit() operations. Implement .enable() and .disable() and rework .prepare(), .commit() and .dpms() as wrappers around .enable() and .disable(), easing their future removal. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 48 ++- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c index 89a7c0ecc935..04e21b5f96d4 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c @@ -26,35 +26,54 @@ struct rcar_du_hdmienc { struct rcar_du_encoder *renc; struct device *dev; - int dpms; + bool enabled; }; #define to_rcar_hdmienc(e) (to_rcar_encoder(e)->hdmi) #define to_slave_funcs(e) (to_rcar_encoder(e)->slave.slave_funcs) -static void rcar_du_hdmienc_dpms(struct drm_encoder *encoder, int mode) +static void rcar_du_hdmienc_disable(struct drm_encoder *encoder) { struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder); - if (mode != DRM_MODE_DPMS_ON) - mode = DRM_MODE_DPMS_OFF; + if (sfuncs->dpms) + sfuncs->dpms(encoder, DRM_MODE_DPMS_OFF); - if (hdmienc->dpms == mode) - return; + if (hdmienc->renc->lvds) + rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc, + false); + + hdmienc->enabled = false; +} + +static void rcar_du_hdmienc_enable(struct drm_encoder *encoder) +{ + struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); + struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder); - if (mode == DRM_MODE_DPMS_ON && hdmienc->renc->lvds) + if (hdmienc->renc->lvds) rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc, true); if (sfuncs->dpms) - sfuncs->dpms(encoder, mode); + sfuncs->dpms(encoder, DRM_MODE_DPMS_ON); - if (mode != DRM_MODE_DPMS_ON && hdmienc->renc->lvds) - rcar_du_lvdsenc_enable(hdmienc->renc->lvds, encoder->crtc, - false); + hdmienc->enabled = true; +} - hdmienc->dpms = mode; +static void rcar_du_hdmienc_dpms(struct drm_encoder *encoder, int mode) +{ + struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); + bool enable = mode == DRM_MODE_DPMS_ON; + + if (hdmienc->enabled == enable) + return; + + if (enable) + rcar_du_hdmienc_enable(encoder); + else + rcar_du_hdmienc_disable(encoder); } static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder, @@ -106,13 +125,16 @@ static const struct drm_encoder_helper_funcs encoder_helper_funcs = { .prepare = rcar_du_hdmienc_mode_prepare, .commit = rcar_du_hdmienc_mode_commit, .mode_set = rcar_du_hdmienc_mode_set, + .disable = rcar_du_hdmienc_disable, + .enable = rcar_du_hdmienc_enable, }; static void rcar_du_hdmienc_cleanup(struct drm_encoder *encoder) { struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); - rcar_du_hdmienc_dpms(encoder, DRM_MODE_DPMS_OFF); + if (hdmienc->enabled) + rcar_du_hdmienc_disable(encoder); drm_encoder_cleanup(encoder); put_device(hdmienc->dev); -- 2.0.5
[PATCH 24/38] drm: rcar-du: Rework CRTC enable/disable for atomic updates
When using atomic updates the CRTC .enable() and .disable() helper operations are preferred over the (then legacy) .prepare() and .commit() operations. Implement .enable() and rework .disable() to not depend on DPMS, easing DPMS removal later on. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 59 -- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 2 +- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 6e7266c1a47b..7fdb968756ba 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -431,7 +431,7 @@ void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc) void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc) { - if (rcrtc->dpms != DRM_MODE_DPMS_ON) + if (!rcrtc->enabled) return; rcar_du_crtc_get(rcrtc); @@ -450,25 +450,38 @@ static void rcar_du_crtc_update_base(struct rcar_du_crtc *rcrtc) * CRTC Functions */ -static void rcar_du_crtc_dpms(struct drm_crtc *crtc, int mode) +static void rcar_du_crtc_enable(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - if (mode != DRM_MODE_DPMS_ON) - mode = DRM_MODE_DPMS_OFF; + if (rcrtc->enabled) + return; + + rcar_du_crtc_get(rcrtc); + rcar_du_crtc_start(rcrtc); + + rcrtc->enabled = true; +} + +static void rcar_du_crtc_disable(struct drm_crtc *crtc) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - if (rcrtc->dpms == mode) + if (!rcrtc->enabled) return; - if (mode == DRM_MODE_DPMS_ON) { - rcar_du_crtc_get(rcrtc); - rcar_du_crtc_start(rcrtc); - } else { - rcar_du_crtc_stop(rcrtc); - rcar_du_crtc_put(rcrtc); - } + rcar_du_crtc_stop(rcrtc); + rcar_du_crtc_put(rcrtc); - rcrtc->dpms = mode; + rcrtc->enabled = false; +} + +static void rcar_du_crtc_dpms(struct drm_crtc *crtc, int mode) +{ + if (mode == DRM_MODE_DPMS_ON) + rcar_du_crtc_enable(crtc); + else + rcar_du_crtc_disable(crtc); } static bool rcar_du_crtc_mode_fixup(struct drm_crtc *crtc, @@ -488,10 +501,10 @@ static void rcar_du_crtc_mode_prepare(struct drm_crtc *crtc) */ rcar_du_crtc_get(rcrtc); - /* Stop the CRTC, force the DPMS mode to off as a result. */ + /* Stop the CRTC, force enabled to false as a result. */ rcar_du_crtc_stop(rcrtc); - rcrtc->dpms = DRM_MODE_DPMS_OFF; + rcrtc->enabled = false; rcrtc->outputs = 0; } @@ -508,17 +521,12 @@ static void rcar_du_crtc_mode_commit(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - /* We're done, restart the CRTC and set the DPMS mode to on. The -* reference to the DU acquired at prepare() time will thus be released -* by the DPMS handler (possibly called by the disable() handler). + /* We're done, restart the CRTC and set enabled to true. The reference +* to the DU acquired at prepare() time will thus be released by the +* disable() handler. */ rcar_du_crtc_start(rcrtc); - rcrtc->dpms = DRM_MODE_DPMS_ON; -} - -static void rcar_du_crtc_disable(struct drm_crtc *crtc) -{ - rcar_du_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); + rcrtc->enabled = true; } static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) @@ -554,6 +562,7 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .mode_set_nofb = rcar_du_crtc_mode_set_nofb, .mode_set_base = drm_helper_crtc_mode_set_base, .disable = rcar_du_crtc_disable, + .enable = rcar_du_crtc_enable, .atomic_begin = rcar_du_crtc_atomic_begin, .atomic_flush = rcar_du_crtc_atomic_flush, }; @@ -670,7 +679,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) rcrtc->group = rgrp; rcrtc->mmio_offset = mmio_offsets[index]; rcrtc->index = index; - rcrtc->dpms = DRM_MODE_DPMS_OFF; + rcrtc->enabled = false; rcrtc->plane = &rgrp->planes.planes[index % 2]; rcrtc->plane->crtc = crtc; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index fb39e040f17b..f50fbafd609f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -36,7 +36,7 @@ struct rcar_du_crtc { wait_queue_head_t flip_wait; unsigned int outputs; - int dpms; + bool enabled; struct rcar_du_group *group; struct rcar_du_plane *plane; -- 2.0.5
[PATCH 25/38] drm: rcar-du: Switch plane update to atomic helpers
This removes the legacy plane update code. Wire up the default atomic check and atomic commit mode config helpers as needed by the plane update atomic helpers. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 3 +++ drivers/gpu/drm/rcar-du/rcar_du_plane.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 94ff8fcc7268..2b36f4f2980f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -188,6 +189,8 @@ static void rcar_du_output_poll_changed(struct drm_device *dev) static const struct drm_mode_config_funcs rcar_du_mode_config_funcs = { .fb_create = rcar_du_fb_create, .output_poll_changed = rcar_du_output_poll_changed, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, }; static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index f247b1fcf791..ff087f7de88e 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -480,8 +480,8 @@ static int rcar_du_plane_set_property(struct drm_plane *plane, } static const struct drm_plane_funcs rcar_du_plane_funcs = { - .update_plane = drm_plane_helper_update, - .disable_plane = drm_plane_helper_disable, + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, .reset = drm_atomic_helper_plane_reset, .set_property = rcar_du_plane_set_property, .destroy = drm_plane_cleanup, -- 2.0.5
[PATCH 26/38] drm: rcar-du: Switch mode config to atomic helpers
This removes the legacy mode config code. The CRTC and encoder prepare and commit operations are not used anymore, remove them. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 55 --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 12 --- drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 12 --- 3 files changed, 6 insertions(+), 73 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 7fdb968756ba..f82893884a8a 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -362,12 +362,10 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) /* FIXME: Commit the planes state. This is required here as the CRTC can * be started from the DPMS and system resume handler, which don't go * through .atomic_plane_update() and .atomic_flush() to commit plane -* state. Similarly a mode set operation without any update to planes -* will not go through atomic plane configuration either. Additionally, -* given that the plane state atomic commit occurs between CRTC disable -* and enable, the hardware state could also be lost due to runtime PM, -* requiring a full commit here. This will be fixed later after -* switching to atomic updates completely. +* state. Additionally, given that the plane state atomic commit occurs +* between CRTC disable and enable, the hardware state could also be +* lost due to runtime PM, requiring a full commit here. This will be +* fixed later after switching to atomic updates completely. */ mutex_lock(&rcrtc->group->planes.lock); rcar_du_crtc_update_planes(crtc); @@ -474,6 +472,7 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc) rcar_du_crtc_put(rcrtc); rcrtc->enabled = false; + rcrtc->outputs = 0; } static void rcar_du_crtc_dpms(struct drm_crtc *crtc, int mode) @@ -492,43 +491,6 @@ static bool rcar_du_crtc_mode_fixup(struct drm_crtc *crtc, return true; } -static void rcar_du_crtc_mode_prepare(struct drm_crtc *crtc) -{ - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - - /* We need to access the hardware during mode set, acquire a reference -* to the CRTC. -*/ - rcar_du_crtc_get(rcrtc); - - /* Stop the CRTC, force enabled to false as a result. */ - rcar_du_crtc_stop(rcrtc); - - rcrtc->enabled = false; - rcrtc->outputs = 0; -} - -static void rcar_du_crtc_mode_set_nofb(struct drm_crtc *crtc) -{ - /* No-op. We should configure the display timings here, but as we're -* called with the CRTC disabled clocks might be off, and we thus can't -* access the hardware. Let's just configure everything when enabling -* the CRTC. -*/ -} - -static void rcar_du_crtc_mode_commit(struct drm_crtc *crtc) -{ - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - - /* We're done, restart the CRTC and set enabled to true. The reference -* to the DU acquired at prepare() time will thus be released by the -* disable() handler. -*/ - rcar_du_crtc_start(rcrtc); - rcrtc->enabled = true; -} - static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); @@ -556,11 +518,6 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .dpms = rcar_du_crtc_dpms, .mode_fixup = rcar_du_crtc_mode_fixup, - .prepare = rcar_du_crtc_mode_prepare, - .commit = rcar_du_crtc_mode_commit, - .mode_set = drm_helper_crtc_mode_set, - .mode_set_nofb = rcar_du_crtc_mode_set_nofb, - .mode_set_base = drm_helper_crtc_mode_set_base, .disable = rcar_du_crtc_disable, .enable = rcar_du_crtc_enable, .atomic_begin = rcar_du_crtc_atomic_begin, @@ -602,7 +559,7 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, static const struct drm_crtc_funcs crtc_funcs = { .reset = drm_atomic_helper_crtc_reset, .destroy = drm_crtc_cleanup, - .set_config = drm_crtc_helper_set_config, + .set_config = drm_atomic_helper_set_config, .page_flip = rcar_du_crtc_page_flip, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 74a744f5dfdb..76b201f2f75e 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -118,16 +118,6 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, return true; } -static void rcar_du_encoder_mode_prepare(struct drm_encoder *encoder) -{ - rcar_du_encoder_disabl
[PATCH 27/38] drm: rcar-du: Switch connector DPMS to atomic helpers
The atomic connector DPMS helper implements the connector DPMS operation using atomic commit, removing the need for DPMS helper operations on CRTCs and encoders. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 11 +-- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 9 - drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c | 4 ++-- drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 15 --- drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 4 ++-- drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | 4 ++-- 6 files changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index f82893884a8a..8a44d37f1716 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -360,7 +360,7 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) rcar_du_group_set_routing(rcrtc->group); /* FIXME: Commit the planes state. This is required here as the CRTC can -* be started from the DPMS and system resume handler, which don't go +* be started from the system resume handler, which don't go * through .atomic_plane_update() and .atomic_flush() to commit plane * state. Additionally, given that the plane state atomic commit occurs * between CRTC disable and enable, the hardware state could also be @@ -475,14 +475,6 @@ static void rcar_du_crtc_disable(struct drm_crtc *crtc) rcrtc->outputs = 0; } -static void rcar_du_crtc_dpms(struct drm_crtc *crtc, int mode) -{ - if (mode == DRM_MODE_DPMS_ON) - rcar_du_crtc_enable(crtc); - else - rcar_du_crtc_disable(crtc); -} - static bool rcar_du_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) @@ -516,7 +508,6 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) } static const struct drm_crtc_helper_funcs crtc_helper_funcs = { - .dpms = rcar_du_crtc_dpms, .mode_fixup = rcar_du_crtc_mode_fixup, .disable = rcar_du_crtc_disable, .enable = rcar_du_crtc_enable, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index 76b201f2f75e..d4a70228ce50 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -58,14 +58,6 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder) rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); } -static void rcar_du_encoder_dpms(struct drm_encoder *encoder, int mode) -{ - if (mode == DRM_MODE_DPMS_ON) - rcar_du_encoder_enable(encoder); - else - rcar_du_encoder_disable(encoder); -} - static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) @@ -128,7 +120,6 @@ static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs encoder_helper_funcs = { - .dpms = rcar_du_encoder_dpms, .mode_fixup = rcar_du_encoder_mode_fixup, .mode_set = rcar_du_encoder_mode_set, .disable = rcar_du_encoder_disable, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c index 9378c283cb58..96f2eb43713c 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c @@ -75,7 +75,7 @@ rcar_du_hdmi_connector_detect(struct drm_connector *connector, bool force) } static const struct drm_connector_funcs connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .reset = drm_atomic_helper_connector_reset, .detect = rcar_du_hdmi_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, @@ -112,7 +112,7 @@ int rcar_du_hdmi_connector_init(struct rcar_du_device *rcdu, if (ret < 0) return ret; - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); + connector->dpms = DRM_MODE_DPMS_OFF; drm_object_property_set_value(&connector->base, rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF); diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c index a88ef2d6800e..3c29250c8abd 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c @@ -62,20 +62,6 @@ static void rcar_du_hdmienc_enable(struct drm_encoder *encoder) hdmienc->enabled = true; } -static void rcar_du_hdmienc_dpms(struct drm_encoder *encoder, int mode) -{ - struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); - bool enable = mode == DR
[PATCH 29/38] drm: rcar-du: Implement asynchronous commit support
Implement a custom .atomic_commit() handler that supports asynchronous commits using a work queue. This can be used for userspace-driven asynchronous commits, as well as for an atomic page flip implementation. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 3 + drivers/gpu/drm/rcar-du/rcar_du_drv.h | 6 ++ drivers/gpu/drm/rcar-du/rcar_du_kms.c | 105 +- 3 files changed, 113 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 8ab4c69c599b..1d9e4f8568ae 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -163,6 +164,8 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags) return -ENOMEM; } + init_waitqueue_head(&rcdu->commit.wait); + rcdu->dev = &pdev->dev; rcdu->info = np ? of_match_device(rcar_du_of_table, rcdu->dev)->data : (void *)platform_get_device_id(pdev)->driver_data; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index d1ede13cb1d5..c7c538dd2e68 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h @@ -15,6 +15,7 @@ #define __RCAR_DU_DRV_H__ #include +#include #include "rcar_du_crtc.h" #include "rcar_du_group.h" @@ -84,6 +85,11 @@ struct rcar_du_device { unsigned int dpad0_source; struct rcar_du_lvdsenc *lvds[RCAR_DU_MAX_LVDS]; + + struct { + wait_queue_head_t wait; + u32 pending; + } commit; }; static inline bool rcar_du_has(struct rcar_du_device *rcdu, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 2b36f4f2980f..cec35e405248 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -19,6 +20,7 @@ #include #include +#include #include "rcar_du_crtc.h" #include "rcar_du_drv.h" @@ -186,11 +188,112 @@ static void rcar_du_output_poll_changed(struct drm_device *dev) drm_fbdev_cma_hotplug_event(rcdu->fbdev); } +/* - + * Atomic Updates + */ + +struct rcar_du_commit { + struct work_struct work; + struct drm_device *dev; + struct drm_atomic_state *state; + u32 crtcs; +}; + +static void rcar_du_atomic_complete(struct rcar_du_commit *commit) +{ + struct drm_device *dev = commit->dev; + struct rcar_du_device *rcdu = dev->dev_private; + struct drm_atomic_state *old_state = commit->state; + + /* Apply the atomic update. */ + drm_atomic_helper_commit_modeset_disables(dev, old_state); + drm_atomic_helper_commit_planes(dev, old_state); + drm_atomic_helper_commit_modeset_enables(dev, old_state); + + drm_atomic_helper_wait_for_vblanks(dev, old_state); + + drm_atomic_helper_cleanup_planes(dev, old_state); + + drm_atomic_state_free(old_state); + + /* Complete the commit, wake up any waiter. */ + spin_lock(&rcdu->commit.wait.lock); + rcdu->commit.pending &= ~commit->crtcs; + wake_up_all_locked(&rcdu->commit.wait); + spin_unlock(&rcdu->commit.wait.lock); + + kfree(commit); +} + +static void rcar_du_atomic_work(struct work_struct *work) +{ + struct rcar_du_commit *commit = + container_of(work, struct rcar_du_commit, work); + + rcar_du_atomic_complete(commit); +} + +static int rcar_du_atomic_commit(struct drm_device *dev, +struct drm_atomic_state *state, bool async) +{ + struct rcar_du_device *rcdu = dev->dev_private; + struct rcar_du_commit *commit; + unsigned int i; + int ret; + + ret = drm_atomic_helper_prepare_planes(dev, state); + if (ret) + return ret; + + /* Allocate the commit object. */ + commit = kzalloc(sizeof(*commit), GFP_KERNEL); + if (commit == NULL) + return -ENOMEM; + + INIT_WORK(&commit->work, rcar_du_atomic_work); + commit->dev = dev; + commit->state = state; + + /* Wait until all affected CRTCs have completed previous commits and +* mark them as pending. +*/ + for (i = 0; i < dev->mode_config.num_crtc; ++i) { + if (state->crtcs[i]) + commit->crtcs |= 1 << drm_crtc_index(state->crtcs[i]); + } + + spin_lock(&rcdu->commit.wait.lock); + ret = wait_event_interruptible_locked(rcdu->commit.wait, + !(rcdu->commit.pending & commit->crtcs)); + if (ret == 0) + rcdu->commit.pending |= commit->crtcs; + spin_unlock(&rcdu->commit.wait.lock); + + i
[PATCH 30/38] drm: rcar-du: Switch page flip to atomic helpers
The atomic page flip helper implements the page flip operation using asynchronous commits. As the legacy page flip was the last CRTC operation that needed direct access to plane setup, the plane setup functions can now become private to the plane implementation. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 55 + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 6 ++-- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 3 -- 3 files changed, 17 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 8a44d37f1716..2a1119b52c2a 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -436,14 +436,6 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc) rcar_du_crtc_start(rcrtc); } -static void rcar_du_crtc_update_base(struct rcar_du_crtc *rcrtc) -{ - struct drm_crtc *crtc = &rcrtc->crtc; - - rcar_du_plane_compute_base(rcrtc->plane, crtc->primary->fb); - rcar_du_plane_update_base(rcrtc->plane); -} - /* - * CRTC Functions */ @@ -485,12 +477,25 @@ static bool rcar_du_crtc_mode_fixup(struct drm_crtc *crtc, static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) { + struct drm_pending_vblank_event *event = crtc->state->event; struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + struct drm_device *dev = rcrtc->crtc.dev; + unsigned long flags; /* We need to access the hardware during atomic update, acquire a * reference to the CRTC. */ rcar_du_crtc_get(rcrtc); + + if (event) { + event->pipe = rcrtc->index; + + WARN_ON(drm_crtc_vblank_get(crtc) != 0); + + spin_lock_irqsave(&dev->event_lock, flags); + rcrtc->event = event; + spin_unlock_irqrestore(&dev->event_lock, flags); + } } static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) @@ -515,43 +520,11 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .atomic_flush = rcar_du_crtc_atomic_flush, }; -static int rcar_du_crtc_page_flip(struct drm_crtc *crtc, - struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, - uint32_t page_flip_flags) -{ - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - struct drm_device *dev = rcrtc->crtc.dev; - unsigned long flags; - - spin_lock_irqsave(&dev->event_lock, flags); - if (rcrtc->event != NULL) { - spin_unlock_irqrestore(&dev->event_lock, flags); - return -EBUSY; - } - spin_unlock_irqrestore(&dev->event_lock, flags); - - drm_atomic_set_fb_for_plane(crtc->primary->state, fb); - - crtc->primary->fb = fb; - rcar_du_crtc_update_base(rcrtc); - - if (event) { - event->pipe = rcrtc->index; - drm_crtc_vblank_get(crtc); - spin_lock_irqsave(&dev->event_lock, flags); - rcrtc->event = event; - spin_unlock_irqrestore(&dev->event_lock, flags); - } - - return 0; -} - static const struct drm_crtc_funcs crtc_funcs = { .reset = drm_atomic_helper_crtc_reset, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, - .page_flip = rcar_du_crtc_page_flip, + .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index ff087f7de88e..9176ac451438 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -129,7 +129,7 @@ static void rcar_du_plane_release(struct rcar_du_plane *plane) plane->hwindex = -1; } -void rcar_du_plane_update_base(struct rcar_du_plane *plane) +static void rcar_du_plane_update_base(struct rcar_du_plane *plane) { struct rcar_du_group *rgrp = plane->group; unsigned int src_x = plane->plane.state->src_x >> 16; @@ -182,8 +182,8 @@ void rcar_du_plane_update_base(struct rcar_du_plane *plane) } } -void rcar_du_plane_compute_base(struct rcar_du_plane *plane, - struct drm_framebuffer *fb) +static void rcar_du_plane_compute_base(struct rcar_du_plane *plane, + struct drm_framebuffer *fb) { struct drm_gem_cma_object *gem; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index 3420ff07f2c6..9b77a638863f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -62,8 +62,5 @@ struct r
[PATCH 33/38] drm: rcar-du: Replace plane crtc and enabled fields by plane state
The crtc and enabled fields duplicates information stored in the plane state. Use the plane state instead and remove the fields. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 6 ++ drivers/gpu/drm/rcar-du/rcar_du_plane.c | 15 +++ drivers/gpu/drm/rcar-du/rcar_du_plane.h | 3 --- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index faa46ed23a62..3f64707412e6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -212,7 +212,7 @@ static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; unsigned int j; - if (plane->crtc != &rcrtc->crtc || !plane->enabled) + if (plane->plane.state->crtc != &rcrtc->crtc) continue; /* Insert the plane in the sorted planes array. */ @@ -379,7 +379,7 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) { struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; - if (plane->crtc != crtc || !plane->enabled) + if (plane->plane.state->crtc != crtc) continue; rcar_du_plane_setup(plane); @@ -608,8 +608,6 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) rcrtc->enabled = false; rcrtc->plane = &rgrp->planes.planes[index % 2]; - rcrtc->plane->crtc = crtc; - ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, &rcrtc->plane->plane, NULL, &crtc_funcs); if (ret < 0) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index f28d13dc6fc9..c5cb2ade2722 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -140,7 +140,8 @@ static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane) bool interlaced; u32 mwr; - interlaced = plane->crtc->mode.flags & DRM_MODE_FLAG_INTERLACE; + interlaced = plane->plane.state->crtc->state->adjusted_mode.flags + & DRM_MODE_FLAG_INTERLACE; /* Memory pitch (expressed in pixels). Must be doubled for interlaced * operation with 32bpp formats. @@ -354,16 +355,11 @@ static int rcar_du_plane_atomic_check(struct drm_plane *plane, static void rcar_du_plane_disable(struct rcar_du_plane *rplane) { - if (!rplane->enabled) + if (!rplane->plane.state->crtc) return; - mutex_lock(&rplane->group->planes.lock); - rplane->enabled = false; - mutex_unlock(&rplane->group->planes.lock); - rcar_du_plane_release(rplane); - rplane->crtc = NULL; rplane->format = NULL; } @@ -391,14 +387,9 @@ static void rcar_du_plane_atomic_update(struct drm_plane *plane, rcar_du_plane_reserve(rplane, format); } - rplane->crtc = state->crtc; rplane->format = format; rcar_du_plane_setup(rplane); - - mutex_lock(&rplane->group->planes.lock); - rplane->enabled = true; - mutex_unlock(&rplane->group->planes.lock); } static const struct drm_plane_helper_funcs rcar_du_plane_helper_funcs = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index 012f2185ca1f..7050fc1e11ec 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -34,9 +34,6 @@ struct rcar_du_plane { struct drm_plane plane; struct rcar_du_group *group; - struct drm_crtc *crtc; - - bool enabled; int hwindex;/* 0-based, -1 means unused */ -- 2.0.5
[PATCH 34/38] drm: rcar-du: Remove unneeded rcar_du_crtc plane field
The rcar_du_crtc plane field is only used to check for an error that can't occur. Remove it. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 7 ++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 3f64707412e6..c70f73036056 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -353,9 +353,6 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) if (rcrtc->started) return; - if (WARN_ON(rcrtc->plane->format == NULL)) - return; - /* Set display off and background to black */ rcar_du_crtc_write(rcrtc, DOOR, DOOR_RGB(0, 0, 0)); rcar_du_crtc_write(rcrtc, BPOR, BPOR_RGB(0, 0, 0)); @@ -606,9 +603,9 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) rcrtc->mmio_offset = mmio_offsets[index]; rcrtc->index = index; rcrtc->enabled = false; - rcrtc->plane = &rgrp->planes.planes[index % 2]; - ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, &rcrtc->plane->plane, + ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, + &rgrp->planes.planes[index % 2].plane, NULL, &crtc_funcs); if (ret < 0) return ret; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index 0a3dcca58fd7..5d9aa9b33769 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -21,7 +21,6 @@ #include struct rcar_du_group; -struct rcar_du_plane; struct rcar_du_crtc { struct drm_crtc crtc; @@ -39,7 +38,6 @@ struct rcar_du_crtc { bool enabled; struct rcar_du_group *group; - struct rcar_du_plane *plane; }; #define to_rcar_crtc(c)container_of(c, struct rcar_du_crtc, crtc) -- 2.0.5
[PATCH 35/38] drm: rcar-du: Move plane format to plane state
The format stored in the rcar_du_plane structure is part of the plane state. Move it to the rcar_du_plane_state structure and precompute it in the .atomic_check() handler. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 10 ++- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 107 ++-- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 6 +- 3 files changed, 71 insertions(+), 52 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index c70f73036056..98f770622b2d 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -198,6 +198,12 @@ static unsigned int plane_zpos(struct rcar_du_plane *plane) return to_rcar_du_plane_state(plane->plane.state)->zpos; } +static const struct rcar_du_format_info * +plane_format(struct rcar_du_plane *plane) +{ + return to_rcar_du_plane_state(plane->plane.state)->format; +} + static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); @@ -223,7 +229,7 @@ static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) } planes[j] = plane; - prio += plane->format->planes * 4; + prio += plane_format(plane)->planes * 4; } for (i = 0; i < num_planes; ++i) { @@ -234,7 +240,7 @@ static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) dspr |= (index + 1) << prio; dptsr |= DPTSR_PnDK(index) | DPTSR_PnTS(index); - if (plane->format->planes == 2) { + if (plane_format(plane)->planes == 2) { index = (index + 1) % 8; prio -= 4; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index c5cb2ade2722..58b9e02e6910 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -48,7 +48,8 @@ static void rcar_du_plane_write(struct rcar_du_group *rgrp, } static int rcar_du_plane_reserve_check(struct rcar_du_plane *plane, - const struct rcar_du_format_info *format) + const struct rcar_du_format_info *cur_format, + const struct rcar_du_format_info *new_format) { struct rcar_du_group *rgrp = plane->group; unsigned int free; @@ -61,7 +62,7 @@ static int rcar_du_plane_reserve_check(struct rcar_du_plane *plane, if (plane->hwindex != -1) { free |= 1 << plane->hwindex; - if (plane->format->planes == 2) + if (cur_format->planes == 2) free |= 1 << ((plane->hwindex + 1) % 8); } @@ -69,7 +70,7 @@ static int rcar_du_plane_reserve_check(struct rcar_du_plane *plane, if (!(free & (1 << i))) continue; - if (format->planes == 1 || free & (1 << ((i + 1) % 8))) + if (new_format->planes == 1 || free & (1 << ((i + 1) % 8))) break; } @@ -113,7 +114,8 @@ done: return ret; } -static void rcar_du_plane_release(struct rcar_du_plane *plane) +static void rcar_du_plane_release(struct rcar_du_plane *plane, + const struct rcar_du_format_info *format) { struct rcar_du_group *rgrp = plane->group; @@ -122,7 +124,7 @@ static void rcar_du_plane_release(struct rcar_du_plane *plane) mutex_lock(&rgrp->planes.lock); rgrp->planes.free |= 1 << plane->hwindex; - if (plane->format->planes == 2) + if (format->planes == 2) rgrp->planes.free |= 1 << ((plane->hwindex + 1) % 8); mutex_unlock(&rgrp->planes.lock); @@ -131,27 +133,29 @@ static void rcar_du_plane_release(struct rcar_du_plane *plane) static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane) { + struct rcar_du_plane_state *state = + to_rcar_du_plane_state(plane->plane.state); struct drm_framebuffer *fb = plane->plane.state->fb; struct rcar_du_group *rgrp = plane->group; - unsigned int src_x = plane->plane.state->src_x >> 16; - unsigned int src_y = plane->plane.state->src_y >> 16; + unsigned int src_x = state->state.src_x >> 16; + unsigned int src_y = state->state.src_y >> 16; unsigned int index = plane->hwindex; struct drm_gem_cma_object *gem; bool interlaced; u32 mwr; - interlaced = plane->plane.state->crtc->state->adjusted_mode.flags + interlaced = state->state.crtc->state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE; /* Memory pitch (expressed in pixels). Must be doubled for interlaced * operation with 32bpp formats. */ - if (plane->format->planes == 2) + if (state->format->planes == 2) mwr = fb->pitches[0]; else -
[PATCH 37/38] drm: rcar-du: Move group locking inside rcar_du_crtc_update_planes()
Only the planes to CRTCs association control register DPTSR needs to be protected by custom locking, don't hold the mutex around the whole code. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 29bbb44eecc9..8459aaee8add 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -252,8 +252,6 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc) * with superposition controller 2. */ if (rcrtc->index % 2) { - u32 value = rcar_du_group_read(rcrtc->group, DPTSR); - /* The DPTSR register is updated when the display controller is * stopped. We thus need to restart the DU. Once again, sorry * for the flicker. One way to mitigate the issue would be to @@ -261,11 +259,13 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc) * split, or through a module parameter). Flicker would then * occur only if we need to break the pre-association. */ - if (value != dptsr) { + mutex_lock(&rcrtc->group->planes.lock); + if (rcar_du_group_read(rcrtc->group, DPTSR) != dptsr) { rcar_du_group_write(rcrtc->group, DPTSR, dptsr); if (rcrtc->group->used_crtcs) rcar_du_group_restart(rcrtc->group); } + mutex_unlock(&rcrtc->group->planes.lock); } rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, @@ -435,9 +435,7 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc) rcar_du_plane_setup(plane); } - mutex_lock(&rcrtc->group->planes.lock); rcar_du_crtc_update_planes(rcrtc); - mutex_unlock(&rcrtc->group->planes.lock); } /* - @@ -501,9 +499,7 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - mutex_lock(&rcrtc->group->planes.lock); rcar_du_crtc_update_planes(rcrtc); - mutex_unlock(&rcrtc->group->planes.lock); } static const struct drm_crtc_helper_funcs crtc_helper_funcs = { -- 2.0.5
[PATCH 38/38] drm: rcar-du: Fix race condition in hardware plane allocator
The plane allocator has been inherently racy since the beginning of the transition to atomic updates, as the allocator lock is released between free plane check (at .atomic_check() time) and the reservation (at .atomic_update() time). To fix it, create a new allocator solely based on the atomic plane states without keeping any external state and perform allocation in the .atomic_check() handler. The core idea is to replace the free planes bitmask with a collective knowledge based on the allocated hardware plane(s) for each KMS plane. The allocator then loops over all plane states to compute the free planes bitmask, allocates hardware planes based on that bitmask, and stores the result back in the plane states. For this to work we need to access the current state of planes not touched by the atomic update. To ensure that it won't be modified, we need to lock all planes using drm_atomic_get_plane_state(). This effectively serializes atomic updates from .atomic_check() up to completion, either when swapping the states if the check step has succeeded, or when freeing the states if the check step has failed. Suggested-by: Daniel Vetter Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 7 +- drivers/gpu/drm/rcar-du/rcar_du_group.h | 5 + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 203 +++- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 166 ++ drivers/gpu/drm/rcar-du/rcar_du_plane.h | 11 +- 5 files changed, 228 insertions(+), 164 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 8459aaee8add..9e72133bb64b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -233,7 +233,8 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc) for (i = 0; i < num_planes; ++i) { struct rcar_du_plane *plane = planes[i]; - unsigned int index = plane->hwindex; + struct drm_plane_state *state = plane->plane.state; + unsigned int index = to_rcar_du_plane_state(state)->hwindex; prio -= 4; dspr |= (index + 1) << prio; @@ -259,13 +260,13 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc) * split, or through a module parameter). Flicker would then * occur only if we need to break the pre-association. */ - mutex_lock(&rcrtc->group->planes.lock); + mutex_lock(&rcrtc->group->lock); if (rcar_du_group_read(rcrtc->group, DPTSR) != dptsr) { rcar_du_group_write(rcrtc->group, DPTSR, dptsr); if (rcrtc->group->used_crtcs) rcar_du_group_restart(rcrtc->group); } - mutex_unlock(&rcrtc->group->planes.lock); + mutex_unlock(&rcrtc->group->lock); } rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h index 0c38cdcda4ca..ed36433fbe84 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_group.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h @@ -14,6 +14,8 @@ #ifndef __RCAR_DU_GROUP_H__ #define __RCAR_DU_GROUP_H__ +#include + #include "rcar_du_plane.h" struct rcar_du_device; @@ -25,6 +27,7 @@ struct rcar_du_device; * @index: group index * @use_count: number of users of the group (rcar_du_group_(get|put)) * @used_crtcs: number of CRTCs currently in use + * @lock: protects the DPTSR register * @planes: planes handled by the group */ struct rcar_du_group { @@ -35,6 +38,8 @@ struct rcar_du_group { unsigned int use_count; unsigned int used_crtcs; + struct mutex lock; + struct rcar_du_planes planes; }; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 8bc7242ba979..fb052bca574f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -189,9 +189,206 @@ static void rcar_du_output_poll_changed(struct drm_device *dev) } /* - - * Atomic Updates + * Atomic Check and Update */ +/* + * Atomic hardware plane allocator + * + * The hardware plane allocator is solely based on the atomic plane states + * without keeping any external state to avoid races between .atomic_check() + * and .atomic_commit(). + * + * The core idea is to avoid using a free planes bitmask that would need to be + * shared between check and commit handlers with a collective knowledge based on + * the allocated hardware plane(s) for each KMS plane. The allocator then loops + * over all plane states to compute the free planes bitmask, allocates hardware + * planes based on that bitmask, and stores the result back in the plane st
[PATCH 07/38] drm: rcar-du: Don't disable unused functions at init time
All encoders and CRTCs start disabled, re-disabling them is a no-op. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index cc9136e8ee9c..1ea2c1e9cb79 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -448,8 +448,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) drm_kms_helper_poll_init(dev); - drm_helper_disable_unused_functions(dev); - fbdev = drm_fbdev_cma_init(dev, 32, dev->mode_config.num_crtc, dev->mode_config.num_connector); if (IS_ERR(fbdev)) -- 2.0.5
[PATCH 28/38] drm: rcar-du: Replace encoder mode_fixup with atomic_check
The encoder .mode_fixup() operation is legacy, atomic updates uses the new .atomic_check() operation. Convert the encoders drivers. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 35 +++ drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c | 14 +++-- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c index d4a70228ce50..d0ae1e8009c6 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c @@ -58,35 +58,24 @@ static void rcar_du_encoder_enable(struct drm_encoder *encoder) rcar_du_lvdsenc_enable(renc->lvds, encoder->crtc, true); } -static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int rcar_du_encoder_atomic_check(struct drm_encoder *encoder, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct rcar_du_encoder *renc = to_rcar_encoder(encoder); + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + const struct drm_display_mode *mode = &crtc_state->mode; const struct drm_display_mode *panel_mode; + struct drm_connector *connector = conn_state->connector; struct drm_device *dev = encoder->dev; - struct drm_connector *connector; - bool found = false; /* DAC encoders have currently no restriction on the mode. */ if (encoder->encoder_type == DRM_MODE_ENCODER_DAC) - return true; - - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { - if (connector->encoder == encoder) { - found = true; - break; - } - } - - if (!found) { - dev_dbg(dev->dev, "mode_fixup: no connector found\n"); - return false; - } + return 0; if (list_empty(&connector->modes)) { - dev_dbg(dev->dev, "mode_fixup: empty modes list\n"); - return false; + dev_dbg(dev->dev, "encoder: empty modes list\n"); + return -EINVAL; } panel_mode = list_first_entry(&connector->modes, @@ -95,7 +84,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, /* We're not allowed to modify the resolution. */ if (mode->hdisplay != panel_mode->hdisplay || mode->vdisplay != panel_mode->vdisplay) - return false; + return -EINVAL; /* The flat panel mode is fixed, just copy it to the adjusted mode. */ drm_mode_copy(adjusted_mode, panel_mode); @@ -107,7 +96,7 @@ static bool rcar_du_encoder_mode_fixup(struct drm_encoder *encoder, adjusted_mode->clock = clamp(adjusted_mode->clock, 3, 15); - return true; + return 0; } static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, @@ -120,10 +109,10 @@ static void rcar_du_encoder_mode_set(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs encoder_helper_funcs = { - .mode_fixup = rcar_du_encoder_mode_fixup, .mode_set = rcar_du_encoder_mode_set, .disable = rcar_du_encoder_disable, .enable = rcar_du_encoder_enable, + .atomic_check = rcar_du_encoder_atomic_check, }; static const struct drm_encoder_funcs encoder_funcs = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c index 3c29250c8abd..81da8419282b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c @@ -62,12 +62,14 @@ static void rcar_du_hdmienc_enable(struct drm_encoder *encoder) hdmienc->enabled = true; } -static bool rcar_du_hdmienc_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int rcar_du_hdmienc_atomic_check(struct drm_encoder *encoder, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct rcar_du_hdmienc *hdmienc = to_rcar_hdmienc(encoder); struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder); + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + const struct drm_display_mode *mode = &crtc_state->mode; /* The internal LVDS encoder has a clock frequency operating range of * 30MHz to 150MHz. Clamp the clock accordingly. @@ -77,9 +79,9 @@ s
[PATCH 31/38] drm: rcar-du: Switch plane set_property to atomic helpers
Allow setting up plane properties atomically using the plane set_property atomic helper. The properties are now stored in the plane state (requiring subclassing it) and applied when updating the planes. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 9 ++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 1 - drivers/gpu/drm/rcar-du/rcar_du_plane.c | 125 +++- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 17 - 4 files changed, 95 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 2a1119b52c2a..faa46ed23a62 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -193,7 +193,12 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc, rcdu->dpad0_source = rcrtc->index; } -void rcar_du_crtc_update_planes(struct drm_crtc *crtc) +static unsigned int plane_zpos(struct rcar_du_plane *plane) +{ + return to_rcar_du_plane_state(plane->plane.state)->zpos; +} + +static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); struct rcar_du_plane *planes[RCAR_DU_NUM_HW_PLANES]; @@ -212,7 +217,7 @@ void rcar_du_crtc_update_planes(struct drm_crtc *crtc) /* Insert the plane in the sorted planes array. */ for (j = num_planes++; j > 0; --j) { - if (planes[j-1]->zpos <= plane->zpos) + if (plane_zpos(planes[j-1]) <= plane_zpos(plane)) break; planes[j] = planes[j-1]; } diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index f50fbafd609f..0a3dcca58fd7 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -62,6 +62,5 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc); void rcar_du_crtc_route_output(struct drm_crtc *crtc, enum rcar_du_output output); -void rcar_du_crtc_update_planes(struct drm_crtc *crtc); #endif /* __RCAR_DU_CRTC_H__ */ diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 9176ac451438..7e0e2731ea27 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -201,6 +201,8 @@ static void rcar_du_plane_compute_base(struct rcar_du_plane *plane, static void rcar_du_plane_setup_mode(struct rcar_du_plane *plane, unsigned int index) { + struct rcar_du_plane_state *state = + to_rcar_du_plane_state(plane->plane.state); struct rcar_du_group *rgrp = plane->group; u32 colorkey; u32 pnmr; @@ -218,7 +220,7 @@ static void rcar_du_plane_setup_mode(struct rcar_du_plane *plane, rcar_du_plane_write(rgrp, index, PnALPHAR, PnALPHAR_ABIT_0); else rcar_du_plane_write(rgrp, index, PnALPHAR, - PnALPHAR_ABIT_X | plane->alpha); + PnALPHAR_ABIT_X | state->alpha); pnmr = PnMR_BM_MD | plane->format->pnmr; @@ -226,7 +228,7 @@ static void rcar_du_plane_setup_mode(struct rcar_du_plane *plane, * PnMR_SPIM_TP_OFF bit set in their pnmr field, disabling color keying * automatically. */ - if ((plane->colorkey & RCAR_DU_COLORKEY_MASK) == RCAR_DU_COLORKEY_NONE) + if ((state->colorkey & RCAR_DU_COLORKEY_MASK) == RCAR_DU_COLORKEY_NONE) pnmr |= PnMR_SPIM_TP_OFF; /* For packed YUV formats we need to select the U/V order. */ @@ -237,24 +239,24 @@ static void rcar_du_plane_setup_mode(struct rcar_du_plane *plane, switch (plane->format->fourcc) { case DRM_FORMAT_RGB565: - colorkey = ((plane->colorkey & 0xf8) >> 8) -| ((plane->colorkey & 0x00fc00) >> 5) -| ((plane->colorkey & 0xf8) >> 3); + colorkey = ((state->colorkey & 0xf8) >> 8) +| ((state->colorkey & 0x00fc00) >> 5) +| ((state->colorkey & 0xf8) >> 3); rcar_du_plane_write(rgrp, index, PnTC2R, colorkey); break; case DRM_FORMAT_ARGB1555: case DRM_FORMAT_XRGB1555: - colorkey = ((plane->colorkey & 0xf8) >> 9) -| ((plane->colorkey & 0x00f800) >> 6) -| ((plane->colorkey & 0xf8) >> 3); + colorkey = ((state->colorkey & 0xf8) >> 9) +| ((state->colorkey & 0x00f800) >> 6) +| ((state->colorkey & 0xf8) >> 3); rcar_du_plane_write(rgrp, index, PnTC2R, colorkey); break; case DRM_FORMAT_XRGB: case DRM_FORMAT_ARGB: rc
[PATCH 32/38] drm: rcar-du: Rework plane setup code
Now that the plane setup code isn't called outside of the plane implementation, it can be simplified by merging the rcar_du_plane_compute_base() and rcar_du_plane_update_base() functions. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 34 - drivers/gpu/drm/rcar-du/rcar_du_plane.h | 3 --- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 7e0e2731ea27..f28d13dc6fc9 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c @@ -129,12 +129,14 @@ static void rcar_du_plane_release(struct rcar_du_plane *plane) plane->hwindex = -1; } -static void rcar_du_plane_update_base(struct rcar_du_plane *plane) +static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane) { + struct drm_framebuffer *fb = plane->plane.state->fb; struct rcar_du_group *rgrp = plane->group; unsigned int src_x = plane->plane.state->src_x >> 16; unsigned int src_y = plane->plane.state->src_y >> 16; unsigned int index = plane->hwindex; + struct drm_gem_cma_object *gem; bool interlaced; u32 mwr; @@ -144,9 +146,9 @@ static void rcar_du_plane_update_base(struct rcar_du_plane *plane) * operation with 32bpp formats. */ if (plane->format->planes == 2) - mwr = plane->pitch; + mwr = fb->pitches[0]; else - mwr = plane->pitch * 8 / plane->format->bpp; + mwr = fb->pitches[0] * 8 / plane->format->bpp; if (interlaced && plane->format->bpp == 32) mwr *= 2; @@ -168,33 +170,22 @@ static void rcar_du_plane_update_base(struct rcar_du_plane *plane) rcar_du_plane_write(rgrp, index, PnSPXR, src_x); rcar_du_plane_write(rgrp, index, PnSPYR, src_y * (!interlaced && plane->format->bpp == 32 ? 2 : 1)); - rcar_du_plane_write(rgrp, index, PnDSA0R, plane->dma[0]); + + gem = drm_fb_cma_get_gem_obj(fb, 0); + rcar_du_plane_write(rgrp, index, PnDSA0R, gem->paddr + fb->offsets[0]); if (plane->format->planes == 2) { index = (index + 1) % 8; - rcar_du_plane_write(rgrp, index, PnMWR, plane->pitch); + rcar_du_plane_write(rgrp, index, PnMWR, fb->pitches[0]); rcar_du_plane_write(rgrp, index, PnSPXR, src_x); rcar_du_plane_write(rgrp, index, PnSPYR, src_y * (plane->format->bpp == 16 ? 2 : 1) / 2); - rcar_du_plane_write(rgrp, index, PnDSA0R, plane->dma[1]); - } -} - -static void rcar_du_plane_compute_base(struct rcar_du_plane *plane, - struct drm_framebuffer *fb) -{ - struct drm_gem_cma_object *gem; - - plane->pitch = fb->pitches[0]; - gem = drm_fb_cma_get_gem_obj(fb, 0); - plane->dma[0] = gem->paddr + fb->offsets[0]; - - if (plane->format->planes == 2) { gem = drm_fb_cma_get_gem_obj(fb, 1); - plane->dma[1] = gem->paddr + fb->offsets[1]; + rcar_du_plane_write(rgrp, index, PnDSA0R, + gem->paddr + fb->offsets[1]); } } @@ -316,7 +307,7 @@ void rcar_du_plane_setup(struct rcar_du_plane *plane) if (plane->format->planes == 2) __rcar_du_plane_setup(plane, (plane->hwindex + 1) % 8); - rcar_du_plane_update_base(plane); + rcar_du_plane_setup_fb(plane); } static int rcar_du_plane_atomic_check(struct drm_plane *plane, @@ -403,7 +394,6 @@ static void rcar_du_plane_atomic_update(struct drm_plane *plane, rplane->crtc = state->crtc; rplane->format = format; - rcar_du_plane_compute_base(rplane, state->fb); rcar_du_plane_setup(rplane); mutex_lock(&rplane->group->planes.lock); diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index d291e85896ef..012f2185ca1f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h @@ -41,9 +41,6 @@ struct rcar_du_plane { int hwindex;/* 0-based, -1 means unused */ const struct rcar_du_format_info *format; - - unsigned long dma[2]; - unsigned int pitch; }; struct rcar_du_planes { -- 2.0.5
[PATCH 36/38] drm: rcar-du: Move plane commit code from CRTC start to CRTC resume
As the DRM core will commit plane states when performing atomic updates, those don't need to be committed manually when the CRTC is started except in the system resume code path. However, the atomic plane commit step is currently performed between mode set disable and mode set enable to mimick the legacy mode setting operations order. This causes the device clocks to be disabled after applying plane settings and reenabled when enabling the CRTC, potentially losing hardware in between. Reorder the operations to enable the CRTC first and only then apply plane settings, removing the need to manage clocks in the atomic begin and flush handlers. We can then move the plane state commit code out of the CRTC start handler to the system resume handler. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 54 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 98f770622b2d..29bbb44eecc9 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -204,9 +204,8 @@ plane_format(struct rcar_du_plane *plane) return to_rcar_du_plane_state(plane->plane.state)->format; } -static void rcar_du_crtc_update_planes(struct drm_crtc *crtc) +static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc) { - struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); struct rcar_du_plane *planes[RCAR_DU_NUM_HW_PLANES]; unsigned int num_planes = 0; unsigned int prio = 0; @@ -354,7 +353,6 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) { struct drm_crtc *crtc = &rcrtc->crtc; bool interlaced; - unsigned int i; if (rcrtc->started) return; @@ -367,26 +365,8 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc) rcar_du_crtc_set_display_timing(rcrtc); rcar_du_group_set_routing(rcrtc->group); - /* FIXME: Commit the planes state. This is required here as the CRTC can -* be started from the system resume handler, which don't go -* through .atomic_plane_update() and .atomic_flush() to commit plane -* state. Additionally, given that the plane state atomic commit occurs -* between CRTC disable and enable, the hardware state could also be -* lost due to runtime PM, requiring a full commit here. This will be -* fixed later after switching to atomic updates completely. -*/ - mutex_lock(&rcrtc->group->planes.lock); - rcar_du_crtc_update_planes(crtc); - mutex_unlock(&rcrtc->group->planes.lock); - - for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) { - struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; - - if (plane->plane.state->crtc != crtc) - continue; - - rcar_du_plane_setup(plane); - } + /* Start with all planes disabled. */ + rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0); /* Select master sync mode. This enables display operation in master * sync mode (with the HSYNC and VSYNC signals configured as outputs and @@ -437,11 +417,27 @@ void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc) void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc) { + unsigned int i; + if (!rcrtc->enabled) return; rcar_du_crtc_get(rcrtc); rcar_du_crtc_start(rcrtc); + + /* Commit the planes state. */ + for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) { + struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i]; + + if (plane->plane.state->crtc != &rcrtc->crtc) + continue; + + rcar_du_plane_setup(plane); + } + + mutex_lock(&rcrtc->group->planes.lock); + rcar_du_crtc_update_planes(rcrtc); + mutex_unlock(&rcrtc->group->planes.lock); } /* - @@ -490,11 +486,6 @@ static void rcar_du_crtc_atomic_begin(struct drm_crtc *crtc) struct drm_device *dev = rcrtc->crtc.dev; unsigned long flags; - /* We need to access the hardware during atomic update, acquire a -* reference to the CRTC. -*/ - rcar_du_crtc_get(rcrtc); - if (event) { event->pipe = rcrtc->index; @@ -510,14 +501,9 @@ static void rcar_du_crtc_atomic_flush(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); - /* We're done, apply the configuration and drop the reference acquired -* in .atomic_begin(). -*/ mutex_lock(&rcrtc->group->planes.lock); - rcar_du_crtc_update_planes(crtc); + rcar_du_crtc_update_planes(rcrtc); mutex_unlock(&rcrtc->g
[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst
https://bugs.freedesktop.org/show_bug.cgi?id=73338 --- Comment #85 from Kamil Páral --- I just tested this with kernel 4.0 (some pre version), and I just want to say big thank you to everyone involved. My system is now finally quiet, and everything seems to be working properly. Great work, folks. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/2cfe5651/attachment.html>
[Bug 89327] Loss of HDMI audio on auto screen off (energy saving)
https://bugs.freedesktop.org/show_bug.cgi?id=89327 Bug ID: 89327 Summary: Loss of HDMI audio on auto screen off (energy saving) Product: Mesa Version: git Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel at lists.freedesktop.org Reporter: john.ettedgui at gmail.com QA Contact: dri-devel at lists.freedesktop.org Since moving to 4.0-rc1 when my screen goes off (energy saving), I lose the hdmi audio, standard stuff. When I move the mouse I get the screen back but not the audio anymore. Switching it back on with xrandr works. Thanks -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/edc05d6c/attachment-0001.html>
[Bug 89327] Loss of HDMI audio on auto screen off (energy saving)
https://bugs.freedesktop.org/show_bug.cgi?id=89327 Alex Deucher changed: What|Removed |Added Component|Drivers/Gallium/radeonsi|DRM/Radeon Version|git |unspecified Product|Mesa|DRI QA Contact|dri-devel at lists.freedesktop | |.org| --- Comment #1 from Alex Deucher --- Please attach your xorg log and dmesg output. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/b7537056/attachment.html>
[PULL] topic/drm-misc for 4.1
Hi Dave, A few random things and a few small patches for atomic. Pull request for 4.1 so that Laurent can rebase his rcar atomic conversion, which needs a few things from here. Also better to get the renames in before there's conflicts. Cheers, Daniel The following changes since commit 96abd10ecc2e9ab5c8060697ce721683f387c64e: Merge branch 'drm-next-3.20' of git://people.freedesktop.org/~agd5f/linux into drm-next (2015-02-12 10:01:51 +1000) are available in the git repository at: git://anongit.freedesktop.org/drm-intel tags/topic/drm-misc-2015-02-25 for you to fetch changes up to e045d20bef41707dbba676e58624b54f9f39e172: drm: Adding edp1.4 specific dpcd macros (2015-02-24 01:58:16 +0100) Damien Lespiau (2): drm: Fix drm_crtc_vblank_get() documentation drm: Fix the CRTC_STEREO_DOUBLE_ONLY define to include stero modes Daniel Vetter (4): drm: Add DRM_DEBUG_ATOMIC drm: If available use atomic state in getcrtc ioctl drm/atomic-helper: Rename commmit_post/pre_planes drm/atomic-helpers: make mode_set hooks optional Laurent Pinchart (2): drm/atomic-helpers: Fix documentation typos and wrong copy&paste drm/atomic: Rename drm_atomic_helper_commit_pre_planes() state argument Sonika Jindal (1): drm: Adding edp1.4 specific dpcd macros drivers/gpu/drm/drm_atomic.c| 100 ++- drivers/gpu/drm/drm_atomic_helper.c | 192 +++- drivers/gpu/drm/drm_crtc.c | 25 +++-- drivers/gpu/drm/drm_irq.c | 2 +- drivers/gpu/drm/i915/intel_atomic.c | 4 +- drivers/gpu/drm/msm/msm_atomic.c| 4 +- drivers/gpu/drm/tegra/drm.c | 4 +- include/drm/drmP.h | 9 ++ include/drm/drm_atomic_helper.h | 6 +- include/drm/drm_crtc_helper.h | 3 +- include/drm/drm_dp_helper.h | 8 ++ include/drm/drm_modes.h | 2 +- 12 files changed, 202 insertions(+), 157 deletions(-) -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[Bug 89327] Loss of HDMI audio on auto screen off (energy saving)
https://bugs.freedesktop.org/show_bug.cgi?id=89327 --- Comment #2 from Dieter Nützel --- (In reply to John from comment #0) > Since moving to 4.0-rc1 when my screen goes off (energy saving), I lose the > hdmi audio, standard stuff. > When I move the mouse I get the screen back but not the audio anymore. > Switching it back on with xrandr works. > > Thanks Can you please attach the 'right' xrandr line, please? I do not hear anything after screen goes off (energy saving) with drm-next-4.1-wip on r600/NI/Turks, too. So it seems to be not only with radeonsi. -Dieter -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/4f9c9407/attachment.html>
[Bug 89327] Loss of HDMI audio on auto screen off (energy saving)
https://bugs.freedesktop.org/show_bug.cgi?id=89327 --- Comment #3 from Dieter Nützel --- Created attachment 113830 --> https://bugs.freedesktop.org/attachment.cgi?id=113830&action=edit dmesg-drm-next-4.1-wip.log.xz -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/4efb7572/attachment.html>
[Bug 89327] Loss of HDMI audio on auto screen off (energy saving)
https://bugs.freedesktop.org/show_bug.cgi?id=89327 --- Comment #4 from Dieter Nützel --- Created attachment 113831 --> https://bugs.freedesktop.org/attachment.cgi?id=113831&action=edit Xorg.0.log-drm-next-4.1-wip.xz -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150225/899a1933/attachment.html>