[PATCH] gpu: drm/nouveau/nouveau_fence.c: remove unnecessary null pointer check
the variable sender is dereferenced in line 190, so it is no reason to check null again in line 198. Signed-off-by: Cong Ding --- drivers/gpu/drm/nouveau/nouveau_fence.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 1d049be..b6b8e49 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -195,11 +195,9 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **pfence) return -ENOMEM; kref_init(&fence->kref); - if (chan) { - ret = nouveau_fence_emit(fence, chan); - if (ret) - nouveau_fence_unref(&fence); - } + ret = nouveau_fence_emit(fence, chan); + if (ret) + nouveau_fence_unref(&fence); *pfence = fence; return ret; -- 1.7.10.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] gpu: drm/gma500/mdfld_dsi_pkg_sender.c: remove unnecessary null pointer check
the variable sender is dereferenced in line 536, so it is no reason to check null again in line 541. Signed-off-by: Cong Ding --- drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c index 489ffd2..823854a 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c @@ -538,7 +538,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, u32 gen_data_reg; int retry = MDFLD_DSI_READ_MAX_COUNT; - if (!sender || !data_out || !len_out) { + if (!data_out || !len_out) { DRM_ERROR("Invalid parameters\n"); return -EINVAL; } -- 1.7.10.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] gpu: drm/gma500/mdfld_dsi_output.c: remove unnecessary null pointer check
the variable sender is dereferenced in line 95, so it is no reason to check null again in line 99. Signed-off-by: Cong Ding --- drivers/gpu/drm/gma500/mdfld_dsi_output.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c index 2d4ab48..67e439a 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c @@ -96,11 +96,6 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe) struct drm_psb_private *dev_priv = dev->dev_private; u32 gen_ctrl_val; - if (!sender) { - DRM_ERROR("No sender found\n"); - return; - } - /* Set default display backlight value to 85% (0xd8)*/ mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1, true); -- 1.7.10.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Regression: drm/radeon: brightness control hard system lockup
On Mon, 14 Jan 2013, Alex Deucher wrote: > On Sun, Jan 13, 2013 at 4:00 PM, Eldad Zack wrote: > > > > On Mon, 7 Jan 2013, Alex Deucher wrote: > >> On Mon, Jan 7, 2013 at 4:33 PM, Eldad Zack wrote: > >> > > >> > On Mon, 7 Jan 2013, Alex Deucher wrote: > >> >> On Sun, Jan 6, 2013 at 7:59 AM, Eldad Zack > >> >> wrote: > >> >> > > >> >> > Hi Alex, > >> >> > > >> >> > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f "drm/radeon: switch > >> >> > to a > >> >> > finer grained reset for evergreen" introduced a hard system lockup to > >> >> > my > >> >> > setup. I found it after bisecting, and confirmed it by reverting it on > >> >> > the latest mainline ( 5f243b9 ). > >> >> > > >> >> > This: > >> >> > > >> >> >echo 7 > > >> >> > /sys/devices/pci:00/:00:01.0/:01:00.0/backlight/acpi_video0/brightness > >> >> > > >> >> > Causes a hard lock-up hard, i.e. immediate freeze, without any logs. > >> >> > > >> >> > See lspci output and kernel .config below. > >> >> > If there's any more info I can provide, please let me know. > >> >> > >> >> Do you normally see GPU resets when changing the backlight? Please > >> >> attach your dmesg output when changing the backlight with the patch > >> >> reverted. > >> > > >> > I see nothing. Just to make sure, I cleared the buffer, cycled through > >> > 0-7 a couple of hunderd times (until the flicker annoyed), but I see no > >> > messages at all. > >> > Is there any debug config I should turn on? > >> > >> Can you try adding a printk() in evergreen_asic_reset() and see if it > >> is somehow getting called when you change the brightness? When you > >> use the apci backlight control, the radeon driver is not involved at > >> all. They only way the driver would get involved is if the acpi > >> backlight control somehow caused the GPU to hang and then the driver > >> detected the hang and attempted to reset the GPU. I don't see any > >> evidence of a GPU reset in your kernel log however. Note that the > >> driver also registers native backlight contol. Does that work any > >> better than acpi? > > > > The native backlight controls work very well. Thanks for that, I didn't > > even noticed that. It has finer control over brightness too. > > > > I worked out a fix for the problem, but I think it's not a proper one. > > What I noticed is that evergreen_gpu_soft_reset() is only ever called > > once on my system, at boot. > > Then I realized from the dmesg that neither > > evergreen_gpu_soft_reset_dma() nor evergreen_gpu_soft_reset_gfx() actually > > do anything. Both return on the first if statements there. > > > > So as far as I can tell, the difference your patch introduced is calling > > evergreen_mc_stop() and evergreen_mc_resume(), which somehow puts my > > system in some state that ACPI brightness control leads to a lock up. > > > > BTW, I don't see a GPU reset happening at all - I also tried suspend/resume > > and starting an OpenGL application. Do you know how I can trigger it? > > > > To fix this, I moved the GUI_ACTIVE test before evergreen_mc_stop(), but > > I think it just masks the issue. > > Patch below (against latest HEAD) just in case. > > > > Thanks for tracking this down. The attached patch should fix the > issue properly. Thanks, I just applied it and it works as expected. Tested-by: Eldad Zack @Paul: Thanks for the comments, will do so in the future. Cheers, Eldad ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 58033] [r300g] Black gap artifacts when playing WoW
https://bugs.freedesktop.org/show_bug.cgi?id=58033 --- Comment #7 from Tomasz P. --- Marek Ol??k post some patches on mailing list that implementing separate depth-stencil clear. Maybe they will help. -- 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/20130114/f55594dc/attachment.html>
[Bug 58033] [r300g] Black gap artifacts when playing WoW
https://bugs.freedesktop.org/show_bug.cgi?id=58033 --- Comment #6 from Chris Rankin --- This bug is still present after Marek's latest r300g commits: HEAD is commit e3e1ffb2520498584ef402213d0c8aa4303a46a3 Author: Marek Ol??k Date: Mon Jan 14 05:51:05 2013 +0100 r300g: set a dummy vertex buffer in context_create so that the driver doesn't crash if an app doesn't set any vertex buffers. -- 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/20130114/967a3f89/attachment.html>
Regression: drm/radeon: brightness control hard system lockup
On Mon, 14 Jan 2013, Alex Deucher wrote: > On Sun, Jan 13, 2013 at 4:00 PM, Eldad Zack wrote: > > > > On Mon, 7 Jan 2013, Alex Deucher wrote: > >> On Mon, Jan 7, 2013 at 4:33 PM, Eldad Zack > >> wrote: > >> > > >> > On Mon, 7 Jan 2013, Alex Deucher wrote: > >> >> On Sun, Jan 6, 2013 at 7:59 AM, Eldad Zack > >> >> wrote: > >> >> > > >> >> > Hi Alex, > >> >> > > >> >> > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f "drm/radeon: switch > >> >> > to a > >> >> > finer grained reset for evergreen" introduced a hard system lockup to > >> >> > my > >> >> > setup. I found it after bisecting, and confirmed it by reverting it on > >> >> > the latest mainline ( 5f243b9 ). > >> >> > > >> >> > This: > >> >> > > >> >> >echo 7 > > >> >> > /sys/devices/pci:00/:00:01.0/:01:00.0/backlight/acpi_video0/brightness > >> >> > > >> >> > Causes a hard lock-up hard, i.e. immediate freeze, without any logs. > >> >> > > >> >> > See lspci output and kernel .config below. > >> >> > If there's any more info I can provide, please let me know. > >> >> > >> >> Do you normally see GPU resets when changing the backlight? Please > >> >> attach your dmesg output when changing the backlight with the patch > >> >> reverted. > >> > > >> > I see nothing. Just to make sure, I cleared the buffer, cycled through > >> > 0-7 a couple of hunderd times (until the flicker annoyed), but I see no > >> > messages at all. > >> > Is there any debug config I should turn on? > >> > >> Can you try adding a printk() in evergreen_asic_reset() and see if it > >> is somehow getting called when you change the brightness? When you > >> use the apci backlight control, the radeon driver is not involved at > >> all. They only way the driver would get involved is if the acpi > >> backlight control somehow caused the GPU to hang and then the driver > >> detected the hang and attempted to reset the GPU. I don't see any > >> evidence of a GPU reset in your kernel log however. Note that the > >> driver also registers native backlight contol. Does that work any > >> better than acpi? > > > > The native backlight controls work very well. Thanks for that, I didn't > > even noticed that. It has finer control over brightness too. > > > > I worked out a fix for the problem, but I think it's not a proper one. > > What I noticed is that evergreen_gpu_soft_reset() is only ever called > > once on my system, at boot. > > Then I realized from the dmesg that neither > > evergreen_gpu_soft_reset_dma() nor evergreen_gpu_soft_reset_gfx() actually > > do anything. Both return on the first if statements there. > > > > So as far as I can tell, the difference your patch introduced is calling > > evergreen_mc_stop() and evergreen_mc_resume(), which somehow puts my > > system in some state that ACPI brightness control leads to a lock up. > > > > BTW, I don't see a GPU reset happening at all - I also tried suspend/resume > > and starting an OpenGL application. Do you know how I can trigger it? > > > > To fix this, I moved the GUI_ACTIVE test before evergreen_mc_stop(), but > > I think it just masks the issue. > > Patch below (against latest HEAD) just in case. > > > > Thanks for tracking this down. The attached patch should fix the > issue properly. Thanks, I just applied it and it works as expected. Tested-by: Eldad Zack @Paul: Thanks for the comments, will do so in the future. Cheers, Eldad
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #7 from Bryan Quigley --- Created attachment 73018 --> https://bugs.freedesktop.org/attachment.cgi?id=73018&action=edit tail -f output of Xorg, from starting big picture Syslog doesn't report anything when this happens, Xorg.0.log shows the following attachment (using tail -f). -- 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/20130114/33253572/attachment.html>
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #6 from Bryan Quigley --- https://docs.google.com/file/d/0B9PdLrdrtm1wQVRma3JNdzFNa0k/edit Video of steam creating the issue, and then the issue disappearing (this doesn't usually happen) https://docs.google.com/file/d/0B9PdLrdrtm1wS2RyV2g1SmRSbnc/edit What usually happens to the rest of the desktop. -- 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/20130114/b14eedc4/attachment.html>
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #5 from Bryan Quigley --- IN 3.8-rc3 this crash no longer happens. However, there is a new graphical corruption when launching Steam's Big Picture. This corruption stays until logoff. It does not affect openbox/lxde, only compiz/unity which is why I thought it might be related to this bug or it's fix. It does not happen in 3.7. -- 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/20130114/cd8e52ad/attachment.html>
[Bug 59322] r300g MSAA breaks Half-Life 2 in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=59322 --- Comment #7 from Marek Ol??k --- Yes, the GALLIUM_MSAA environment variable might break some apps, because it changes the default framebufer to MSAA, which adds lots of limitations to BlitFramebuffer. For example, you can no longer use BlitFramebuffer to do a stretched blit, because the ARB_fbo specification doesn't allow it if either src or dst is multisample, etc. That's why GALLIUM_MSAA should be used carefully. -- 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/20130114/58493492/attachment.html>
Regression: drm/radeon: brightness control hard system lockup
On Mon, Jan 14, 2013 at 11:51 AM, Paul Menzel wrote: > Dear Alex, > > > Am Montag, den 14.01.2013, 11:08 -0500 schrieb Alex Deucher: > > [?] > >> Date: Mon, 14 Jan 2013 11:04:39 -0500 >> Subject: [PATCH] drm/radeon: clear reset flags if engines are idle >> >> Fixes a regression > > please describe the regression. > > ?brightness control hard system lockup? > >> in the gpu reset code after the rework for DMA support. > > and add the corresponding commit, Eldad tracked down. And for > completeness the URL of the discussion. > > This is important for distribution folks to judge if certain commits are > needed or not. And for users looking through the commit history to spot > a certain fix. >> >> Reported-by: Eldad Zack >> Signed-off-by: Alex Deucher > > With the above, > > Acked-by: Paul Menzel I'll fix it up when I add it to my next -fixes pull. Thanks! Alex > >> --- >> drivers/gpu/drm/radeon/evergreen.c |6 ++ >> drivers/gpu/drm/radeon/ni.c|6 ++ >> drivers/gpu/drm/radeon/r600.c |6 ++ >> drivers/gpu/drm/radeon/si.c|6 ++ >> 4 files changed, 24 insertions(+), 0 deletions(-) > > [?] > > > Thanks, > > Paul
Regression: drm/radeon: brightness control hard system lockup
On Mon, Jan 14, 2013 at 3:27 PM, Eldad Zack wrote: > > On Mon, 14 Jan 2013, Alex Deucher wrote: >> On Sun, Jan 13, 2013 at 4:00 PM, Eldad Zack wrote: >> > >> > On Mon, 7 Jan 2013, Alex Deucher wrote: >> >> On Mon, Jan 7, 2013 at 4:33 PM, Eldad Zack >> >> wrote: >> >> > >> >> > On Mon, 7 Jan 2013, Alex Deucher wrote: >> >> >> On Sun, Jan 6, 2013 at 7:59 AM, Eldad Zack >> >> >> wrote: >> >> >> > >> >> >> > Hi Alex, >> >> >> > >> >> >> > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f "drm/radeon: switch >> >> >> > to a >> >> >> > finer grained reset for evergreen" introduced a hard system lockup >> >> >> > to my >> >> >> > setup. I found it after bisecting, and confirmed it by reverting it >> >> >> > on >> >> >> > the latest mainline ( 5f243b9 ). >> >> >> > >> >> >> > This: >> >> >> > >> >> >> >echo 7 > >> >> >> > /sys/devices/pci:00/:00:01.0/:01:00.0/backlight/acpi_video0/brightness >> >> >> > >> >> >> > Causes a hard lock-up hard, i.e. immediate freeze, without any logs. >> >> >> > >> >> >> > See lspci output and kernel .config below. >> >> >> > If there's any more info I can provide, please let me know. >> >> >> >> >> >> Do you normally see GPU resets when changing the backlight? Please >> >> >> attach your dmesg output when changing the backlight with the patch >> >> >> reverted. >> >> > >> >> > I see nothing. Just to make sure, I cleared the buffer, cycled through >> >> > 0-7 a couple of hunderd times (until the flicker annoyed), but I see no >> >> > messages at all. >> >> > Is there any debug config I should turn on? >> >> >> >> Can you try adding a printk() in evergreen_asic_reset() and see if it >> >> is somehow getting called when you change the brightness? When you >> >> use the apci backlight control, the radeon driver is not involved at >> >> all. They only way the driver would get involved is if the acpi >> >> backlight control somehow caused the GPU to hang and then the driver >> >> detected the hang and attempted to reset the GPU. I don't see any >> >> evidence of a GPU reset in your kernel log however. Note that the >> >> driver also registers native backlight contol. Does that work any >> >> better than acpi? >> > >> > The native backlight controls work very well. Thanks for that, I didn't >> > even noticed that. It has finer control over brightness too. >> > >> > I worked out a fix for the problem, but I think it's not a proper one. >> > What I noticed is that evergreen_gpu_soft_reset() is only ever called >> > once on my system, at boot. >> > Then I realized from the dmesg that neither >> > evergreen_gpu_soft_reset_dma() nor evergreen_gpu_soft_reset_gfx() actually >> > do anything. Both return on the first if statements there. >> > >> > So as far as I can tell, the difference your patch introduced is calling >> > evergreen_mc_stop() and evergreen_mc_resume(), which somehow puts my >> > system in some state that ACPI brightness control leads to a lock up. >> > >> > BTW, I don't see a GPU reset happening at all - I also tried suspend/resume >> > and starting an OpenGL application. Do you know how I can trigger it? >> > >> > To fix this, I moved the GUI_ACTIVE test before evergreen_mc_stop(), but >> > I think it just masks the issue. >> > Patch below (against latest HEAD) just in case. >> > >> >> Thanks for tracking this down. The attached patch should fix the >> issue properly. > > Thanks, I just applied it and it works as expected. > > Tested-by: Eldad Zack Thanks! I'll add the patch to my -fixes queue. Alex > > @Paul: Thanks for the comments, will do so in the future. > > Cheers, > Eldad
[Bug 27407] The new MESA degrades performance on RS690M and x1270 graphs chip.
https://bugs.freedesktop.org/show_bug.cgi?id=27407 --- Comment #12 from dE --- That ATI chip got burnt out, and nobody else's complaining. -- 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/20130114/fcfdaa67/attachment.html>
[Bug 37262] Extreme IO using libre/openoffice
https://bugs.freedesktop.org/show_bug.cgi?id=37262 dE changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #5 from dE --- Looks like no one uses R690 (x1270) anymore. And mine is dead. -- 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/20130114/a1812638/attachment.html>
[PATCH v2 3/5] drm/tegra: Implement .mode_set_base()
Am Montag, den 14.01.2013, 17:05 +0100 schrieb Thierry Reding: > The sequence for replacing the scanout buffer is much shorter than a > full mode change operation so implementing this callback considerably > speeds up cases where only a new framebuffer is to be scanned out. > > Signed-off-by: Thierry Reding Aside from the small comment: Reviewed-by: Lucas Stach > --- > drivers/gpu/drm/tegra/dc.c | 29 + > 1 file changed, 29 insertions(+) > > diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c > index 157e962..8dd7d8a 100644 > --- a/drivers/gpu/drm/tegra/dc.c > +++ b/drivers/gpu/drm/tegra/dc.c > @@ -116,6 +116,25 @@ static int tegra_dc_add_planes(struct drm_device *drm, > struct tegra_dc *dc) > return 0; > } > > +static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, > + struct tegra_framebuffer *fb) > +{ > + unsigned long value; > + > + tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); > + > + value = fb->base.offsets[0] + y * fb->base.pitches[0] + > + x * fb->base.bits_per_pixel / 8; > + > + tegra_dc_writel(dc, fb->obj->paddr + value, DC_WINBUF_START_ADDR); > + > + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; > + value |= GENERAL_UPDATE | WIN_A_UPDATE; > + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); Make this two separate writes. > + > + return 0; > +} > + > static const struct drm_crtc_funcs tegra_crtc_funcs = { > .set_config = drm_crtc_helper_set_config, > .destroy = drm_crtc_cleanup, > @@ -404,6 +423,15 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, > return 0; > } > > +static int tegra_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, > + struct drm_framebuffer *old_fb) > +{ > + struct tegra_framebuffer *fb = to_tegra_fb(crtc->fb); > + struct tegra_dc *dc = to_tegra_dc(crtc); > + > + return tegra_dc_set_base(dc, x, y, fb); > +} > + > static void tegra_crtc_prepare(struct drm_crtc *crtc) > { > struct tegra_dc *dc = to_tegra_dc(crtc); > @@ -483,6 +511,7 @@ static const struct drm_crtc_helper_funcs > tegra_crtc_helper_funcs = { > .dpms = tegra_crtc_dpms, > .mode_fixup = tegra_crtc_mode_fixup, > .mode_set = tegra_crtc_mode_set, > + .mode_set_base = tegra_crtc_mode_set_base, > .prepare = tegra_crtc_prepare, > .commit = tegra_crtc_commit, > .load_lut = tegra_crtc_load_lut,
[PATCH v2 2/5] drm/tegra: Add plane support
Am Montag, den 14.01.2013, 17:05 +0100 schrieb Thierry Reding: > Add support for the B and C planes which support RGB and YUV pixel > formats and can be used as overlays or hardware cursor. > > Signed-off-by: Thierry Reding > --- [...] > +static int tegra_plane_disable(struct drm_plane *plane) > +{ > + struct tegra_dc *dc = to_tegra_dc(plane->crtc); > + struct tegra_plane *p = to_tegra_plane(plane); > + unsigned int index = p->index + 1; > + unsigned long value; > + > + value = WINDOW_A_SELECT << index; > + tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); > + > + value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); > + value &= ~WIN_ENABLE; > + tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); > + > + value = (WIN_A_ACT_REQ << index) | (WIN_A_UPDATE << index); > + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); This should be two separate writes to the register. I don't know how relevant this is on real HW, but the TRM states: "Restrictions: ACT_REQ cannot be programmed at the same time the corresponding "UPDATE" is programmed." Better be safe than sorry and split it up. [...] > +int tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, > + const struct tegra_dc_window *window) > +{ > + unsigned h_offset, v_offset, h_size, v_size, h_dda, v_dda, bpp; > + unsigned long value; > + > + bpp = window->bits_per_pixel / 8; > + > + value = WINDOW_A_SELECT << index; > + tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); > + > + tegra_dc_writel(dc, window->format, DC_WIN_COLOR_DEPTH); > + tegra_dc_writel(dc, 0, DC_WIN_BYTE_SWAP); > + > + value = V_POSITION(window->dst.y) | H_POSITION(window->dst.x); > + tegra_dc_writel(dc, value, DC_WIN_POSITION); > + > + value = V_SIZE(window->dst.h) | H_SIZE(window->dst.w); > + tegra_dc_writel(dc, value, DC_WIN_SIZE); > + > + h_offset = window->src.x * bpp; > + v_offset = window->src.y; > + h_size = window->src.w * bpp; > + v_size = window->src.h; > + > + value = V_PRESCALED_SIZE(v_size) | H_PRESCALED_SIZE(h_size); > + tegra_dc_writel(dc, value, DC_WIN_PRESCALED_SIZE); > + > + h_dda = compute_dda_inc(window->src.w, window->dst.w, false, bpp); > + v_dda = compute_dda_inc(window->src.h, window->dst.h, true, bpp); > + > + value = V_DDA_INC(v_dda) | H_DDA_INC(h_dda); > + tegra_dc_writel(dc, value, DC_WIN_DDA_INC); > + > + h_dda = compute_initial_dda(window->src.x); > + v_dda = compute_initial_dda(window->src.y); > + > + tegra_dc_writel(dc, h_dda, DC_WIN_H_INITIAL_DDA); > + tegra_dc_writel(dc, v_dda, DC_WIN_V_INITIAL_DDA); > + > + tegra_dc_writel(dc, 0, DC_WIN_UV_BUF_STRIDE); > + tegra_dc_writel(dc, 0, DC_WIN_BUF_STRIDE); > + > + tegra_dc_writel(dc, window->base, DC_WINBUF_START_ADDR); > + tegra_dc_writel(dc, window->stride, DC_WIN_LINE_STRIDE); > + tegra_dc_writel(dc, h_offset, DC_WINBUF_ADDR_H_OFFSET); > + tegra_dc_writel(dc, v_offset, DC_WINBUF_ADDR_V_OFFSET); > + > + value = WIN_ENABLE; > + > + if (bpp < 24) > + value |= COLOR_EXPAND; > + > + tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); > + > + /* > + * Disable blending and assume Window A is the bottom-most window, > + * Window C is the top-most window and Window B is in the middle. > + */ I would like to see the root window using WIN_C, so we only loose the least capable plane (WIN_A: no filtering or YUV conversion) when using a plane for the hardware cursor. Maybe you can fold this in, otherwise I'll send a patch on top of this series. > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_NOKEY); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_1WIN); > + > + switch (index) { > + case 0: > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_X); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_Y); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_3WIN_XY); > + break; > + > + case 1: > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_X); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_Y); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_3WIN_XY); > + break; > + > + case 2: > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_X); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_2WIN_Y); > + tegra_dc_writel(dc, 0x00, DC_WIN_BLEND_3WIN_XY); > + break; > + } > + > + value = (WIN_A_ACT_REQ << index) | (WIN_A_UPDATE << index); > + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); Same comment as above. > + > + return 0; > +} > + [...]
Regression: drm/radeon: brightness control hard system lockup
Dear Alex, Am Montag, den 14.01.2013, 11:08 -0500 schrieb Alex Deucher: [?] > Date: Mon, 14 Jan 2013 11:04:39 -0500 > Subject: [PATCH] drm/radeon: clear reset flags if engines are idle > > Fixes a regression please describe the regression. ?brightness control hard system lockup? > in the gpu reset code after the rework for DMA support. and add the corresponding commit, Eldad tracked down. And for completeness the URL of the discussion. This is important for distribution folks to judge if certain commits are needed or not. And for users looking through the commit history to spot a certain fix. > > Reported-by: Eldad Zack > Signed-off-by: Alex Deucher With the above, Acked-by: Paul Menzel > --- > drivers/gpu/drm/radeon/evergreen.c |6 ++ > drivers/gpu/drm/radeon/ni.c|6 ++ > drivers/gpu/drm/radeon/r600.c |6 ++ > drivers/gpu/drm/radeon/si.c|6 ++ > 4 files changed, 24 insertions(+), 0 deletions(-) [?] Thanks, Paul -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/e3540501/attachment.pgp>
[Bug 45913] [r300g] piglit vs-clip-vertex-const-reject fails
https://bugs.freedesktop.org/show_bug.cgi?id=45913 Tomasz P. changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WONTFIX |--- -- 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/20130114/59918b52/attachment-0001.html>
[PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned
On Mon, Jan 14, 2013 at 04:06:13PM +0100, Thierry Reding wrote: > On Mon, Jan 14, 2013 at 04:42:39PM +0200, Ville Syrj?l? wrote: > > On Mon, Jan 14, 2013 at 03:30:20PM +0100, Thierry Reding wrote: > > > Since the variable's value is the size of an array, we can assume that > > > it will never be negative. > > > > > > Signed-off-by: Thierry Reding > > > --- > > > drivers/gpu/drm/drm_edid_modes.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/drm_edid_modes.h > > > b/drivers/gpu/drm/drm_edid_modes.h > > > index 5dbf7d2..d65d863 100644 > > > --- a/drivers/gpu/drm/drm_edid_modes.h > > > +++ b/drivers/gpu/drm/drm_edid_modes.h > > > @@ -771,4 +771,4 @@ static const struct drm_display_mode edid_cea_modes[] > > > = { > > > 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, > > > DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, > > > }; > > > -static const int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); > > > +static const unsigned int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); > > > > Why do we even have these num_foo things? I think it would be clearer to > > use ARRAY_SIZE(foo) directly where appropriate. > > Actually I was thinking about maybe writing a patch to move the table > out of the header and into drm_edid.c (or drm_cea.c?) to make it less > easy to create duplicates of the table. In that case, using the > ARRAY_SIZE macro directly wouldn't be an option. Well drm_edid.c is the only one accessing these tables anyway, so it they would be in drm_edid.c and static, you could still use ARRAY_SIZE(). Not that I really like the idea of polluting drm_edid.c with all these massive tables. Too bad cpp doesn't support this kind of thing: #if __BASE_FILE__ != "drm_edid.c" #error ... #endif -- Ville Syrj?l? Intel OTC
[Bug 45913] [r300g] piglit vs-clip-vertex-const-reject fails
https://bugs.freedesktop.org/show_bug.cgi?id=45913 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX -- 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/20130114/68525f54/attachment.html>
[Intel-gfx] [PATCH 2/5] drm/i915: Add has_hdmi_monitor to intel_hdmi
On Mon, Jan 14, 2013 at 04:09:39PM +0100, Daniel Vetter wrote: > On Mon, Jan 14, 2013 at 04:15:07PM +0200, ville.syrjala at linux.intel.com > wrote: > > From: Ville Syrj?l? > > > > intel_hdmi.has_hdmi_sink is tied into the force audio property, so it > > doesn't seem like the correct way to detect HDMI monitors. Instead add > > a new has_hdmi_monitor member which simply tells whether a HDMI monitor > > was detected. > > > > Not sure if this is the best way, or if we should just use has_hdmi_sink > > for the CEA-861 automatic color range property... At least the infoframe > > stuff already depends on has_hdmi_sink. > > > > Signed-off-by: Ville Syrj?l? > > Imo it looks simpler if we just reuse the has_hdmi_sink bool. That already > controls infoframes and similar stuff, so if users would force dvi mode > this would automatically also disable all broadcast range magic (if that's > in the default value). Users could still override the broadcast stuff > explictly. OK. I can do that. > I guess it'd have been better if we have a a force-dvi master switch > outside of the audio property to control all things hdmi. But alas > ... Yeah it feels a bit weird that some audio prop controls it all. > -Daniel > > > --- > > drivers/gpu/drm/i915/intel_drv.h |1 + > > drivers/gpu/drm/i915/intel_hdmi.c |6 -- > > 2 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > > b/drivers/gpu/drm/i915/intel_drv.h > > index 4df47be..aed7478 100644 > > --- a/drivers/gpu/drm/i915/intel_drv.h > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > @@ -344,6 +344,7 @@ struct intel_hdmi { > > int ddc_bus; > > uint32_t color_range; > > bool has_hdmi_sink; > > + bool has_hdmi_monitor; > > bool has_audio; > > enum hdmi_force_audio force_audio; > > void (*write_infoframe)(struct drm_encoder *encoder, > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c > > b/drivers/gpu/drm/i915/intel_hdmi.c > > index f194d75..e663dec 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -815,6 +815,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool > > force) > > return status; > > > > intel_hdmi->has_hdmi_sink = false; > > + intel_hdmi->has_hdmi_monitor = false; > > intel_hdmi->has_audio = false; > > edid = drm_get_edid(connector, > > intel_gmbus_get_adapter(dev_priv, > > @@ -823,9 +824,10 @@ intel_hdmi_detect(struct drm_connector *connector, > > bool force) > > if (edid) { > > if (edid->input & DRM_EDID_INPUT_DIGITAL) { > > status = connector_status_connected; > > + intel_hdmi->has_hdmi_monitor = > > + drm_detect_hdmi_monitor(edid); > > if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) > > - intel_hdmi->has_hdmi_sink = > > - drm_detect_hdmi_monitor(edid); > > + intel_hdmi->has_hdmi_sink = > > intel_hdmi->has_hdmi_monitor; > > intel_hdmi->has_audio = drm_detect_monitor_audio(edid); > > } > > kfree(edid); > > -- > > 1.7.8.6 > > > > ___ > > Intel-gfx mailing list > > Intel-gfx at lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Daniel Vetter > Software Engineer, Intel Corporation > +41 (0) 79 365 57 48 - http://blog.ffwll.ch -- Ville Syrj?l? Intel OTC
[PATCH] [RFC] video: exynos dp: Making Exynos DP Compliant with CDF
Hello Sean, Thanks for reviewing the patch. On Sat, Jan 12, 2013 at 1:30 AM, Sean Paul wrote: > On Fri, Jan 11, 2013 at 5:35 AM, Leela Krishna Amudala > wrote: >> The Exynos DP transmitter is treated as an end entity in the display pipeline >> and made this RFC patch compliant with CDF. >> >> Any suggestions are welcome. >> > > A few comments below. It's hard to get too much of an appreciation for > what you're trying to do since a bunch of the interesting parts are > stubbed out. > >> Signed-off-by: Leela Krishna Amudala >> --- >> drivers/video/display/display-core.c | 2 +- >> drivers/video/exynos/exynos_dp_core.c | 88 >> +++ >> drivers/video/exynos/exynos_dp_core.h | 6 +++ >> 3 files changed, 95 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/video/display/display-core.c >> b/drivers/video/display/display-core.c >> index 5f8be30..dbad7e9 100644 >> --- a/drivers/video/display/display-core.c >> +++ b/drivers/video/display/display-core.c >> @@ -15,7 +15,7 @@ >> #include >> #include >> #include >> -#include >> +#include >> >> #include >> >> diff --git a/drivers/video/exynos/exynos_dp_core.c >> b/drivers/video/exynos/exynos_dp_core.c >> index 4ef18e2..0f8de27b 100644 >> --- a/drivers/video/exynos/exynos_dp_core.c >> +++ b/drivers/video/exynos/exynos_dp_core.c >> @@ -23,6 +23,9 @@ >> #include >> >> #include "exynos_dp_core.h" >> +#include >> +#include >> +#define to_panel(p) container_of(p, struct exynos_dp_device, entity) >> >> static int exynos_dp_init_dp(struct exynos_dp_device *dp) >> { >> @@ -1033,6 +1036,81 @@ static void exynos_dp_phy_exit(struct >> exynos_dp_device *dp) >> } >> #endif /* CONFIG_OF */ >> >> +static int exynos_dp_power_on(struct exynos_dp_device *dp) >> +{ >> + struct platform_device *pdev = to_platform_device(dp->dev); >> + struct exynos_dp_platdata *pdata = pdev->dev.platform_data; >> + >> + if (dp->dev->of_node) { >> + if (dp->phy_addr) >> + exynos_dp_phy_init(dp); >> + } else { >> + if (pdata->phy_init) >> + pdata->phy_init(); >> + } >> + >> + clk_prepare_enable(dp->clock); >> + exynos_dp_init_dp(dp); >> + enable_irq(dp->irq); >> + >> + return 0; >> +} >> + >> +static int dp_set_state(struct display_entity *entity, >> + enum display_entity_state state) >> +{ >> + struct exynos_dp_device *dp = to_panel(entity); >> + struct platform_device *pdev = to_platform_device(dp->dev); >> + int ret = 0; >> + >> + switch (state) { >> + case DISPLAY_ENTITY_STATE_OFF: >> + case DISPLAY_ENTITY_STATE_STANDBY: >> + ret = exynos_dp_remove(pdev); > > This is incorrect, that is the module remove function. It seems like > it works right now since there's nothing permanent happening (like > platform data being freed), but there's no guarantee that this will > remain like that in the future. > > IMO, you should factor out the common bits from remove and suspend > into a new function which is called from all three. > Yes, I used the module remove function because it works fine with its current state. I'll factor out the common things and will create a common function. >> + break; >> + case DISPLAY_ENTITY_STATE_ON: >> + ret = exynos_dp_power_on(dp); >> + break; >> + } >> + return ret; >> +} >> + >> +static int dp_get_modes(struct display_entity *entity, >> + const struct videomode **modes) >> +{ >> + /* Rework has to be done here*/ >> + return 1; > > Returning 1 here is pretty risky since you didn't actually allocate or > populate a mode. I'm surprised this isn't causing some weird > side-effects for you. > This current code is a dummy function, That is the reason to mention "Rework has to be done here" The current DP driver is not receiving any video mode properties. So I have to think out how to get the same and will do the implementation. >> +} >> + >> +static int dp_get_size(struct display_entity *entity, >> + unsigned int *width, unsigned int *height) >> +{ >> + struct exynos_dp_device *dp = to_panel(entity); >> + struct platform_device *pdev = to_platform_device(dp->dev); >> + /*getting pdata in older way, rework has to be done here to >> + parse it from dt node */ >> + struct exynos_dp_platdata *pdata = pdev->dev.platform_data; >> + >> + /*Rework has to be done here */ >> + *width = 1280; >> + *height = 800; >> + return 0; >> +} >> + >> +static int dp_update(struct display_entity *entity, >> + void (*callback)(int, void *), void *data) >> +{ >> + /*Rework has to be done here*/ >> + return 0; >> +} >> + >> +static const struct display_entity_control_ops dp_control_ops = { >> + .set_state = dp_set_state, >> + .get_modes = dp_g
[PATCH v2 5/5] drm/tegra: Implement page-flipping support
All the necessary support bits like .mode_set_base() and VBLANK are now available, so page-flipping case easily be implemented on top. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 72 + drivers/gpu/drm/tegra/drm.c | 9 ++ drivers/gpu/drm/tegra/drm.h | 5 3 files changed, 86 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 3aa7ccc..ce4e14a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -161,7 +161,78 @@ void tegra_dc_disable_vblank(struct tegra_dc *dc) spin_unlock_irqrestore(&dc->lock, flags); } +static void tegra_dc_finish_page_flip(struct tegra_dc *dc) +{ + struct drm_pending_vblank_event *event; + struct drm_device *drm = dc->base.dev; + unsigned long flags; + struct timeval now; + + spin_lock_irqsave(&drm->event_lock, flags); + event = dc->event; + dc->event = NULL; + spin_unlock_irqrestore(&drm->event_lock, flags); + + if (!event) + return; + + event->event.sequence = drm_vblank_count_and_time(drm, dc->pipe, &now); + event->event.tv_sec = now.tv_sec; + event->event.tv_usec = now.tv_usec; + + spin_lock_irqsave(&drm->event_lock, flags); + list_add_tail(&event->base.link, &event->base.file_priv->event_list); + wake_up_interruptible(&event->base.file_priv->event_wait); + spin_unlock_irqrestore(&drm->event_lock, flags); + + drm_vblank_put(drm, dc->pipe); +} + +void tegra_dc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) +{ + struct tegra_dc *dc = to_tegra_dc(crtc); + struct drm_device *drm = crtc->dev; + unsigned long flags; + + spin_lock_irqsave(&drm->event_lock, flags); + + if (dc->event && dc->event->base.file_priv == file) { + dc->event->base.destroy(&dc->event->base); + drm_vblank_put(drm, dc->pipe); + dc->event = NULL; + } + + spin_unlock_irqrestore(&drm->event_lock, flags); +} + +static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event) +{ + struct tegra_framebuffer *newfb = to_tegra_fb(fb); + struct tegra_dc *dc = to_tegra_dc(crtc); + struct drm_device *drm = crtc->dev; + unsigned long flags; + + if (dc->event) + return -EBUSY; + + tegra_dc_set_base(dc, 0, 0, newfb); + + if (event) { + event->pipe = dc->pipe; + + spin_lock_irqsave(&drm->event_lock, flags); + dc->event = event; + spin_unlock_irqrestore(&drm->event_lock, flags); + + drm_vblank_get(drm, dc->pipe); + } + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { + .page_flip = tegra_dc_page_flip, .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, }; @@ -556,6 +627,7 @@ static irqreturn_t tegra_dc_irq(int irq, void *data) dev_dbg(dc->dev, "%s(): vertical blank\n", __func__); */ drm_handle_vblank(dc->base.dev, dc->pipe); + tegra_dc_finish_page_flip(dc); } if (status & (WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT)) { diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 62f8121..7bab784 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -129,11 +129,20 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) tegra_dc_disable_vblank(dc); } +static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) +{ + struct drm_crtc *crtc; + + list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) + tegra_dc_cancel_page_flip(crtc, file); +} + struct drm_driver tegra_drm_driver = { .driver_features = DRIVER_BUS_PLATFORM | DRIVER_MODESET | DRIVER_GEM, .load = tegra_drm_load, .unload = tegra_drm_unload, .open = tegra_drm_open, + .preclose = tegra_drm_preclose, .lastclose = tegra_drm_lastclose, .get_vblank_counter = drm_vblank_count, diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index ca742b2..1f1cb37 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -100,6 +100,9 @@ struct tegra_dc { struct drm_info_list *debugfs_files; struct drm_minor *minor; struct dentry *debugfs; + + /* page-flip handling */ + struct drm_pending_vblank_event *event; }; static inline struct tegra_dc *host1x_client_to_dc(struct host1x_client *client) @@ -149,6 +152,8 @@ extern int tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, const struct tegra_dc_window *window); extern void tegra_dc_enable_vblank(struct tegra_dc *dc); extern v
[PATCH v2 4/5] drm/tegra: Implement VBLANK support
Implement support for the VBLANK IOCTL. Note that Tegra is somewhat special in this case because it doesn't use the generic IRQ support provided by the DRM core (DRIVER_HAVE_IRQ) but rather registers one interrupt handler for each display controller. While at it, clean up the way that interrupts are enabled to ensure that the VBLANK interrupt only gets enabled when required. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 55 +++-- drivers/gpu/drm/tegra/drm.c | 44 drivers/gpu/drm/tegra/drm.h | 3 +++ 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 8dd7d8a..3aa7ccc 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -135,6 +135,32 @@ static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, return 0; } +void tegra_dc_enable_vblank(struct tegra_dc *dc) +{ + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value |= VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); +} + +void tegra_dc_disable_vblank(struct tegra_dc *dc) +{ + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value &= ~VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -375,6 +401,8 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, unsigned long div, value; int err; + drm_vblank_pre_modeset(crtc->dev, dc->pipe); + err = tegra_crtc_setup_clk(crtc, mode, &div); if (err) { dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); @@ -476,31 +504,23 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); - - value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); + + value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); } static void tegra_crtc_commit(struct drm_crtc *crtc) { struct tegra_dc *dc = to_tegra_dc(crtc); - unsigned long update_mask; unsigned long value; - update_mask = GENERAL_ACT_REQ | WIN_A_ACT_REQ; - - tegra_dc_writel(dc, update_mask << 8, DC_CMD_STATE_CONTROL); - - value = tegra_dc_readl(dc, DC_CMD_INT_ENABLE); - value |= FRAME_END_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ | + GENERAL_UPDATE | WIN_A_UPDATE; - value = tegra_dc_readl(dc, DC_CMD_INT_MASK); - value |= FRAME_END_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); - tegra_dc_writel(dc, update_mask, DC_CMD_STATE_CONTROL); + drm_vblank_post_modeset(crtc->dev, dc->pipe); } static void tegra_crtc_load_lut(struct drm_crtc *crtc) @@ -517,7 +537,7 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { .load_lut = tegra_crtc_load_lut, }; -static irqreturn_t tegra_drm_irq(int irq, void *data) +static irqreturn_t tegra_dc_irq(int irq, void *data) { struct tegra_dc *dc = data; unsigned long status; @@ -862,7 +882,7 @@ static int tegra_dc_drm_init(struct host1x_client *client, dev_err(dc->dev, "debugfs setup failed: %d\n", err); } - err = devm_request_irq(dc->dev, dc->irq, tegra_drm_irq, 0, + err = devm_request_irq(dc->dev, dc->irq, tegra_dc_irq, 0, dev_name(dc->dev), dc); if (err < 0) { dev_err(dc->dev, "failed to request IRQ#%u: %d\n", dc->irq, @@ -911,6 +931,7 @@ static int tegra_dc_probe(struct platform_device *pdev) if (!dc) return -ENOMEM; + spin_lock_init(&dc->lock); INIT_LIST_HEAD(&dc->list); dc->dev = &pdev->dev; diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 3a503c9..62f8121 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -40,6 +40,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags) if (err < 0) return err; + err = drm_vblank_init(drm, drm->mode_config.num_crtc); + if (err < 0) + return err; + err = tegra_drm_fb_init(drm); if (err < 0)
[PATCH v2 3/5] drm/tegra: Implement .mode_set_base()
The sequence for replacing the scanout buffer is much shorter than a full mode change operation so implementing this callback considerably speeds up cases where only a new framebuffer is to be scanned out. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 29 + 1 file changed, 29 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 157e962..8dd7d8a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -116,6 +116,25 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) return 0; } +static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, +struct tegra_framebuffer *fb) +{ + unsigned long value; + + tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); + + value = fb->base.offsets[0] + y * fb->base.pitches[0] + + x * fb->base.bits_per_pixel / 8; + + tegra_dc_writel(dc, fb->obj->paddr + value, DC_WINBUF_START_ADDR); + + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; + value |= GENERAL_UPDATE | WIN_A_UPDATE; + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -404,6 +423,15 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, return 0; } +static int tegra_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, + struct drm_framebuffer *old_fb) +{ + struct tegra_framebuffer *fb = to_tegra_fb(crtc->fb); + struct tegra_dc *dc = to_tegra_dc(crtc); + + return tegra_dc_set_base(dc, x, y, fb); +} + static void tegra_crtc_prepare(struct drm_crtc *crtc) { struct tegra_dc *dc = to_tegra_dc(crtc); @@ -483,6 +511,7 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { .dpms = tegra_crtc_dpms, .mode_fixup = tegra_crtc_mode_fixup, .mode_set = tegra_crtc_mode_set, + .mode_set_base = tegra_crtc_mode_set_base, .prepare = tegra_crtc_prepare, .commit = tegra_crtc_commit, .load_lut = tegra_crtc_load_lut, -- 1.8.1
[PATCH v2 2/5] drm/tegra: Add plane support
Add support for the B and C planes which support RGB and YUV pixel formats and can be used as overlays or hardware cursor. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 321 +++- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/drm.h | 29 3 files changed, 259 insertions(+), 93 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 656b2e3..157e962 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -18,19 +18,104 @@ #include "drm.h" #include "dc.h" -struct tegra_dc_window { - fixed20_12 x; - fixed20_12 y; - fixed20_12 w; - fixed20_12 h; - unsigned int outx; - unsigned int outy; - unsigned int outw; - unsigned int outh; - unsigned int stride; - unsigned int fmt; +struct tegra_plane { + struct drm_plane base; + unsigned int index; }; +static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) +{ + return container_of(plane, struct tegra_plane, base); +} + +static int tegra_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, + struct drm_framebuffer *fb, int crtc_x, + int crtc_y, unsigned int crtc_w, + unsigned int crtc_h, uint32_t src_x, + uint32_t src_y, uint32_t src_w, uint32_t src_h) +{ + unsigned long base = tegra_framebuffer_base(fb); + struct tegra_plane *p = to_tegra_plane(plane); + struct tegra_dc *dc = to_tegra_dc(crtc); + struct tegra_dc_window window; + + memset(&window, 0, sizeof(window)); + window.src.x = src_x >> 16; + window.src.y = src_y >> 16; + window.src.w = src_w >> 16; + window.src.h = src_h >> 16; + window.dst.x = crtc_x; + window.dst.y = crtc_y; + window.dst.w = crtc_w; + window.dst.h = crtc_h; + window.format = tegra_dc_format(fb->pixel_format); + window.bits_per_pixel = fb->bits_per_pixel; + window.stride = fb->pitches[0]; + window.base = base; + + return tegra_dc_setup_window(dc, p->index + 1, &window); +} + +static int tegra_plane_disable(struct drm_plane *plane) +{ + struct tegra_dc *dc = to_tegra_dc(plane->crtc); + struct tegra_plane *p = to_tegra_plane(plane); + unsigned int index = p->index + 1; + unsigned long value; + + value = WINDOW_A_SELECT << index; + tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); + + value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); + value &= ~WIN_ENABLE; + tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); + + value = (WIN_A_ACT_REQ << index) | (WIN_A_UPDATE << index); + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); + + return 0; +} + +static void tegra_plane_destroy(struct drm_plane *plane) +{ + drm_plane_cleanup(plane); +} + +static const struct drm_plane_funcs tegra_plane_funcs = { + .update_plane = tegra_plane_update, + .disable_plane = tegra_plane_disable, + .destroy = tegra_plane_destroy, +}; + +static const uint32_t plane_formats[] = { + DRM_FORMAT_XRGB, + DRM_FORMAT_YUV422, +}; + +static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) +{ + unsigned int i; + int err = 0; + + for (i = 0; i < 2; i++) { + struct tegra_plane *plane; + + plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); + if (!plane) + return -ENOMEM; + + plane->index = i; + + err = drm_plane_init(drm, &plane->base, 1 << dc->pipe, +&tegra_plane_funcs, plane_formats, +ARRAY_SIZE(plane_formats), false); + if (err < 0) + return err; + } + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -47,10 +132,11 @@ static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, return true; } -static inline u32 compute_dda_inc(fixed20_12 inf, unsigned int out, bool v, +static inline u32 compute_dda_inc(unsigned int in, unsigned int out, bool v, unsigned int bpp) { fixed20_12 outf = dfixed_init(out); + fixed20_12 inf = dfixed_init(in); u32 dda_inc; int max; @@ -80,9 +166,10 @@ static inline u32 compute_dda_inc(fixed20_12 inf, unsigned int out, bool v, return dda_inc; } -static inline u32 compute_initial_dda(fixed20_12 in) +static inline u32 compute_initial_dda(unsigned int in) { - return dfixed_frac(in); + fixed20_12 inf = dfixed_init(in); + return dfixed_frac(inf); } static int tegra_dc_set_timings(struct tegra_dc *dc, @@ -153,6 +240,111 @@ static int te
[PATCH v2 1/5] drm: Allow vblank support without DRIVER_HAVE_IRQ
Drivers that register interrupt handlers without the DRM core helpers don't initialize the .irq_enabled field and drm_dev_to_irq() may fail when called on them. This shouldn't preclude them from implementing the vblank IOCTL. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 19c01ca..71f8205 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1218,8 +1218,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data, int ret; unsigned int flags, seq, crtc, high_crtc; - if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) - return -EINVAL; + if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) + return -EINVAL; if (vblwait->request.type & _DRM_VBLANK_SIGNAL) return -EINVAL; -- 1.8.1
[PATCH v2 0/5] drm/tegra: Miscellaneous enhancements
[Rebased on v3.8-rc3 to avoid a conflict in drivers/gpu/drm/tegra/drm.h] Hi, This patch series introduces a number of useful features for the Tegra DRM driver. The first patch allows VBLANK support to be used in drivers that don't or can't use DRIVER_HAVE_IRQ for interrupt support. Patch 2 adds support for the additional two planes available on Tegra hardware, while patch 3 implement .mode_set_base() to allow for some nice speed up when changing the framebuffer without actually changing the resolution. Patch 4 adds VBLANK support and finally patch 5 builds on it to provide the page-flipping IOCTL. Thierry Thierry Reding (5): drm: Allow vblank support without DRIVER_HAVE_IRQ drm/tegra: Add plane support drm/tegra: Implement .mode_set_base() drm/tegra: Implement VBLANK support drm/tegra: Implement page-flipping support drivers/gpu/drm/drm_irq.c | 5 +- drivers/gpu/drm/tegra/dc.c | 475 ++-- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/drm.c | 53 + drivers/gpu/drm/tegra/drm.h | 37 5 files changed, 461 insertions(+), 111 deletions(-) -- 1.8.1
[PATCH] drm/exynos: Replace mdelay with usleep_range
Replace the unnecessary atomic mdelay calls with usleep_range calls. Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_hdmi.c | 14 +++--- drivers/gpu/drm/exynos/exynos_mixer.c |2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index b2f8de9..4cf01f3 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1646,9 +1646,9 @@ static void hdmi_conf_reset(struct hdmi_context *hdata) /* resetting HDMI core */ hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); } static void hdmi_conf_init(struct hdmi_context *hdata) @@ -1773,7 +1773,7 @@ static void hdmi_v13_timing_apply(struct hdmi_context *hdata) u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); if (val & HDMI_PHY_STATUS_READY) break; - mdelay(1); + usleep_range(1000, 2000); } /* steady state not achieved */ if (tries == 0) { @@ -1940,7 +1940,7 @@ static void hdmi_v14_timing_apply(struct hdmi_context *hdata) u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0); if (val & HDMI_PHY_STATUS_READY) break; - mdelay(1); + usleep_range(1000, 2000); } /* steady state not achieved */ if (tries == 0) { @@ -1992,9 +1992,9 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) /* reset hdmiphy */ hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); } static void hdmiphy_poweron(struct hdmi_context *hdata) @@ -2042,7 +2042,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) return; } - mdelay(10); + usleep_range(1, 12000); /* operation mode */ operation[0] = 0x1f; diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index e9dbf79..2be9833 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -600,7 +600,7 @@ static void vp_win_reset(struct mixer_context *ctx) /* waiting until VP_SRESET_PROCESSING is 0 */ if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING) break; - mdelay(10); + usleep_range(1, 12000); } WARN(tries == 0, "failed to reset Video Processor\n"); } -- 1.7.7.3
[PATCH v3 9/9] drm: Remove duplicate drm_mode_cea_vic()
On Mon, Jan 14, 2013 at 03:30:28PM +0100, Thierry Reding wrote: > The same function had already been merged with a different name. Remove > the duplicate one but reuse some of its kerneldoc fragments for the > existing implementation. And I just used that function. Oh well ;) Personally I would have kept the other function instead since it has a more descriptive name, but I can't be bothered to care enough to complain too much. The patch could be moved to the beginning of the series, so it can be merged w/o being blocked by the more invasive stuff. Well, assuming that the more invasive stuff still needs discussing. > Signed-off-by: Thierry Reding > --- > drivers/gpu/drm/drm_edid.c | 30 +++--- > include/drm/drm_crtc.h | 3 +-- > 2 files changed, 8 insertions(+), 25 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 1cfafc0..0acd6f3 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -1514,11 +1514,14 @@ u8 *drm_find_cea_extension(struct edid *edid) > } > EXPORT_SYMBOL(drm_find_cea_extension); > > -/* > - * Looks for a CEA mode matching given drm_display_mode. > - * Returns its CEA Video ID code, or 0 if not found. > +/** > + * drm_match_cea_mode - look for a CEA mode matching given mode > + * @mode: display mode > + * > + * Returns the CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861 > + * mode. > */ > -u8 drm_match_cea_mode(struct drm_display_mode *to_match) > +u8 drm_match_cea_mode(const struct drm_display_mode *to_match) > { > struct drm_display_mode *cea_mode; > u8 mode; > @@ -2082,25 +2085,6 @@ int drm_add_modes_noedid(struct drm_connector > *connector, > EXPORT_SYMBOL(drm_add_modes_noedid); > > /** > - * drm_mode_cea_vic - return the CEA-861 VIC of a given mode > - * @mode: mode > - * > - * RETURNS: > - * The VIC number, 0 in case it's not a CEA-861 mode. > - */ > -uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode) > -{ > - uint8_t i; > - > - for (i = 0; i < drm_num_cea_modes; i++) > - if (drm_mode_equal(mode, &edid_cea_modes[i])) > - return i + 1; > - > - return 0; > -} > -EXPORT_SYMBOL(drm_mode_cea_vic); > - > -/** > * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe > with > * data from a DRM display mode > * @frame: HDMI AVI infoframe > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index dd62ca0..d0f3927 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -1031,7 +1031,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device > *dev, > extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, > void *data, struct drm_file *file_priv); > extern u8 *drm_find_cea_extension(struct edid *edid); > -extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); > +extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); > extern bool drm_detect_hdmi_monitor(struct edid *edid); > extern bool drm_detect_monitor_audio(struct edid *edid); > extern int drm_mode_page_flip_ioctl(struct drm_device *dev, > @@ -1048,7 +1048,6 @@ extern struct drm_display_mode > *drm_gtf_mode_complex(struct drm_device *dev, > int GTF_2C, int GTF_K, int GTF_2J); > extern int drm_add_modes_noedid(struct drm_connector *connector, > int hdisplay, int vdisplay); > -extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode); > > extern int drm_edid_header_is_valid(const u8 *raw_edid); > extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool > print_bad_edid); > -- > 1.8.1 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel OTC
[PATCH 5/5] drm/tegra: Implement page-flipping support
All the necessary support bits like .mode_set_base() and VBLANK are now available, so page-flipping case easily be implemented on top. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 72 + drivers/gpu/drm/tegra/drm.c | 9 ++ drivers/gpu/drm/tegra/drm.h | 5 3 files changed, 86 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 3aa7ccc..ce4e14a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -161,7 +161,78 @@ void tegra_dc_disable_vblank(struct tegra_dc *dc) spin_unlock_irqrestore(&dc->lock, flags); } +static void tegra_dc_finish_page_flip(struct tegra_dc *dc) +{ + struct drm_pending_vblank_event *event; + struct drm_device *drm = dc->base.dev; + unsigned long flags; + struct timeval now; + + spin_lock_irqsave(&drm->event_lock, flags); + event = dc->event; + dc->event = NULL; + spin_unlock_irqrestore(&drm->event_lock, flags); + + if (!event) + return; + + event->event.sequence = drm_vblank_count_and_time(drm, dc->pipe, &now); + event->event.tv_sec = now.tv_sec; + event->event.tv_usec = now.tv_usec; + + spin_lock_irqsave(&drm->event_lock, flags); + list_add_tail(&event->base.link, &event->base.file_priv->event_list); + wake_up_interruptible(&event->base.file_priv->event_wait); + spin_unlock_irqrestore(&drm->event_lock, flags); + + drm_vblank_put(drm, dc->pipe); +} + +void tegra_dc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) +{ + struct tegra_dc *dc = to_tegra_dc(crtc); + struct drm_device *drm = crtc->dev; + unsigned long flags; + + spin_lock_irqsave(&drm->event_lock, flags); + + if (dc->event && dc->event->base.file_priv == file) { + dc->event->base.destroy(&dc->event->base); + drm_vblank_put(drm, dc->pipe); + dc->event = NULL; + } + + spin_unlock_irqrestore(&drm->event_lock, flags); +} + +static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, + struct drm_pending_vblank_event *event) +{ + struct tegra_framebuffer *newfb = to_tegra_fb(fb); + struct tegra_dc *dc = to_tegra_dc(crtc); + struct drm_device *drm = crtc->dev; + unsigned long flags; + + if (dc->event) + return -EBUSY; + + tegra_dc_set_base(dc, 0, 0, newfb); + + if (event) { + event->pipe = dc->pipe; + + spin_lock_irqsave(&drm->event_lock, flags); + dc->event = event; + spin_unlock_irqrestore(&drm->event_lock, flags); + + drm_vblank_get(drm, dc->pipe); + } + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { + .page_flip = tegra_dc_page_flip, .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, }; @@ -556,6 +627,7 @@ static irqreturn_t tegra_dc_irq(int irq, void *data) dev_dbg(dc->dev, "%s(): vertical blank\n", __func__); */ drm_handle_vblank(dc->base.dev, dc->pipe); + tegra_dc_finish_page_flip(dc); } if (status & (WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT)) { diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 62f8121..7bab784 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -129,11 +129,20 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) tegra_dc_disable_vblank(dc); } +static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) +{ + struct drm_crtc *crtc; + + list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) + tegra_dc_cancel_page_flip(crtc, file); +} + struct drm_driver tegra_drm_driver = { .driver_features = DRIVER_BUS_PLATFORM | DRIVER_MODESET | DRIVER_GEM, .load = tegra_drm_load, .unload = tegra_drm_unload, .open = tegra_drm_open, + .preclose = tegra_drm_preclose, .lastclose = tegra_drm_lastclose, .get_vblank_counter = drm_vblank_count, diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index bb5e9d3..3aa21b1 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -103,6 +103,9 @@ struct tegra_dc { struct drm_info_list *debugfs_files; struct drm_minor *minor; struct dentry *debugfs; + + /* page-flip handling */ + struct drm_pending_vblank_event *event; }; static inline struct tegra_dc *host1x_client_to_dc(struct host1x_client *client) @@ -152,6 +155,8 @@ extern int tegra_dc_setup_window(struct tegra_dc *dc, unsigned int index, const struct tegra_dc_window *window); extern void tegra_dc_enable_vblank(struct tegra_dc *dc); extern v
[PATCH 4/5] drm/tegra: Implement VBLANK support
Implement support for the VBLANK IOCTL. Note that Tegra is somewhat special in this case because it doesn't use the generic IRQ support provided by the DRM core (DRIVER_HAVE_IRQ) but rather registers one interrupt handler for each display controller. While at it, clean up the way that interrupts are enabled to ensure that the VBLANK interrupt only gets enabled when required. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 55 +++-- drivers/gpu/drm/tegra/drm.c | 44 drivers/gpu/drm/tegra/drm.h | 3 +++ 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 8dd7d8a..3aa7ccc 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -135,6 +135,32 @@ static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, return 0; } +void tegra_dc_enable_vblank(struct tegra_dc *dc) +{ + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value |= VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); +} + +void tegra_dc_disable_vblank(struct tegra_dc *dc) +{ + unsigned long value, flags; + + spin_lock_irqsave(&dc->lock, flags); + + value = tegra_dc_readl(dc, DC_CMD_INT_MASK); + value &= ~VBLANK_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + + spin_unlock_irqrestore(&dc->lock, flags); +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -375,6 +401,8 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, unsigned long div, value; int err; + drm_vblank_pre_modeset(crtc->dev, dc->pipe); + err = tegra_crtc_setup_clk(crtc, mode, &div); if (err) { dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); @@ -476,31 +504,23 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); - - value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); + + value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; + tegra_dc_writel(dc, value, DC_CMD_INT_MASK); } static void tegra_crtc_commit(struct drm_crtc *crtc) { struct tegra_dc *dc = to_tegra_dc(crtc); - unsigned long update_mask; unsigned long value; - update_mask = GENERAL_ACT_REQ | WIN_A_ACT_REQ; - - tegra_dc_writel(dc, update_mask << 8, DC_CMD_STATE_CONTROL); - - value = tegra_dc_readl(dc, DC_CMD_INT_ENABLE); - value |= FRAME_END_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ | + GENERAL_UPDATE | WIN_A_UPDATE; - value = tegra_dc_readl(dc, DC_CMD_INT_MASK); - value |= FRAME_END_INT; - tegra_dc_writel(dc, value, DC_CMD_INT_MASK); + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); - tegra_dc_writel(dc, update_mask, DC_CMD_STATE_CONTROL); + drm_vblank_post_modeset(crtc->dev, dc->pipe); } static void tegra_crtc_load_lut(struct drm_crtc *crtc) @@ -517,7 +537,7 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { .load_lut = tegra_crtc_load_lut, }; -static irqreturn_t tegra_drm_irq(int irq, void *data) +static irqreturn_t tegra_dc_irq(int irq, void *data) { struct tegra_dc *dc = data; unsigned long status; @@ -862,7 +882,7 @@ static int tegra_dc_drm_init(struct host1x_client *client, dev_err(dc->dev, "debugfs setup failed: %d\n", err); } - err = devm_request_irq(dc->dev, dc->irq, tegra_drm_irq, 0, + err = devm_request_irq(dc->dev, dc->irq, tegra_dc_irq, 0, dev_name(dc->dev), dc); if (err < 0) { dev_err(dc->dev, "failed to request IRQ#%u: %d\n", dc->irq, @@ -911,6 +931,7 @@ static int tegra_dc_probe(struct platform_device *pdev) if (!dc) return -ENOMEM; + spin_lock_init(&dc->lock); INIT_LIST_HEAD(&dc->list); dc->dev = &pdev->dev; diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 3a503c9..62f8121 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -40,6 +40,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags) if (err < 0) return err; + err = drm_vblank_init(drm, drm->mode_config.num_crtc); + if (err < 0) + return err; + err = tegra_drm_fb_init(drm); if (err < 0)
[PATCH 3/5] drm/tegra: Implement .mode_set_base()
The sequence for replacing the scanout buffer is much shorter than a full mode change operation so implementing this callback considerably speeds up cases where only a new framebuffer is to be scanned out. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 29 + 1 file changed, 29 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 157e962..8dd7d8a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -116,6 +116,25 @@ static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) return 0; } +static int tegra_dc_set_base(struct tegra_dc *dc, int x, int y, +struct tegra_framebuffer *fb) +{ + unsigned long value; + + tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); + + value = fb->base.offsets[0] + y * fb->base.pitches[0] + + x * fb->base.bits_per_pixel / 8; + + tegra_dc_writel(dc, fb->obj->paddr + value, DC_WINBUF_START_ADDR); + + value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; + value |= GENERAL_UPDATE | WIN_A_UPDATE; + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -404,6 +423,15 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, return 0; } +static int tegra_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, + struct drm_framebuffer *old_fb) +{ + struct tegra_framebuffer *fb = to_tegra_fb(crtc->fb); + struct tegra_dc *dc = to_tegra_dc(crtc); + + return tegra_dc_set_base(dc, x, y, fb); +} + static void tegra_crtc_prepare(struct drm_crtc *crtc) { struct tegra_dc *dc = to_tegra_dc(crtc); @@ -483,6 +511,7 @@ static const struct drm_crtc_helper_funcs tegra_crtc_helper_funcs = { .dpms = tegra_crtc_dpms, .mode_fixup = tegra_crtc_mode_fixup, .mode_set = tegra_crtc_mode_set, + .mode_set_base = tegra_crtc_mode_set_base, .prepare = tegra_crtc_prepare, .commit = tegra_crtc_commit, .load_lut = tegra_crtc_load_lut, -- 1.8.1
[PATCH 2/5] drm/tegra: Add plane support
Add support for the B and C planes which support RGB and YUV pixel formats and can be used as overlays or hardware cursor. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 321 +++- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/drm.h | 29 3 files changed, 259 insertions(+), 93 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 656b2e3..157e962 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -18,19 +18,104 @@ #include "drm.h" #include "dc.h" -struct tegra_dc_window { - fixed20_12 x; - fixed20_12 y; - fixed20_12 w; - fixed20_12 h; - unsigned int outx; - unsigned int outy; - unsigned int outw; - unsigned int outh; - unsigned int stride; - unsigned int fmt; +struct tegra_plane { + struct drm_plane base; + unsigned int index; }; +static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) +{ + return container_of(plane, struct tegra_plane, base); +} + +static int tegra_plane_update(struct drm_plane *plane, struct drm_crtc *crtc, + struct drm_framebuffer *fb, int crtc_x, + int crtc_y, unsigned int crtc_w, + unsigned int crtc_h, uint32_t src_x, + uint32_t src_y, uint32_t src_w, uint32_t src_h) +{ + unsigned long base = tegra_framebuffer_base(fb); + struct tegra_plane *p = to_tegra_plane(plane); + struct tegra_dc *dc = to_tegra_dc(crtc); + struct tegra_dc_window window; + + memset(&window, 0, sizeof(window)); + window.src.x = src_x >> 16; + window.src.y = src_y >> 16; + window.src.w = src_w >> 16; + window.src.h = src_h >> 16; + window.dst.x = crtc_x; + window.dst.y = crtc_y; + window.dst.w = crtc_w; + window.dst.h = crtc_h; + window.format = tegra_dc_format(fb->pixel_format); + window.bits_per_pixel = fb->bits_per_pixel; + window.stride = fb->pitches[0]; + window.base = base; + + return tegra_dc_setup_window(dc, p->index + 1, &window); +} + +static int tegra_plane_disable(struct drm_plane *plane) +{ + struct tegra_dc *dc = to_tegra_dc(plane->crtc); + struct tegra_plane *p = to_tegra_plane(plane); + unsigned int index = p->index + 1; + unsigned long value; + + value = WINDOW_A_SELECT << index; + tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); + + value = tegra_dc_readl(dc, DC_WIN_WIN_OPTIONS); + value &= ~WIN_ENABLE; + tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); + + value = (WIN_A_ACT_REQ << index) | (WIN_A_UPDATE << index); + tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); + + return 0; +} + +static void tegra_plane_destroy(struct drm_plane *plane) +{ + drm_plane_cleanup(plane); +} + +static const struct drm_plane_funcs tegra_plane_funcs = { + .update_plane = tegra_plane_update, + .disable_plane = tegra_plane_disable, + .destroy = tegra_plane_destroy, +}; + +static const uint32_t plane_formats[] = { + DRM_FORMAT_XRGB, + DRM_FORMAT_YUV422, +}; + +static int tegra_dc_add_planes(struct drm_device *drm, struct tegra_dc *dc) +{ + unsigned int i; + int err = 0; + + for (i = 0; i < 2; i++) { + struct tegra_plane *plane; + + plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); + if (!plane) + return -ENOMEM; + + plane->index = i; + + err = drm_plane_init(drm, &plane->base, 1 << dc->pipe, +&tegra_plane_funcs, plane_formats, +ARRAY_SIZE(plane_formats), false); + if (err < 0) + return err; + } + + return 0; +} + static const struct drm_crtc_funcs tegra_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .destroy = drm_crtc_cleanup, @@ -47,10 +132,11 @@ static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, return true; } -static inline u32 compute_dda_inc(fixed20_12 inf, unsigned int out, bool v, +static inline u32 compute_dda_inc(unsigned int in, unsigned int out, bool v, unsigned int bpp) { fixed20_12 outf = dfixed_init(out); + fixed20_12 inf = dfixed_init(in); u32 dda_inc; int max; @@ -80,9 +166,10 @@ static inline u32 compute_dda_inc(fixed20_12 inf, unsigned int out, bool v, return dda_inc; } -static inline u32 compute_initial_dda(fixed20_12 in) +static inline u32 compute_initial_dda(unsigned int in) { - return dfixed_frac(in); + fixed20_12 inf = dfixed_init(in); + return dfixed_frac(inf); } static int tegra_dc_set_timings(struct tegra_dc *dc, @@ -153,6 +240,111 @@ static int te
[PATCH 1/5] drm: Allow vblank support without DRIVER_HAVE_IRQ
Drivers that register interrupt handlers without the DRM core helpers don't initialize the .irq_enabled field and drm_dev_to_irq() may fail when called on them. This shouldn't preclude them from implementing the vblank IOCTL. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 19c01ca..71f8205 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -1218,8 +1218,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data, int ret; unsigned int flags, seq, crtc, high_crtc; - if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) - return -EINVAL; + if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) + if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) + return -EINVAL; if (vblwait->request.type & _DRM_VBLANK_SIGNAL) return -EINVAL; -- 1.8.1
[PATCH 0/5] drm/tegra: Miscellaneous enhancements
Hi, This patch series introduces a number of useful features for the Tegra DRM driver. The first patch allows VBLANK support to be used in drivers that don't or can't use DRIVER_HAVE_IRQ for interrupt support. Patch 2 adds support for the additional two planes available on Tegra hardware, while patch 3 implement .mode_set_base() to allow for some nice speed up when changing the framebuffer without actually changing the resolution. Patch 4 adds VBLANK support and finally patch 5 builds on it to provide the page-flipping IOCTL. Thierry Thierry Reding (5): drm: Allow vblank support without DRIVER_HAVE_IRQ drm/tegra: Add plane support drm/tegra: Implement .mode_set_base() drm/tegra: Implement VBLANK support drm/tegra: Implement page-flipping support drivers/gpu/drm/drm_irq.c | 5 +- drivers/gpu/drm/tegra/dc.c | 475 ++-- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/drm.c | 53 + drivers/gpu/drm/tegra/drm.h | 37 5 files changed, 461 insertions(+), 111 deletions(-) -- 1.8.1
[PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned
On Mon, Jan 14, 2013 at 03:30:20PM +0100, Thierry Reding wrote: > Since the variable's value is the size of an array, we can assume that > it will never be negative. > > Signed-off-by: Thierry Reding > --- > drivers/gpu/drm/drm_edid_modes.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_edid_modes.h > b/drivers/gpu/drm/drm_edid_modes.h > index 5dbf7d2..d65d863 100644 > --- a/drivers/gpu/drm/drm_edid_modes.h > +++ b/drivers/gpu/drm/drm_edid_modes.h > @@ -771,4 +771,4 @@ static const struct drm_display_mode edid_cea_modes[] = { > 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, > DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, > }; > -static const int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); > +static const unsigned int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); Why do we even have these num_foo things? I think it would be clearer to use ARRAY_SIZE(foo) directly where appropriate. -- Ville Syrj?l? Intel OTC
[PATCH] drm/exynos: Remove "internal" interrupt handling
Remove the "internal" interrupt handling since it's never invoked and remove "external" reference. This patch removes a bunch of dead code and clarifies how hotplugging is handled in the HDMI driver. Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_hdmi.c | 74 +++--- 1 files changed, 15 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 36e9214..b2f8de9 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -98,8 +98,7 @@ struct hdmi_context { void __iomem*regs; void*parent_ctx; - int external_irq; - int internal_irq; + int irq; struct i2c_client *ddc_port; struct i2c_client *hdmiphy_port; @@ -1656,7 +1655,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) { struct hdmi_infoframe infoframe; - /* disable HPD interrupts */ + /* disable HPD interrupts from HDMI IP block, use GPIO instead */ hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); @@ -2260,7 +2259,7 @@ static struct exynos_hdmi_ops hdmi_ops = { .dpms = hdmi_dpms, }; -static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) +static irqreturn_t hdmi_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg; struct hdmi_context *hdata = ctx->ctx; @@ -2275,31 +2274,6 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) return IRQ_HANDLED; } -static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) -{ - struct exynos_drm_hdmi_context *ctx = arg; - struct hdmi_context *hdata = ctx->ctx; - u32 intc_flag; - - intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); - /* clearing flags for HPD plug/unplug */ - if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) { - DRM_DEBUG_KMS("unplugged\n"); - hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_UNPLUG); - } - if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) { - DRM_DEBUG_KMS("plugged\n"); - hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_PLUG); - } - - if (ctx->drm_dev) - drm_helper_hpd_irq_event(ctx->drm_dev); - - return IRQ_HANDLED; -} - static int __devinit hdmi_resources_init(struct hdmi_context *hdata) { struct device *dev = hdata->dev; @@ -2550,39 +2524,24 @@ static int __devinit hdmi_probe(struct platform_device *pdev) hdata->hdmiphy_port = hdmi_hdmiphy; - hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); - if (hdata->external_irq < 0) { - DRM_ERROR("failed to get GPIO external irq\n"); - ret = hdata->external_irq; - goto err_hdmiphy; - } - - hdata->internal_irq = platform_get_irq(pdev, 0); - if (hdata->internal_irq < 0) { - DRM_ERROR("failed to get platform internal irq\n"); - ret = hdata->internal_irq; + hdata->irq = gpio_to_irq(hdata->hpd_gpio); + if (hdata->irq < 0) { + DRM_ERROR("failed to get GPIO irq\n"); + ret = hdata->irq; goto err_hdmiphy; } hdata->hpd = gpio_get_value(hdata->hpd_gpio); - ret = request_threaded_irq(hdata->external_irq, NULL, - hdmi_external_irq_thread, IRQF_TRIGGER_RISING | + ret = request_threaded_irq(hdata->irq, NULL, + hdmi_irq_thread, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "hdmi_external", drm_hdmi_ctx); + "hdmi", drm_hdmi_ctx); if (ret) { - DRM_ERROR("failed to register hdmi external interrupt\n"); + DRM_ERROR("failed to register hdmi interrupt\n"); goto err_hdmiphy; } - ret = request_threaded_irq(hdata->internal_irq, NULL, - hdmi_internal_irq_thread, IRQF_ONESHOT, - "hdmi_internal", drm_hdmi_ctx); - if (ret) { - DRM_ERROR("failed to register hdmi internal interrupt\n"); - goto err_free_irq; - } - /* Attach HDMI Driver to common hdmi. */ exynos_hdmi_drv_attach(drm_hdmi_ctx); @@ -2594,7 +2553,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) return 0; err_free_irq: - free_irq(hdata->external_irq, drm_hdmi_ctx); + free_irq(hdata->irq, drm_hdmi_ctx); err_hdmiphy: i2c_del_driver(&hdmiphy_driver); err_ddc: @@ -2612,8 +2571,7 @@ static int __devexit hdmi_remov
[PATCH 5/5] drm/i915: Provide the quantization range in the AVI infoframe
From: Ville Syrj?l? The AVI infoframe is able to inform the display whether the source is sending full or limited range RGB data. As per CEA-861 we must first check whether the display reports the quantization range as selectable, and if so we can set the approriate bits in the AVI inforframe. Signed-off-by: Ville Syrj?l? --- drivers/gpu/drm/i915/intel_drv.h |3 +++ drivers/gpu/drm/i915/intel_hdmi.c | 11 +++ drivers/gpu/drm/i915/intel_sdvo.c | 16 ++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index a6a74b7..dff220e 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -289,6 +289,8 @@ struct cxsr_latency { #define DIP_LEN_AVI 13 #define DIP_AVI_PR_10 #define DIP_AVI_PR_21 +#define DIP_AVI_Q0 0x4 +#define DIP_AVI_Q1 0x8 #define DIP_TYPE_SPD 0x83 #define DIP_VERSION_SPD0x1 @@ -348,6 +350,7 @@ struct intel_hdmi { bool has_hdmi_monitor; bool has_audio; enum hdmi_force_audio force_audio; + bool rgb_quant_range_selectable; void (*write_infoframe)(struct drm_encoder *encoder, struct dip_infoframe *frame); void (*set_infoframes)(struct drm_encoder *encoder, diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 870d1e9..297396d 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -331,6 +331,7 @@ static void intel_set_infoframe(struct drm_encoder *encoder, static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, struct drm_display_mode *adjusted_mode) { + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); struct dip_infoframe avi_if = { .type = DIP_TYPE_AVI, .ver = DIP_VERSION_AVI, @@ -340,6 +341,13 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2; + if (intel_hdmi->rgb_quant_range_selectable) { + if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE) + avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_Q0; + else + avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_Q1; + } + avi_if.body.avi.VIC = drm_mode_cea_vic(adjusted_mode); intel_set_infoframe(encoder, &avi_if); @@ -826,6 +834,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) intel_hdmi->has_hdmi_sink = false; intel_hdmi->has_hdmi_monitor = false; intel_hdmi->has_audio = false; + intel_hdmi->rgb_quant_range_selectable = false; edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus)); @@ -838,6 +847,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) intel_hdmi->has_hdmi_sink = intel_hdmi->has_hdmi_monitor; intel_hdmi->has_audio = drm_detect_monitor_audio(edid); + intel_hdmi->rgb_quant_range_selectable = + drm_rgb_quant_range_selectable(edid); } kfree(edid); } diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index b422109..af93999 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -126,6 +126,7 @@ struct intel_sdvo { bool is_hdmi; bool has_hdmi_monitor; bool has_hdmi_audio; + bool rgb_quant_range_selectable; /** * This is set if we detect output of sdvo device as LVDS and @@ -947,7 +948,8 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo, &tx_rate, 1); } -static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) +static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo, +const struct drm_display_mode *adjusted_mode) { struct dip_infoframe avi_if = { .type = DIP_TYPE_AVI, @@ -956,6 +958,13 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) }; uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; + if (intel_sdvo->rgb_quant_range_selectable) { + if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE) + avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_Q0; + else + avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_Q1; + } + intel_dip_infoframe_csum(&avi_if); /* sdvo spec says that the ecc is
[PATCH 4/5] drm/edid: Add drm_rgb_quant_range_selectable()
From: Ville Syrj?l? drm_rgb_quant_range_selectable() will report whether the monitor claims to support for RGB quantization range selection. The information can be found in the CEA Video capability block. Signed-off-by: Ville Syrj?l? --- drivers/gpu/drm/drm_edid.c | 33 + include/drm/drm_crtc.h |1 + 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5a3770f..deba722 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1483,9 +1483,11 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, #define VIDEO_BLOCK 0x02 #define VENDOR_BLOCK0x03 #define SPEAKER_BLOCK 0x04 +#define VIDEO_CAPABILITY_BLOCK 0x07 #define EDID_BASIC_AUDIO (1 << 6) #define EDID_CEA_YCRCB444 (1 << 5) #define EDID_CEA_YCRCB422 (1 << 4) +#define EDID_CEA_VCDB_QS (1 << 6) /** * Search EDID for CEA extension block. @@ -1902,6 +1904,37 @@ end: EXPORT_SYMBOL(drm_detect_monitor_audio); /** + * drm_rgb_quant_range_selectable - is RGB quantization range selectable? + * + * Check whether the monitor reports the RGB quantization range selection + * as supported. The AVI infoframe can then be used to inform the monitor + * which quantzation range (full or limited) is used. + */ +bool drm_rgb_quant_range_selectable(struct edid *edid) +{ + u8 *edid_ext; + int i, start, end; + + edid_ext = drm_find_cea_extension(edid); + if (!edid_ext) + return false; + + if (cea_db_offsets(edid_ext, &start, &end)) + return false; + + for_each_cea_db(edid_ext, i, start, end) { + if (cea_db_tag(&edid_ext[i]) == VIDEO_CAPABILITY_BLOCK && + cea_db_payload_len(&edid_ext[i]) == 2) { + DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", edid_ext[i + 2]); + return edid_ext[i + 2] & EDID_CEA_VCDB_QS; + } + } + + return false; +} +EXPORT_SYMBOL(drm_rgb_quant_range_selectable); + +/** * drm_add_display_info - pull display info out if present * @edid: EDID data * @info: display info (attached to connector) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 00d78b5..30892dc 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1033,6 +1033,7 @@ extern u8 *drm_find_cea_extension(struct edid *edid); extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); extern bool drm_detect_hdmi_monitor(struct edid *edid); extern bool drm_detect_monitor_audio(struct edid *edid); +extern bool drm_rgb_quant_range_selectable(struct edid *edid); extern int drm_mode_page_flip_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, -- 1.7.8.6
[PATCH 3/5] drm/i915: Add "Automatic" mode for the "Broadcast RGB" property
From: Ville Syrj?l? Add a new "Automatic" mode to the "Broadcast RGB" range property. When selected the driver automagically selects between full range and limited range output. Based on CEA-861 guidelines, limited range output is selected if the mode is a CEA mode, except 640x480. Otherwise full range output is used. Additionally DVI monitors should most likely default to full range always. As per DP1.2a DisplayPort should always use full range for 18bpp, and otherwise will follow CEA-861 rules. NOTE: The default value for the property will now be "Automatic" so some people may be affected in case they're relying on the current full range default. Signed-off-by: Ville Syrj?l? --- drivers/gpu/drm/i915/i915_drv.h|4 +++ drivers/gpu/drm/i915/intel_dp.c| 28 ++--- drivers/gpu/drm/i915/intel_drv.h |2 + drivers/gpu/drm/i915/intel_hdmi.c | 29 +++--- drivers/gpu/drm/i915/intel_modes.c |5 ++- drivers/gpu/drm/i915/intel_sdvo.c | 38 +-- 6 files changed, 89 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b1b1b73..573edb6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1799,5 +1799,9 @@ __i915_write(64, q) #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg) #define POSTING_READ16(reg)(void)I915_READ16_NOTRACE(reg) +/* "Broadcast RGB" property */ +#define INTEL_BROADCAST_RGB_AUTO 0 +#define INTEL_BROADCAST_RGB_FULL 1 +#define INTEL_BROADCAST_RGB_LIMITED 2 #endif diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index d995627..be1a1ee 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -764,6 +764,14 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; + if (intel_dp->color_range_auto) { + /* as per DP1.2a and CEA-861 */ + if (bpp != 18 && drm_mode_cea_vic(adjusted_mode) > 1) + intel_dp->color_range = DP_COLOR_RANGE_16_235; + else + intel_dp->color_range = 0; + } + if (intel_dp->color_range) adjusted_mode->private_flags |= INTEL_MODE_LIMITED_COLOR_RANGE; @@ -2462,10 +2470,21 @@ intel_dp_set_property(struct drm_connector *connector, } if (property == dev_priv->broadcast_rgb_property) { - if (val == !!intel_dp->color_range) - return 0; - - intel_dp->color_range = val ? DP_COLOR_RANGE_16_235 : 0; + switch (val) { + case INTEL_BROADCAST_RGB_AUTO: + intel_dp->color_range_auto = true; + break; + case INTEL_BROADCAST_RGB_FULL: + intel_dp->color_range_auto = false; + intel_dp->color_range = 0; + break; + case INTEL_BROADCAST_RGB_LIMITED: + intel_dp->color_range_auto = false; + intel_dp->color_range = DP_COLOR_RANGE_16_235; + break; + default: + return -EINVAL; + } goto done; } @@ -2606,6 +2625,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect intel_attach_force_audio_property(connector); intel_attach_broadcast_rgb_property(connector); + intel_dp->color_range_auto = true; if (is_edp(intel_dp)) { drm_mode_create_scaling_mode_property(connector->dev); diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index aed7478..a6a74b7 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -343,6 +343,7 @@ struct intel_hdmi { u32 sdvox_reg; int ddc_bus; uint32_t color_range; + bool color_range_auto; bool has_hdmi_sink; bool has_hdmi_monitor; bool has_audio; @@ -363,6 +364,7 @@ struct intel_dp { bool has_audio; enum hdmi_force_audio force_audio; uint32_t color_range; + bool color_range_auto; uint8_t link_bw; uint8_t lane_count; uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index e663dec..870d1e9 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -768,6 +768,15 @@ bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, { struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); + if (intel_hdmi->color_range_auto) { + /* as per CEA-861 */ + if (intel_hdmi->has_hdmi_monitor && + drm_mode_cea_vic(adjusted_mode) > 1) + intel_hdmi->color_r
[PATCH 2/5] drm/i915: Add has_hdmi_monitor to intel_hdmi
From: Ville Syrj?l? intel_hdmi.has_hdmi_sink is tied into the force audio property, so it doesn't seem like the correct way to detect HDMI monitors. Instead add a new has_hdmi_monitor member which simply tells whether a HDMI monitor was detected. Not sure if this is the best way, or if we should just use has_hdmi_sink for the CEA-861 automatic color range property... At least the infoframe stuff already depends on has_hdmi_sink. Signed-off-by: Ville Syrj?l? --- drivers/gpu/drm/i915/intel_drv.h |1 + drivers/gpu/drm/i915/intel_hdmi.c |6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 4df47be..aed7478 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -344,6 +344,7 @@ struct intel_hdmi { int ddc_bus; uint32_t color_range; bool has_hdmi_sink; + bool has_hdmi_monitor; bool has_audio; enum hdmi_force_audio force_audio; void (*write_infoframe)(struct drm_encoder *encoder, diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f194d75..e663dec 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -815,6 +815,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) return status; intel_hdmi->has_hdmi_sink = false; + intel_hdmi->has_hdmi_monitor = false; intel_hdmi->has_audio = false; edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, @@ -823,9 +824,10 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) if (edid) { if (edid->input & DRM_EDID_INPUT_DIGITAL) { status = connector_status_connected; + intel_hdmi->has_hdmi_monitor = + drm_detect_hdmi_monitor(edid); if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) - intel_hdmi->has_hdmi_sink = - drm_detect_hdmi_monitor(edid); + intel_hdmi->has_hdmi_sink = intel_hdmi->has_hdmi_monitor; intel_hdmi->has_audio = drm_detect_monitor_audio(edid); } kfree(edid); -- 1.7.8.6
[PATCH v3 1/5] drm/i915: Fix RGB color range property for PCH platforms
From: Ville Syrj?l? The RGB color range select bit on the DP/SDVO/HDMI registers disappeared when PCH was introduced, and instead a new PIPECONF bit was added that performs the same function. Add a new INTEL_MODE_LIMITED_COLOR_RANGE private mode flag, and set it in the encoder mode_fixup if limited color range is requested. Set the the PIPECONF bit 13 based on the flag. Experimentation showed that simply toggling the bit while the pipe is active doesn't work. We need to restart the pipe, which luckily already happens. The DP/SDVO/HDMI bit 8 is marked MBZ in the docs, so avoid setting it, although it doesn't seem to do any harm in practice. TODO: - the PIPECONF bit too seems to have disappeared from HSW. Need a volunteer to test if it's just a documentation issue or if it's really gone. If the bit is gone and no easy replacement is found, then I suppose we may need to use the pipe CSC unit to perform the range compression. v2: Use mode private_flags instead of intel_encoder virtual functions v3: Moved the intel_dp color_range handling after bpc check to help later patches Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46800 Signed-off-by: Ville Syrj?l? --- drivers/gpu/drm/i915/i915_reg.h |1 + drivers/gpu/drm/i915/intel_display.c |5 + drivers/gpu/drm/i915/intel_dp.c |7 ++- drivers/gpu/drm/i915/intel_drv.h |5 + drivers/gpu/drm/i915/intel_hdmi.c|5 + drivers/gpu/drm/i915/intel_sdvo.c|5 - 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3b039f4..a653b64 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2650,6 +2650,7 @@ #define PIPECONF_INTERLACED_DBL_ILK (4 << 21) /* ilk/snb only */ #define PIPECONF_PFIT_PF_INTERLACED_DBL_ILK (5 << 21) /* ilk/snb only */ #define PIPECONF_CXSR_DOWNCLOCK (1<<16) +#define PIPECONF_COLOR_RANGE_SELECT (1 << 13) #define PIPECONF_BPC_MASK(0x7 << 5) #define PIPECONF_8BPC(0<<5) #define PIPECONF_10BPC (1<<5) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index cf0c713..a409a51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5093,6 +5093,11 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc, else val |= PIPECONF_PROGRESSIVE; + if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE) + val |= PIPECONF_COLOR_RANGE_SELECT; + else + val &= ~PIPECONF_COLOR_RANGE_SELECT; + I915_WRITE(PIPECONF(pipe), val); POSTING_READ(PIPECONF(pipe)); } diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 5f12eb2..d995627 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -763,6 +763,10 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, return false; bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; + + if (intel_dp->color_range) + adjusted_mode->private_flags |= INTEL_MODE_LIMITED_COLOR_RANGE; + mode_rate = intel_dp_link_required(adjusted_mode->clock, bpp); for (clock = 0; clock <= max_clock; clock++) { @@ -967,7 +971,8 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, else intel_dp->DP |= DP_PLL_FREQ_270MHZ; } else if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { - intel_dp->DP |= intel_dp->color_range; + if (!HAS_PCH_SPLIT(dev)) + intel_dp->DP |= intel_dp->color_range; if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) intel_dp->DP |= DP_SYNC_HS_HIGH; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 54a034c..4df47be 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -109,6 +109,11 @@ * timings in the mode to prevent the crtc fixup from overwriting them. * Currently only lvds needs that. */ #define INTEL_MODE_CRTC_TIMINGS_SET (0x20) +/* + * Set when limited 16-235 (as opposed to full 0-255) RGB color range is + * to be used. + */ +#define INTEL_MODE_LIMITED_COLOR_RANGE (0x40) static inline void intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 6387f9b..f194d75 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -766,6 +766,11 @@ bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { + struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); + + if (intel_hdm
drm/i915: RGB quantization range stuff
This series tries fix and improve the 'Broadcast RGB' property on i915. Currently the property takes has two values 'Full' and 'Limited 16:235'. I'm adding a third option 'Automatic' that automagically changes between full and limited range based on CEA-861 and DP1.2a rules. I'm also adding support for informing the display about the currently used RGB quantization range using the AVI inforframe Q bits. Unfortunately my TV doesn't support this mechanism, so this part is untested territory. While doing this I noticed that we're not setting the PR and VIC information in the AVI infoframe intel_sdvo, while we do set them in intel_hdmi. I wonder if there's some real reason for this discrepancy?
[Intel-gfx] [PATCH 2/5] drm/i915: Add has_hdmi_monitor to intel_hdmi
On Mon, Jan 14, 2013 at 04:15:07PM +0200, ville.syrjala at linux.intel.com wrote: > From: Ville Syrj?l? > > intel_hdmi.has_hdmi_sink is tied into the force audio property, so it > doesn't seem like the correct way to detect HDMI monitors. Instead add > a new has_hdmi_monitor member which simply tells whether a HDMI monitor > was detected. > > Not sure if this is the best way, or if we should just use has_hdmi_sink > for the CEA-861 automatic color range property... At least the infoframe > stuff already depends on has_hdmi_sink. > > Signed-off-by: Ville Syrj?l? Imo it looks simpler if we just reuse the has_hdmi_sink bool. That already controls infoframes and similar stuff, so if users would force dvi mode this would automatically also disable all broadcast range magic (if that's in the default value). Users could still override the broadcast stuff explictly. I guess it'd have been better if we have a a force-dvi master switch outside of the audio property to control all things hdmi. But alas ... -Daniel > --- > drivers/gpu/drm/i915/intel_drv.h |1 + > drivers/gpu/drm/i915/intel_hdmi.c |6 -- > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > b/drivers/gpu/drm/i915/intel_drv.h > index 4df47be..aed7478 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -344,6 +344,7 @@ struct intel_hdmi { > int ddc_bus; > uint32_t color_range; > bool has_hdmi_sink; > + bool has_hdmi_monitor; > bool has_audio; > enum hdmi_force_audio force_audio; > void (*write_infoframe)(struct drm_encoder *encoder, > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c > b/drivers/gpu/drm/i915/intel_hdmi.c > index f194d75..e663dec 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -815,6 +815,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool > force) >return status; > > intel_hdmi->has_hdmi_sink = false; > + intel_hdmi->has_hdmi_monitor = false; > intel_hdmi->has_audio = false; > edid = drm_get_edid(connector, > intel_gmbus_get_adapter(dev_priv, > @@ -823,9 +824,10 @@ intel_hdmi_detect(struct drm_connector *connector, bool > force) > if (edid) { > if (edid->input & DRM_EDID_INPUT_DIGITAL) { > status = connector_status_connected; > + intel_hdmi->has_hdmi_monitor = > + drm_detect_hdmi_monitor(edid); > if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) > - intel_hdmi->has_hdmi_sink = > - drm_detect_hdmi_monitor(edid); > + intel_hdmi->has_hdmi_sink = > intel_hdmi->has_hdmi_monitor; > intel_hdmi->has_audio = drm_detect_monitor_audio(edid); > } > kfree(edid); > -- > 1.7.8.6 > > ___ > Intel-gfx mailing list > Intel-gfx at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
[PATCH] drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try
Op 14-01-13 15:08, Daniel Vetter schreef: > This fixes up > > commit e8e89622ed361c46bf90ba4828e685a8b603f7e5 > Author: Daniel Vetter > Date: Tue Dec 18 22:25:11 2012 +0100 > > drm/ttm: fix fence locking in ttm_buffer_object_transfer > > which leaves behind a might_sleep in atomic context, since the > fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix > is to revert the above commit and only take the lock where we need it, > around the call to ->sync_obj_ref. > > v2: Fixup things noticed by Maarten Lankhorst: > - Brown paper bag locking bug. > - No need for kzalloc if we clear the entire thing on the next line. > - check for bo->sync_obj (totally unlikely race, but still someone > else could have snuck in) and clear fbo->sync_obj if it's cleared > already. > > Reported-by: Dave Airlie > Cc: Jerome Glisse > Cc: Maarten Lankhorst Reviewed-by: Maarten Lankhorst > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/ttm/ttm_bo_util.c | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c > b/drivers/gpu/drm/ttm/ttm_bo_util.c > index d73d6e3..544e407 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -422,7 +422,7 @@ static int ttm_buffer_object_transfer(struct > ttm_buffer_object *bo, > struct ttm_bo_device *bdev = bo->bdev; > struct ttm_bo_driver *driver = bdev->driver; > > - fbo = kzalloc(sizeof(*fbo), GFP_KERNEL); > + fbo = kmalloc(sizeof(*fbo), GFP_KERNEL); > if (!fbo) > return -ENOMEM; > > @@ -441,7 +441,12 @@ static int ttm_buffer_object_transfer(struct > ttm_buffer_object *bo, > fbo->vm_node = NULL; > atomic_set(&fbo->cpu_writers, 0); > > - fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); > + spin_lock(&bdev->fence_lock); > + if (bo->sync_obj) > + fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); > + else > + fbo->sync_obj = NULL; > + spin_unlock(&bdev->fence_lock); > kref_init(&fbo->list_kref); > kref_init(&fbo->kref); > fbo->destroy = &ttm_transfered_destroy; > @@ -654,13 +659,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object > *bo, >*/ > > set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); > - > - /* ttm_buffer_object_transfer accesses bo->sync_obj */ > - ret = ttm_buffer_object_transfer(bo, &ghost_obj); > spin_unlock(&bdev->fence_lock); > if (tmp_obj) > driver->sync_obj_unref(&tmp_obj); > > + ret = ttm_buffer_object_transfer(bo, &ghost_obj); > if (ret) > return ret; >
[PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned
On Mon, Jan 14, 2013 at 04:42:39PM +0200, Ville Syrj?l? wrote: > On Mon, Jan 14, 2013 at 03:30:20PM +0100, Thierry Reding wrote: > > Since the variable's value is the size of an array, we can assume that > > it will never be negative. > > > > Signed-off-by: Thierry Reding > > --- > > drivers/gpu/drm/drm_edid_modes.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_edid_modes.h > > b/drivers/gpu/drm/drm_edid_modes.h > > index 5dbf7d2..d65d863 100644 > > --- a/drivers/gpu/drm/drm_edid_modes.h > > +++ b/drivers/gpu/drm/drm_edid_modes.h > > @@ -771,4 +771,4 @@ static const struct drm_display_mode edid_cea_modes[] = > > { > >2492, 2640, 0, 1080, 1084, 1094, 1125, 0, > >DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, > > }; > > -static const int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); > > +static const unsigned int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); > > Why do we even have these num_foo things? I think it would be clearer to > use ARRAY_SIZE(foo) directly where appropriate. Actually I was thinking about maybe writing a patch to move the table out of the header and into drm_edid.c (or drm_cea.c?) to make it less easy to create duplicates of the table. In that case, using the ARRAY_SIZE macro directly wouldn't be an option. Thierry -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/040ecc9a/attachment.pgp>
[PATCH v3 9/9] drm: Remove duplicate drm_mode_cea_vic()
On Mon, Jan 14, 2013 at 04:57:56PM +0200, Ville Syrj?l? wrote: > On Mon, Jan 14, 2013 at 03:30:28PM +0100, Thierry Reding wrote: > > The same function had already been merged with a different name. Remove > > the duplicate one but reuse some of its kerneldoc fragments for the > > existing implementation. > > And I just used that function. Oh well ;) > > Personally I would have kept the other function instead since it has a > more descriptive name, but I can't be bothered to care enough to > complain too much. drm_mode_cea_vic() was introduced later, so I preferred the older variant. > The patch could be moved to the beginning of the series, so it can be > merged w/o being blocked by the more invasive stuff. Well, assuming that > the more invasive stuff still needs discussing. I had it at the beginning of the series, then realized that I hadn't updated the i915 driver properly. So I cheated a bit and just moved the patch instead of updating i915 and then resolving the conflict in the subsequent i915 HDMI helper patch. =) If the series can't be merged as-is, I can work this in for the next version. Thierry -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/283e109d/attachment.pgp>
Re: Regression: drm/radeon: brightness control hard system lockup
On Mon, Jan 14, 2013 at 11:51 AM, Paul Menzel wrote: > Dear Alex, > > > Am Montag, den 14.01.2013, 11:08 -0500 schrieb Alex Deucher: > > […] > >> Date: Mon, 14 Jan 2013 11:04:39 -0500 >> Subject: [PATCH] drm/radeon: clear reset flags if engines are idle >> >> Fixes a regression > > please describe the regression. > > »brightness control hard system lockup« > >> in the gpu reset code after the rework for DMA support. > > and add the corresponding commit, Eldad tracked down. And for > completeness the URL of the discussion. > > This is important for distribution folks to judge if certain commits are > needed or not. And for users looking through the commit history to spot > a certain fix. >> >> Reported-by: Eldad Zack >> Signed-off-by: Alex Deucher > > With the above, > > Acked-by: Paul Menzel I'll fix it up when I add it to my next -fixes pull. Thanks! Alex > >> --- >> drivers/gpu/drm/radeon/evergreen.c |6 ++ >> drivers/gpu/drm/radeon/ni.c|6 ++ >> drivers/gpu/drm/radeon/r600.c |6 ++ >> drivers/gpu/drm/radeon/si.c|6 ++ >> 4 files changed, 24 insertions(+), 0 deletions(-) > > […] > > > Thanks, > > Paul ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Regression: drm/radeon: brightness control hard system lockup
On Mon, Jan 14, 2013 at 3:27 PM, Eldad Zack wrote: > > On Mon, 14 Jan 2013, Alex Deucher wrote: >> On Sun, Jan 13, 2013 at 4:00 PM, Eldad Zack wrote: >> > >> > On Mon, 7 Jan 2013, Alex Deucher wrote: >> >> On Mon, Jan 7, 2013 at 4:33 PM, Eldad Zack wrote: >> >> > >> >> > On Mon, 7 Jan 2013, Alex Deucher wrote: >> >> >> On Sun, Jan 6, 2013 at 7:59 AM, Eldad Zack >> >> >> wrote: >> >> >> > >> >> >> > Hi Alex, >> >> >> > >> >> >> > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f "drm/radeon: switch >> >> >> > to a >> >> >> > finer grained reset for evergreen" introduced a hard system lockup >> >> >> > to my >> >> >> > setup. I found it after bisecting, and confirmed it by reverting it >> >> >> > on >> >> >> > the latest mainline ( 5f243b9 ). >> >> >> > >> >> >> > This: >> >> >> > >> >> >> >echo 7 > >> >> >> > /sys/devices/pci:00/:00:01.0/:01:00.0/backlight/acpi_video0/brightness >> >> >> > >> >> >> > Causes a hard lock-up hard, i.e. immediate freeze, without any logs. >> >> >> > >> >> >> > See lspci output and kernel .config below. >> >> >> > If there's any more info I can provide, please let me know. >> >> >> >> >> >> Do you normally see GPU resets when changing the backlight? Please >> >> >> attach your dmesg output when changing the backlight with the patch >> >> >> reverted. >> >> > >> >> > I see nothing. Just to make sure, I cleared the buffer, cycled through >> >> > 0-7 a couple of hunderd times (until the flicker annoyed), but I see no >> >> > messages at all. >> >> > Is there any debug config I should turn on? >> >> >> >> Can you try adding a printk() in evergreen_asic_reset() and see if it >> >> is somehow getting called when you change the brightness? When you >> >> use the apci backlight control, the radeon driver is not involved at >> >> all. They only way the driver would get involved is if the acpi >> >> backlight control somehow caused the GPU to hang and then the driver >> >> detected the hang and attempted to reset the GPU. I don't see any >> >> evidence of a GPU reset in your kernel log however. Note that the >> >> driver also registers native backlight contol. Does that work any >> >> better than acpi? >> > >> > The native backlight controls work very well. Thanks for that, I didn't >> > even noticed that. It has finer control over brightness too. >> > >> > I worked out a fix for the problem, but I think it's not a proper one. >> > What I noticed is that evergreen_gpu_soft_reset() is only ever called >> > once on my system, at boot. >> > Then I realized from the dmesg that neither >> > evergreen_gpu_soft_reset_dma() nor evergreen_gpu_soft_reset_gfx() actually >> > do anything. Both return on the first if statements there. >> > >> > So as far as I can tell, the difference your patch introduced is calling >> > evergreen_mc_stop() and evergreen_mc_resume(), which somehow puts my >> > system in some state that ACPI brightness control leads to a lock up. >> > >> > BTW, I don't see a GPU reset happening at all - I also tried suspend/resume >> > and starting an OpenGL application. Do you know how I can trigger it? >> > >> > To fix this, I moved the GUI_ACTIVE test before evergreen_mc_stop(), but >> > I think it just masks the issue. >> > Patch below (against latest HEAD) just in case. >> > >> >> Thanks for tracking this down. The attached patch should fix the >> issue properly. > > Thanks, I just applied it and it works as expected. > > Tested-by: Eldad Zack Thanks! I'll add the patch to my -fixes queue. Alex > > @Paul: Thanks for the comments, will do so in the future. > > Cheers, > Eldad ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 58667] Random crashes on CAYMAN
https://bugs.freedesktop.org/show_bug.cgi?id=58667 --- Comment #36 from Jerome Glisse --- Did you test with mesa reverted to before following commit : http://cgit.freedesktop.org/mesa/mesa/commit/?id=24b1206ab2dcd506aaac3ef656aebc8bc20cd27a -- 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/20130114/79711958/attachment.html>
[PATCH] Revert "drm: Add EDID_QUIRK_FORCE_REDUCED_BLANKING for ASUS VW222S"
Am Montag, den 14.01.2013, 11:06 +0100 schrieb Daniel Vetter: > This reverts commit 6f33814bd4d9cfe76033a31b1c0c76c960cd8e4b. > > The quirk cause a regression, and it looks like the original bug was > simply a lack of FIFO bandwidth on the i915G of the reporter. Which > should eventually be fixed as soon as we get around to implemented > DSPARB FIFO reassignment on gen 3. Reported-by: Florian Mickler > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=52281 > Cc: stable at vger.kernel.org > Signed-off-by: Daniel Vetter Acked-by: Paul Menzel > --- > drivers/gpu/drm/drm_edid.c |3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 5a3770f..39919f2 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -87,9 +87,6 @@ static struct edid_quirk { > int product_id; > u32 quirks; > } edid_quirk_list[] = { > - /* ASUS VW222S */ > - { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING }, > - > /* Acer AL1706 */ > { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 }, > /* Acer F51 */ -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/5acd5cee/attachment.pgp>
[PATCH v3 9/9] drm: Remove duplicate drm_mode_cea_vic()
The same function had already been merged with a different name. Remove the duplicate one but reuse some of its kerneldoc fragments for the existing implementation. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_edid.c | 30 +++--- include/drm/drm_crtc.h | 3 +-- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1cfafc0..0acd6f3 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1514,11 +1514,14 @@ u8 *drm_find_cea_extension(struct edid *edid) } EXPORT_SYMBOL(drm_find_cea_extension); -/* - * Looks for a CEA mode matching given drm_display_mode. - * Returns its CEA Video ID code, or 0 if not found. +/** + * drm_match_cea_mode - look for a CEA mode matching given mode + * @mode: display mode + * + * Returns the CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861 + * mode. */ -u8 drm_match_cea_mode(struct drm_display_mode *to_match) +u8 drm_match_cea_mode(const struct drm_display_mode *to_match) { struct drm_display_mode *cea_mode; u8 mode; @@ -2082,25 +2085,6 @@ int drm_add_modes_noedid(struct drm_connector *connector, EXPORT_SYMBOL(drm_add_modes_noedid); /** - * drm_mode_cea_vic - return the CEA-861 VIC of a given mode - * @mode: mode - * - * RETURNS: - * The VIC number, 0 in case it's not a CEA-861 mode. - */ -uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode) -{ - uint8_t i; - - for (i = 0; i < drm_num_cea_modes; i++) - if (drm_mode_equal(mode, &edid_cea_modes[i])) - return i + 1; - - return 0; -} -EXPORT_SYMBOL(drm_mode_cea_vic); - -/** * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with * data from a DRM display mode * @frame: HDMI AVI infoframe diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index dd62ca0..d0f3927 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -1031,7 +1031,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); extern u8 *drm_find_cea_extension(struct edid *edid); -extern u8 drm_match_cea_mode(struct drm_display_mode *to_match); +extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); extern bool drm_detect_hdmi_monitor(struct edid *edid); extern bool drm_detect_monitor_audio(struct edid *edid); extern int drm_mode_page_flip_ioctl(struct drm_device *dev, @@ -1048,7 +1048,6 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, int GTF_2C, int GTF_K, int GTF_2J); extern int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); -extern uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode); extern int drm_edid_header_is_valid(const u8 *raw_edid); extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid); -- 1.8.1
[PATCH v3 8/9] drm/radeon: Use generic HDMI infoframe helpers
Use the generic HDMI infoframe helpers to get rid of the duplicate implementation in the radeon driver. Signed-off-by: Thierry Reding --- drivers/gpu/drm/radeon/evergreen_hdmi.c | 85 +--- drivers/gpu/drm/radeon/r600_hdmi.c | 134 ++-- 2 files changed, 58 insertions(+), 161 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 327c08b..4fdecc2 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -24,6 +24,7 @@ * Authors: Christian K?nig * Rafa? Mi?ecki */ +#include #include #include #include "radeon.h" @@ -54,79 +55,18 @@ static void evergreen_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t cloc } /* - * calculate the crc for a given info frame - */ -static void evergreen_hdmi_infoframe_checksum(uint8_t packetType, -uint8_t versionNumber, -uint8_t length, -uint8_t *frame) -{ - int i; - frame[0] = packetType + versionNumber + length; - for (i = 1; i <= length; i++) - frame[0] += frame[i]; - frame[0] = 0x100 - frame[0]; -} - -/* * build a HDMI Video Info Frame */ -static void evergreen_hdmi_videoinfoframe( - struct drm_encoder *encoder, - uint8_t color_format, - int active_information_present, - uint8_t active_format_aspect_ratio, - uint8_t scan_information, - uint8_t colorimetry, - uint8_t ex_colorimetry, - uint8_t quantization, - int ITC, - uint8_t picture_aspect_ratio, - uint8_t video_format_identification, - uint8_t pixel_repetition, - uint8_t non_uniform_picture_scaling, - uint8_t bar_info_data_valid, - uint16_t top_bar, - uint16_t bottom_bar, - uint16_t left_bar, - uint16_t right_bar -) +static void evergreen_hdmi_update_avi_infoframe(struct drm_encoder *encoder, + void *buffer, size_t size) { struct drm_device *dev = encoder->dev; struct radeon_device *rdev = dev->dev_private; struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; uint32_t offset = dig->afmt->offset; + uint8_t *frame = buffer + 3; - uint8_t frame[14]; - - frame[0x0] = 0; - frame[0x1] = - (scan_information & 0x3) | - ((bar_info_data_valid & 0x3) << 2) | - ((active_information_present & 0x1) << 4) | - ((color_format & 0x3) << 5); - frame[0x2] = - (active_format_aspect_ratio & 0xF) | - ((picture_aspect_ratio & 0x3) << 4) | - ((colorimetry & 0x3) << 6); - frame[0x3] = - (non_uniform_picture_scaling & 0x3) | - ((quantization & 0x3) << 2) | - ((ex_colorimetry & 0x7) << 4) | - ((ITC & 0x1) << 7); - frame[0x4] = (video_format_identification & 0x7F); - frame[0x5] = (pixel_repetition & 0xF); - frame[0x6] = (top_bar & 0xFF); - frame[0x7] = (top_bar >> 8); - frame[0x8] = (bottom_bar & 0xFF); - frame[0x9] = (bottom_bar >> 8); - frame[0xA] = (left_bar & 0xFF); - frame[0xB] = (left_bar >> 8); - frame[0xC] = (right_bar & 0xFF); - frame[0xD] = (right_bar >> 8); - - evergreen_hdmi_infoframe_checksum(0x82, 0x02, 0x0D, frame); /* Our header values (type, version, length) should be alright, Intel * is using the same. Checksum function also seems to be OK, it works * fine for audio infoframe. However calculated value is always lower @@ -154,7 +94,10 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode struct radeon_device *rdev = dev->dev_private; struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; + u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE]; + struct hdmi_avi_infoframe frame; uint32_t offset; + ssize_t err; /* Silent, r600_hdmi_enable will raise WARN for us */ if (!dig->afmt->enabled) @@ -200,9 +143,19 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode WREG32(HDMI_GC + offset, 0); /* unset HDMI_GC_AVMUTE */ - evergreen_hdmi_videoinfoframe(encoder, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0); + err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode); + if (err < 0) { + DRM_ERROR("failed to setup AVI infoframe: %zd\n", err); + return; + } + + err = hdmi_avi_infoframe_pack(&frame, buffer, sizeof(buffer)); + if (
[PATCH v3 7/9] drm/i915: Use generic HDMI infoframe helpers
From: Paulo Zanoni Use the generic HDMI infoframe helpers to get rid of the duplicate implementation in the i915 driver. This patch is based on the initial patch by Thierry Reding, but with a different approach. TODO: - The SDVO part is totally untested. I am not sure if the buffer size on the SDVO code must be a multiple of 4. - The HDMI part was tested only on SNB/CPT. - The patch is forcing pixel_repeat to 1 so I can properly test the patch. Remove this before the final version. - The correctnes of this patch depends on a fix on patch "video: add Generic HDMI infoframe helpers" Signed-off-by: Paulo Zanoni Signed-off-by: Thierry Reding --- drivers/gpu/drm/i915/intel_drv.h | 62 + drivers/gpu/drm/i915/intel_hdmi.c | 186 -- drivers/gpu/drm/i915/intel_sdvo.c | 21 ++--- 3 files changed, 112 insertions(+), 157 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 8a1bd4a..f7c237d 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -26,6 +26,7 @@ #define __INTEL_DRV_H__ #include +#include #include #include "i915_drv.h" #include @@ -276,63 +277,6 @@ struct cxsr_latency { #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) #define to_intel_plane(x) container_of(x, struct intel_plane, base) -#define DIP_HEADER_SIZE5 - -#define DIP_TYPE_AVI0x82 -#define DIP_VERSION_AVI 0x2 -#define DIP_LEN_AVI 13 -#define DIP_AVI_PR_10 -#define DIP_AVI_PR_21 - -#define DIP_TYPE_SPD 0x83 -#define DIP_VERSION_SPD0x1 -#define DIP_LEN_SPD25 -#define DIP_SPD_UNKNOWN0 -#define DIP_SPD_DSTB 0x1 -#define DIP_SPD_DVDP 0x2 -#define DIP_SPD_DVHS 0x3 -#define DIP_SPD_HDDVR 0x4 -#define DIP_SPD_DVC0x5 -#define DIP_SPD_DSC0x6 -#define DIP_SPD_VCD0x7 -#define DIP_SPD_GAME 0x8 -#define DIP_SPD_PC 0x9 -#define DIP_SPD_BD 0xa -#define DIP_SPD_SCD0xb - -struct dip_infoframe { - uint8_t type; /* HB0 */ - uint8_t ver;/* HB1 */ - uint8_t len;/* HB2 - body len, not including checksum */ - uint8_t ecc;/* Header ECC */ - uint8_t checksum; /* PB0 */ - union { - struct { - /* PB1 - Y 6:5, A 4:4, B 3:2, S 1:0 */ - uint8_t Y_A_B_S; - /* PB2 - C 7:6, M 5:4, R 3:0 */ - uint8_t C_M_R; - /* PB3 - ITC 7:7, EC 6:4, Q 3:2, SC 1:0 */ - uint8_t ITC_EC_Q_SC; - /* PB4 - VIC 6:0 */ - uint8_t VIC; - /* PB5 - YQ 7:6, CN 5:4, PR 3:0 */ - uint8_t YQ_CN_PR; - /* PB6 to PB13 */ - uint16_t top_bar_end; - uint16_t bottom_bar_start; - uint16_t left_bar_end; - uint16_t right_bar_start; - } __attribute__ ((packed)) avi; - struct { - uint8_t vn[8]; - uint8_t pd[16]; - uint8_t sdi; - } __attribute__ ((packed)) spd; - uint8_t payload[27]; - } __attribute__ ((packed)) body; -} __attribute__((packed)); - struct intel_hdmi { u32 sdvox_reg; int ddc_bus; @@ -341,7 +285,8 @@ struct intel_hdmi { bool has_audio; enum hdmi_force_audio force_audio; void (*write_infoframe)(struct drm_encoder *encoder, - struct dip_infoframe *frame); + uint8_t *frame, ssize_t len, + enum hdmi_infoframe_type type); void (*set_infoframes)(struct drm_encoder *encoder, struct drm_display_mode *adjusted_mode); }; @@ -433,7 +378,6 @@ extern struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder); extern bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); -extern void intel_dip_infoframe_csum(struct dip_infoframe *avi_if); extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob); extern void intel_dvo_init(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 2ee9821..b49df1b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -66,88 +67,75 @@ static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector) return enc_to_intel_hdmi(&intel_attached_encoder(connector)->base); } -void intel_dip_i
[PATCH v3 6/9] drm/tegra: Use generic HDMI infoframe helpers
Use the generic HDMI infoframe helpers to get rid of the NVIDIA Tegra reimplementation. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/hdmi.c | 226 -- drivers/gpu/drm/tegra/hdmi.h | 189 --- 3 files changed, 110 insertions(+), 306 deletions(-) diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig index 721483b..50d9c94 100644 --- a/drivers/gpu/drm/tegra/Kconfig +++ b/drivers/gpu/drm/tegra/Kconfig @@ -4,6 +4,7 @@ config DRM_TEGRA select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER + select DRM_HDMI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index e060c7e..0daee8e 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,8 @@ #include +#include + #include "hdmi.h" #include "drm.h" #include "dc.h" @@ -401,54 +404,65 @@ static int tegra_hdmi_setup_audio(struct tegra_hdmi *hdmi, unsigned int pclk) return 0; } -static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, - unsigned int offset, u8 type, - u8 version, void *data, size_t size) +static inline unsigned long tegra_hdmi_subpack(const u8 *ptr, size_t size) { - unsigned long value; - u8 *ptr = data; - u32 subpack[2]; + unsigned long value = 0; size_t i; - u8 csum; - /* first byte of data is the checksum */ - csum = type + version + size - 1; + for (i = size; i > 0; i--) + value = (value << 8) | ptr[i - 1]; - for (i = 1; i < size; i++) - csum += ptr[i]; + return value; +} - ptr[0] = 0x100 - csum; +static void tegra_hdmi_write_infopack(struct tegra_hdmi *hdmi, const void *data, + size_t size) +{ + const u8 *ptr = data; + unsigned long offset; + unsigned long value; + size_t i, j; - value = INFOFRAME_HEADER_TYPE(type) | - INFOFRAME_HEADER_VERSION(version) | - INFOFRAME_HEADER_LEN(size - 1); - tegra_hdmi_writel(hdmi, value, offset); + switch (ptr[0]) { + case HDMI_INFOFRAME_TYPE_AVI: + offset = HDMI_NV_PDISP_HDMI_AVI_INFOFRAME_HEADER; + break; - /* The audio inforame only has one set of subpack registers. The hdmi -* block pads the rest of the data as per the spec so we have to fixup -* the length before filling in the subpacks. -*/ - if (offset == HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER) - size = 6; + case HDMI_INFOFRAME_TYPE_AUDIO: + offset = HDMI_NV_PDISP_HDMI_AUDIO_INFOFRAME_HEADER; + break; - /* each subpack 7 bytes devided into: -* subpack_low - bytes 0 - 3 -* subpack_high - bytes 4 - 6 (with byte 7 padded to 0x00) -*/ - for (i = 0; i < size; i++) { - size_t index = i % 7; + case HDMI_INFOFRAME_TYPE_VENDOR: + offset = HDMI_NV_PDISP_HDMI_GENERIC_HEADER; + break; + + default: + dev_err(hdmi->dev, "unsupported infoframe type: %02x\n", + ptr[0]); + return; + } + + value = INFOFRAME_HEADER_TYPE(ptr[0]) | + INFOFRAME_HEADER_VERSION(ptr[1]) | + INFOFRAME_HEADER_LEN(ptr[2]); + tegra_hdmi_writel(hdmi, value, offset); + offset++; - if (index == 0) - memset(subpack, 0x0, sizeof(subpack)); + /* +* Each subpack contains 7 bytes, divided into: +* - subpack_low: bytes 0 - 3 +* - subpack_high: bytes 4 - 6 (with byte 7 padded to 0x00) +*/ + for (i = 3, j = 0; i < size; i += 7, j += 8) { + size_t rem = size - i, num = min_t(size_t, rem, 4); - ((u8 *)subpack)[index] = ptr[i]; + value = tegra_hdmi_subpack(&ptr[i], num); + tegra_hdmi_writel(hdmi, value, offset++); - if (index == 6 || (i + 1 == size)) { - unsigned int reg = offset + 1 + (i / 7) * 2; + num = min_t(size_t, rem - num, 3); - tegra_hdmi_writel(hdmi, subpack[0], reg); - tegra_hdmi_writel(hdmi, subpack[1], reg + 1); - } + value = tegra_hdmi_subpack(&ptr[i + 4], num); + tegra_hdmi_writel(hdmi, value, offset++); } } @@ -456,9 +470,8 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi, struct drm_display_mode *mode) {
[PATCH v3 5/9] drm: Add EDID helper documentation
Add a reference section about the EDID helper functions to the DRM documentation. Signed-off-by: Thierry Reding --- Documentation/DocBook/drm.tmpl | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 4ee2304..34249bb 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2111,6 +2111,10 @@ void intel_crt_init(struct drm_device *dev) !Iinclude/drm/drm_dp_helper.h !Edrivers/gpu/drm/drm_dp_helper.c + + EDID Helper Functions Reference +!Edrivers/gpu/drm/drm_edid.c + -- 1.8.1
[PATCH v3 4/9] drm: Add HDMI infoframe helpers
Add a generic helper to fill in an HDMI AVI infoframe with data extracted from a DRM display mode. Signed-off-by: Thierry Reding --- Changes in v2: - reuse CEA modes defined in drm_edid_modes.h - don't use pixel aspect ratio for picture aspect Changes in v3: - move implementation into drm_edid.[ch] drivers/gpu/drm/Kconfig| 1 + drivers/gpu/drm/drm_edid.c | 33 + include/drm/drm_edid.h | 6 ++ 3 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 983201b..92d2294 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -7,6 +7,7 @@ menuconfig DRM tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU + select HDMI select I2C select I2C_ALGOBIT select DMA_SHARED_BUFFER diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5a3770f..1cfafc0 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -29,6 +29,7 @@ */ #include #include +#include #include #include #include @@ -2098,3 +2099,35 @@ uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode) return 0; } EXPORT_SYMBOL(drm_mode_cea_vic); + +/** + * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with + * data from a DRM display mode + * @frame: HDMI AVI infoframe + * @mode: DRM display mode + * + * Returns 0 on success or a negative error code on failure. + */ +int +drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, +const struct drm_display_mode *mode) +{ + int err; + + if (!frame || !mode) + return -EINVAL; + + err = hdmi_avi_infoframe_init(frame); + if (err < 0) + return err; + + frame->video_code = drm_match_cea_mode(mode); + if (!frame->video_code) + return 0; + + frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE; + frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; + + return 0; +} +EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode); diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 0cac551..5da1b4a 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -247,6 +247,8 @@ struct edid { struct drm_encoder; struct drm_connector; struct drm_display_mode; +struct hdmi_avi_infoframe; + void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid); int drm_av_sync_delay(struct drm_connector *connector, struct drm_display_mode *mode); @@ -254,4 +256,8 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder, struct drm_display_mode *mode); int drm_load_edid_firmware(struct drm_connector *connector); +int +drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, +const struct drm_display_mode *mode); + #endif /* __DRM_EDID_H__ */ -- 1.8.1
[PATCH v3 3/9] video: Add generic HDMI infoframe helpers
Add generic helpers to pack HDMI infoframes into binary buffers. Signed-off-by: Thierry Reding --- Changes in v2: - add support for audio, vendor-specific and SPD infoframes - add various validity checks on infoframes - factor out checksum computation Changes in v3: - introduce HDMI_INFOFRAME_HEADER_SIZE - fix SPD infoframe SDI field offset drivers/video/Kconfig | 3 + drivers/video/Makefile | 1 + drivers/video/hdmi.c | 332 + include/linux/hdmi.h | 221 4 files changed, 557 insertions(+) create mode 100644 drivers/video/hdmi.c create mode 100644 include/linux/hdmi.h diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 807c7fa..baa3f90 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -54,6 +54,9 @@ config OF_VIDEOMODE help helper to get videomodes from the devicetree +config HDMI + bool + menuconfig FB tristate "Support for frame buffer devices" ---help--- diff --git a/drivers/video/Makefile b/drivers/video/Makefile index f592f3b..0b50082 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -5,6 +5,7 @@ # Each configuration option enables a list of files. obj-$(CONFIG_VGASTATE)+= vgastate.o +obj-$(CONFIG_HDMI)+= hdmi.o obj-y += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c new file mode 100644 index 000..a84e606 --- /dev/null +++ b/drivers/video/hdmi.c @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2012 Avionic Design GmbH + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +static void hdmi_infoframe_checksum(void *buffer, size_t size) +{ + u8 *ptr = buffer; + u8 csum = 0; + size_t i; + + /* compute checksum */ + for (i = 0; i < size; i++) + csum += ptr[i]; + + ptr[3] = 256 - csum; +} + +/** + * hdmi_avi_infoframe_init() - initialize an HDMI AVI infoframe + * @frame: HDMI AVI infoframe + * + * Returns 0 on success or a negative error code on failure. + */ +int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame) +{ + if (!frame) + return -EINVAL; + + memset(frame, 0, sizeof(*frame)); + + frame->type = HDMI_INFOFRAME_TYPE_AVI; + frame->version = 2; + frame->length = 13; + + return 0; +} +EXPORT_SYMBOL(hdmi_avi_infoframe_init); + +/** + * hdmi_avi_infoframe_pack() - write HDMI AVI infoframe to binary buffer + * @frame: HDMI AVI infoframe + * @buffer: destination buffer + * @size: size of buffer + * + * Packs the information contained in the @frame structure into a binary + * representation that can be written into the corresponding controller + * registers. Also computes the checksum as required by section 5.3.5 of + * the HDMI 1.4 specification. + * + * Returns the number of bytes packed into the binary buffer or a negative + * error code on failure. + */ +ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer, + size_t size) +{ + u8 *ptr = buffer; + size_t length; + + if (!frame || !buffer) + return -EINVAL; + + length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; + + if (size < length) + return -ENOSPC; + + memset(buffer, 0, length); + + ptr[0] = frame->type; + ptr[1] = frame->version; + ptr[2] = frame->length; + ptr[3] = 0; /* checksum */ + + /* start infoframe payload */ + ptr += HDMI_INFOFRAME_HEADER_SIZE; + + ptr[0] = ((frame->colorspace & 0x3) << 5) | (frame->scan_mode & 0x3); + + if (frame->active_info_valid) + ptr[0] |= BIT(4); + + if (frame->horizontal_bar_valid) + ptr[0] |= BIT(3); + + if (frame->vertical_bar_valid) + ptr[0] |= BIT(2); + + ptr[1] = ((frame->colorimetry & 0x3) << 6) | +((frame->picture_aspect & 0x3) << 4) | +(frame->active_aspect & 0xf); + + ptr[2] = ((frame->extended_colorimetry & 0x7) << 4) | +((frame->quantization_range & 0x3) << 2) | +(frame->nups & 0x3); + + if (frame->itc) + ptr[2] |= BIT(7); + + ptr[3] = frame->video_code & 0x7f; + + ptr[4] = ((frame->ycc_quantization_range & 0x3) << 6) | +((frame->content_type & 0x3) << 4) | +(frame->pixel_repeat & 0xf); + + ptr[5] = frame->top_bar & 0xff; + ptr[6] = (frame->top_bar >> 8) & 0xff; + ptr[7] = frame->bottom_bar & 0xff; + ptr[8] = (frame->bottom_bar >> 8) & 0xff; +
[PATCH v3 2/9] drm: Add some missing forward declarations
The drm_file and drm_clip_rect structures are used throughout the file but they are never declared nor pulled in through an include. Add forward declarations to make them available. Signed-off-by: Thierry Reding --- include/drm/drm_crtc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 00d78b5..dd62ca0 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -38,7 +38,8 @@ struct drm_device; struct drm_mode_set; struct drm_framebuffer; struct drm_object_properties; - +struct drm_file; +struct drm_clip_rect; #define DRM_MODE_OBJECT_CRTC 0x #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 -- 1.8.1
[PATCH v3 1/9] drm: Make drm_num_cea_modes unsigned
Since the variable's value is the size of an array, we can assume that it will never be negative. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_edid_modes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h index 5dbf7d2..d65d863 100644 --- a/drivers/gpu/drm/drm_edid_modes.h +++ b/drivers/gpu/drm/drm_edid_modes.h @@ -771,4 +771,4 @@ static const struct drm_display_mode edid_cea_modes[] = { 2492, 2640, 0, 1080, 1084, 1094, 1125, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, }; -static const int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); +static const unsigned int drm_num_cea_modes = ARRAY_SIZE(edid_cea_modes); -- 1.8.1
[PATCH v3 0/9] Add HDMI infoframe helpers
The first two patches are of a janitorial nature, the first converting the drm_num_cea_modes constant to unsigned and the second adding a few missing forward declarations in order to fix build issues. Patch 3 adds generic helpers to pack a structures that describe HDMI AVI, audio, vendor-specific or SPD infoframes into the binary format specified in the HDMI specification. The resulting binary buffer should be easily programmable into the HDMI controller. Patch 4 provides a helper to fill an HDMI AVI infoframe with data from a struct drm_display_mode. Patch 5 adds the DRM EDID helpers (including the new DRM HDMI helper from patch 4) to the DRM DocBook documentation. Patch 6, 7 and 8 move the Tegra, Intel and Radeon drivers over to the new helpers. Patch 7 was contributed by Intel's Paulo Zanoni. Finally, patch 9 removes the drm_mode_cea_vic() function which is a duplicate implementation of the older drm_match_cea_mode(). I haven't gotten around to converting the Exynos driver reimplementation because it isn't as trivial as the others. Nouveau also has some code to write infoframes and I'll see if I can convert those next. One item that I have on my TODO list is the ACR computations requested by Christian K?nig. My schedule has been really busy lately, so I'm not sure how long it will take until I get to it. I'd appreciate it if we could merge this series without the ACR implementation in order to get at least the numerous infoframe reimplementations cleaned up and to prevent others from getting in. Thierry Paulo Zanoni (1): drm/i915: Use generic HDMI infoframe helpers Thierry Reding (8): drm: Make drm_num_cea_modes unsigned drm: Add some missing forward declarations video: Add generic HDMI infoframe helpers drm: Add HDMI infoframe helpers drm: Add EDID helper documentation drm/tegra: Use generic HDMI infoframe helpers drm/radeon: Use generic HDMI infoframe helpers drm: Remove duplicate drm_mode_cea_vic() Documentation/DocBook/drm.tmpl | 4 + drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/drm_edid.c | 45 +++-- drivers/gpu/drm/drm_edid_modes.h| 2 +- drivers/gpu/drm/i915/intel_drv.h| 62 +- drivers/gpu/drm/i915/intel_hdmi.c | 186 +- drivers/gpu/drm/i915/intel_sdvo.c | 21 +- drivers/gpu/drm/radeon/evergreen_hdmi.c | 85 ++-- drivers/gpu/drm/radeon/r600_hdmi.c | 134 - drivers/gpu/drm/tegra/Kconfig | 1 + drivers/gpu/drm/tegra/hdmi.c| 226 +++--- drivers/gpu/drm/tegra/hdmi.h| 189 -- drivers/video/Kconfig | 3 + drivers/video/Makefile | 1 + drivers/video/hdmi.c| 332 include/drm/drm_crtc.h | 6 +- include/drm/drm_edid.h | 6 + include/linux/hdmi.h| 221 + 18 files changed, 883 insertions(+), 642 deletions(-) create mode 100644 drivers/video/hdmi.c create mode 100644 include/linux/hdmi.h -- 1.8.1
[PATCH] nouveau: add support for setting engine on nve0
On Fri, 2013-01-11 at 16:04 +0100, Maarten Lankhorst wrote: > When a specific engine is needed that's not GR, struct nve0_fifo should be > used, > and the engine member should be used to select the engine. > > This will fail on kernels before 3.8, since no support for such engines has > been added yet. This looks strikingly similar to the version of the patch I sent you ages back. Was there something you noticed wrong with that version? I do need to re-check some things with that patch and make sure it'll work properly on both 32/64-bit (hint: sizeof(struct nve0_fifo) is the same as nvc0_fifo on 64-bit, due to padding...), and maintain compat with pre-3.8 kernels. I'll try and sort this out before the end of tomorrow. Ben. > > Signed-off-by: Maarten Lankhorst > > --- > Can you review/test this libdrm patch? > > diff --git a/nouveau/abi16.c b/nouveau/abi16.c > index a67fbc1..f8b51c1 100644 > --- a/nouveau/abi16.c > +++ b/nouveau/abi16.c > @@ -70,6 +70,29 @@ abi16_chan_nvc0(struct nouveau_object *obj) > } > > int > +abi16_chan_nve0(struct nouveau_object *obj) > +{ > + struct nouveau_device *dev = (struct nouveau_device *)obj->parent; > + struct nve0_fifo *nve0 = obj->data; > + struct nvc0_fifo *nvc0 = &nve0->base; > + struct drm_nouveau_channel_alloc req = { ~0, nve0->engine }; > + int ret; > + > + ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, > + &req, sizeof(req)); > + if (ret) > + return ret; > + > + nvc0->base.channel = req.channel; > + nvc0->base.pushbuf = req.pushbuf_domains; > + nvc0->notify = req.notifier_handle; > + nvc0->base.object->handle = req.channel; > + nvc0->base.object->length = sizeof(*nve0); > + return 0; > +} > + > + > +int > abi16_engobj(struct nouveau_object *obj) > { > struct drm_nouveau_grobj_alloc req = { > diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c > index 940d933..24b4639 100644 > --- a/nouveau/nouveau.c > +++ b/nouveau/nouveau.c > @@ -246,8 +246,11 @@ nouveau_object_new(struct nouveau_object *parent, > uint64_t handle, > { > if (dev->chipset < 0xc0) > ret = abi16_chan_nv04(obj); > - else > + else if (dev->chipset < 0xe0 || > + length < sizeof(struct nve0_fifo)) > ret = abi16_chan_nvc0(obj); > + else > + ret = abi16_chan_nve0(obj); > } > break; > default: > diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h > index c42eea7..e088de5 100644 > --- a/nouveau/nouveau.h > +++ b/nouveau/nouveau.h > @@ -41,6 +41,19 @@ struct nvc0_fifo { > uint32_t notify; > }; > > +struct nve0_fifo { > + struct nvc0_fifo base; > + uint32_t engine; > + > +#define NVE0_CHANNEL_IND_ENGINE_GR > 0x0001 > +#define NVE0_CHANNEL_IND_ENGINE_VP > 0x0002 > +#define NVE0_CHANNEL_IND_ENGINE_PPP > 0x0004 > +#define NVE0_CHANNEL_IND_ENGINE_BSP > 0x0008 > +#define NVE0_CHANNEL_IND_ENGINE_CE0 > 0x0010 > +#define NVE0_CHANNEL_IND_ENGINE_CE1 > 0x0020 > +#define NVE0_CHANNEL_IND_ENGINE_ENC > 0x0040 > +}; > + > struct nv04_notify { > struct nouveau_object *object; > uint32_t offset; > diff --git a/nouveau/private.h b/nouveau/private.h > index b409cc8..8a5cb26 100644 > --- a/nouveau/private.h > +++ b/nouveau/private.h > @@ -113,6 +113,7 @@ nouveau_device_open_existing(struct nouveau_device **, > int, int, drm_context_t); > /* abi16.c */ > int abi16_chan_nv04(struct nouveau_object *); > int abi16_chan_nvc0(struct nouveau_object *); > +int abi16_chan_nve0(struct nouveau_object *); > int abi16_engobj(struct nouveau_object *); > int abi16_ntfy(struct nouveau_object *); > void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *); >
Fan control in nouveau driver with geforce 9600gt
Le 07/01/2013 17:25, Ozan ?a?layan a ?crit : >> We will be waiting a until one kernel is released before activating fan >> management by default. > So these fan stuff will be merged into 3.9? Yeah, quite likely :) I see no reasons for us not to. So far, all bugs have been fixed.
Regression: drm/radeon: brightness control hard system lockup
Dear Eldad, thanks a lot for the patch. Am Sonntag, den 13.01.2013, 22:00 +0100 schrieb Eldad Zack: [?] > From 5817128d2761f60051b069d2bb31209c909b6a04 Mon Sep 17 00:00:00 2001 > From: Eldad Zack > Date: Sun, 13 Jan 2013 21:14:08 +0100 > Subject: [PATCH] drm/radeon: fix evergreen brightness control regression > > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f please paste the commit summary into the commit message as remembering hashes is difficult. > introduced a > regression, where using ACPI brightness control leads to a > hard system lock-up. > To resolve the issue, this patch moves the GUI_ACTIVE test > earlier, as it was before the commit. Please also add a link to this discussion on the list to the commit message. > Signed-off-by: Eldad Zack > --- > drivers/gpu/drm/radeon/evergreen.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) [?] Thanks, Paul -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: This is a digitally signed message part URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/e3b87900/attachment.pgp>
[PATCH] drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try
This fixes up commit e8e89622ed361c46bf90ba4828e685a8b603f7e5 Author: Daniel Vetter Date: Tue Dec 18 22:25:11 2012 +0100 drm/ttm: fix fence locking in ttm_buffer_object_transfer which leaves behind a might_sleep in atomic context, since the fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix is to revert the above commit and only take the lock where we need it, around the call to ->sync_obj_ref. v2: Fixup things noticed by Maarten Lankhorst: - Brown paper bag locking bug. - No need for kzalloc if we clear the entire thing on the next line. - check for bo->sync_obj (totally unlikely race, but still someone else could have snuck in) and clear fbo->sync_obj if it's cleared already. Reported-by: Dave Airlie Cc: Jerome Glisse Cc: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ttm/ttm_bo_util.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index d73d6e3..544e407 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -422,7 +422,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_driver *driver = bdev->driver; - fbo = kzalloc(sizeof(*fbo), GFP_KERNEL); + fbo = kmalloc(sizeof(*fbo), GFP_KERNEL); if (!fbo) return -ENOMEM; @@ -441,7 +441,12 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, fbo->vm_node = NULL; atomic_set(&fbo->cpu_writers, 0); - fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); + spin_lock(&bdev->fence_lock); + if (bo->sync_obj) + fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); + else + fbo->sync_obj = NULL; + spin_unlock(&bdev->fence_lock); kref_init(&fbo->list_kref); kref_init(&fbo->kref); fbo->destroy = &ttm_transfered_destroy; @@ -654,13 +659,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, */ set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - - /* ttm_buffer_object_transfer accesses bo->sync_obj */ - ret = ttm_buffer_object_transfer(bo, &ghost_obj); spin_unlock(&bdev->fence_lock); if (tmp_obj) driver->sync_obj_unref(&tmp_obj); + ret = ttm_buffer_object_transfer(bo, &ghost_obj); if (ret) return ret; -- 1.7.10.4
[Bug 58033] [r300g] Black gap artifacts when playing WoW
https://bugs.freedesktop.org/show_bug.cgi?id=58033 --- Comment #7 from Tomasz P. --- Marek Olšák post some patches on mailing list that implementing separate depth-stencil clear. Maybe they will help. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 59322] r300g MSAA breaks Half-Life 2 in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=59322 --- Comment #6 from Stefan D?singer --- I'll have a look at this function and see which check we fail, but I have my doubts that it is Wine's fault. This code works fine on all other drivers - nvidia, fglrx, r600g, osx drivers. Also keep in mind that MSAA in Wine apps fails if Wine doesn't request the multisampling, but it is enabled with GALLIUM_MSAA=n. I don't see how this can possibly be a fault in Wine. -- 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/20130114/8a9573c1/attachment.html>
[Bug 58033] [r300g] Black gap artifacts when playing WoW
https://bugs.freedesktop.org/show_bug.cgi?id=58033 --- Comment #6 from Chris Rankin --- This bug is still present after Marek's latest r300g commits: HEAD is commit e3e1ffb2520498584ef402213d0c8aa4303a46a3 Author: Marek Olšák Date: Mon Jan 14 05:51:05 2013 +0100 r300g: set a dummy vertex buffer in context_create so that the driver doesn't crash if an app doesn't set any vertex buffers. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 59322] r300g MSAA breaks Half-Life 2 in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=59322 --- Comment #5 from Marek Ol??k --- I think this is an issue which should probably be fixed in Wine. There must be something wrong with the FBO setup. The Mesa function which marks the attachment(s) as incomplete is test_attachment_completeness. -- 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/20130114/f54242a8/attachment-0001.html>
[Bug 59089] [bisected, regression] flood of GPU fault detected in logs caused by 9af20... drm/radeon: fix fence locking in the pageflip callback
https://bugs.freedesktop.org/show_bug.cgi?id=59089 --- Comment #7 from Anthony Waters --- I would consider it a flood, the message continually appears until glxgears is exited. Can you confirm whether 3e163a137be7f9a80ec720903c4bda028de5681f in mesa stops all of the GPU faults? If it does I will open another bug report seeing as it may be different. -- 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/20130114/a88480cb/attachment.html>
[PATCH] drm/exynos: Replace mdelay with usleep_range
Replace the unnecessary atomic mdelay calls with usleep_range calls. Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_hdmi.c | 14 +++--- drivers/gpu/drm/exynos/exynos_mixer.c |2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index b2f8de9..4cf01f3 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1646,9 +1646,9 @@ static void hdmi_conf_reset(struct hdmi_context *hdata) /* resetting HDMI core */ hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); } static void hdmi_conf_init(struct hdmi_context *hdata) @@ -1773,7 +1773,7 @@ static void hdmi_v13_timing_apply(struct hdmi_context *hdata) u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); if (val & HDMI_PHY_STATUS_READY) break; - mdelay(1); + usleep_range(1000, 2000); } /* steady state not achieved */ if (tries == 0) { @@ -1940,7 +1940,7 @@ static void hdmi_v14_timing_apply(struct hdmi_context *hdata) u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0); if (val & HDMI_PHY_STATUS_READY) break; - mdelay(1); + usleep_range(1000, 2000); } /* steady state not achieved */ if (tries == 0) { @@ -1992,9 +1992,9 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata) /* reset hdmiphy */ hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT); - mdelay(10); + usleep_range(1, 12000); } static void hdmiphy_poweron(struct hdmi_context *hdata) @@ -2042,7 +2042,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) return; } - mdelay(10); + usleep_range(1, 12000); /* operation mode */ operation[0] = 0x1f; diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index e9dbf79..2be9833 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -600,7 +600,7 @@ static void vp_win_reset(struct mixer_context *ctx) /* waiting until VP_SRESET_PROCESSING is 0 */ if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING) break; - mdelay(10); + usleep_range(1, 12000); } WARN(tries == 0, "failed to reset Video Processor\n"); } -- 1.7.7.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
-next: no resume from suspend
On 01/14/2013 01:56 PM, Rafael J. Wysocki wrote: > On Monday, January 14, 2013 11:11:52 AM Jiri Slaby wrote: >> Hi, >> >> since friday's -next (the last known to be working is the last monday's) >> I cannot resume from suspend. The last thing I see with >> no_console_suspend is: >> i915: No ACPI video bus found >> >> But I used to see the message always, so this is no difference. Any idea >> before I start bisecting? > > Well, what's the next message you normally see with no_console_suspend? [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on minor 0 Adding DRM and intel guys. -- js suse labs
[PATCH] drm/exynos: Remove "internal" interrupt handling
Remove the "internal" interrupt handling since it's never invoked and remove "external" reference. This patch removes a bunch of dead code and clarifies how hotplugging is handled in the HDMI driver. Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_hdmi.c | 74 +++--- 1 files changed, 15 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 36e9214..b2f8de9 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -98,8 +98,7 @@ struct hdmi_context { void __iomem*regs; void*parent_ctx; - int external_irq; - int internal_irq; + int irq; struct i2c_client *ddc_port; struct i2c_client *hdmiphy_port; @@ -1656,7 +1655,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) { struct hdmi_infoframe infoframe; - /* disable HPD interrupts */ + /* disable HPD interrupts from HDMI IP block, use GPIO instead */ hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); @@ -2260,7 +2259,7 @@ static struct exynos_hdmi_ops hdmi_ops = { .dpms = hdmi_dpms, }; -static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) +static irqreturn_t hdmi_irq_thread(int irq, void *arg) { struct exynos_drm_hdmi_context *ctx = arg; struct hdmi_context *hdata = ctx->ctx; @@ -2275,31 +2274,6 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) return IRQ_HANDLED; } -static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) -{ - struct exynos_drm_hdmi_context *ctx = arg; - struct hdmi_context *hdata = ctx->ctx; - u32 intc_flag; - - intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); - /* clearing flags for HPD plug/unplug */ - if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) { - DRM_DEBUG_KMS("unplugged\n"); - hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_UNPLUG); - } - if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) { - DRM_DEBUG_KMS("plugged\n"); - hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, - HDMI_INTC_FLAG_HPD_PLUG); - } - - if (ctx->drm_dev) - drm_helper_hpd_irq_event(ctx->drm_dev); - - return IRQ_HANDLED; -} - static int __devinit hdmi_resources_init(struct hdmi_context *hdata) { struct device *dev = hdata->dev; @@ -2550,39 +2524,24 @@ static int __devinit hdmi_probe(struct platform_device *pdev) hdata->hdmiphy_port = hdmi_hdmiphy; - hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); - if (hdata->external_irq < 0) { - DRM_ERROR("failed to get GPIO external irq\n"); - ret = hdata->external_irq; - goto err_hdmiphy; - } - - hdata->internal_irq = platform_get_irq(pdev, 0); - if (hdata->internal_irq < 0) { - DRM_ERROR("failed to get platform internal irq\n"); - ret = hdata->internal_irq; + hdata->irq = gpio_to_irq(hdata->hpd_gpio); + if (hdata->irq < 0) { + DRM_ERROR("failed to get GPIO irq\n"); + ret = hdata->irq; goto err_hdmiphy; } hdata->hpd = gpio_get_value(hdata->hpd_gpio); - ret = request_threaded_irq(hdata->external_irq, NULL, - hdmi_external_irq_thread, IRQF_TRIGGER_RISING | + ret = request_threaded_irq(hdata->irq, NULL, + hdmi_irq_thread, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "hdmi_external", drm_hdmi_ctx); + "hdmi", drm_hdmi_ctx); if (ret) { - DRM_ERROR("failed to register hdmi external interrupt\n"); + DRM_ERROR("failed to register hdmi interrupt\n"); goto err_hdmiphy; } - ret = request_threaded_irq(hdata->internal_irq, NULL, - hdmi_internal_irq_thread, IRQF_ONESHOT, - "hdmi_internal", drm_hdmi_ctx); - if (ret) { - DRM_ERROR("failed to register hdmi internal interrupt\n"); - goto err_free_irq; - } - /* Attach HDMI Driver to common hdmi. */ exynos_hdmi_drv_attach(drm_hdmi_ctx); @@ -2594,7 +2553,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) return 0; err_free_irq: - free_irq(hdata->external_irq, drm_hdmi_ctx); + free_irq(hdata->irq, drm_hdmi_ctx); err_hdmiphy: i2c_del_driver(&hdmiphy_driver); err_ddc: @@ -2612,8 +2571,7 @@ static int __devex
[Bug 35861] [r300g] Oilrush: whiter triangle between center of the screen and horizon
https://bugs.freedesktop.org/show_bug.cgi?id=35861 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX -- 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/20130114/7698e84c/attachment.html>
[Bug 41668] Screen locks up at random points when using a 3D compositing wm (gnome-shell) on an rv515 (radeon mobility x1300)
https://bugs.freedesktop.org/show_bug.cgi?id=41668 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- 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/20130114/79c7b799/attachment.html>
[Bug 48382] weird rendering distortions on R200M
https://bugs.freedesktop.org/show_bug.cgi?id=48382 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- 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/20130114/dbcfd6ec/attachment.html>
[Bug 35998] RS600: Texture alignment issues under Gnome Shell
https://bugs.freedesktop.org/show_bug.cgi?id=35998 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- 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/20130114/2318b18c/attachment-0001.html>
[Bug 40495] r300 performance is slower on sleep resume
https://bugs.freedesktop.org/show_bug.cgi?id=40495 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- 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/20130114/573c37c5/attachment.html>
[Bug 56918] [R350] Black labels on MapsGL
https://bugs.freedesktop.org/show_bug.cgi?id=56918 Tomasz P. changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- 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/20130114/f3c8aab0/attachment.html>
[PATCH 3/3] drm/exynos: Add missing static specifiers in exynos_drm_rotator.c
Fixes the following warnings: drivers/gpu/drm/exynos/exynos_drm_rotator.c:737:24: warning: symbol 'rot_limit_tbl' was not declared. Should it be static? drivers/gpu/drm/exynos/exynos_drm_rotator.c:754:27: warning: symbol 'rotator_driver_ids' was not declared. Should it be static? Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_rotator.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index e9e83ef..f976e29 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -734,7 +734,7 @@ static int rotator_remove(struct platform_device *pdev) return 0; } -struct rot_limit_table rot_limit_tbl = { +static struct rot_limit_table rot_limit_tbl = { .ycbcr420_2p = { .min_w = 32, .min_h = 32, @@ -751,7 +751,7 @@ struct rot_limit_table rot_limit_tbl = { }, }; -struct platform_device_id rotator_driver_ids[] = { +static struct platform_device_id rotator_driver_ids[] = { { .name = "exynos-rot", .driver_data= (unsigned long)&rot_limit_tbl, -- 1.7.4.1
[PATCH 2/3] drm/exynos: Make ipp_handle_cmd_work static
Fixes the following warning: drivers/gpu/drm/exynos/exynos_drm_ipp.c:872:6: warning: symbol 'ipp_handle_cmd_work' was not declared. Should it be static? Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_ipp.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 0bda964..1a55635 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -869,7 +869,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, } } -void ipp_handle_cmd_work(struct device *dev, +static void ipp_handle_cmd_work(struct device *dev, struct exynos_drm_ippdrv *ippdrv, struct drm_exynos_ipp_cmd_work *cmd_work, struct drm_exynos_ipp_cmd_node *c_node) -- 1.7.4.1
[PATCH 1/3] drm/exynos: Make g2d_userptr_get_dma_addr static
Fixes the following warning: drivers/gpu/drm/exynos/exynos_drm_g2d.c:327:12: warning: symbol 'g2d_userptr_get_dma_addr' was not declared. Should it be static? Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_g2d.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 36c3905..9a4c08e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -324,7 +324,7 @@ out: g2d_userptr = NULL; } -dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, +static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, unsigned long userptr, unsigned long size, struct drm_file *filp, -- 1.7.4.1
[RFC PATCH 4/4] alsa/soc: add hdmi audio codec based on cdf
Thanks Sachin, On Mon, Jan 14, 2013 at 11:13 AM, Sachin Kamat wrote: > +CC: ALSA mailing list, Mark Brown > > On 13 January 2013 18:22, Rahul Sharma wrote: >> This patch registers hdmi-audio codec to the ALSA framework. This is the >> second >> client to the hdmi panel. Once notified by the CDF Core it proceeds towards >> audio setting and audio control. It also subscribes for hpd notification to >> implement hpd related audio requirements. >> >> Signed-off-by: Rahul Sharma >> --- >> sound/soc/codecs/Kconfig | 4 + >> sound/soc/codecs/Makefile| 2 + >> sound/soc/codecs/exynos_hdmi_audio.c | 307 >> +++ >> 3 files changed, 313 insertions(+) >> create mode 100644 sound/soc/codecs/exynos_hdmi_audio.c >> >> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig >> index b92759a..93f3f6b 100644 >> --- a/sound/soc/codecs/Kconfig >> +++ b/sound/soc/codecs/Kconfig >> @@ -496,3 +496,7 @@ config SND_SOC_ML26124 >> >> config SND_SOC_TPA6130A2 >> tristate >> + >> +config SND_SOC_EXYNOS_HDMI_AUDIO >> + tristate >> + default y > > Do you want to enable this by default? Shouldn't this be depending on > HDMI support? > Yes, it should depend on Exynos HDMI support. I will add it in v2. >> diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile >> index 9bd4d95..bfe93e6 100644 >> --- a/sound/soc/codecs/Makefile >> +++ b/sound/soc/codecs/Makefile >> @@ -112,6 +112,7 @@ snd-soc-wm9705-objs := wm9705.o >> snd-soc-wm9712-objs := wm9712.o >> snd-soc-wm9713-objs := wm9713.o >> snd-soc-wm-hubs-objs := wm_hubs.o >> +snd-soc-exynos-hdmi-audio-objs := exynos_hdmi_audio.o >> >> # Amp >> snd-soc-max9877-objs := max9877.o >> @@ -230,6 +231,7 @@ obj-$(CONFIG_SND_SOC_WM9705)+= snd-soc-wm9705.o >> obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o >> obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o >> obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o >> +obj-$(CONFIG_SND_SOC_EXYNOS_HDMI_AUDIO)+= >> snd-soc-exynos-hdmi-audio.o >> >> # Amp >> obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o >> diff --git a/sound/soc/codecs/exynos_hdmi_audio.c >> b/sound/soc/codecs/exynos_hdmi_audio.c >> new file mode 100644 >> index 000..50e8564 >> --- /dev/null >> +++ b/sound/soc/codecs/exynos_hdmi_audio.c >> @@ -0,0 +1,307 @@ >> +/* >> + * ALSA SoC codec driver for HDMI audio on Samsung Exynos processors. >> + * Copyright (C) 2012 Samsung corp. > > Copyright (c) 2012 (-13?) Samsung Electronics Co., Ltd. > I will correct this. > >> + * Author: Rahul Sharma >> + * >> + * This program is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU General Public License >> + * version 2 as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it will be useful, but >> + * WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * General Public License for more details. >> + * >> + */ >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#undef dev_info >> + >> +#define dev_info(dev, format, arg...) \ >> + dev_printk(KERN_CRIT, dev, format, ##arg) > > You may directly use dev_crit instead of dev_printk. > I will clean this in v2. >> + >> +static struct snd_soc_codec_driver hdmi_codec; >> + >> +/* platform device pointer for eynos hdmi audio device. */ >> +static struct platform_device *exynos_hdmi_audio_pdev; >> + >> +struct hdmi_audio_context { >> + struct platform_device *pdev; >> + atomic_tplugged; >> + struct display_entity_audio_params audio_params; >> + struct display_entity *entity; >> + struct display_entity_notifier notf; >> + struct display_event_subscriber subscriber; >> +}; >> + >> +static int exynos_hdmi_audio_hw_params(struct snd_pcm_substream *substream, >> + struct snd_pcm_hw_params *params, >> + struct snd_soc_dai *dai) >> +{ >> + struct snd_soc_codec *codec = dai->codec; >> + struct hdmi_audio_context *ctx = snd_soc_codec_get_drvdata(codec); >> + int ret; >> + >> + dev_info(codec->dev, "[%d] %s\n", __LINE__, __func__); > > How about making this a debug message as it does not convey anything useful? ok. > >> + >> + ctx->audio_params.type = DISPLAY_ENTITY_AUDIO_I2S; >> + >> + switch (params_channels(params)) { >> + case 6: >> + case 4: >> + case 2: >> + case 1: >> + ctx->audio_params.channels = params_channels(params); >> + break; >> + default: >> + dev_err(codec->dev, "%d channels not supported\n", >> + params_channels(params)); >> + return -EINVAL; >> + } >> + >> +
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #7 from Bryan Quigley --- Created attachment 73018 --> https://bugs.freedesktop.org/attachment.cgi?id=73018&action=edit tail -f output of Xorg, from starting big picture Syslog doesn't report anything when this happens, Xorg.0.log shows the following attachment (using tail -f). -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #6 from Bryan Quigley --- https://docs.google.com/file/d/0B9PdLrdrtm1wQVRma3JNdzFNa0k/edit Video of steam creating the issue, and then the issue disappearing (this doesn't usually happen) https://docs.google.com/file/d/0B9PdLrdrtm1wS2RyV2g1SmRSbnc/edit What usually happens to the rest of the desktop. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: improve semaphore debugging on lockup
On Fri, Jan 11, 2013 at 3:19 PM, wrote: > From: Jerome Glisse > > Signed-off-by: Jerome Glisse Added to my -fixes queue. Alex > --- > drivers/gpu/drm/radeon/radeon.h | 2 ++ > drivers/gpu/drm/radeon/radeon_ring.c | 2 ++ > drivers/gpu/drm/radeon/radeon_semaphore.c | 4 > 3 files changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h > index 9b9422c..f0bb8d5 100644 > --- a/drivers/gpu/drm/radeon/radeon.h > +++ b/drivers/gpu/drm/radeon/radeon.h > @@ -649,6 +649,8 @@ struct radeon_ring { > u32 ptr_reg_mask; > u32 nop; > u32 idx; > + u64 last_semaphore_signal_addr; > + u64 last_semaphore_wait_addr; > }; > > /* > diff --git a/drivers/gpu/drm/radeon/radeon_ring.c > b/drivers/gpu/drm/radeon/radeon_ring.c > index 141f2b6..2430d80 100644 > --- a/drivers/gpu/drm/radeon/radeon_ring.c > +++ b/drivers/gpu/drm/radeon/radeon_ring.c > @@ -784,6 +784,8 @@ static int radeon_debugfs_ring_info(struct seq_file *m, > void *data) > } > seq_printf(m, "driver's copy of the wptr: 0x%08x [%5d]\n", > ring->wptr, ring->wptr); > seq_printf(m, "driver's copy of the rptr: 0x%08x [%5d]\n", > ring->rptr, ring->rptr); > + seq_printf(m, "last semaphore signal addr : 0x%016llx\n", > ring->last_semaphore_signal_addr); > + seq_printf(m, "last semaphore wait addr : 0x%016llx\n", > ring->last_semaphore_wait_addr); > seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); > seq_printf(m, "%u dwords in ring\n", count); > /* print 8 dw before current rptr as often it's the last executed > diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c > b/drivers/gpu/drm/radeon/radeon_semaphore.c > index 97f3ece..8dcc20f 100644 > --- a/drivers/gpu/drm/radeon/radeon_semaphore.c > +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c > @@ -95,6 +95,10 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, > /* we assume caller has already allocated space on waiters ring */ > radeon_semaphore_emit_wait(rdev, waiter, semaphore); > > + /* for debugging lockup only, used by sysfs debug files */ > + rdev->ring[signaler].last_semaphore_signal_addr = semaphore->gpu_addr; > + rdev->ring[waiter].last_semaphore_wait_addr = semaphore->gpu_addr; > + > return 0; > } > > -- > 1.7.11.7 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC PATCH 4/4] alsa/soc: add hdmi audio codec based on cdf
+CC: ALSA mailing list, Mark Brown On 13 January 2013 18:22, Rahul Sharma wrote: > This patch registers hdmi-audio codec to the ALSA framework. This is the > second > client to the hdmi panel. Once notified by the CDF Core it proceeds towards > audio setting and audio control. It also subscribes for hpd notification to > implement hpd related audio requirements. > > Signed-off-by: Rahul Sharma > --- > sound/soc/codecs/Kconfig | 4 + > sound/soc/codecs/Makefile| 2 + > sound/soc/codecs/exynos_hdmi_audio.c | 307 > +++ > 3 files changed, 313 insertions(+) > create mode 100644 sound/soc/codecs/exynos_hdmi_audio.c > > diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig > index b92759a..93f3f6b 100644 > --- a/sound/soc/codecs/Kconfig > +++ b/sound/soc/codecs/Kconfig > @@ -496,3 +496,7 @@ config SND_SOC_ML26124 > > config SND_SOC_TPA6130A2 > tristate > + > +config SND_SOC_EXYNOS_HDMI_AUDIO > + tristate > + default y Do you want to enable this by default? Shouldn't this be depending on HDMI support? > diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile > index 9bd4d95..bfe93e6 100644 > --- a/sound/soc/codecs/Makefile > +++ b/sound/soc/codecs/Makefile > @@ -112,6 +112,7 @@ snd-soc-wm9705-objs := wm9705.o > snd-soc-wm9712-objs := wm9712.o > snd-soc-wm9713-objs := wm9713.o > snd-soc-wm-hubs-objs := wm_hubs.o > +snd-soc-exynos-hdmi-audio-objs := exynos_hdmi_audio.o > > # Amp > snd-soc-max9877-objs := max9877.o > @@ -230,6 +231,7 @@ obj-$(CONFIG_SND_SOC_WM9705)+= snd-soc-wm9705.o > obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o > obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o > obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o > +obj-$(CONFIG_SND_SOC_EXYNOS_HDMI_AUDIO)+= snd-soc-exynos-hdmi-audio.o > > # Amp > obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o > diff --git a/sound/soc/codecs/exynos_hdmi_audio.c > b/sound/soc/codecs/exynos_hdmi_audio.c > new file mode 100644 > index 000..50e8564 > --- /dev/null > +++ b/sound/soc/codecs/exynos_hdmi_audio.c > @@ -0,0 +1,307 @@ > +/* > + * ALSA SoC codec driver for HDMI audio on Samsung Exynos processors. > + * Copyright (C) 2012 Samsung corp. Copyright (c) 2012 (-13?) Samsung Electronics Co., Ltd. > + * Author: Rahul Sharma > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * version 2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * General Public License for more details. > + * > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#undef dev_info > + > +#define dev_info(dev, format, arg...) \ > + dev_printk(KERN_CRIT, dev, format, ##arg) You may directly use dev_crit instead of dev_printk. > + > +static struct snd_soc_codec_driver hdmi_codec; > + > +/* platform device pointer for eynos hdmi audio device. */ > +static struct platform_device *exynos_hdmi_audio_pdev; > + > +struct hdmi_audio_context { > + struct platform_device *pdev; > + atomic_tplugged; > + struct display_entity_audio_params audio_params; > + struct display_entity *entity; > + struct display_entity_notifier notf; > + struct display_event_subscriber subscriber; > +}; > + > +static int exynos_hdmi_audio_hw_params(struct snd_pcm_substream *substream, > + struct snd_pcm_hw_params *params, > + struct snd_soc_dai *dai) > +{ > + struct snd_soc_codec *codec = dai->codec; > + struct hdmi_audio_context *ctx = snd_soc_codec_get_drvdata(codec); > + int ret; > + > + dev_info(codec->dev, "[%d] %s\n", __LINE__, __func__); How about making this a debug message as it does not convey anything useful? > + > + ctx->audio_params.type = DISPLAY_ENTITY_AUDIO_I2S; > + > + switch (params_channels(params)) { > + case 6: > + case 4: > + case 2: > + case 1: > + ctx->audio_params.channels = params_channels(params); > + break; > + default: > + dev_err(codec->dev, "%d channels not supported\n", > + params_channels(params)); > + return -EINVAL; > + } > + > + switch (params_format(params)) { > + case SNDRV_PCM_FORMAT_S8: > + ctx->audio_params.bits_per_sample = 8; > + break; > + case SNDRV_PCM_FORMAT_S16_LE: > + ctx->audio_params.bits_per_sample = 12; > + break; > + case SNDRV_PCM_FORMAT_S24_LE: > + ctx->audi
[PATCH] drm/radeon: allow FP16 color clear registers on r500
On Fri, Jan 11, 2013 at 10:19 PM, Marek Ol??k wrote: > Probably not a candidate for stable kernels because of conflicts > in DRM versioning. > > Signed-off-by: Marek Ol??k Added to my -fixes queue. Thanks, Alex > --- > drivers/gpu/drm/radeon/radeon_drv.c |3 ++- > drivers/gpu/drm/radeon/reg_srcs/rv515 |2 ++ > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_drv.c > b/drivers/gpu/drm/radeon/radeon_drv.c > index dff6cf7..d9bf96e 100644 > --- a/drivers/gpu/drm/radeon/radeon_drv.c > +++ b/drivers/gpu/drm/radeon/radeon_drv.c > @@ -69,9 +69,10 @@ > * 2.26.0 - r600-eg: fix htile size computation > * 2.27.0 - r600-SI: Add CS ioctl support for async DMA > * 2.28.0 - r600-eg: Add MEM_WRITE packet support > + * 2.29.0 - R500 FP16 color clear registers > */ > #define KMS_DRIVER_MAJOR 2 > -#define KMS_DRIVER_MINOR 28 > +#define KMS_DRIVER_MINOR 29 > #define KMS_DRIVER_PATCHLEVEL 0 > int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); > int radeon_driver_unload_kms(struct drm_device *dev); > diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 > b/drivers/gpu/drm/radeon/reg_srcs/rv515 > index 911a8fb..78d5e99 100644 > --- a/drivers/gpu/drm/radeon/reg_srcs/rv515 > +++ b/drivers/gpu/drm/radeon/reg_srcs/rv515 > @@ -324,6 +324,8 @@ rv515 0x6d40 > 0x46AC US_OUT_FMT_2 > 0x46B0 US_OUT_FMT_3 > 0x46B4 US_W_FMT > +0x46C0 RB3D_COLOR_CLEAR_VALUE_AR > +0x46C4 RB3D_COLOR_CLEAR_VALUE_GB > 0x4BC0 FG_FOG_BLEND > 0x4BC4 FG_FOG_FACTOR > 0x4BC8 FG_FOG_COLOR_R > -- > 1.7.10.4 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try
Op 14-01-13 11:03, Daniel Vetter schreef: > This fixes up > > commit e8e89622ed361c46bf90ba4828e685a8b603f7e5 > Author: Daniel Vetter > Date: Tue Dec 18 22:25:11 2012 +0100 > > drm/ttm: fix fence locking in ttm_buffer_object_transfer > > which leaves behind a might_sleep in atomic context, since the > fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix > is to revert the above commit and only take the lock where we need it, > around the call to ->sync_obj_ref. > > Reported-by: Dave Airlie > Cc: Jerome Glisse > Cc: Maarten Lankhorst > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/ttm/ttm_bo_util.c |6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c > b/drivers/gpu/drm/ttm/ttm_bo_util.c > index d73d6e3..d4bb792 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -441,7 +441,9 @@ static int ttm_buffer_object_transfer(struct > ttm_buffer_object *bo, > fbo->vm_node = NULL; > atomic_set(&fbo->cpu_writers, 0); > > + spin_unlock(&bdev->fence_lock); > fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); > + spin_lock(&bdev->fence_lock); > kref_init(&fbo->list_kref); > kref_init(&fbo->kref); > fbo->destroy = &ttm_transfered_destroy; Methinks you messed up spin_lock and spin_unlock here. > @@ -654,13 +656,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object > *bo, >*/ > > set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); > - > - /* ttm_buffer_object_transfer accesses bo->sync_obj */ > - ret = ttm_buffer_object_transfer(bo, &ghost_obj); > spin_unlock(&bdev->fence_lock); > if (tmp_obj) > driver->sync_obj_unref(&tmp_obj); > > + ret = ttm_buffer_object_transfer(bo, &ghost_obj); > if (ret) > return ret; > ~Maarten
Regression: drm/radeon: brightness control hard system lockup
On Sun, Jan 13, 2013 at 4:00 PM, Eldad Zack wrote: > > On Mon, 7 Jan 2013, Alex Deucher wrote: >> On Mon, Jan 7, 2013 at 4:33 PM, Eldad Zack wrote: >> > >> > On Mon, 7 Jan 2013, Alex Deucher wrote: >> >> On Sun, Jan 6, 2013 at 7:59 AM, Eldad Zack >> >> wrote: >> >> > >> >> > Hi Alex, >> >> > >> >> > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f "drm/radeon: switch to a >> >> > finer grained reset for evergreen" introduced a hard system lockup to my >> >> > setup. I found it after bisecting, and confirmed it by reverting it on >> >> > the latest mainline ( 5f243b9 ). >> >> > >> >> > This: >> >> > >> >> >echo 7 > >> >> > /sys/devices/pci:00/:00:01.0/:01:00.0/backlight/acpi_video0/brightness >> >> > >> >> > Causes a hard lock-up hard, i.e. immediate freeze, without any logs. >> >> > >> >> > See lspci output and kernel .config below. >> >> > If there's any more info I can provide, please let me know. >> >> >> >> Do you normally see GPU resets when changing the backlight? Please >> >> attach your dmesg output when changing the backlight with the patch >> >> reverted. >> > >> > I see nothing. Just to make sure, I cleared the buffer, cycled through >> > 0-7 a couple of hunderd times (until the flicker annoyed), but I see no >> > messages at all. >> > Is there any debug config I should turn on? >> >> Can you try adding a printk() in evergreen_asic_reset() and see if it >> is somehow getting called when you change the brightness? When you >> use the apci backlight control, the radeon driver is not involved at >> all. They only way the driver would get involved is if the acpi >> backlight control somehow caused the GPU to hang and then the driver >> detected the hang and attempted to reset the GPU. I don't see any >> evidence of a GPU reset in your kernel log however. Note that the >> driver also registers native backlight contol. Does that work any >> better than acpi? > > The native backlight controls work very well. Thanks for that, I didn't > even noticed that. It has finer control over brightness too. > > I worked out a fix for the problem, but I think it's not a proper one. > What I noticed is that evergreen_gpu_soft_reset() is only ever called > once on my system, at boot. > Then I realized from the dmesg that neither > evergreen_gpu_soft_reset_dma() nor evergreen_gpu_soft_reset_gfx() actually > do anything. Both return on the first if statements there. > > So as far as I can tell, the difference your patch introduced is calling > evergreen_mc_stop() and evergreen_mc_resume(), which somehow puts my > system in some state that ACPI brightness control leads to a lock up. > > BTW, I don't see a GPU reset happening at all - I also tried suspend/resume > and starting an OpenGL application. Do you know how I can trigger it? > > To fix this, I moved the GUI_ACTIVE test before evergreen_mc_stop(), but > I think it just masks the issue. > Patch below (against latest HEAD) just in case. > Thanks for tracking this down. The attached patch should fix the issue properly. Alex > Cheers, > Eldad > > From 5817128d2761f60051b069d2bb31209c909b6a04 Mon Sep 17 00:00:00 2001 > From: Eldad Zack > Date: Sun, 13 Jan 2013 21:14:08 +0100 > Subject: [PATCH] drm/radeon: fix evergreen brightness control regression > > Commit 0ecebb9e0d14e9948e0b1529883a776758117d6f introduced a > regression, where using ACPI brightness control leads to a > hard system lock-up. > To resolve the issue, this patch moves the GUI_ACTIVE test > earlier, as it was before the commit. > > Signed-off-by: Eldad Zack > --- > drivers/gpu/drm/radeon/evergreen.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/evergreen.c > b/drivers/gpu/drm/radeon/evergreen.c > index 061fa0a..1392f99 100644 > --- a/drivers/gpu/drm/radeon/evergreen.c > +++ b/drivers/gpu/drm/radeon/evergreen.c > @@ -2310,9 +2310,6 @@ static void evergreen_gpu_soft_reset_gfx(struct > radeon_device *rdev) > { > u32 grbm_reset = 0; > > - if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) > - return; > - > dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n", > RREG32(GRBM_STATUS)); > dev_info(rdev->dev, " GRBM_STATUS_SE0 = 0x%08X\n", > @@ -2404,6 +2401,9 @@ static int evergreen_gpu_soft_reset(struct > radeon_device *rdev, u32 reset_mask) > if (reset_mask == 0) > return 0; > > + if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) > + return 0; > + > dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask); > > evergreen_mc_stop(rdev, &save); > -- > 1.7.12.4 > -- next part -- A non-text attachment was scrubbed... Name: 0001-drm-radeon-clear-reset-flags-if-engines-are-idle.patch Type: text/x-patch Size: 2821 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20130114/fbe39729/attachment-0001.bin>
[PATCH] Revert "drm: Add EDID_QUIRK_FORCE_REDUCED_BLANKING for ASUS VW222S"
This reverts commit 6f33814bd4d9cfe76033a31b1c0c76c960cd8e4b. The quirk cause a regression, and it looks like the original bug was simply a lack of FIFO bandwidth on the i915G of the reporter. Which should eventually be fixed as soon as we get around to implemented DSPARB FIFO reassignment on gen 3. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=52281 Cc: stable at vger.kernel.org Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_edid.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5a3770f..39919f2 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -87,9 +87,6 @@ static struct edid_quirk { int product_id; u32 quirks; } edid_quirk_list[] = { - /* ASUS VW222S */ - { "ACI", 0x22a2, EDID_QUIRK_FORCE_REDUCED_BLANKING }, - /* Acer AL1706 */ { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60 }, /* Acer F51 */ -- 1.7.10.4
[PATCH] nouveau: add support for setting engine on nve0
Hey, Op 14-01-13 06:25, Ben Skeggs schreef: > On Fri, 2013-01-11 at 16:04 +0100, Maarten Lankhorst wrote: >> When a specific engine is needed that's not GR, struct nve0_fifo should be >> used, >> and the engine member should be used to select the engine. >> >> This will fail on kernels before 3.8, since no support for such engines has >> been added yet. > This looks strikingly similar to the version of the patch I sent you > ages back. Was there something you noticed wrong with that version? I think you forgot to send that patch to me, I remember you sending me the mesa changes, but not the libdrm diff. :) > I do need to re-check some things with that patch and make sure it'll > work properly on both 32/64-bit (hint: sizeof(struct nve0_fifo) is the > same as nvc0_fifo on 64-bit, due to padding...), and maintain compat > with pre-3.8 kernels. This should not be the case with the patch I wrote. Since I encapsulate the original nvc0_fifo struct as base, the size should be different. > I'll try and sort this out before the end of tomorrow. > > Ben. > Sure, np. Just wanted to see if I could get the mesa changes in before 9.1 branching off. :) ~Maarten
[Bug 58659] With latest kernel 3.8-rc1, compiz crashes after boot
https://bugs.freedesktop.org/show_bug.cgi?id=58659 --- Comment #5 from Bryan Quigley --- IN 3.8-rc3 this crash no longer happens. However, there is a new graphical corruption when launching Steam's Big Picture. This corruption stays until logoff. It does not affect openbox/lxde, only compiz/unity which is why I thought it might be related to this bug or it's fix. It does not happen in 3.7. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try
This fixes up commit e8e89622ed361c46bf90ba4828e685a8b603f7e5 Author: Daniel Vetter Date: Tue Dec 18 22:25:11 2012 +0100 drm/ttm: fix fence locking in ttm_buffer_object_transfer which leaves behind a might_sleep in atomic context, since the fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix is to revert the above commit and only take the lock where we need it, around the call to ->sync_obj_ref. Reported-by: Dave Airlie Cc: Jerome Glisse Cc: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ttm/ttm_bo_util.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index d73d6e3..d4bb792 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -441,7 +441,9 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, fbo->vm_node = NULL; atomic_set(&fbo->cpu_writers, 0); + spin_unlock(&bdev->fence_lock); fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); + spin_lock(&bdev->fence_lock); kref_init(&fbo->list_kref); kref_init(&fbo->kref); fbo->destroy = &ttm_transfered_destroy; @@ -654,13 +656,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, */ set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - - /* ttm_buffer_object_transfer accesses bo->sync_obj */ - ret = ttm_buffer_object_transfer(bo, &ghost_obj); spin_unlock(&bdev->fence_lock); if (tmp_obj) driver->sync_obj_unref(&tmp_obj); + ret = ttm_buffer_object_transfer(bo, &ghost_obj); if (ret) return ret; -- 1.7.10.4
[Bug 59322] r300g MSAA breaks Half-Life 2 in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=59322 --- Comment #7 from Marek Olšák --- Yes, the GALLIUM_MSAA environment variable might break some apps, because it changes the default framebufer to MSAA, which adds lots of limitations to BlitFramebuffer. For example, you can no longer use BlitFramebuffer to do a stretched blit, because the ARB_fbo specification doesn't allow it if either src or dst is multisample, etc. That's why GALLIUM_MSAA should be used carefully. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 59322] r300g MSAA breaks Half-Life 2 in Wine
https://bugs.freedesktop.org/show_bug.cgi?id=59322 --- Comment #4 from Stefan D?singer --- Created attachment 72999 --> https://bugs.freedesktop.org/attachment.cgi?id=72999&action=edit Screenshot It looks just like a dump from /dev/random, but here you go :-) I noticed that the driver seems to reject the multisampled framebuffer during draws, clears and blits: err:d3d_draw:drawStridedFast >>>>>>>>>>>>>>>>> GL_INVALID_FRAMEBUFFER_OPERATION (0x506) from glDrawElementsBaseVertex @ ../../../wine-git/dlls/wined3d/drawprim.c / 63 fixme:d3d:context_check_fbo_status FBO status GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (0x8cd6) fixme:d3d:context_check_fbo_status Location SFLAG_INRB_MULTISAMPLE (0x20). fixme:d3d:context_check_fbo_status Color attachment 0: (0x186090) WINED3DFMT_B8G8R8A8_UNORM 800x600 2 samples. fixme:d3d:context_check_fbo_status Depth attachment: (0x186210) WINED3DFMT_D24_UNORM_S8_UINT 800x600 2 samples. The problem affects other applications as well, including 3DMark2000(which does not support multisampling itself) when run with GALLIUM_MSAA=2. -- 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/20130114/0fe7e16e/attachment.html>
[Bug 27407] The new MESA degrades performance on RS690M and x1270 graphs chip.
https://bugs.freedesktop.org/show_bug.cgi?id=27407 --- Comment #12 from dE --- That ATI chip got burnt out, and nobody else's complaining. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 37262] Extreme IO using libre/openoffice
https://bugs.freedesktop.org/show_bug.cgi?id=37262 dE changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #5 from dE --- Looks like no one uses R690 (x1270) anymore. And mine is dead. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel