[Bug 24097] screen backlight off after resume-from-suspend when using ATI KMS
https://bugs.freedesktop.org/show_bug.cgi?id=24097 stek...@sedata.org changed: What|Removed |Added CC||stek...@sedata.org --- Comment #13 from stek...@sedata.org 2012-05-04 00:49:55 PDT --- (In reply to comment #12) > Is this still an issue? If so, what is blocking its progress? It is still an issue for me at least. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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
Re: [PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
On 03.05.2012 19:44, j.gli...@gmail.com wrote: From: Jerome Glisse We need to sync with the GFX ring as ttm might have schedule bo move on it and new command scheduled for other ring need to wait for bo data to be in place. Signed-off-by: Jerome Glisse Reviewed-by: Christian König --- drivers/gpu/drm/radeon/radeon_cs.c | 12 ++-- include/drm/radeon_drm.h |1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 82f2e7b0..e5f8e17 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -122,15 +122,15 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p) int i, r; for (i = 0; i< p->nrelocs; i++) { + struct radeon_fence *fence; + if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj) continue; - if (!(p->relocs[i].flags& RADEON_RELOC_DONT_SYNC)) { - struct radeon_fence *fence = p->relocs[i].robj->tbo.sync_obj; - if (fence->ring != p->ring&& !radeon_fence_signaled(fence)) { - sync_to_ring[fence->ring] = true; - need_sync = true; - } + fence = p->relocs[i].robj->tbo.sync_obj; + if (fence->ring != p->ring&& !radeon_fence_signaled(fence)) { + sync_to_ring[fence->ring] = true; + need_sync = true; } } diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 7c491b4..5805686 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h @@ -926,7 +926,6 @@ struct drm_radeon_cs_chunk { }; /* drm_radeon_cs_reloc.flags */ -#define RADEON_RELOC_DONT_SYNC 0x01 struct drm_radeon_cs_reloc { uint32_thandle; ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Bart Verwilst changed: What|Removed |Added CC||b...@verwilst.be --- Comment #15 from Bart Verwilst 2012-05-04 08:10:21 --- I can reproduce the lockups easily by switching from my 2 monitors in default mode to dual screen mode. Lockups start happening right away. Worked flawlessy with Ubuntu 11.10's kernel/radeon driver. If there's anything i can do to help debug this? -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
>> >> From: Jerome Glisse >> >> We need to sync with the GFX ring as ttm might have schedule bo move >> on it and new command scheduled for other ring need to wait for bo >> data to be in place. >> Is this required for -fixes? if so it doesn't apply clean. Dave. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
On 04.05.2012 10:42, Dave Airlie wrote: From: Jerome Glisse We need to sync with the GFX ring as ttm might have schedule bo move on it and new command scheduled for other ring need to wait for bo data to be in place. Is this required for -fixes? if so it doesn't apply clean. Nope, only drm-next, since there isn't any public available client that makes use of it. Christian. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Linux 3.4-rc4
>> >> FWIW, for me EDID failure on new kernels is 100% reproducible, and there >> are no such checksum errors in the log. It's just missing. >> >> > Just a crazy thought, but didn't we change some timings related to >> > EDID retrieval? To make it faster. >> >> OK, this time bisecting started off relatively smoothly (doing the same >> "backwards" bisect on the branch-o-reverts as last time), but then my >> disk died halfway through... > [...] > > OK, system is back online and I finished the bisection. The commit that > broke it for me is the following, and reverting it on top of 3.3.4 + the > "make VGA work at all" patch fixes this particular issue for me. > Can you test with the attached patch? its a revert mostly of Ben's patch, and he says with the i2c core change stuff is working for him again. Dave. 0001-drm-nouveau-i2c-resume-use-of-i2c-algo-bit-rather-th.patch Description: Binary data ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2] libdrm: add exynos drm support
this patch adds libdrm_exynos helper layer that inclues some intefaces for exynos specific gem and virtual display driver and also adds exynos module name to modtest and vbltest. Changelog v2: - fixed exynos broken ioctl. the pointer of uint64_t *edid should be removed. - removed unnecessary definitions. - added drm prime interfaces. this feature is used to share a buffer between drivers or memory managers and for this, please, refer to below links: http://www.mjmwired.net/kernel/Documentation/dma-buf-sharing.txt http://lwn.net/Articles/488664/ this patch is based on a link below: git://anongit.freedesktop.org/mesa/drm commit id: d72a44c7c4f5eea9c1e5bb0c36cb9e0224b9ca22 Reviewed-by: Rob Clark Reviewed-by: Alex Deucher Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- Makefile.am|6 +- configure.ac | 13 ++ exynos/Makefile.am | 22 +++ exynos/exynos_drm.c| 396 exynos/exynos_drm.h| 149 + exynos/exynos_drmif.h | 88 ++ exynos/libdrm_exynos.pc| 11 ++ exynos/libdrm_exynos.pc.in | 11 ++ tests/modetest/modetest.c |2 +- tests/vbltest/vbltest.c|2 +- 10 files changed, 697 insertions(+), 3 deletions(-) create mode 100644 exynos/Makefile.am create mode 100644 exynos/exynos_drm.c create mode 100644 exynos/exynos_drm.h create mode 100644 exynos/exynos_drmif.h create mode 100644 exynos/libdrm_exynos.pc create mode 100644 exynos/libdrm_exynos.pc.in diff --git a/Makefile.am b/Makefile.am index 4f625a1..256a8cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,11 @@ if HAVE_OMAP OMAP_SUBDIR = omap endif -SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) tests include +if HAVE_EXYNOS +EXYNOS_SUBDIR = exynos +endif + +SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) tests include libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir) diff --git a/configure.ac b/configure.ac index 6a1d98e..f832201 100644 --- a/configure.ac +++ b/configure.ac @@ -88,6 +88,11 @@ AC_ARG_ENABLE(omap-experimental-api, [Enable support for OMAP's experimental API (default: disabled)]), [OMAP=$enableval], [OMAP=no]) +AC_ARG_ENABLE(exynos-experimental-api, + AS_HELP_STRING([--enable-exynos-experimental-api], + [Enable support for EXYNOS's experimental API (default: disabled)]), + [EXYNOS=$enableval], [EXYNOS=no]) + dnl === dnl check compiler flags AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ @@ -191,6 +196,11 @@ if test "x$OMAP" = xyes; then AC_DEFINE(HAVE_OMAP, 1, [Have OMAP support]) fi +AM_CONDITIONAL(HAVE_EXYNOS, [test "x$EXYNOS" = xyes]) +if test "x$EXYNOS" = xyes; then + AC_DEFINE(HAVE_EXYNOS, 1, [Have EXYNOS support]) +fi + PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) if test "x$HAVE_CAIRO" = xyes; then AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support]) @@ -313,6 +323,8 @@ AC_CONFIG_FILES([ nouveau/libdrm_nouveau.pc omap/Makefile omap/libdrm_omap.pc + exynos/Makefile + exynos/libdrm_exynos.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile @@ -333,4 +345,5 @@ echo " vmwgfx API $VMWGFX" echo " Radeon API $RADEON" echo " Nouveau API$NOUVEAU" echo " OMAP API $OMAP" +echo " EXYNOS API $EXYNOS" echo "" diff --git a/exynos/Makefile.am b/exynos/Makefile.am new file mode 100644 index 000..e782d34 --- /dev/null +++ b/exynos/Makefile.am @@ -0,0 +1,22 @@ +AM_CFLAGS = \ + $(WARN_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/exynos \ + $(PTHREADSTUBS_CFLAGS) \ + -I$(top_srcdir)/include/drm + +libdrm_exynos_la_LTLIBRARIES = libdrm_exynos.la +libdrm_exynos_ladir = $(libdir) +libdrm_exynos_la_LDFLAGS = -version-number 1:0:0 -no-undefined +libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ + +libdrm_exynos_la_SOURCES = exynos_drm.c + +libdrm_exynoscommonincludedir = ${includedir}/exynos +libdrm_exynoscommoninclude_HEADERS = exynos_drm.h + +libdrm_exynosincludedir = ${includedir}/libdrm +libdrm_exynosinclude_HEADERS = exynos_drmif.h + +pkgconfigdir = @pkgconfigdir@ +pkgconfig_DATA = libdrm_exynos.pc diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c new file mode 100644 index 000..4db755e --- /dev/null +++ b/exynos/exynos_drm.c @@ -0,0 +1,396 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, d
[git pull] updated exynos-drm-next
Hi Dave, Please pull from git://git.infradead.org/users/kmpark/linux-samsung exynos-drm-next this is based on git repository below: git://people.freedesktop.org/~airlied/linux.git drm-next commit-id: 5db578e167cfeedbd086df45cc2328b5bb9cf3fd this patch set had already been posted two week ago for review and among them one patch, userptr feature, is excluded from this time because of the issue you pointed out for now. for this, you can refer to below link: http://www.spinics.net/lists/dri-devel/msg21850.html and for Rotator and FIMC driver, RFC for them are in progress so we will post them with updated codes again in the near future. for these, you can refer to below link: http://www.spinics.net/lists/dri-devel/msg22002.html http://lwn.net/Articles/494974/ please let me know if there is any problem. Thanks, Inki Dae Inki Dae (6): drm/exynos: fixed duplicatd memory allocation bug. drm/exynos: fixed exynos_drm_gem_map_pages bug. drm/exynos: added missed vm area region mapping type. drm/exynos: added cache attribute support for gem. drm/exynos: added drm prime feature. drm/exynos: added a feature to get gem buffer information. Joonyoung Shim (6): drm/exynos: cleanup for hdmi platform data drm/exynos: use platform_get_irq_byname for hdmi drm/exynos: use threaded irq for hdmi hotplug drm/exynos: add dpms for hdmi drm/exynos: add PM functions for hdmi and mixer drm/exynos: add G2D driver Seung-Woo Kim (5): drm/exynos: fixed wrong pageflip finish event for interlace mode drm/exynos: enable dvi mode for dvi monitor drm/exynos: add additional display mode for hdmi drm/exynos: added source size to overlay structure drm/exynos: added vp scaling feature for hdmi drivers/gpu/drm/exynos/Kconfig | 12 + drivers/gpu/drm/exynos/Makefile|2 + drivers/gpu/drm/exynos/exynos_drm_buf.c| 12 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c |4 + drivers/gpu/drm/exynos/exynos_drm_crtc.h |4 + drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 272 drivers/gpu/drm/exynos/exynos_drm_dmabuf.h | 39 ++ drivers/gpu/drm/exynos/exynos_drm_drv.c| 41 ++- drivers/gpu/drm/exynos/exynos_drm_drv.h| 17 + drivers/gpu/drm/exynos/exynos_drm_g2d.c| 932 drivers/gpu/drm/exynos/exynos_drm_g2d.h| 36 ++ drivers/gpu/drm/exynos/exynos_drm_gem.c| 119 +++-- drivers/gpu/drm/exynos/exynos_drm_gem.h| 12 + drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 77 ++- drivers/gpu/drm/exynos/exynos_drm_hdmi.h |6 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 10 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 429 - drivers/gpu/drm/exynos/exynos_mixer.c | 401 ++-- drivers/gpu/drm/exynos/regs-hdmi.h |6 +- include/drm/exynos_drm.h | 99 +++- 20 files changed, 2066 insertions(+), 464 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.h -- 1.7.4.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 24097] screen backlight off after resume-from-suspend when using ATI KMS
https://bugs.freedesktop.org/show_bug.cgi?id=24097 Alex Deucher changed: What|Removed |Added Status|NEW |RESOLVED Resolution||DUPLICATE --- Comment #14 from Alex Deucher 2012-05-04 05:48:46 PDT --- *** This bug has been marked as a duplicate of bug 23103 *** -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 23103] screen not lighting up on resume when using kms
https://bugs.freedesktop.org/show_bug.cgi?id=23103 Alex Deucher changed: What|Removed |Added CC||br...@canonical.com --- Comment #73 from Alex Deucher 2012-05-04 05:48:46 PDT --- *** Bug 24097 has been marked as a duplicate of this bug. *** -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Alex Deucher changed: What|Removed |Added CC||alexdeuc...@gmail.com --- Comment #16 from Alex Deucher 2012-05-04 12:50:55 --- (In reply to comment #15) > I can reproduce the lockups easily by switching from my 2 monitors in default > mode to dual screen mode. Lockups start happening right away. Worked flawlessy > with Ubuntu 11.10's kernel/radeon driver. If there's anything i can do to help > debug this? Can you track down the problematic component (kernel, ddx, mesa, etc.) and bisect? -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #17 from Bart Verwilst 2012-05-04 13:04:11 --- I managed to finally switch to dual screen mode without hangs. But while using the desktop, i have frequent hangs -> black screen -> restore loops. Using kernel 3.4.0-rc4 provided by the launchpad bugreport in comment #14. If you can give me some pointers, i'll do my best to get some more info! -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #18 from Michel Dänzer 2012-05-04 13:08:18 --- (In reply to comment #15) > I can reproduce the lockups easily by switching from my 2 monitors in default > mode to dual screen mode. Lockups start happening right away. Note that this bug report isn't about lockups per se but about the inability to recover from a lockup. You should probably look for another bug report about monitor switching causing lockups, or file your own. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 49484] New: invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 Bug #: 49484 Summary: invalid enum 0x500, invalid value 0x501 Classification: Unclassified Product: Mesa Version: 8.0 Platform: x86-64 (AMD64) OS/Version: Linux (All) Status: NEW Severity: enhancement Priority: medium Component: Drivers/DRI/R600 AssignedTo: dri-devel@lists.freedesktop.org ReportedBy: hramr...@gmail.com running D3D application in wine I get lots of err:d3d_surface:surface_allocate_surface > GL_INVALID_VALUE (0x501) from glTexImage2D @ surface.c / 2566 err:d3d_surface:surface_upload_data > GL_INVALID_ENUM (0x500) from glTexSubImage2D @ surface.c / 2349 Needless to say I get pretty much nothing visible. OpenGL renderer string: Gallium 0.4 on AMD REDWOOD OpenGL version string: 2.1 Mesa 8.0.2 Maybe wine is using a format/feature without checking it is available here. However, r600 could implement it I guess. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 Alex Deucher changed: What|Removed |Added Component|Drivers/DRI/R600|Drivers/Gallium/r600 -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 1/2] ttm: add prime sharing support to TTM
From: Dave Airlie This adds the ability for ttm common code to take an SG table and use it as the backing for a slave TTM object. The drivers can then populate their GTT tables using the SG object. Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/nouveau_bo.c |2 +- drivers/gpu/drm/radeon/radeon_object.c |2 +- drivers/gpu/drm/ttm/ttm_bo.c | 14 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |2 +- include/drm/ttm/ttm_bo_api.h |9 - include/drm/ttm/ttm_bo_driver.h |2 ++ 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 7d15a77..f8aa501 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -121,7 +121,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, ttm_bo_type_device, &nvbo->placement, - align >> PAGE_SHIFT, 0, false, NULL, acc_size, + align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, nouveau_bo_del_ttm); if (ret) { /* ttm will call nouveau_bo_del_ttm if it fails.. */ diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index df6a4db..1affbc9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -155,7 +155,7 @@ retry: mutex_lock(&rdev->vram_mutex); r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, &bo->placement, page_align, 0, !kernel, NULL, - acc_size, &radeon_ttm_bo_destroy); + acc_size, NULL, &radeon_ttm_bo_destroy); mutex_unlock(&rdev->vram_mutex); if (unlikely(r != 0)) { if (r != -ERESTARTSYS) { diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 1f5c67c..289e27b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -343,6 +343,16 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) if (unlikely(bo->ttm == NULL)) ret = -ENOMEM; break; + case ttm_bo_type_sg: + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT, + page_flags | TTM_PAGE_FLAG_SG, + glob->dummy_read_page); + if (unlikely(bo->ttm == NULL)) { + ret = -ENOMEM; + break; + } + bo->ttm->sg = bo->sg; + break; default: pr_err("Illegal buffer object type\n"); ret = -EINVAL; @@ -1169,6 +1179,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, bool interruptible, struct file *persistent_swap_storage, size_t acc_size, + struct sg_table *sg, void (*destroy) (struct ttm_buffer_object *)) { int ret = 0; @@ -1223,6 +1234,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, bo->seq_valid = false; bo->persistent_swap_storage = persistent_swap_storage; bo->acc_size = acc_size; + bo->sg = sg; atomic_inc(&bo->glob->bo_count); ret = ttm_bo_check_placement(bo, placement); @@ -1312,7 +1324,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev, ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, buffer_start, interruptible, - persistent_swap_storage, acc_size, NULL); + persistent_swap_storage, acc_size, NULL, NULL); if (likely(ret == 0)) *p_bo = bo; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index a37abb5..22bf9a2 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -1567,7 +1567,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, ret = ttm_bo_init(bdev, &vmw_bo->base, size, ttm_bo_type_device, placement, 0, 0, interruptible, - NULL, acc_size, bo_free); + NULL, acc_size, NULL, bo_free); return ret; } diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 974c8f8..e15f2a8 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -124,11 +124,15 @@ struct ttm_mem_reg { * * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, * but they cannot be accessed from user-space. For kernel-only use. + * + * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another
[PATCH 2/2] nouveau: add PRIME support
From: Dave Airlie This adds prime->fd and fd->prime support to nouveau, it passes the SG object to TTM, and then populates the GART entries using it. Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/Makefile |2 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 39 +++-- drivers/gpu/drm/nouveau/nouveau_channel.c |2 +- drivers/gpu/drm/nouveau/nouveau_drv.c |8 ++- drivers/gpu/drm/nouveau/nouveau_drv.h | 10 ++- drivers/gpu/drm/nouveau/nouveau_fence.c |2 +- drivers/gpu/drm/nouveau/nouveau_gem.c |6 +- drivers/gpu/drm/nouveau/nouveau_mem.c |2 +- drivers/gpu/drm/nouveau/nouveau_prime.c | 132 + drivers/gpu/drm/nouveau/nouveau_sgdma.c |5 +- drivers/gpu/drm/nouveau/nouveau_vm.c | 57 drivers/gpu/drm/nouveau/nouveau_vm.h |6 +- drivers/gpu/drm/nouveau/nv04_crtc.c |2 +- drivers/gpu/drm/nouveau/nv50_crtc.c |4 +- drivers/gpu/drm/nouveau/nv50_evo.c|4 +- drivers/gpu/drm/nouveau/nvd0_display.c|6 +- 16 files changed, 262 insertions(+), 25 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nouveau_prime.c diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 1a2ad7e..01f1335 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile @@ -37,7 +37,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ nv50_calc.o \ nv04_pm.o nv40_pm.o nv50_pm.o nva3_pm.o nvc0_pm.o \ nv50_vram.o nvc0_vram.o \ -nv50_vm.o nvc0_vm.o +nv50_vm.o nvc0_vm.o nouveau_prime.o nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG) += nouveau_debugfs.o nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index f8aa501..4daf1dd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -89,12 +89,17 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags, int nouveau_bo_new(struct drm_device *dev, int size, int align, uint32_t flags, uint32_t tile_mode, uint32_t tile_flags, + struct sg_table *sg, struct nouveau_bo **pnvbo) { struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_bo *nvbo; size_t acc_size; int ret; + int type = ttm_bo_type_device; + + if (sg) + type = ttm_bo_type_sg; nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); if (!nvbo) @@ -120,8 +125,8 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, sizeof(struct nouveau_bo)); ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, - ttm_bo_type_device, &nvbo->placement, - align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, + type, &nvbo->placement, + align >> PAGE_SHIFT, 0, false, NULL, acc_size, sg, nouveau_bo_del_ttm); if (ret) { /* ttm will call nouveau_bo_del_ttm if it fails.. */ @@ -817,9 +822,14 @@ nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) } else if (new_mem && new_mem->mem_type == TTM_PL_TT && nvbo->page_shift == vma->vm->spg_shift) { - nouveau_vm_map_sg(vma, 0, new_mem-> - num_pages << PAGE_SHIFT, - new_mem->mm_node); + if (((struct nouveau_mem *)new_mem->mm_node)->sg) + nouveau_vm_map_sg_table(vma, 0, new_mem-> + num_pages << PAGE_SHIFT, + new_mem->mm_node); + else + nouveau_vm_map_sg(vma, 0, new_mem-> + num_pages << PAGE_SHIFT, + new_mem->mm_node); } else { nouveau_vm_unmap(vma); } @@ -1058,10 +1068,16 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) struct drm_device *dev; unsigned i; int r; + bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG); if (ttm->state != tt_unpopulated) return 0; + if (slave && ttm->sg) { + ttm->state = tt_unbound; + return 0; + } + dev_priv = nouveau_bdev(ttm->bdev); dev = dev_priv->dev; @@ -1106,6 +1122,10 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) struct drm_nouveau_private *dev_priv; struct drm_device *dev; unsigned i; + bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG); + + if (s
[PATCH] i915: add dmabuf/prime buffer sharing support.
From: Dave Airlie This adds handle->fd and fd->handle support to i915, this is to allow for offloading of rendering in one direction and outputs in the other. Signed-off-by: Dave Airlie --- drivers/gpu/drm/i915/Makefile |3 +- drivers/gpu/drm/i915/i915_drv.c|8 ++- drivers/gpu/drm/i915/i915_drv.h| 11 +++ drivers/gpu/drm/i915/i915_gem.c| 11 ++- drivers/gpu/drm/i915/i915_gem_dmabuf.c | 149 drivers/gpu/drm/i915/i915_gem_gtt.c| 18 +++- 6 files changed, 193 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_dmabuf.c diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index ce7fc77..72d1293 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -34,7 +34,8 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ dvo_ch7017.o \ dvo_ivch.o \ dvo_tfp410.o \ - dvo_sil164.o + dvo_sil164.o \ + i915_gem_dmabuf.o i915-$(CONFIG_COMPAT) += i915_ioc32.o diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index ae8a64f..30b0132 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -901,7 +901,7 @@ static struct drm_driver driver = { */ .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ - DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM, + DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME, .load = i915_driver_load, .unload = i915_driver_unload, .open = i915_driver_open, @@ -924,6 +924,12 @@ static struct drm_driver driver = { .gem_init_object = i915_gem_init_object, .gem_free_object = i915_gem_free_object, .gem_vm_ops = &i915_gem_vm_ops, + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_export = i915_gem_prime_export, + .gem_prime_import = i915_gem_prime_import, + .dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_mmap_gtt, .dumb_destroy = i915_gem_dumb_destroy, diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 5fabc6c..a42b1c5 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -890,6 +890,8 @@ struct drm_i915_gem_object { struct scatterlist *sg_list; int num_sg; + /* prime dma-buf support */ + struct sg_table *sg_table; /** * Used for performing relocations during execbuffer insertion. */ @@ -1205,6 +1207,8 @@ int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj); void i915_gem_release_mmap(struct drm_i915_gem_object *obj); void i915_gem_lastclose(struct drm_device *dev); +int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, + gfp_t gfpmask); int __must_check i915_mutex_lock_interruptible(struct drm_device *dev); int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj); void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, @@ -1301,6 +1305,13 @@ i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev, int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, enum i915_cache_level cache_level); +struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, + struct dma_buf *dma_buf); + +struct dma_buf *i915_gem_prime_export(struct drm_device *dev, + struct drm_gem_object *gem_obj, int flags); + + /* i915_gem_gtt.c */ int __must_check i915_gem_init_aliasing_ppgtt(struct drm_device *dev); void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0d1e4b7..06ca09b 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -35,6 +35,7 @@ #include #include #include +#include static __must_check int i915_gem_object_flush_gpu_write_domain(struct drm_i915_gem_object *obj); static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj); @@ -1374,8 +1375,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, return i915_gem_mmap_gtt(file, dev, args->handle, &args->offset); } - -static int +int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, gfp_t gfpmask) { @@ -1384,6 +1384,8 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, struct inode *inode; struct page *page; + if (obj->pages || obj->sg_table) + return 0; /* Get the list of pages out of our struct file. They'll be pinned * at this point until we release them. */ @@ -1425,6 +1427,8 @@
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #19 from Jérôme Glisse 2012-05-04 14:21:53 --- Please one persone one bug report we will mark appropriate bug as duplicate. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[git pull] drm fixes
Some minor fixes from Intel and a radeon fix. I have the nouveau fix for the i2c regression queued for next week, its mostly a revert and seems to work on the system it was originally introduced for thanks to some i2c core changes. Dave. The following changes since commit addde4ec31456c5f1e9b61aae3edcfeb0f338f87: nouveau: initialise has_optimus variable. (2012-05-03 09:30:58 +0100) are available in the git repository at: git://people.freedesktop.org/~airlied/linux drm-fixes Alex Deucher (1): drm/radeon: clarify and extend wb setup on APUs and NI+ asics Chris Wilson (2): drm/i915: Do not read non-existent DPLL registers on PCH hardware drm/i915: Only enable IPS polling for gen5 Dave Airlie (1): Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes Marc Gariepy (1): fixing dmi match for hp t5745 and hp st5747 thin client Paulo Zanoni (1): drm/i915: enable dip before writing data on gen4 drivers/gpu/drm/i915/i915_debugfs.c|3 +++ drivers/gpu/drm/i915/i915_dma.c| 15 ++- drivers/gpu/drm/i915/intel_display.c |9 + drivers/gpu/drm/i915/intel_hdmi.c |2 +- drivers/gpu/drm/i915/intel_lvds.c |4 ++-- drivers/gpu/drm/radeon/radeon_device.c |4 ++-- 6 files changed, 23 insertions(+), 14 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This should fix : https://bugzilla.redhat.com/show_bug.cgi?id=726143 Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 4fbc590..5fd0490 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable HDP on eDP or LVDS help to avoid +* issue such as: +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] ttm: add prime sharing support to TTM
On Fri, May 04, 2012 at 02:46:54PM +0100, Dave Airlie wrote: > From: Dave Airlie > > This adds the ability for ttm common code to take an SG table > and use it as the backing for a slave TTM object. I took a look at both patches from the perspective of the TTM DMA pool code and it looks fine (thought I would prefer to test this first - but I don't have the hardware). What I am curious is that you are allowing to map two or more of SG pages to different PCI devices. And for that you are using the nouveau_gem_map_dma_buf, which does this (roughly) ttm->sg = sg_alloc_table(). for_each_sg() sg->dma_address[i] = dma_map(..) So I am seeing two potential issues: 1). ttm->sg = sg_alloc() is called on every new other device. In other words, if you end up with three of these attachment PCI devices you are going to cause an memory leak of the sg_alloc() and over-write the ttm->sg every time. But I might be misreading how the import code works. 2). You are going to put in sg->dma_address() in of different PCI devices. Meaning - the dma address might have a different value depending on whether there is an different IOMMU for each of the devices. On x86 that is usually not the case (the odd ball being the IBM high-end boxes that have an Calgary-X IOMMU for PCI buses). What this means is that the DMA address you are programming in the sub-sequent PCI devices might the DMA address for a previous PCI device. But both of these issues are only a problem if the slave cards have a different PCI device. If they are the same - then I think you are OK (except the multiple calls to import which would cause a memory leak). > > The drivers can then populate their GTT tables using the SG object. > > Signed-off-by: Dave Airlie > --- > drivers/gpu/drm/nouveau/nouveau_bo.c |2 +- > drivers/gpu/drm/radeon/radeon_object.c |2 +- > drivers/gpu/drm/ttm/ttm_bo.c | 14 +- > drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |2 +- > include/drm/ttm/ttm_bo_api.h |9 - > include/drm/ttm/ttm_bo_driver.h |2 ++ > 6 files changed, 26 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c > b/drivers/gpu/drm/nouveau/nouveau_bo.c > index 7d15a77..f8aa501 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -121,7 +121,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int > align, > > ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, > ttm_bo_type_device, &nvbo->placement, > - align >> PAGE_SHIFT, 0, false, NULL, acc_size, > + align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, > nouveau_bo_del_ttm); > if (ret) { > /* ttm will call nouveau_bo_del_ttm if it fails.. */ > diff --git a/drivers/gpu/drm/radeon/radeon_object.c > b/drivers/gpu/drm/radeon/radeon_object.c > index df6a4db..1affbc9 100644 > --- a/drivers/gpu/drm/radeon/radeon_object.c > +++ b/drivers/gpu/drm/radeon/radeon_object.c > @@ -155,7 +155,7 @@ retry: > mutex_lock(&rdev->vram_mutex); > r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, > &bo->placement, page_align, 0, !kernel, NULL, > - acc_size, &radeon_ttm_bo_destroy); > + acc_size, NULL, &radeon_ttm_bo_destroy); > mutex_unlock(&rdev->vram_mutex); > if (unlikely(r != 0)) { > if (r != -ERESTARTSYS) { > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index 1f5c67c..289e27b 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -343,6 +343,16 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, > bool zero_alloc) > if (unlikely(bo->ttm == NULL)) > ret = -ENOMEM; > break; > + case ttm_bo_type_sg: > + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << > PAGE_SHIFT, > + page_flags | > TTM_PAGE_FLAG_SG, > + glob->dummy_read_page); > + if (unlikely(bo->ttm == NULL)) { > + ret = -ENOMEM; > + break; > + } > + bo->ttm->sg = bo->sg; > + break; > default: > pr_err("Illegal buffer object type\n"); > ret = -EINVAL; > @@ -1169,6 +1179,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, > bool interruptible, > struct file *persistent_swap_storage, > size_t acc_size, > + struct sg_table *sg, > void (*destroy) (struct ttm_buffer_object *)) > { > int ret = 0; > @@ -1223,6 +1234,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, > bo->seq_valid = false; > bo->per
Re: [PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
On Fre, 2012-05-04 at 10:28 -0400, j.gli...@gmail.com wrote: > From: Jerome Glisse > > It seems imac pannel doesn't like whe we change the hot plug setup > and then refuse to work. This should fix : > https://bugzilla.redhat.com/show_bug.cgi?id=726143 > > Signed-off-by: Matthew Garrett > Signed-off-by: Jerome Glisse [...] > + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || > + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { > + /* don't try to enable HDP on eDP or LVDS help to avoid I think this should say 'HPD', not 'HDP'. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] ttm: add prime sharing support to TTM
On Fri, May 4, 2012 at 3:33 PM, Konrad Rzeszutek Wilk wrote: > On Fri, May 04, 2012 at 02:46:54PM +0100, Dave Airlie wrote: >> From: Dave Airlie >> >> This adds the ability for ttm common code to take an SG table >> and use it as the backing for a slave TTM object. > > I took a look at both patches from the perspective of the TTM DMA pool > code and it looks fine (thought I would prefer to test this first - but > I don't have the hardware). > > What I am curious is that you are allowing to map two or more > of SG pages to different PCI devices. And for that you are using > the nouveau_gem_map_dma_buf, which does this (roughly) > > ttm->sg = sg_alloc_table(). > for_each_sg() > sg->dma_address[i] = dma_map(..) > > So I am seeing two potential issues: > 1). ttm->sg = sg_alloc() is called on every new other device. > In other words, if you end up with three of these attachment PCI devices > you are going to cause an memory leak of the sg_alloc() and over-write > the ttm->sg every time. But I might be misreading how the import code > works. I think you are mixing up the export and import sides. The export side takes a TTM object, and create an sg table mapped into the importers address space. The import side takes an exported sg_table and wraps an object around it. So for multiple importers, there are multiple sg_tables. For one import there should only be one sg_table per object. > 2). You are going to put in sg->dma_address() in of different PCI devices. > Meaning - the dma address might have a different value depending on > whether there is an different IOMMU for each of the devices. > On x86 that is usually not the case (the odd ball being the IBM high-end > boxes that have an Calgary-X IOMMU for PCI buses). > What this means is that the DMA address you are programming in > the sub-sequent PCI devices might the DMA address for a previous PCI > device. > > But both of these issues are only a problem if the slave cards have > a different PCI device. If they are the same - then I think you are OK > (except the multiple calls to import which would cause a memory leak). Yeah we need to stop a slave calling map_dma_buf multiple times, but we block that by keeping a list of currently imported buffer handles. Dave. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
On Fri, May 4, 2012 at 10:44 AM, Michel Dänzer wrote: > On Fre, 2012-05-04 at 10:28 -0400, j.gli...@gmail.com wrote: >> From: Jerome Glisse >> >> It seems imac pannel doesn't like whe we change the hot plug setup >> and then refuse to work. This should fix : >> https://bugzilla.redhat.com/show_bug.cgi?id=726143 >> >> Signed-off-by: Matthew Garrett >> Signed-off-by: Jerome Glisse > [...] >> + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || >> + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { >> + /* don't try to enable HDP on eDP or LVDS help to avoid > > I think this should say 'HPD', not 'HDP'. It should :) v2 on its way > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Debian, X and DRI developer ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector v2
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This help but doesn't fully fix: https://bugzilla.redhat.com/show_bug.cgi?id=726143 v2: fix typo and improve commit message Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 694b6b2..a304c9d 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable hpd on eDP or LVDS avoid breaking the +* aux dp channel on imac and help (but not completely fix) +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.9.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector v2
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This help but doesn't fully fix: https://bugzilla.redhat.com/show_bug.cgi?id=726143 v2: fix typo and improve commit message Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 694b6b2..a304c9d 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable hpd on eDP or LVDS avoid breaking the +* aux dp channel on imac and help (but not completely fix) +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.9.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: eliminate redundant connector_names table
connector_names table is just a repeat of information that already exists in drm_connector_enum_list and the same string can be retrieved using drm_get_connector_name function. Nuke the redundant table and use the proper function to retrieve the connector name. Signed-off-by: Ilija Hadzic --- drivers/gpu/drm/radeon/radeon_display.c | 20 +--- 1 files changed, 1 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8086c96..60aecc5 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -572,24 +572,6 @@ static const char *encoder_names[36] = { "TRAVIS", }; -static const char *connector_names[15] = { - "Unknown", - "VGA", - "DVI-I", - "DVI-D", - "DVI-A", - "Composite", - "S-video", - "LVDS", - "Component", - "DIN", - "DisplayPort", - "HDMI-A", - "HDMI-B", - "TV", - "eDP", -}; - static const char *hpd_names[6] = { "HPD1", "HPD2", @@ -612,7 +594,7 @@ static void radeon_print_display_setup(struct drm_device *dev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { radeon_connector = to_radeon_connector(connector); DRM_INFO("Connector %d:\n", i); - DRM_INFO(" %s\n", connector_names[connector->connector_type]); + DRM_INFO(" %s\n", drm_get_connector_name(connector)); if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) DRM_INFO(" %s\n", hpd_names[radeon_connector->hpd.hpd]); if (radeon_connector->ddc_bus) { -- 1.7.8.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 --- Comment #1 from Michal Suchanek 2012-05-04 09:22:37 PDT --- Does not work with recent git either. Perhaps more useful is this part of the log: fixme:d3d:debug_d3dformat Unrecognized 0x34324644 (as fourcc: DF24) WINED3DFORMAT! fixme:d3d:wined3d_get_format Can't find format unrecognized (0x34324644) in the format lookup table -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Alexandre Demers changed: What|Removed |Added CC||alexandre.f.dem...@gmail.co ||m --- Comment #20 from Alexandre Demers 2012-05-04 17:27:14 --- As a side note, it could be related to Bug 45018. For me, it all started at the same time. Since, it happens a lot less with latest drm, ddx, mesa, kernel and X server, but it still happens from time to time randomly. As I was saying it may be related, or not, but since everything happened at the same time as Bug 45018 and using a 3.2 kernel fixes most of what I see, I think there is a similar root to all this. I can usually reproduce the lockup followed by a stucked X by playing a movie (this is the easiest way I've been able to do it or with what I reported in bug 45018). It often locks up after nearly 40 minutes of video. In a few seconds, image skips, turns greenish on some parts, and BAM! Locks up, resets and hangs with X unable to come back on its feet. Lately, in some occasions, it was able to get in X, but everything related to 3D is then dead. I may have missed it, but which video card/chipset is Maciej using? Radeon 6950 over here. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 --- Comment #2 from Ian Romanick 2012-05-04 11:21:17 PDT --- Can you: - Run wine (and your app) in GDB. - Set a breakpoint at _mesa_warning. - Provide the output of 'bt full' -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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
Re: [Intel-gfx] [RFC] Reduce idle vblank wakeups
Anyone have any further thoughts on this? -- Matthew Garrett | mj...@srcf.ucam.org ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC] fence, sa allocator, ib pool, semaphore rework
First chunk rework fence to use uin64_t, unlike previous patch, we only emit the lower 32 bits with the hw. The upper 32bits is handled in the fence process function where a lenghty comment discuss all the possible things that can go wrong and why it doesn't matter. Then taking advantage of faster fence querying, the sa allocator is simplified and improved. The commit message describe the algorithm used. Taking advantage of that ib & semaphore is simplified to use the same temporary ring related manager. To finish all this, more code is axed and simplified. It all need the previous 17 patches and the various other small fixes. To make it easier i regrouped all the patch needed at : http://people.freedesktop.org/~glisse/reset5/base/ Those patch should hit next soon. The whole patchset can also be found at : http://people.freedesktop.org/~glisse/reset5/ It all got limited testing so far, but i tried hard to make sure that each step is working and thus bisectable. I split the fence rework in 2 part so one can bisect if either the move to 64bits fence or the complete change in fence handling logic is causing trouble. Cheers, Jerome ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 01/18] drm/radeon: replace the per ring mutex with a global one
From: Christian König A single global mutex for ring submissions seems sufficient. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h |3 +- drivers/gpu/drm/radeon/radeon_device.c|3 +- drivers/gpu/drm/radeon/radeon_pm.c| 10 +- drivers/gpu/drm/radeon/radeon_ring.c | 28 +++--- drivers/gpu/drm/radeon/radeon_semaphore.c | 42 + 5 files changed, 41 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 729d332..71d8af8 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -667,7 +667,6 @@ struct radeon_ring { uint64_tgpu_addr; uint32_talign_mask; uint32_tptr_mask; - struct mutexmutex; boolready; u32 ptr_reg_shift; u32 ptr_reg_mask; @@ -806,6 +805,7 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsign int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); +void radeon_ring_undo(struct radeon_ring *ring); void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring *ring); @@ -1516,6 +1516,7 @@ struct radeon_device { rwlock_tfence_lock; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; struct radeon_semaphore_driver semaphore_drv; + struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; struct radeon_ib_pool ib_pool; struct radeon_irq irq; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 93615d1..ad3a7fb 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -724,8 +724,7 @@ int radeon_device_init(struct radeon_device *rdev, * can recall function without having locking issues */ radeon_mutex_init(&rdev->cs_mutex); radeon_mutex_init(&rdev->ib_pool.mutex); - for (i = 0; i < RADEON_NUM_RINGS; ++i) - mutex_init(&rdev->ring[i].mutex); + mutex_init(&rdev->ring_lock); mutex_init(&rdev->dc_hw_i2c_mutex); if (rdev->family >= CHIP_R600) spin_lock_init(&rdev->ih.lock); diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index caa55d6..7c38745 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -252,10 +252,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) mutex_lock(&rdev->ddev->struct_mutex); mutex_lock(&rdev->vram_mutex); - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - if (rdev->ring[i].ring_obj) - mutex_lock(&rdev->ring[i].mutex); - } + mutex_lock(&rdev->ring_lock); /* gui idle int has issues on older chips it seems */ if (rdev->family >= CHIP_R600) { @@ -311,10 +308,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - if (rdev->ring[i].ring_obj) - mutex_unlock(&rdev->ring[i].mutex); - } + mutex_unlock(&rdev->ring_lock); mutex_unlock(&rdev->vram_mutex); mutex_unlock(&rdev->ddev->struct_mutex); } diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 2eb4c6e..a4d60ae 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -346,9 +346,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi if (ndw < ring->ring_free_dw) { break; } - mutex_unlock(&ring->mutex); + mutex_unlock(&rdev->ring_lock); r = radeon_fence_wait_next(rdev, radeon_ring_index(rdev, ring)); - mutex_lock(&ring->mutex); + mutex_lock(&rdev->ring_lock); if (r) return r; } @@ -361,10 +361,10 @@ int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *ring, unsig { int r; - mutex_lock(&ring->mutex); + mutex_lock(&rdev->ring_lock); r = radeon_ring_alloc(rdev, ring, ndw); if (r) { - mutex_unlock(&ring->mutex); + mutex_unlock(&rdev->ring_l
[PATCH 02/18] drm/radeon: convert fence to uint64_t v3
From: Jerome Glisse This convert fence to use uint64_t sequence number intention is to use the fact that uin64_t is big enough that we don't need to care about wrap around. Tested with and without writeback using 0xF000 as initial fence sequence and thus allowing to test the wrap around from 32bits to 64bits. v2: Add comment about possible race btw CPU & GPU, add comment stressing that we need 2 dword aligned for R600_WB_EVENT_OFFSET Read fence sequenc in reverse order of GPU write them so we mitigate the race btw CPU and GPU. v3: Drop the need for ring to emit the 64bits fence, and just have each ring emit the lower 32bits of the fence sequence. We handle the wrap over 32bits in fence_process. Signed-off-by: Jerome Glisse Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h | 39 ++- drivers/gpu/drm/radeon/radeon_fence.c | 116 +++-- drivers/gpu/drm/radeon/radeon_ring.c |9 ++- 3 files changed, 107 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 71d8af8..4d9c433 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -100,28 +100,32 @@ extern int radeon_lockup_timeout; * Copy from radeon_drv.h so we don't have to include both and have conflicting * symbol; */ -#define RADEON_MAX_USEC_TIMEOUT10 /* 100 ms */ -#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) +#define RADEON_MAX_USEC_TIMEOUT10 /* 100 ms */ +#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) /* RADEON_IB_POOL_SIZE must be a power of 2 */ -#define RADEON_IB_POOL_SIZE16 -#define RADEON_DEBUGFS_MAX_COMPONENTS 32 -#define RADEONFB_CONN_LIMIT4 -#define RADEON_BIOS_NUM_SCRATCH8 +#define RADEON_IB_POOL_SIZE16 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32 +#define RADEONFB_CONN_LIMIT4 +#define RADEON_BIOS_NUM_SCRATCH8 /* max number of rings */ -#define RADEON_NUM_RINGS 3 +#define RADEON_NUM_RINGS 3 + +/* fence seq are set to this number when signaled */ +#define RADEON_FENCE_SIGNALED_SEQ 0LL +#define RADEON_FENCE_NOTEMITED_SEQ (~0LL) /* internal ring indices */ /* r1xx+ has gfx CP ring */ -#define RADEON_RING_TYPE_GFX_INDEX 0 +#define RADEON_RING_TYPE_GFX_INDEX 0 /* cayman has 2 compute CP rings */ -#define CAYMAN_RING_TYPE_CP1_INDEX 1 -#define CAYMAN_RING_TYPE_CP2_INDEX 2 +#define CAYMAN_RING_TYPE_CP1_INDEX 1 +#define CAYMAN_RING_TYPE_CP2_INDEX 2 /* hardcode those limit for now */ -#define RADEON_VA_RESERVED_SIZE(8 << 20) -#define RADEON_IB_VM_MAX_SIZE (64 << 10) +#define RADEON_VA_RESERVED_SIZE(8 << 20) +#define RADEON_IB_VM_MAX_SIZE (64 << 10) /* * Errata workarounds. @@ -254,8 +258,9 @@ struct radeon_fence_driver { uint32_tscratch_reg; uint64_tgpu_addr; volatile uint32_t *cpu_addr; - atomic_tseq; - uint32_tlast_seq; + /* seq is protected by ring emission lock */ + uint64_tseq; + atomic64_t last_seq; unsigned long last_activity; wait_queue_head_t queue; struct list_heademitted; @@ -268,11 +273,9 @@ struct radeon_fence { struct kref kref; struct list_headlist; /* protected by radeon_fence.lock */ - uint32_tseq; - boolemitted; - boolsignaled; + uint64_tseq; /* RB, DMA, etc. */ - int ring; + unsignedring; struct radeon_semaphore *semaphore; }; diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 5bb78bf..0d3d226 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -66,14 +66,14 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) unsigned long irq_flags; write_lock_irqsave(&rdev->fence_lock, irq_flags); - if (fence->emitted) { + if (fence->seq && fence->seq < RADEON_FENCE_NOTEMITED_SEQ) { write_unlock_irqrestore(&rdev->fence_lock, irq_flags); return 0; } - fence->seq = atomic_add_return(1, &rdev->fence_drv[fence->ring].seq); + /* we are protected by the ring emission mutex */ + fence->seq = rdev->fence_drv[fence->ring].seq++; radeon_fence_ring_emit(rdev, fence->ring,
[PATCH 03/18] drm/radeon: rework fence handling, drop fence list v5
From: Jerome Glisse Using 64bits fence sequence we can directly compare sequence number to know if a fence is signaled or not. Thus the fence list became useless, so does the fence lock that mainly protected the fence list. Things like ring.ready are no longer behind a lock, this should be ok as ring.ready is initialized once and will only change when facing lockup. Worst case is that we return an -EBUSY just after a successfull GPU reset, or we go into wait state instead of returning -EBUSY (thus delaying reporting -EBUSY to fence wait caller). v2: Remove left over comment, force using writeback on cayman and newer, thus not having to suffer from possibly scratch reg exhaustion v3: Rebase on top of change to uint64 fence patch v4: Change DCE5 test to force write back on cayman and newer but also any APU such as PALM or SUMO family v5: Rebase on top of new uint64 fence patch Signed-off-by: Jerome Glisse Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h|6 +- drivers/gpu/drm/radeon/radeon_device.c |8 +- drivers/gpu/drm/radeon/radeon_fence.c | 287 +--- 3 files changed, 123 insertions(+), 178 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4d9c433..2928139 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -263,15 +263,12 @@ struct radeon_fence_driver { atomic64_t last_seq; unsigned long last_activity; wait_queue_head_t queue; - struct list_heademitted; - struct list_headsignaled; boolinitialized; }; struct radeon_fence { struct radeon_device*rdev; struct kref kref; - struct list_headlist; /* protected by radeon_fence.lock */ uint64_tseq; /* RB, DMA, etc. */ @@ -291,7 +288,7 @@ int radeon_fence_wait_next(struct radeon_device *rdev, int ring); int radeon_fence_wait_empty(struct radeon_device *rdev, int ring); struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); void radeon_fence_unref(struct radeon_fence **fence); -int radeon_fence_count_emitted(struct radeon_device *rdev, int ring); +unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); /* * Tiling registers @@ -1516,7 +1513,6 @@ struct radeon_device { struct radeon_mode_info mode_info; struct radeon_scratch scratch; struct radeon_mman mman; - rwlock_tfence_lock; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; struct radeon_semaphore_driver semaphore_drv; struct mutexring_lock; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ad3a7fb..cb4f9c2 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -225,9 +225,9 @@ int radeon_wb_init(struct radeon_device *rdev) /* disable event_write fences */ rdev->wb.use_event = false; /* disabled via module param */ - if (radeon_no_wb == 1) + if (radeon_no_wb == 1) { rdev->wb.enabled = false; - else { + } else { if (rdev->flags & RADEON_IS_AGP) { /* often unreliable on AGP */ rdev->wb.enabled = false; @@ -237,8 +237,9 @@ int radeon_wb_init(struct radeon_device *rdev) } else { rdev->wb.enabled = true; /* event_write fences are only available on r600+ */ - if (rdev->family >= CHIP_R600) + if (rdev->family >= CHIP_R600) { rdev->wb.use_event = true; + } } } /* always use writeback/events on NI, APUs */ @@ -731,7 +732,6 @@ int radeon_device_init(struct radeon_device *rdev, mutex_init(&rdev->gem.mutex); mutex_init(&rdev->pm.mutex); mutex_init(&rdev->vram_mutex); - rwlock_init(&rdev->fence_lock); rwlock_init(&rdev->semaphore_drv.lock); INIT_LIST_HEAD(&rdev->gem.objects); init_waitqueue_head(&rdev->irq.vblank_queue); diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 0d3d226..1610601 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -63,30 +63,18 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring) int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) { - unsigned long irq_flags; - - write_lock_irqsave(&rdev->fence_lock, irq_flags); + /* we are protected by the ring emission mutex */
[PATCH 04/18] drm/radeon: hold ring emission mutex for lockup detection
From: Christian König We are locking the ring emission mutex anyway, so there is no harm in doing it a bit earlier and prevent multiple resets to happen at the same time. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_fence.c | 10 +- drivers/gpu/drm/radeon/radeon_ring.c |2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 1610601..99c31b2 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -258,8 +258,11 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, if (seq != atomic64_read(&rdev->fence_drv[ring].last_seq)) { continue; } + + mutex_lock(&rdev->ring_lock); /* test if somebody else has already decided that this is a lockup */ if (last_activity != rdev->fence_drv[ring].last_activity) { + mutex_unlock(&rdev->ring_lock); continue; } @@ -273,15 +276,12 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, rdev->fence_drv[i].last_activity = jiffies; } - /* change last activity so nobody else think there is a lockup */ - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - rdev->fence_drv[i].last_activity = jiffies; - } - /* mark the ring as not ready any more */ rdev->ring[ring].ready = false; + mutex_unlock(&rdev->ring_lock); return -EDEADLK; } + mutex_unlock(&rdev->ring_lock); } } return 0; diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 4ae222b..8b7f00e 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -408,7 +408,6 @@ void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring * { int r; - mutex_lock(&rdev->ring_lock); radeon_ring_free_size(rdev, ring); if (ring->rptr == ring->wptr) { r = radeon_ring_alloc(rdev, ring, 1); @@ -417,7 +416,6 @@ void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring * radeon_ring_commit(rdev, ring); } } - mutex_unlock(&rdev->ring_lock); } void radeon_ring_lockup_update(struct radeon_ring *ring) -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/18] drm/radeon: use inline functions to calc sa_bo addr
From: Christian König Instead of hacking the calculation multiple times. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_gart.c |6 ++ drivers/gpu/drm/radeon/radeon_object.h| 11 +++ drivers/gpu/drm/radeon/radeon_ring.c |6 ++ drivers/gpu/drm/radeon/radeon_semaphore.c |6 ++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index c58a036..4a5d9d4 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -404,10 +404,8 @@ retry: radeon_vm_unbind(rdev, vm_evict); goto retry; } - vm->pt = rdev->vm_manager.sa_manager.cpu_ptr; - vm->pt += (vm->sa_bo.offset >> 3); - vm->pt_gpu_addr = rdev->vm_manager.sa_manager.gpu_addr; - vm->pt_gpu_addr += vm->sa_bo.offset; + vm->pt = radeon_sa_bo_cpu_addr(&vm->sa_bo); + vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(&vm->sa_bo); memset(vm->pt, 0, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8)); retry_id: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index f9104be..c120ab9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -146,6 +146,17 @@ extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, /* * sub allocation */ + +static inline uint64_t radeon_sa_bo_gpu_addr(struct radeon_sa_bo *sa_bo) +{ + return sa_bo->manager->gpu_addr + sa_bo->offset; +} + +static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo) +{ + return sa_bo->manager->cpu_ptr + sa_bo->offset; +} + extern int radeon_sa_bo_manager_init(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, unsigned size, u32 domain); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 8b7f00e..b4c8a67 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -127,10 +127,8 @@ retry: size, 256); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; - (*ib)->ptr = rdev->ib_pool.sa_manager.cpu_ptr; - (*ib)->ptr += ((*ib)->sa_bo.offset >> 2); - (*ib)->gpu_addr = rdev->ib_pool.sa_manager.gpu_addr; - (*ib)->gpu_addr += (*ib)->sa_bo.offset; + (*ib)->ptr = radeon_sa_bo_cpu_addr(&(*ib)->sa_bo); + (*ib)->gpu_addr = radeon_sa_bo_gpu_addr(&(*ib)->sa_bo); (*ib)->fence = fence; (*ib)->vm_id = 0; (*ib)->is_const_ib = false; diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index c5b3d8e..f312ba5 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c @@ -53,10 +53,8 @@ static int radeon_semaphore_add_bo(struct radeon_device *rdev) kfree(bo); return r; } - gpu_addr = rdev->ib_pool.sa_manager.gpu_addr; - gpu_addr += bo->ib->sa_bo.offset; - cpu_ptr = rdev->ib_pool.sa_manager.cpu_ptr; - cpu_ptr += (bo->ib->sa_bo.offset >> 2); + gpu_addr = radeon_sa_bo_gpu_addr(&bo->ib->sa_bo); + cpu_ptr = radeon_sa_bo_cpu_addr(&bo->ib->sa_bo); for (i = 0; i < (RADEON_SEMAPHORE_BO_SIZE/8); i++) { bo->semaphores[i].gpu_addr = gpu_addr; bo->semaphores[i].cpu_ptr = cpu_ptr; -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 06/18] drm/radeon: add proper locking to the SA v3
From: Christian König Make the suballocator self containing to locking. v2: split the bugfix into a seperate patch. v3: remove some unreleated changes. Sig-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h|1 + drivers/gpu/drm/radeon/radeon_sa.c |6 ++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2928139..2621794 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -381,6 +381,7 @@ struct radeon_bo_list { * alignment). */ struct radeon_sa_manager { + spinlock_t lock; struct radeon_bo*bo; struct list_headsa_bo; unsignedsize; diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index 8fbfe69..aed0a8c 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -37,6 +37,7 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev, { int r; + spin_lock_init(&sa_manager->lock); sa_manager->bo = NULL; sa_manager->size = size; sa_manager->domain = domain; @@ -139,6 +140,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, BUG_ON(align > RADEON_GPU_PAGE_SIZE); BUG_ON(size > sa_manager->size); + spin_lock(&sa_manager->lock); /* no one ? */ head = sa_manager->sa_bo.prev; @@ -172,6 +174,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, offset += wasted; if ((sa_manager->size - offset) < size) { /* failed to find somethings big enough */ + spin_unlock(&sa_manager->lock); return -ENOMEM; } @@ -180,10 +183,13 @@ out: sa_bo->offset = offset; sa_bo->size = size; list_add(&sa_bo->list, head); + spin_unlock(&sa_manager->lock); return 0; } void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo) { + spin_lock(&sa_bo->manager->lock); list_del_init(&sa_bo->list); + spin_unlock(&sa_bo->manager->lock); } -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 07/18] drm/radeon: add sub allocator debugfs file
From: Christian König Dumping the current allocations. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_object.h |5 + drivers/gpu/drm/radeon/radeon_ring.c | 22 ++ drivers/gpu/drm/radeon/radeon_sa.c | 14 ++ 3 files changed, 41 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index c120ab9..d9fca1e 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -172,5 +172,10 @@ extern int radeon_sa_bo_new(struct radeon_device *rdev, unsigned size, unsigned align); extern void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo); +#if defined(CONFIG_DEBUG_FS) +extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, +struct seq_file *m); +#endif + #endif diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index b4c8a67..40a8528 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -603,6 +603,23 @@ static int radeon_debugfs_ib_info(struct seq_file *m, void *data) static struct drm_info_list radeon_debugfs_ib_list[RADEON_IB_POOL_SIZE]; static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32]; static unsigned radeon_debugfs_ib_idx[RADEON_IB_POOL_SIZE]; + +static int radeon_debugfs_sa_info(struct seq_file *m, void *data) +{ + struct drm_info_node *node = (struct drm_info_node *) m->private; + struct drm_device *dev = node->minor->dev; + struct radeon_device *rdev = dev->dev_private; + + radeon_sa_bo_dump_debug_info(&rdev->ib_pool.sa_manager, m); + + return 0; + +} + +static struct drm_info_list radeon_debugfs_sa_list[] = { +{"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL}, +}; + #endif int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring) @@ -629,6 +646,11 @@ int radeon_debugfs_ib_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) unsigned i; + int r; + + r = radeon_debugfs_add_files(rdev, radeon_debugfs_sa_list, 1); + if (r) + return r; for (i = 0; i < RADEON_IB_POOL_SIZE; i++) { sprintf(radeon_debugfs_ib_names[i], "radeon_ib_%04u", i); diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index aed0a8c..1db0568 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -193,3 +193,17 @@ void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo) list_del_init(&sa_bo->list); spin_unlock(&sa_bo->manager->lock); } + +#if defined(CONFIG_DEBUG_FS) +void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, + struct seq_file *m) +{ + struct radeon_sa_bo *i; + + spin_lock(&sa_manager->lock); + list_for_each_entry(i, &sa_manager->sa_bo, list) { + seq_printf(m, "offset %08d: size %4d\n", i->offset, i->size); + } + spin_unlock(&sa_manager->lock); +} +#endif -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/18] drm/radeon: keep start and end offset in the SA
From: Christian König Instead of offset + size keep start and end offset directly. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h|4 ++-- drivers/gpu/drm/radeon/radeon_cs.c |4 ++-- drivers/gpu/drm/radeon/radeon_object.h |4 ++-- drivers/gpu/drm/radeon/radeon_sa.c | 13 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2621794..a90cabf 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -396,8 +396,8 @@ struct radeon_sa_bo; struct radeon_sa_bo { struct list_headlist; struct radeon_sa_manager*manager; - unsignedoffset; - unsignedsize; + unsignedsoffset; + unsignedeoffset; }; /* diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index dd0fdef..ac6c9e3 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -470,7 +470,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->const_ib->gpu_addr = parser->const_ib->sa_bo.offset; + parser->const_ib->gpu_addr = parser->const_ib->sa_bo.soffset; r = radeon_ib_schedule(rdev, parser->const_ib); if (r) goto out; @@ -480,7 +480,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->ib->gpu_addr = parser->ib->sa_bo.offset; + parser->ib->gpu_addr = parser->ib->sa_bo.soffset; parser->ib->is_const_ib = false; r = radeon_ib_schedule(rdev, parser->ib); out: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index d9fca1e..99ab46a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -149,12 +149,12 @@ extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, static inline uint64_t radeon_sa_bo_gpu_addr(struct radeon_sa_bo *sa_bo) { - return sa_bo->manager->gpu_addr + sa_bo->offset; + return sa_bo->manager->gpu_addr + sa_bo->soffset; } static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo) { - return sa_bo->manager->cpu_ptr + sa_bo->offset; + return sa_bo->manager->cpu_ptr + sa_bo->soffset; } extern int radeon_sa_bo_manager_init(struct radeon_device *rdev, diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index 1db0568..3bea7ba 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -152,11 +152,11 @@ int radeon_sa_bo_new(struct radeon_device *rdev, offset = 0; list_for_each_entry(tmp, &sa_manager->sa_bo, list) { /* room before this object ? */ - if (offset < tmp->offset && (tmp->offset - offset) >= size) { + if (offset < tmp->soffset && (tmp->soffset - offset) >= size) { head = tmp->list.prev; goto out; } - offset = tmp->offset + tmp->size; + offset = tmp->eoffset; wasted = offset % align; if (wasted) { wasted = align - wasted; @@ -166,7 +166,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, /* room at the end ? */ head = sa_manager->sa_bo.prev; tmp = list_entry(head, struct radeon_sa_bo, list); - offset = tmp->offset + tmp->size; + offset = tmp->eoffset; wasted = offset % align; if (wasted) { wasted = align - wasted; @@ -180,8 +180,8 @@ int radeon_sa_bo_new(struct radeon_device *rdev, out: sa_bo->manager = sa_manager; - sa_bo->offset = offset; - sa_bo->size = size; + sa_bo->soffset = offset; + sa_bo->eoffset = offset + size; list_add(&sa_bo->list, head); spin_unlock(&sa_manager->lock); return 0; @@ -202,7 +202,8 @@ void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, spin_lock(&sa_manager->lock); list_for_each_entry(i, &sa_manager->sa_bo, list) { - seq_printf(m, "offset %08d: size %4d\n", i->offset, i->size); + seq_printf(m, "[%08x %08x] size %4d [%p]\n", + i->soffset, i->eoffset, i->eoffset - i->soffset, i); } spin_unlock(&sa_manager->lock); } -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedeskto
[PATCH 09/18] drm/radeon: make sa bo a stand alone object
From: Christian König Allocating and freeing it seperately. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h |4 ++-- drivers/gpu/drm/radeon/radeon_cs.c|4 ++-- drivers/gpu/drm/radeon/radeon_gart.c |4 ++-- drivers/gpu/drm/radeon/radeon_object.h|4 ++-- drivers/gpu/drm/radeon/radeon_ring.c |6 +++--- drivers/gpu/drm/radeon/radeon_sa.c| 28 +++- drivers/gpu/drm/radeon/radeon_semaphore.c |4 ++-- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a90cabf..3519a52 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -629,7 +629,7 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc); */ struct radeon_ib { - struct radeon_sa_bo sa_bo; + struct radeon_sa_bo *sa_bo; unsignedidx; uint32_tlength_dw; uint64_tgpu_addr; @@ -684,7 +684,7 @@ struct radeon_vm { unsignedlast_pfn; u64 pt_gpu_addr; u64 *pt; - struct radeon_sa_bo sa_bo; + struct radeon_sa_bo *sa_bo; struct mutexmutex; /* last fence for cs using this vm */ struct radeon_fence *fence; diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index ac6c9e3..2aa3f89 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -470,7 +470,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->const_ib->gpu_addr = parser->const_ib->sa_bo.soffset; + parser->const_ib->gpu_addr = parser->const_ib->sa_bo->soffset; r = radeon_ib_schedule(rdev, parser->const_ib); if (r) goto out; @@ -480,7 +480,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->ib->gpu_addr = parser->ib->sa_bo.soffset; + parser->ib->gpu_addr = parser->ib->sa_bo->soffset; parser->ib->is_const_ib = false; r = radeon_ib_schedule(rdev, parser->ib); out: diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 4a5d9d4..c5789ef 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -404,8 +404,8 @@ retry: radeon_vm_unbind(rdev, vm_evict); goto retry; } - vm->pt = radeon_sa_bo_cpu_addr(&vm->sa_bo); - vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(&vm->sa_bo); + vm->pt = radeon_sa_bo_cpu_addr(vm->sa_bo); + vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(vm->sa_bo); memset(vm->pt, 0, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8)); retry_id: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 99ab46a..4fc7f07 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -168,10 +168,10 @@ extern int radeon_sa_bo_manager_suspend(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager); extern int radeon_sa_bo_new(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, - struct radeon_sa_bo *sa_bo, + struct radeon_sa_bo **sa_bo, unsigned size, unsigned align); extern void radeon_sa_bo_free(struct radeon_device *rdev, - struct radeon_sa_bo *sa_bo); + struct radeon_sa_bo **sa_bo); #if defined(CONFIG_DEBUG_FS) extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, struct seq_file *m); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 40a8528..739554c 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -127,8 +127,8 @@ retry: size, 256); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; - (*ib)->ptr = radeon_sa_bo_cpu_addr(&(*ib)->sa_bo); - (*ib)->gpu_addr = radeon_sa_bo_gpu_addr(&(*ib)->sa_bo); + (*ib)->ptr = radeon_sa_bo_cpu_addr((*ib)->sa_bo); + (*ib)->gpu_addr = radeon_sa_bo_gpu_addr((*ib)->
[PATCH 10/18] drm/radeon: define new SA interface v2
From: Christian König Define the interface without modifying the allocation algorithm in any way. v2: rebase on top of fence new uint64 patch Signed-off-by: Jerome Glisse Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h |1 + drivers/gpu/drm/radeon/radeon_gart.c |6 +- drivers/gpu/drm/radeon/radeon_object.h|5 +- drivers/gpu/drm/radeon/radeon_ring.c |8 ++-- drivers/gpu/drm/radeon/radeon_sa.c| 60 drivers/gpu/drm/radeon/radeon_semaphore.c |2 +- 6 files changed, 63 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 3519a52..c78f15b 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -398,6 +398,7 @@ struct radeon_sa_bo { struct radeon_sa_manager*manager; unsignedsoffset; unsignedeoffset; + struct radeon_fence *fence; }; /* diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index c5789ef..53dba8e 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -326,7 +326,7 @@ static void radeon_vm_unbind_locked(struct radeon_device *rdev, rdev->vm_manager.use_bitmap &= ~(1 << vm->id); list_del_init(&vm->list); vm->id = -1; - radeon_sa_bo_free(rdev, &vm->sa_bo); + radeon_sa_bo_free(rdev, &vm->sa_bo, NULL); vm->pt = NULL; list_for_each_entry(bo_va, &vm->va, vm_list) { @@ -395,7 +395,7 @@ int radeon_vm_bind(struct radeon_device *rdev, struct radeon_vm *vm) retry: r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, &vm->sa_bo, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8), -RADEON_GPU_PAGE_SIZE); +RADEON_GPU_PAGE_SIZE, false); if (r) { if (list_empty(&rdev->vm_manager.lru_vm)) { return r; @@ -426,7 +426,7 @@ retry_id: /* do hw bind */ r = rdev->vm_manager.funcs->bind(rdev, vm, id); if (r) { - radeon_sa_bo_free(rdev, &vm->sa_bo); + radeon_sa_bo_free(rdev, &vm->sa_bo, NULL); return r; } rdev->vm_manager.use_bitmap |= 1 << id; diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 4fc7f07..befec7d 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -169,9 +169,10 @@ extern int radeon_sa_bo_manager_suspend(struct radeon_device *rdev, extern int radeon_sa_bo_new(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, struct radeon_sa_bo **sa_bo, - unsigned size, unsigned align); + unsigned size, unsigned align, bool block); extern void radeon_sa_bo_free(struct radeon_device *rdev, - struct radeon_sa_bo **sa_bo); + struct radeon_sa_bo **sa_bo, + struct radeon_fence *fence); #if defined(CONFIG_DEBUG_FS) extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, struct seq_file *m); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 739554c..c84af9c 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -85,7 +85,7 @@ bool radeon_ib_try_free(struct radeon_device *rdev, struct radeon_ib *ib) if (ib->fence && ib->fence->seq < RADEON_FENCE_NOTEMITED_SEQ) { if (radeon_fence_signaled(ib->fence)) { radeon_fence_unref(&ib->fence); - radeon_sa_bo_free(rdev, &ib->sa_bo); + radeon_sa_bo_free(rdev, &ib->sa_bo, NULL); done = true; } } @@ -124,7 +124,7 @@ retry: if (rdev->ib_pool.ibs[idx].fence == NULL) { r = radeon_sa_bo_new(rdev, &rdev->ib_pool.sa_manager, &rdev->ib_pool.ibs[idx].sa_bo, -size, 256); +size, 256, false); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; (*ib)->ptr = radeon_sa_bo_cpu_addr((*ib)->sa_bo); @@ -173,7 +173,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib) } radeon_mutex_lock(&rdev->ib_pool.mutex); if (tmp->fence && tmp->fence->seq == RADEON_FENCE_NOTEMITED_SEQ) { - radeon_sa_bo_free(rdev, &tmp->sa_bo); + radeon_sa_bo_free(rdev, &tmp->sa_bo, NULL);
[PATCH 11/18] drm/radeon: use one wait queue for all rings add fence_wait_any
From: Jerome Glisse Use one wait queue for all rings. When one ring progress, other likely does to and we are not expecting to have a lot of waiter anyway. Also add a fence_wait_any that will wait until the first fence in the fence array (one fence per ring) is signaled. This allow to wait on all rings. Signed-off-by: Christian König Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon.h |5 +- drivers/gpu/drm/radeon/radeon_fence.c | 151 +++- 2 files changed, 150 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index c78f15b..6f8d0f5 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -262,7 +262,6 @@ struct radeon_fence_driver { uint64_tseq; atomic64_t last_seq; unsigned long last_activity; - wait_queue_head_t queue; boolinitialized; }; @@ -286,6 +285,9 @@ bool radeon_fence_signaled(struct radeon_fence *fence); int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); int radeon_fence_wait_next(struct radeon_device *rdev, int ring); int radeon_fence_wait_empty(struct radeon_device *rdev, int ring); +int radeon_fence_wait_any(struct radeon_device *rdev, + struct radeon_fence **fences, + bool intr); struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); void radeon_fence_unref(struct radeon_fence **fence); unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); @@ -1516,6 +1518,7 @@ struct radeon_device { struct radeon_scratch scratch; struct radeon_mman mman; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; + wait_queue_head_t fence_queue; struct radeon_semaphore_driver semaphore_drv; struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 99c31b2..9c2c1b3 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -233,11 +233,11 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, trace_radeon_fence_wait_begin(rdev->ddev, seq); radeon_irq_kms_sw_irq_get(rdev, ring); if (intr) { - r = wait_event_interruptible_timeout(rdev->fence_drv[ring].queue, + r = wait_event_interruptible_timeout(rdev->fence_queue, (signaled = radeon_seq_signaled(rdev, target_seq, ring)), timeout); } else { - r = wait_event_timeout(rdev->fence_drv[ring].queue, + r = wait_event_timeout(rdev->fence_queue, (signaled = radeon_seq_signaled(rdev, target_seq, ring)), timeout); } @@ -304,6 +304,147 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr) return 0; } +bool radeon_seq_any_signaled(struct radeon_device *rdev, u64 *seq) +{ + unsigned i, j; + + for (i = 0; i < RADEON_NUM_RINGS; ++i) { + /* poll new last sequence at least once */ + for (j = 0; j < 2; j++) { + if (atomic64_read(&rdev->fence_drv[i].last_seq) >= seq[i]) { + return true; + } + radeon_fence_poll(rdev, i); + } + } + return false; +} + +static int radeon_wait_seq_any(struct radeon_device *rdev, u64 *target_seq, + bool intr) +{ + unsigned long timeout, last_activity, tmp; + unsigned i, ring = 0; + bool signaled; + int r; + + /* use the most recent one as indicator */ + for (i = 0, last_activity = 0; i < RADEON_NUM_RINGS; ++i) { + if (time_after(rdev->fence_drv[i].last_activity, last_activity)) { + last_activity = rdev->fence_drv[i].last_activity; + } + /* For lockup detection we just pick one of the ring we are +* actively waiting for +*/ + if (target_seq[i]) { + ring = i; + } + } + while (!radeon_seq_any_signaled(rdev, target_seq)) { + timeout = jiffies - RADEON_FENCE_JIFFIES_TIMEOUT; + if (time_after(last_activity, timeout)) { + /* the normal case, timeout is somewhere before last_activity */ + timeout = last_activity - timeout; +
[PATCH 12/18] drm/radeon: multiple ring allocator
From: Christian König A startover with a new idea for a multiple ring allocator. Should perform as well as a normal ring allocator as long as only one ring does somthing, but falls back to a more complex algorithm if more complex things start to happen. We store the last allocated bo in last, we always try to allocate after the last allocated bo. Principle is that in a linear GPU ring progression was is after last is the oldest bo we allocated and thus the first one that should no longer be in use by the GPU. If it's not the case we skip over the bo after last to the closest done bo if such one exist. If none exist and we are not asked to block we report failure to allocate. If we are asked to block we wait on all the oldest fence of all rings. We just wait for any of those fence to complete. Signed-off-by: Christian König Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon.h |7 +- drivers/gpu/drm/radeon/radeon_ring.c | 19 +-- drivers/gpu/drm/radeon/radeon_sa.c | 314 -- 3 files changed, 233 insertions(+), 107 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 6f8d0f5..1c3eb06 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -385,7 +385,9 @@ struct radeon_bo_list { struct radeon_sa_manager { spinlock_t lock; struct radeon_bo*bo; - struct list_headsa_bo; + struct radeon_sa_bo *last; + struct list_headflist[RADEON_NUM_RINGS]; + struct list_headolist; unsignedsize; uint64_tgpu_addr; void*cpu_ptr; @@ -396,7 +398,8 @@ struct radeon_sa_bo; /* sub-allocation buffer */ struct radeon_sa_bo { - struct list_headlist; + struct list_headolist; + struct list_headflist; struct radeon_sa_manager*manager; unsignedsoffset; unsignedeoffset; diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index c84af9c..2eed251 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -204,25 +204,22 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib) int radeon_ib_pool_init(struct radeon_device *rdev) { - struct radeon_sa_manager tmp; int i, r; - r = radeon_sa_bo_manager_init(rdev, &tmp, - RADEON_IB_POOL_SIZE*64*1024, - RADEON_GEM_DOMAIN_GTT); - if (r) { - return r; - } - radeon_mutex_lock(&rdev->ib_pool.mutex); if (rdev->ib_pool.ready) { radeon_mutex_unlock(&rdev->ib_pool.mutex); - radeon_sa_bo_manager_fini(rdev, &tmp); return 0; } - rdev->ib_pool.sa_manager = tmp; - INIT_LIST_HEAD(&rdev->ib_pool.sa_manager.sa_bo); + r = radeon_sa_bo_manager_init(rdev, &rdev->ib_pool.sa_manager, + RADEON_IB_POOL_SIZE*64*1024, + RADEON_GEM_DOMAIN_GTT); + if (r) { + radeon_mutex_unlock(&rdev->ib_pool.mutex); + return r; + } + for (i = 0; i < RADEON_IB_POOL_SIZE; i++) { rdev->ib_pool.ibs[i].fence = NULL; rdev->ib_pool.ibs[i].idx = i; diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index bc4ef87..dc67cb4 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -27,21 +27,42 @@ * Authors: *Jerome Glisse */ +/* Algorithm: + * + * We store the last allocated bo in last, we always try to allocate + * after the last allocated bo. Principle is that in a linear GPU ring + * progression was is after last is the oldest bo we allocated and thus + * the first one that should no longer be in use by the GPU. + * + * If it's not the case we skip over the bo after last to the closest + * done bo if such one exist. If none exist and we are not asked to + * block we report failure to allocate. + * + * If we are asked to block we wait on all the oldest fence of all + * rings. We just wait for any of those fence to complete. + */ #include "drmP.h" #include "drm.h" #include "radeon.h" +static void radeon_sa_bo_remove_locked(struct radeon_sa_bo *sa_bo); +static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager); + int radeon_sa_bo_manager_init(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, unsigned size, u32 domain) { - int r; + int i, r; spin_lock_init(&sa_manager->lock); sa_manager->bo = NULL; sa_manager->size = size; sa_manager->do
[PATCH 13/18] drm/radeon: simplify semaphore handling v2
From: Jerome Glisse Directly use the suballocator to get small chunks of memory. It's equally fast and doesn't crash when we encounter a GPU reset. v2: rebased on new SA interface. Signed-off-by: Christian König Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/evergreen.c|1 - drivers/gpu/drm/radeon/ni.c |1 - drivers/gpu/drm/radeon/r600.c |1 - drivers/gpu/drm/radeon/radeon.h | 29 +- drivers/gpu/drm/radeon/radeon_device.c|2 - drivers/gpu/drm/radeon/radeon_fence.c |2 +- drivers/gpu/drm/radeon/radeon_semaphore.c | 137 + drivers/gpu/drm/radeon/radeon_test.c |4 +- drivers/gpu/drm/radeon/rv770.c|1 - drivers/gpu/drm/radeon/si.c |1 - 10 files changed, 30 insertions(+), 149 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 0e860c6..ec61194 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -3422,7 +3422,6 @@ void evergreen_fini(struct radeon_device *rdev) evergreen_pcie_gart_fini(rdev); r600_vram_scratch_fini(rdev); radeon_gem_fini(rdev); - radeon_semaphore_driver_fini(rdev); radeon_fence_driver_fini(rdev); radeon_agp_fini(rdev); radeon_bo_fini(rdev); diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 9cd2657..107b217 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -1744,7 +1744,6 @@ void cayman_fini(struct radeon_device *rdev) cayman_pcie_gart_fini(rdev); r600_vram_scratch_fini(rdev); radeon_gem_fini(rdev); - radeon_semaphore_driver_fini(rdev); radeon_fence_driver_fini(rdev); radeon_bo_fini(rdev); radeon_atombios_fini(rdev); diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 1cadf97..2bce657 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -2658,7 +2658,6 @@ void r600_fini(struct radeon_device *rdev) r600_vram_scratch_fini(rdev); radeon_agp_fini(rdev); radeon_gem_fini(rdev); - radeon_semaphore_driver_fini(rdev); radeon_fence_driver_fini(rdev); radeon_bo_fini(rdev); radeon_atombios_fini(rdev); diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 1c3eb06..937db02 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -434,34 +434,13 @@ int radeon_mode_dumb_destroy(struct drm_file *file_priv, /* * Semaphores. */ -struct radeon_ring; - -#defineRADEON_SEMAPHORE_BO_SIZE256 - -struct radeon_semaphore_driver { - rwlock_tlock; - struct list_headbo; -}; - -struct radeon_semaphore_bo; - /* everything here is constant */ struct radeon_semaphore { - struct list_headlist; + struct radeon_sa_bo *sa_bo; + signed waiters; uint64_tgpu_addr; - uint32_t*cpu_ptr; - struct radeon_semaphore_bo *bo; }; -struct radeon_semaphore_bo { - struct list_headlist; - struct radeon_ib*ib; - struct list_headfree; - struct radeon_semaphore semaphores[RADEON_SEMAPHORE_BO_SIZE/8]; - unsignednused; -}; - -void radeon_semaphore_driver_fini(struct radeon_device *rdev); int radeon_semaphore_create(struct radeon_device *rdev, struct radeon_semaphore **semaphore); void radeon_semaphore_emit_signal(struct radeon_device *rdev, int ring, @@ -473,7 +452,8 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, bool sync_to[RADEON_NUM_RINGS], int dst_ring); void radeon_semaphore_free(struct radeon_device *rdev, - struct radeon_semaphore *semaphore); + struct radeon_semaphore *semaphore, + struct radeon_fence *fence); /* * GART structures, functions & helpers @@ -1522,7 +1502,6 @@ struct radeon_device { struct radeon_mman mman; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; wait_queue_head_t fence_queue; - struct radeon_semaphore_driver semaphore_drv; struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; struct radeon_ib_pool ib_pool; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index cb4f9c2..9e28060 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -732,11 +732,9 @@ int radeon_device_init(struct radeon_device *
[PATCH 14/18] drm/radeon: rip out the ib pool
From: Jerome Glisse It isn't necessary any more and the suballocator seems to perform even better. Signed-off-by: Christian König Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon.h | 17 +-- drivers/gpu/drm/radeon/radeon_device.c|1 - drivers/gpu/drm/radeon/radeon_gart.c | 12 +- drivers/gpu/drm/radeon/radeon_ring.c | 241 - drivers/gpu/drm/radeon/radeon_semaphore.c |2 +- 5 files changed, 71 insertions(+), 202 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 937db02..24220d1 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -616,7 +616,6 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc); struct radeon_ib { struct radeon_sa_bo *sa_bo; - unsignedidx; uint32_tlength_dw; uint64_tgpu_addr; uint32_t*ptr; @@ -625,18 +624,6 @@ struct radeon_ib { boolis_const_ib; }; -/* - * locking - - * mutex protects scheduled_ibs, ready, alloc_bm - */ -struct radeon_ib_pool { - struct radeon_mutex mutex; - struct radeon_sa_managersa_manager; - struct radeon_ibibs[RADEON_IB_POOL_SIZE]; - boolready; - unsignedhead_id; -}; - struct radeon_ring { struct radeon_bo*ring_obj; volatile uint32_t *ring; @@ -778,7 +765,6 @@ struct si_rlc { int radeon_ib_get(struct radeon_device *rdev, int ring, struct radeon_ib **ib, unsigned size); void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); -bool radeon_ib_try_free(struct radeon_device *rdev, struct radeon_ib *ib); int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); int radeon_ib_pool_init(struct radeon_device *rdev); void radeon_ib_pool_fini(struct radeon_device *rdev); @@ -1504,7 +1490,8 @@ struct radeon_device { wait_queue_head_t fence_queue; struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; - struct radeon_ib_pool ib_pool; + boolib_pool_ready; + struct radeon_sa_managerring_tmp_bo; struct radeon_irq irq; struct radeon_asic *asic; struct radeon_gem gem; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 9e28060..3253e8d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -724,7 +724,6 @@ int radeon_device_init(struct radeon_device *rdev, /* mutex initialization are all done here so we * can recall function without having locking issues */ radeon_mutex_init(&rdev->cs_mutex); - radeon_mutex_init(&rdev->ib_pool.mutex); mutex_init(&rdev->ring_lock); mutex_init(&rdev->dc_hw_i2c_mutex); if (rdev->family >= CHIP_R600) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 53dba8e..8e9ef34 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -432,8 +432,8 @@ retry_id: rdev->vm_manager.use_bitmap |= 1 << id; vm->id = id; list_add_tail(&vm->list, &rdev->vm_manager.lru_vm); - return radeon_vm_bo_update_pte(rdev, vm, rdev->ib_pool.sa_manager.bo, - &rdev->ib_pool.sa_manager.bo->tbo.mem); + return radeon_vm_bo_update_pte(rdev, vm, rdev->ring_tmp_bo.bo, + &rdev->ring_tmp_bo.bo->tbo.mem); } /* object have to be reserved */ @@ -631,7 +631,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) /* map the ib pool buffer at 0 in virtual address space, set * read only */ - r = radeon_vm_bo_add(rdev, vm, rdev->ib_pool.sa_manager.bo, 0, + r = radeon_vm_bo_add(rdev, vm, rdev->ring_tmp_bo.bo, 0, RADEON_VM_PAGE_READABLE | RADEON_VM_PAGE_SNOOPED); return r; } @@ -648,12 +648,12 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm) radeon_mutex_unlock(&rdev->cs_mutex); /* remove all bo */ - r = radeon_bo_reserve(rdev->ib_pool.sa_manager.bo, false); + r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); if (!r) { - bo_va = radeon_bo_va(rdev->ib_pool.sa_manager.bo, vm); + bo_va = radeon_bo_va(rdev->ring_tmp_bo.bo, vm); list_del_init(&bo_va->bo_list); list_del_init(&bo_va->vm_list); - radeon_bo_unreserve(rdev->ib_pool.sa_manager.bo); + radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
[PATCH 15/18] drm/radeon: immediately remove ttm-move semaphore
From: Christian König We can now protected the semaphore ram by a fence, so free it immediately. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_ttm.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 5e3d54d..0f6aee8 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -223,6 +223,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, struct radeon_device *rdev; uint64_t old_start, new_start; struct radeon_fence *fence, *old_fence; + struct radeon_semaphore *sem = NULL; int r; rdev = radeon_get_rdev(bo->bdev); @@ -272,15 +273,16 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, bool sync_to_ring[RADEON_NUM_RINGS] = { }; sync_to_ring[old_fence->ring] = true; - r = radeon_semaphore_create(rdev, &fence->semaphore); + r = radeon_semaphore_create(rdev, &sem); if (r) { radeon_fence_unref(&fence); return r; } - r = radeon_semaphore_sync_rings(rdev, fence->semaphore, + r = radeon_semaphore_sync_rings(rdev, sem, sync_to_ring, fence->ring); if (r) { + radeon_semaphore_free(rdev, sem, NULL); radeon_fence_unref(&fence); return r; } @@ -292,6 +294,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, /* FIXME: handle copy error */ r = ttm_bo_move_accel_cleanup(bo, (void *)fence, NULL, evict, no_wait_reserve, no_wait_gpu, new_mem); + radeon_semaphore_free(rdev, sem, fence); radeon_fence_unref(&fence); return r; } -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 16/18] drm/radeon: move the semaphore from the fence into the ib
From: Jerome Glisse It never really belonged there in the first place. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon.h | 16 drivers/gpu/drm/radeon/radeon_cs.c|4 ++-- drivers/gpu/drm/radeon/radeon_fence.c |3 --- drivers/gpu/drm/radeon/radeon_ring.c |2 ++ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 24220d1..3b9e2d3 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -272,7 +272,6 @@ struct radeon_fence { uint64_tseq; /* RB, DMA, etc. */ unsignedring; - struct radeon_semaphore *semaphore; }; int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); @@ -615,13 +614,14 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc); */ struct radeon_ib { - struct radeon_sa_bo *sa_bo; - uint32_tlength_dw; - uint64_tgpu_addr; - uint32_t*ptr; - struct radeon_fence *fence; - unsignedvm_id; - boolis_const_ib; + struct radeon_sa_bo *sa_bo; + uint32_tlength_dw; + uint64_tgpu_addr; + uint32_t*ptr; + struct radeon_fence *fence; + unsignedvm_id; + boolis_const_ib; + struct radeon_semaphore *semaphore; }; struct radeon_ring { diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 2aa3f89..7dbf632 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -138,12 +138,12 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p) return 0; } - r = radeon_semaphore_create(p->rdev, &p->ib->fence->semaphore); + r = radeon_semaphore_create(p->rdev, &p->ib->semaphore); if (r) { return r; } - return radeon_semaphore_sync_rings(p->rdev, p->ib->fence->semaphore, + return radeon_semaphore_sync_rings(p->rdev, p->ib->semaphore, sync_to_ring, p->ring); } diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 8b4778f..541ae92 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -137,8 +137,6 @@ static void radeon_fence_destroy(struct kref *kref) fence = container_of(kref, struct radeon_fence, kref); fence->seq = RADEON_FENCE_NOTEMITED_SEQ; - if (fence->semaphore) - radeon_semaphore_free(fence->rdev, fence->semaphore, NULL); kfree(fence); } @@ -154,7 +152,6 @@ int radeon_fence_create(struct radeon_device *rdev, (*fence)->rdev = rdev; (*fence)->seq = RADEON_FENCE_NOTEMITED_SEQ; (*fence)->ring = ring; - (*fence)->semaphore = NULL; return 0; } diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index c70a3b7..b41aa82 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -93,6 +93,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring, (*ib)->gpu_addr = radeon_sa_bo_gpu_addr((*ib)->sa_bo); (*ib)->vm_id = 0; (*ib)->is_const_ib = false; + (*ib)->semaphore = NULL; return 0; } @@ -105,6 +106,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib) if (tmp == NULL) { return; } + radeon_semaphore_free(rdev, tmp->semaphore, tmp->fence); radeon_sa_bo_free(rdev, &tmp->sa_bo, tmp->fence); radeon_fence_unref(&tmp->fence); kfree(tmp); -- 1.7.7.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 17/18] drm/radeon: remove r600 blit mutex v2
From: Christian König If we don't store local data into global variables it isn't necessary to lock anything. v2: rebased on new SA interface Signed-off-by: Christian König --- drivers/gpu/drm/radeon/evergreen_blit_kms.c |1 - drivers/gpu/drm/radeon/r600.c | 13 +--- drivers/gpu/drm/radeon/r600_blit_kms.c | 99 +++ drivers/gpu/drm/radeon/radeon.h |3 - drivers/gpu/drm/radeon/radeon_asic.h|9 ++- 5 files changed, 50 insertions(+), 75 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index 222acd2..30f0480 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c @@ -637,7 +637,6 @@ int evergreen_blit_init(struct radeon_device *rdev) if (rdev->r600_blit.shader_obj) goto done; - mutex_init(&rdev->r600_blit.mutex); rdev->r600_blit.state_offset = 0; if (rdev->family < CHIP_CAYMAN) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 2bce657..d963fd8 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -2363,20 +2363,15 @@ int r600_copy_blit(struct radeon_device *rdev, unsigned num_gpu_pages, struct radeon_fence *fence) { + struct radeon_sa_bo *vb = NULL; int r; - mutex_lock(&rdev->r600_blit.mutex); - rdev->r600_blit.vb_ib = NULL; - r = r600_blit_prepare_copy(rdev, num_gpu_pages); + r = r600_blit_prepare_copy(rdev, num_gpu_pages, &vb); if (r) { - if (rdev->r600_blit.vb_ib) - radeon_ib_free(rdev, &rdev->r600_blit.vb_ib); - mutex_unlock(&rdev->r600_blit.mutex); return r; } - r600_kms_blit_copy(rdev, src_offset, dst_offset, num_gpu_pages); - r600_blit_done_copy(rdev, fence); - mutex_unlock(&rdev->r600_blit.mutex); + r600_kms_blit_copy(rdev, src_offset, dst_offset, num_gpu_pages, vb); + r600_blit_done_copy(rdev, fence, vb); return 0; } diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index db38f58..ef20822 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c @@ -513,7 +513,6 @@ int r600_blit_init(struct radeon_device *rdev) rdev->r600_blit.primitives.set_default_state = set_default_state; rdev->r600_blit.ring_size_common = 40; /* shaders + def state */ - rdev->r600_blit.ring_size_common += 16; /* fence emit for VB IB */ rdev->r600_blit.ring_size_common += 5; /* done copy */ rdev->r600_blit.ring_size_common += 16; /* fence emit for done copy */ @@ -528,7 +527,6 @@ int r600_blit_init(struct radeon_device *rdev) if (rdev->r600_blit.shader_obj) goto done; - mutex_init(&rdev->r600_blit.mutex); rdev->r600_blit.state_offset = 0; if (rdev->family >= CHIP_RV770) @@ -621,27 +619,6 @@ void r600_blit_fini(struct radeon_device *rdev) radeon_bo_unref(&rdev->r600_blit.shader_obj); } -static int r600_vb_ib_get(struct radeon_device *rdev, unsigned size) -{ - int r; - r = radeon_ib_get(rdev, RADEON_RING_TYPE_GFX_INDEX, - &rdev->r600_blit.vb_ib, size); - if (r) { - DRM_ERROR("failed to get IB for vertex buffer\n"); - return r; - } - - rdev->r600_blit.vb_total = size; - rdev->r600_blit.vb_used = 0; - return 0; -} - -static void r600_vb_ib_put(struct radeon_device *rdev) -{ - radeon_fence_emit(rdev, rdev->r600_blit.vb_ib->fence); - radeon_ib_free(rdev, &rdev->r600_blit.vb_ib); -} - static unsigned r600_blit_create_rect(unsigned num_gpu_pages, int *width, int *height, int max_dim) { @@ -688,7 +665,8 @@ static unsigned r600_blit_create_rect(unsigned num_gpu_pages, } -int r600_blit_prepare_copy(struct radeon_device *rdev, unsigned num_gpu_pages) +int r600_blit_prepare_copy(struct radeon_device *rdev, unsigned num_gpu_pages, + struct radeon_sa_bo **vb) { struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; int r; @@ -705,46 +683,54 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, unsigned num_gpu_pages) } /* 48 bytes for vertex per loop */ - r = r600_vb_ib_get(rdev, (num_loops*48)+256); - if (r) + r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, vb, +(num_loops*48)+256, 256, true); + if (r) { return r; + } /* calculate number of loops correctly */ ring_size = num_loops * dwords_per_loop; ring_size += rdev->r600_blit.ring_size_common; r = radeon_ring_lock(rdev, ring, ring_size); - if (r) + if (r) { +
[PATCH 18/18] drm/radeon: make the ib an inline object
From: Jerome Glisse No need to malloc it any more. Signed-off-by: Jerome Glisse Signed-off-by: Christian König --- drivers/gpu/drm/radeon/evergreen_cs.c | 10 +++--- drivers/gpu/drm/radeon/r100.c | 38 ++-- drivers/gpu/drm/radeon/r200.c |2 +- drivers/gpu/drm/radeon/r300.c |4 +- drivers/gpu/drm/radeon/r600.c | 16 drivers/gpu/drm/radeon/r600_cs.c | 22 +-- drivers/gpu/drm/radeon/radeon.h |8 ++-- drivers/gpu/drm/radeon/radeon_cs.c| 61 - drivers/gpu/drm/radeon/radeon_ring.c | 41 +++--- 9 files changed, 92 insertions(+), 110 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 70089d3..4e7dd2b 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c @@ -1057,7 +1057,7 @@ static int evergreen_cs_packet_parse_vline(struct radeon_cs_parser *p) uint32_t header, h_idx, reg, wait_reg_mem_info; volatile uint32_t *ib; - ib = p->ib->ptr; + ib = p->ib.ptr; /* parse the WAIT_REG_MEM */ r = evergreen_cs_packet_parse(p, &wait_reg_mem, p->idx); @@ -1215,7 +1215,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) if (!(evergreen_reg_safe_bm[i] & m)) return 0; } - ib = p->ib->ptr; + ib = p->ib.ptr; switch (reg) { /* force following reg to 0 in an attempt to disable out buffer * which will need us to better understand how it works to perform @@ -1896,7 +1896,7 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, u32 idx_value; track = (struct evergreen_cs_track *)p->track; - ib = p->ib->ptr; + ib = p->ib.ptr; idx = pkt->idx + 1; idx_value = radeon_get_ib_value(p, idx); @@ -2610,8 +2610,8 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) } } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); #if 0 - for (r = 0; r < p->ib->length_dw; r++) { - printk(KERN_INFO "%05d 0x%08X\n", r, p->ib->ptr[r]); + for (r = 0; r < p->ib.length_dw; r++) { + printk(KERN_INFO "%05d 0x%08X\n", r, p->ib.ptr[r]); mdelay(1); } #endif diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ee0103c..a8e00e8 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c @@ -139,9 +139,9 @@ int r100_reloc_pitch_offset(struct radeon_cs_parser *p, } tmp |= tile_flags; - p->ib->ptr[idx] = (value & 0x3fc0) | tmp; + p->ib.ptr[idx] = (value & 0x3fc0) | tmp; } else - p->ib->ptr[idx] = (value & 0xffc0) | tmp; + p->ib.ptr[idx] = (value & 0xffc0) | tmp; return 0; } @@ -156,7 +156,7 @@ int r100_packet3_load_vbpntr(struct radeon_cs_parser *p, volatile uint32_t *ib; u32 idx_value; - ib = p->ib->ptr; + ib = p->ib.ptr; track = (struct r100_cs_track *)p->track; c = radeon_get_ib_value(p, idx++) & 0x1F; if (c > 16) { @@ -1271,7 +1271,7 @@ void r100_cs_dump_packet(struct radeon_cs_parser *p, unsigned i; unsigned idx; - ib = p->ib->ptr; + ib = p->ib.ptr; idx = pkt->idx; for (i = 0; i <= (pkt->count + 1); i++, idx++) { DRM_INFO("ib[%d]=0x%08X\n", idx, ib[idx]); @@ -1350,7 +1350,7 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p) uint32_t header, h_idx, reg; volatile uint32_t *ib; - ib = p->ib->ptr; + ib = p->ib.ptr; /* parse the wait until */ r = r100_cs_packet_parse(p, &waitreloc, p->idx); @@ -1529,7 +1529,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, u32 tile_flags = 0; u32 idx_value; - ib = p->ib->ptr; + ib = p->ib.ptr; track = (struct r100_cs_track *)p->track; idx_value = radeon_get_ib_value(p, idx); @@ -1885,7 +1885,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p, volatile uint32_t *ib; int r; - ib = p->ib->ptr; + ib = p->ib.ptr; idx = pkt->idx + 1; track = (struct r100_cs_track *)p->track; switch (pkt->opcode) { @@ -3680,7 +3680,7 @@ void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) { - struct radeon_ib *ib; + struct radeon_ib ib; uint32_t scratch; uint32_t tmp = 0; unsigned i; @@ -3696,22 +3696,22 @@ int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) if (r) { return r; } - ib->ptr[0] = PACKET0(scratch, 0); - ib->ptr[1] = 0xDEA
[Bug 49110] AMDILCFGStructurizer.cpp:1751:3: error: 'isCurrentDebugType' was not declared in this scope
https://bugs.freedesktop.org/show_bug.cgi?id=49110 --- Comment #3 from Mike Mestnik 2012-05-04 21:07:05 UTC --- /w llvm-1.3~rc1 same as you. I'm changing to rc2. I get this: https://launchpadlibrarian.net/104275700/buildlog_ubuntu-precise-i386.mesa_8.1~git20120504.5cc4b4aa-1ubuntu0cheako2~precise_FAILEDTOBUILD.txt.gz g++ -c -I. -I../mesa -I../mapi -I../../include -D_FORTIFY_SOURCE=2 -Wall -g -O2 -Wall -fno-strict-aliasing -fno-builtin-memcmp -Wall -g -O2 -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 -DFEATURE_GL=1 -fvisibility=hidden -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 -DFEATURE_GL=1 opt_swizzle_swizzle.cpp -o opt_swizzle_swizzle.o CC r600_llvm.o make[5]: *** No rule to make target `../../../../../../src/gallium/drivers/radeon/libradeon.a', needed by `libr600.a'. Stop. make[5]: *** Waiting for unfinished jobs make[5]: Leaving directory `/build/buildd/mesa-8.1~git20120504.5cc4b4aa/build/dri/src/gallium/drivers/r600' -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 45018] [bisected] rendering regression since added support for virtual address space on cayman v11
https://bugs.freedesktop.org/show_bug.cgi?id=45018 --- Comment #54 from Alexandre Demers 2012-05-04 21:21:18 PDT --- On latest git (3cd7bee48f7caf7850ea64d40f43875d4c975507), in src/gallium/drivers/r600/r66_hw_context.c, on line 194, shouldn't it be: - int offset + unsigned offset Also, at line 1259, I'm not quite sure why it is shifted by 2. Most of the time, offset is usually shifted by 8. Just looking through the code to see if something could have been missed... -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 43477] rendering errors in unigine tropics and sanctuary (regression)
https://bugs.freedesktop.org/show_bug.cgi?id=43477 --- Comment #4 from imamdxl8805 at gmail.com 2012-05-03 18:58:13 PDT --- same result with Intel GMA 4500 with Mesa 8-series and Mesa 8.1-devel from git -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
Linux 3.4-rc4
On Wed, 2012-05-02 at 21:31 +1000, Ben Skeggs wrote: > On Wed, 2012-05-02 at 09:54 +0200, Jean Delvare wrote: > > Hi Luca, Maarten, > > > > On Monday 30 April 2012 01:01:30 pm Luca Tettamanti wrote: > > > On Mon, Apr 30, 2012 at 11:07 AM, Maarten Maathuis > > gmail.com> wrote: > > > > On Mon, Apr 30, 2012 at 12:37 AM, Dmitry Torokhov > > > > > > > > wrote: > > > >> On Sat, Apr 28, 2012 at 11:33:50AM -0400, Nick Bowler wrote: > > > >>> On 2012-04-28 02:19 -0400, Alex Deucher wrote: > > > >>> > On Fri, Apr 27, 2012 at 8:39 PM, Nick Bowler > > >>> > elliptictech.com> wrote: > > > >>> > > Unfortunately, that's not the end of my VGA-related > > > >>> > > regressions. :( > > > >>> > > > > > >>> > > While tracking down the black screen issue, I've been having > > > >>> > > the monitor directly connected to the video card the whole > > > >>> > > time, but now when I'm connected through my KVM switch (an > > > >>> > > IOGear GCS1804), it appears that something's going wrong with > > > >>> > > reading the EDID, because the available modes are all screwed > > > >>> > > up (both console and X decide they want to drive the display > > > >>> > > at 1024x768). Here's the output of xrandr on 3.2.15: > > > >>> > > > > > >>> > > % xrandr > > > >>> > > Screen 1: minimum 320 x 200, current 1600 x 1200, maximum > > > >>> > > 4096 x 4096 VGA-1 connected 1600x1200+0+0 (normal left > > > >>> > > inverted right x axis y axis) 352mm x 264mm > > > >>> > > 1600x1200 75.0*+ 70.0 65.0 60.0 > > > >>> > > 1280x1024 85.0 + 75.0 60.0 > > > >>> > > 1920x1440 60.0 > > > >>> > > 1856x1392 60.0 > > > >>> > > 1792x1344 60.0 > > > >>> > > 1920x1200 74.9 59.9 > > > >>> > > 1680x1050 84.9 74.9 60.0 > > > >>> > > 1400x1050 85.0 74.9 60.0 > > > >>> > > 1440x900 84.8 75.0 59.9 > > > >>> > > 1280x960 85.0 60.0 > > > >>> > > 1360x768 60.0 > > > >>> > > 1280x800 84.9 74.9 59.8 > > > >>> > > 1152x864 75.0 > > > >>> > > 1280x768 84.8 74.9 59.9 > > > >>> > > 1024x768 85.0 75.1 75.0 70.1 60.0 > > > >>> > > 43.5 43.5 > > > >>> > > 832x62474.6 > > > >>> > > 800x60085.1 72.2 75.0 60.3 56.2 > > > >>> > > 848x48060.0 > > > >>> > > 640x48085.0 75.0 72.8 72.8 66.7 > > > >>> > > 60.0 59.9 > > > >>> > > 720x40085.0 87.8 70.1 > > > >>> > > 640x40085.1 > > > >>> > > 640x35085.1 > > > >>> > > 320x200 165.1 > > > >>> > > > > > >>> > > And on 3.4-rc4+ (with your patch cherry-picked): > > > >>> > > > > > >>> > > % xrandr > > > >>> > > Screen 1: minimum 320 x 200, current 1024 x 768, maximum > > > >>> > > 4096 x 4096 VGA-1 connected 1024x768+0+0 (normal left > > > >>> > > inverted right x axis y axis) 0mm x 0mm > > > >>> > > 1024x768 60.0* > > > >>> > > 800x60060.3 56.2 > > > >>> > > 848x48060.0 > > > >>> > > 640x48059.9 > > > >>> > > 320x200 165.1 > > > >>> > > > > > >>> > > Running xrandr on 3.4-rc4+ also causes the screen to go black > > > >>> > > for a second when it does not on 3.2.15. It also causes > > > >>> > > several messages of the form > > > >>> > > > > > >>> > > [drm] nouveau :01:00.0: Load detected on output B > > > >>> > > > > > >>> > > to be logged. Also, looking at > > > >>> > > /sys/class/drm/card0-VGA-1/edid I see that it is empty on > > > >>> > > 3.4-rc4+ and it is correct on 3.2.15. Things seem to work OK > > > >>> > > when the KVM is not involved. > > > >>> > > > > >>> > Were you ever able to fetch a EDID with the KVM involved? KVMs > > > >>> > are notorious for not connecting the ddc pins. > > > >>> > > > >>> Yes, it works on 3.2.15 as described above. > > > >> > > > >> I have the same (or similar) KVM (not in the office at the moment) > > > >> and I can confirm that with newer kernels EDID fecthing in flaky. > > > >> It's 50/50 if EDED retrieval succeeds or if it fails with: > > > >> > > > >> Apr 26 13:06:57 dtor-d630 kernel: [13464.936336] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, > > > >> remainder is 208 Apr 26 13:06:57 dtor-d630 kernel: [13464.955317] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, > > > >> remainder is 208 Apr 26 13:06:57 dtor-d630 kernel: [13464.973879] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, > > > >> remainder is 208 Apr 27 09:13:03 dtor-d630 kernel: [44602.087659] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, > > > >> remainder is 208 Apr 27 09:13:03 dtor-d630 kernel: [44602.107147] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, > > > >> remainder is 208 Apr 27 09:13:03 dtor-d630 kernel: [44602.126908] > > > >> [drm:drm_edid_block_valid] *ERROR* EDID checks
[PATCH] drm/radeon: clarify and extend wb setup on APUs and NI+ asics
On Don, 2012-05-03 at 17:06 -0400, alexdeucher at gmail.com wrote: > From: Alex Deucher > > Use family rather than DCE check for clarity, also always use > wb on APUs, there will never be AGP variants. > > Signed-off-by: Alex Deucher Reviewed-by: Michel D?nzer -- Earthling Michel D?nzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer
[Bug 24097] screen backlight off after resume-from-suspend when using ATI KMS
https://bugs.freedesktop.org/show_bug.cgi?id=24097 stekman at sedata.org changed: What|Removed |Added CC||stekman at sedata.org --- Comment #13 from stekman at sedata.org 2012-05-04 00:49:55 PDT --- (In reply to comment #12) > Is this still an issue? If so, what is blocking its progress? It is still an issue for me at least. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
On 03.05.2012 19:44, j.glisse at gmail.com wrote: > From: Jerome Glisse > > We need to sync with the GFX ring as ttm might have schedule bo move > on it and new command scheduled for other ring need to wait for bo > data to be in place. > > Signed-off-by: Jerome Glisse Reviewed-by: Christian K?nig > --- > drivers/gpu/drm/radeon/radeon_cs.c | 12 ++-- > include/drm/radeon_drm.h |1 - > 2 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_cs.c > b/drivers/gpu/drm/radeon/radeon_cs.c > index 82f2e7b0..e5f8e17 100644 > --- a/drivers/gpu/drm/radeon/radeon_cs.c > +++ b/drivers/gpu/drm/radeon/radeon_cs.c > @@ -122,15 +122,15 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser > *p) > int i, r; > > for (i = 0; i< p->nrelocs; i++) { > + struct radeon_fence *fence; > + > if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj) > continue; > > - if (!(p->relocs[i].flags& RADEON_RELOC_DONT_SYNC)) { > - struct radeon_fence *fence = > p->relocs[i].robj->tbo.sync_obj; > - if (fence->ring != p->ring&& > !radeon_fence_signaled(fence)) { > - sync_to_ring[fence->ring] = true; > - need_sync = true; > - } > + fence = p->relocs[i].robj->tbo.sync_obj; > + if (fence->ring != p->ring&& !radeon_fence_signaled(fence)) { > + sync_to_ring[fence->ring] = true; > + need_sync = true; > } > } > > diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h > index 7c491b4..5805686 100644 > --- a/include/drm/radeon_drm.h > +++ b/include/drm/radeon_drm.h > @@ -926,7 +926,6 @@ struct drm_radeon_cs_chunk { > }; > > /* drm_radeon_cs_reloc.flags */ > -#define RADEON_RELOC_DONT_SYNC 0x01 > > struct drm_radeon_cs_reloc { > uint32_thandle;
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Bart Verwilst changed: What|Removed |Added CC||bart at verwilst.be --- Comment #15 from Bart Verwilst 2012-05-04 08:10:21 --- I can reproduce the lockups easily by switching from my 2 monitors in default mode to dual screen mode. Lockups start happening right away. Worked flawlessy with Ubuntu 11.10's kernel/radeon driver. If there's anything i can do to help debug this? -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
>> >> From: Jerome Glisse >> >> We need to sync with the GFX ring as ttm might have schedule bo move >> on it and new command scheduled for other ring need to wait for bo >> data to be in place. >> Is this required for -fixes? if so it doesn't apply clean. Dave.
[PATCH] drm/radeon: fix possible lack of synchronization btw ttm and other ring
On 04.05.2012 10:42, Dave Airlie wrote: >>> From: Jerome Glisse >>> >>> We need to sync with the GFX ring as ttm might have schedule bo move >>> on it and new command scheduled for other ring need to wait for bo >>> data to be in place. >>> > Is this required for -fixes? if so it doesn't apply clean. Nope, only drm-next, since there isn't any public available client that makes use of it. Christian.
Linux 3.4-rc4
>> >> FWIW, for me EDID failure on new kernels is 100% reproducible, and there >> are no such checksum errors in the log. ?It's just missing. >> >> > Just a crazy thought, but didn't we change some timings related to >> > EDID retrieval? To make it faster. >> >> OK, this time bisecting started off relatively smoothly (doing the same >> "backwards" bisect on the branch-o-reverts as last time), but then my >> disk died halfway through... > [...] > > OK, system is back online and I finished the bisection. ?The commit that > broke it for me is the following, and reverting it on top of 3.3.4 + the > "make VGA work at all" patch fixes this particular issue for me. > Can you test with the attached patch? its a revert mostly of Ben's patch, and he says with the i2c core change stuff is working for him again. Dave. -- next part -- A non-text attachment was scrubbed... Name: 0001-drm-nouveau-i2c-resume-use-of-i2c-algo-bit-rather-th.patch Type: application/octet-stream Size: 6614 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20120504/7142f2b3/attachment.obj>
[PATCH v2] libdrm: add exynos drm support
this patch adds libdrm_exynos helper layer that inclues some intefaces for exynos specific gem and virtual display driver and also adds exynos module name to modtest and vbltest. Changelog v2: - fixed exynos broken ioctl. the pointer of uint64_t *edid should be removed. - removed unnecessary definitions. - added drm prime interfaces. this feature is used to share a buffer between drivers or memory managers and for this, please, refer to below links: http://www.mjmwired.net/kernel/Documentation/dma-buf-sharing.txt http://lwn.net/Articles/488664/ this patch is based on a link below: git://anongit.freedesktop.org/mesa/drm commit id: d72a44c7c4f5eea9c1e5bb0c36cb9e0224b9ca22 Reviewed-by: Rob Clark Reviewed-by: Alex Deucher Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- Makefile.am|6 +- configure.ac | 13 ++ exynos/Makefile.am | 22 +++ exynos/exynos_drm.c| 396 exynos/exynos_drm.h| 149 + exynos/exynos_drmif.h | 88 ++ exynos/libdrm_exynos.pc| 11 ++ exynos/libdrm_exynos.pc.in | 11 ++ tests/modetest/modetest.c |2 +- tests/vbltest/vbltest.c|2 +- 10 files changed, 697 insertions(+), 3 deletions(-) create mode 100644 exynos/Makefile.am create mode 100644 exynos/exynos_drm.c create mode 100644 exynos/exynos_drm.h create mode 100644 exynos/exynos_drmif.h create mode 100644 exynos/libdrm_exynos.pc create mode 100644 exynos/libdrm_exynos.pc.in diff --git a/Makefile.am b/Makefile.am index 4f625a1..256a8cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,11 @@ if HAVE_OMAP OMAP_SUBDIR = omap endif -SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) tests include +if HAVE_EXYNOS +EXYNOS_SUBDIR = exynos +endif + +SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) $(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) tests include libdrm_la_LTLIBRARIES = libdrm.la libdrm_ladir = $(libdir) diff --git a/configure.ac b/configure.ac index 6a1d98e..f832201 100644 --- a/configure.ac +++ b/configure.ac @@ -88,6 +88,11 @@ AC_ARG_ENABLE(omap-experimental-api, [Enable support for OMAP's experimental API (default: disabled)]), [OMAP=$enableval], [OMAP=no]) +AC_ARG_ENABLE(exynos-experimental-api, + AS_HELP_STRING([--enable-exynos-experimental-api], + [Enable support for EXYNOS's experimental API (default: disabled)]), + [EXYNOS=$enableval], [EXYNOS=no]) + dnl === dnl check compiler flags AC_DEFUN([LIBDRM_CC_TRY_FLAG], [ @@ -191,6 +196,11 @@ if test "x$OMAP" = xyes; then AC_DEFINE(HAVE_OMAP, 1, [Have OMAP support]) fi +AM_CONDITIONAL(HAVE_EXYNOS, [test "x$EXYNOS" = xyes]) +if test "x$EXYNOS" = xyes; then + AC_DEFINE(HAVE_EXYNOS, 1, [Have EXYNOS support]) +fi + PKG_CHECK_MODULES(CAIRO, cairo, [HAVE_CAIRO=yes], [HAVE_CAIRO=no]) if test "x$HAVE_CAIRO" = xyes; then AC_DEFINE(HAVE_CAIRO, 1, [Have cairo support]) @@ -313,6 +323,8 @@ AC_CONFIG_FILES([ nouveau/libdrm_nouveau.pc omap/Makefile omap/libdrm_omap.pc + exynos/Makefile + exynos/libdrm_exynos.pc tests/Makefile tests/modeprint/Makefile tests/modetest/Makefile @@ -333,4 +345,5 @@ echo " vmwgfx API $VMWGFX" echo " Radeon API $RADEON" echo " Nouveau API$NOUVEAU" echo " OMAP API $OMAP" +echo " EXYNOS API $EXYNOS" echo "" diff --git a/exynos/Makefile.am b/exynos/Makefile.am new file mode 100644 index 000..e782d34 --- /dev/null +++ b/exynos/Makefile.am @@ -0,0 +1,22 @@ +AM_CFLAGS = \ + $(WARN_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/exynos \ + $(PTHREADSTUBS_CFLAGS) \ + -I$(top_srcdir)/include/drm + +libdrm_exynos_la_LTLIBRARIES = libdrm_exynos.la +libdrm_exynos_ladir = $(libdir) +libdrm_exynos_la_LDFLAGS = -version-number 1:0:0 -no-undefined +libdrm_exynos_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ + +libdrm_exynos_la_SOURCES = exynos_drm.c + +libdrm_exynoscommonincludedir = ${includedir}/exynos +libdrm_exynoscommoninclude_HEADERS = exynos_drm.h + +libdrm_exynosincludedir = ${includedir}/libdrm +libdrm_exynosinclude_HEADERS = exynos_drmif.h + +pkgconfigdir = @pkgconfigdir@ +pkgconfig_DATA = libdrm_exynos.pc diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c new file mode 100644 index 000..4db755e --- /dev/null +++ b/exynos/exynos_drm.c @@ -0,0 +1,396 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distr
[git pull] updated exynos-drm-next
Hi Dave, Please pull from git://git.infradead.org/users/kmpark/linux-samsung exynos-drm-next this is based on git repository below: git://people.freedesktop.org/~airlied/linux.git drm-next commit-id: 5db578e167cfeedbd086df45cc2328b5bb9cf3fd this patch set had already been posted two week ago for review and among them one patch, userptr feature, is excluded from this time because of the issue you pointed out for now. for this, you can refer to below link: http://www.spinics.net/lists/dri-devel/msg21850.html and for Rotator and FIMC driver, RFC for them are in progress so we will post them with updated codes again in the near future. for these, you can refer to below link: http://www.spinics.net/lists/dri-devel/msg22002.html http://lwn.net/Articles/494974/ please let me know if there is any problem. Thanks, Inki Dae Inki Dae (6): drm/exynos: fixed duplicatd memory allocation bug. drm/exynos: fixed exynos_drm_gem_map_pages bug. drm/exynos: added missed vm area region mapping type. drm/exynos: added cache attribute support for gem. drm/exynos: added drm prime feature. drm/exynos: added a feature to get gem buffer information. Joonyoung Shim (6): drm/exynos: cleanup for hdmi platform data drm/exynos: use platform_get_irq_byname for hdmi drm/exynos: use threaded irq for hdmi hotplug drm/exynos: add dpms for hdmi drm/exynos: add PM functions for hdmi and mixer drm/exynos: add G2D driver Seung-Woo Kim (5): drm/exynos: fixed wrong pageflip finish event for interlace mode drm/exynos: enable dvi mode for dvi monitor drm/exynos: add additional display mode for hdmi drm/exynos: added source size to overlay structure drm/exynos: added vp scaling feature for hdmi drivers/gpu/drm/exynos/Kconfig | 12 + drivers/gpu/drm/exynos/Makefile|2 + drivers/gpu/drm/exynos/exynos_drm_buf.c| 12 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c |4 + drivers/gpu/drm/exynos/exynos_drm_crtc.h |4 + drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 272 drivers/gpu/drm/exynos/exynos_drm_dmabuf.h | 39 ++ drivers/gpu/drm/exynos/exynos_drm_drv.c| 41 ++- drivers/gpu/drm/exynos/exynos_drm_drv.h| 17 + drivers/gpu/drm/exynos/exynos_drm_g2d.c| 932 drivers/gpu/drm/exynos/exynos_drm_g2d.h| 36 ++ drivers/gpu/drm/exynos/exynos_drm_gem.c| 119 +++-- drivers/gpu/drm/exynos/exynos_drm_gem.h| 12 + drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 77 ++- drivers/gpu/drm/exynos/exynos_drm_hdmi.h |6 +- drivers/gpu/drm/exynos/exynos_drm_plane.c | 10 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 429 - drivers/gpu/drm/exynos/exynos_mixer.c | 401 ++-- drivers/gpu/drm/exynos/regs-hdmi.h |6 +- include/drm/exynos_drm.h | 99 +++- 20 files changed, 2066 insertions(+), 464 deletions(-) create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dmabuf.h create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.c create mode 100644 drivers/gpu/drm/exynos/exynos_drm_g2d.h -- 1.7.4.1
[Bug 24097] screen backlight off after resume-from-suspend when using ATI KMS
https://bugs.freedesktop.org/show_bug.cgi?id=24097 Alex Deucher changed: What|Removed |Added Status|NEW |RESOLVED Resolution||DUPLICATE --- Comment #14 from Alex Deucher 2012-05-04 05:48:46 PDT --- *** This bug has been marked as a duplicate of bug 23103 *** -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[Bug 23103] screen not lighting up on resume when using kms
https://bugs.freedesktop.org/show_bug.cgi?id=23103 Alex Deucher changed: What|Removed |Added CC||bryce at canonical.com --- Comment #73 from Alex Deucher 2012-05-04 05:48:46 PDT --- *** Bug 24097 has been marked as a duplicate of this bug. *** -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Alex Deucher changed: What|Removed |Added CC||alexdeucher at gmail.com --- Comment #16 from Alex Deucher 2012-05-04 12:50:55 --- (In reply to comment #15) > I can reproduce the lockups easily by switching from my 2 monitors in default > mode to dual screen mode. Lockups start happening right away. Worked flawlessy > with Ubuntu 11.10's kernel/radeon driver. If there's anything i can do to help > debug this? Can you track down the problematic component (kernel, ddx, mesa, etc.) and bisect? -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #17 from Bart Verwilst 2012-05-04 13:04:11 --- I managed to finally switch to dual screen mode without hangs. But while using the desktop, i have frequent hangs -> black screen -> restore loops. Using kernel 3.4.0-rc4 provided by the launchpad bugreport in comment #14. If you can give me some pointers, i'll do my best to get some more info! -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #18 from Michel D?nzer 2012-05-04 13:08:18 --- (In reply to comment #15) > I can reproduce the lockups easily by switching from my 2 monitors in default > mode to dual screen mode. Lockups start happening right away. Note that this bug report isn't about lockups per se but about the inability to recover from a lockup. You should probably look for another bug report about monitor switching causing lockups, or file your own. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[Bug 49484] New: invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 Bug #: 49484 Summary: invalid enum 0x500, invalid value 0x501 Classification: Unclassified Product: Mesa Version: 8.0 Platform: x86-64 (AMD64) OS/Version: Linux (All) Status: NEW Severity: enhancement Priority: medium Component: Drivers/DRI/R600 AssignedTo: dri-devel at lists.freedesktop.org ReportedBy: hramrach at gmail.com running D3D application in wine I get lots of err:d3d_surface:surface_allocate_surface > GL_INVALID_VALUE (0x501) from glTexImage2D @ surface.c / 2566 err:d3d_surface:surface_upload_data > GL_INVALID_ENUM (0x500) from glTexSubImage2D @ surface.c / 2349 Needless to say I get pretty much nothing visible. OpenGL renderer string: Gallium 0.4 on AMD REDWOOD OpenGL version string: 2.1 Mesa 8.0.2 Maybe wine is using a format/feature without checking it is available here. However, r600 could implement it I guess. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[Bug 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 Alex Deucher changed: What|Removed |Added Component|Drivers/DRI/R600|Drivers/Gallium/r600 -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[PATCH 1/2] ttm: add prime sharing support to TTM
From: Dave Airlie This adds the ability for ttm common code to take an SG table and use it as the backing for a slave TTM object. The drivers can then populate their GTT tables using the SG object. Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/nouveau_bo.c |2 +- drivers/gpu/drm/radeon/radeon_object.c |2 +- drivers/gpu/drm/ttm/ttm_bo.c | 14 +- drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |2 +- include/drm/ttm/ttm_bo_api.h |9 - include/drm/ttm/ttm_bo_driver.h |2 ++ 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 7d15a77..f8aa501 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -121,7 +121,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, ttm_bo_type_device, &nvbo->placement, - align >> PAGE_SHIFT, 0, false, NULL, acc_size, + align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, nouveau_bo_del_ttm); if (ret) { /* ttm will call nouveau_bo_del_ttm if it fails.. */ diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index df6a4db..1affbc9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -155,7 +155,7 @@ retry: mutex_lock(&rdev->vram_mutex); r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, &bo->placement, page_align, 0, !kernel, NULL, - acc_size, &radeon_ttm_bo_destroy); + acc_size, NULL, &radeon_ttm_bo_destroy); mutex_unlock(&rdev->vram_mutex); if (unlikely(r != 0)) { if (r != -ERESTARTSYS) { diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 1f5c67c..289e27b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -343,6 +343,16 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) if (unlikely(bo->ttm == NULL)) ret = -ENOMEM; break; + case ttm_bo_type_sg: + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT, + page_flags | TTM_PAGE_FLAG_SG, + glob->dummy_read_page); + if (unlikely(bo->ttm == NULL)) { + ret = -ENOMEM; + break; + } + bo->ttm->sg = bo->sg; + break; default: pr_err("Illegal buffer object type\n"); ret = -EINVAL; @@ -1169,6 +1179,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, bool interruptible, struct file *persistent_swap_storage, size_t acc_size, + struct sg_table *sg, void (*destroy) (struct ttm_buffer_object *)) { int ret = 0; @@ -1223,6 +1234,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, bo->seq_valid = false; bo->persistent_swap_storage = persistent_swap_storage; bo->acc_size = acc_size; + bo->sg = sg; atomic_inc(&bo->glob->bo_count); ret = ttm_bo_check_placement(bo, placement); @@ -1312,7 +1324,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev, ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, buffer_start, interruptible, - persistent_swap_storage, acc_size, NULL); + persistent_swap_storage, acc_size, NULL, NULL); if (likely(ret == 0)) *p_bo = bo; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index a37abb5..22bf9a2 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c @@ -1567,7 +1567,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, ret = ttm_bo_init(bdev, &vmw_bo->base, size, ttm_bo_type_device, placement, 0, 0, interruptible, - NULL, acc_size, bo_free); + NULL, acc_size, NULL, bo_free); return ret; } diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 974c8f8..e15f2a8 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h @@ -124,11 +124,15 @@ struct ttm_mem_reg { * * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, * but they cannot be accessed from user-space. For kernel-only use. + * + * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another + *
[PATCH 2/2] nouveau: add PRIME support
From: Dave Airlie This adds prime->fd and fd->prime support to nouveau, it passes the SG object to TTM, and then populates the GART entries using it. Signed-off-by: Dave Airlie --- drivers/gpu/drm/nouveau/Makefile |2 +- drivers/gpu/drm/nouveau/nouveau_bo.c | 39 +++-- drivers/gpu/drm/nouveau/nouveau_channel.c |2 +- drivers/gpu/drm/nouveau/nouveau_drv.c |8 ++- drivers/gpu/drm/nouveau/nouveau_drv.h | 10 ++- drivers/gpu/drm/nouveau/nouveau_fence.c |2 +- drivers/gpu/drm/nouveau/nouveau_gem.c |6 +- drivers/gpu/drm/nouveau/nouveau_mem.c |2 +- drivers/gpu/drm/nouveau/nouveau_prime.c | 132 + drivers/gpu/drm/nouveau/nouveau_sgdma.c |5 +- drivers/gpu/drm/nouveau/nouveau_vm.c | 57 drivers/gpu/drm/nouveau/nouveau_vm.h |6 +- drivers/gpu/drm/nouveau/nv04_crtc.c |2 +- drivers/gpu/drm/nouveau/nv50_crtc.c |4 +- drivers/gpu/drm/nouveau/nv50_evo.c|4 +- drivers/gpu/drm/nouveau/nvd0_display.c|6 +- 16 files changed, 262 insertions(+), 25 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nouveau_prime.c diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 1a2ad7e..01f1335 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile @@ -37,7 +37,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ nv50_calc.o \ nv04_pm.o nv40_pm.o nv50_pm.o nva3_pm.o nvc0_pm.o \ nv50_vram.o nvc0_vram.o \ -nv50_vm.o nvc0_vm.o +nv50_vm.o nvc0_vm.o nouveau_prime.o nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG) += nouveau_debugfs.o nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index f8aa501..4daf1dd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -89,12 +89,17 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags, int nouveau_bo_new(struct drm_device *dev, int size, int align, uint32_t flags, uint32_t tile_mode, uint32_t tile_flags, + struct sg_table *sg, struct nouveau_bo **pnvbo) { struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_bo *nvbo; size_t acc_size; int ret; + int type = ttm_bo_type_device; + + if (sg) + type = ttm_bo_type_sg; nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); if (!nvbo) @@ -120,8 +125,8 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, sizeof(struct nouveau_bo)); ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, - ttm_bo_type_device, &nvbo->placement, - align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, + type, &nvbo->placement, + align >> PAGE_SHIFT, 0, false, NULL, acc_size, sg, nouveau_bo_del_ttm); if (ret) { /* ttm will call nouveau_bo_del_ttm if it fails.. */ @@ -817,9 +822,14 @@ nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) } else if (new_mem && new_mem->mem_type == TTM_PL_TT && nvbo->page_shift == vma->vm->spg_shift) { - nouveau_vm_map_sg(vma, 0, new_mem-> - num_pages << PAGE_SHIFT, - new_mem->mm_node); + if (((struct nouveau_mem *)new_mem->mm_node)->sg) + nouveau_vm_map_sg_table(vma, 0, new_mem-> + num_pages << PAGE_SHIFT, + new_mem->mm_node); + else + nouveau_vm_map_sg(vma, 0, new_mem-> + num_pages << PAGE_SHIFT, + new_mem->mm_node); } else { nouveau_vm_unmap(vma); } @@ -1058,10 +1068,16 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm) struct drm_device *dev; unsigned i; int r; + bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG); if (ttm->state != tt_unpopulated) return 0; + if (slave && ttm->sg) { + ttm->state = tt_unbound; + return 0; + } + dev_priv = nouveau_bdev(ttm->bdev); dev = dev_priv->dev; @@ -1106,6 +1122,10 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) struct drm_nouveau_private *dev_priv; struct drm_device *dev; unsigned i; + bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG); + + if (slave)
[PATCH] i915: add dmabuf/prime buffer sharing support.
From: Dave Airlie This adds handle->fd and fd->handle support to i915, this is to allow for offloading of rendering in one direction and outputs in the other. Signed-off-by: Dave Airlie --- drivers/gpu/drm/i915/Makefile |3 +- drivers/gpu/drm/i915/i915_drv.c|8 ++- drivers/gpu/drm/i915/i915_drv.h| 11 +++ drivers/gpu/drm/i915/i915_gem.c| 11 ++- drivers/gpu/drm/i915/i915_gem_dmabuf.c | 149 drivers/gpu/drm/i915/i915_gem_gtt.c| 18 +++- 6 files changed, 193 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gem_dmabuf.c diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index ce7fc77..72d1293 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -34,7 +34,8 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ dvo_ch7017.o \ dvo_ivch.o \ dvo_tfp410.o \ - dvo_sil164.o + dvo_sil164.o \ + i915_gem_dmabuf.o i915-$(CONFIG_COMPAT) += i915_ioc32.o diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index ae8a64f..30b0132 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -901,7 +901,7 @@ static struct drm_driver driver = { */ .driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ - DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM, + DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME, .load = i915_driver_load, .unload = i915_driver_unload, .open = i915_driver_open, @@ -924,6 +924,12 @@ static struct drm_driver driver = { .gem_init_object = i915_gem_init_object, .gem_free_object = i915_gem_free_object, .gem_vm_ops = &i915_gem_vm_ops, + + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_export = i915_gem_prime_export, + .gem_prime_import = i915_gem_prime_import, + .dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_mmap_gtt, .dumb_destroy = i915_gem_dumb_destroy, diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 5fabc6c..a42b1c5 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -890,6 +890,8 @@ struct drm_i915_gem_object { struct scatterlist *sg_list; int num_sg; + /* prime dma-buf support */ + struct sg_table *sg_table; /** * Used for performing relocations during execbuffer insertion. */ @@ -1205,6 +1207,8 @@ int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj); void i915_gem_release_mmap(struct drm_i915_gem_object *obj); void i915_gem_lastclose(struct drm_device *dev); +int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, + gfp_t gfpmask); int __must_check i915_mutex_lock_interruptible(struct drm_device *dev); int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj); void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, @@ -1301,6 +1305,13 @@ i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev, int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, enum i915_cache_level cache_level); +struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, + struct dma_buf *dma_buf); + +struct dma_buf *i915_gem_prime_export(struct drm_device *dev, + struct drm_gem_object *gem_obj, int flags); + + /* i915_gem_gtt.c */ int __must_check i915_gem_init_aliasing_ppgtt(struct drm_device *dev); void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0d1e4b7..06ca09b 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -35,6 +35,7 @@ #include #include #include +#include static __must_check int i915_gem_object_flush_gpu_write_domain(struct drm_i915_gem_object *obj); static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj); @@ -1374,8 +1375,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, return i915_gem_mmap_gtt(file, dev, args->handle, &args->offset); } - -static int +int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, gfp_t gfpmask) { @@ -1384,6 +1384,8 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, struct inode *inode; struct page *page; + if (obj->pages || obj->sg_table) + return 0; /* Get the list of pages out of our struct file. They'll be pinned * at this point until we release them. */ @@ -1425,6 +1427,8 @@ i915_gem
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 --- Comment #19 from J?r?me Glisse 2012-05-04 14:21:53 --- Please one persone one bug report we will mark appropriate bug as duplicate. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[git pull] drm fixes
Some minor fixes from Intel and a radeon fix. I have the nouveau fix for the i2c regression queued for next week, its mostly a revert and seems to work on the system it was originally introduced for thanks to some i2c core changes. Dave. The following changes since commit addde4ec31456c5f1e9b61aae3edcfeb0f338f87: nouveau: initialise has_optimus variable. (2012-05-03 09:30:58 +0100) are available in the git repository at: git://people.freedesktop.org/~airlied/linux drm-fixes Alex Deucher (1): drm/radeon: clarify and extend wb setup on APUs and NI+ asics Chris Wilson (2): drm/i915: Do not read non-existent DPLL registers on PCH hardware drm/i915: Only enable IPS polling for gen5 Dave Airlie (1): Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes Marc Gariepy (1): fixing dmi match for hp t5745 and hp st5747 thin client Paulo Zanoni (1): drm/i915: enable dip before writing data on gen4 drivers/gpu/drm/i915/i915_debugfs.c|3 +++ drivers/gpu/drm/i915/i915_dma.c| 15 ++- drivers/gpu/drm/i915/intel_display.c |9 + drivers/gpu/drm/i915/intel_hdmi.c |2 +- drivers/gpu/drm/i915/intel_lvds.c |4 ++-- drivers/gpu/drm/radeon/radeon_device.c |4 ++-- 6 files changed, 23 insertions(+), 14 deletions(-)
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This should fix : https://bugzilla.redhat.com/show_bug.cgi?id=726143 Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 4fbc590..5fd0490 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable HDP on eDP or LVDS help to avoid +* issue such as: +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.7.6
[PATCH 1/2] ttm: add prime sharing support to TTM
On Fri, May 04, 2012 at 02:46:54PM +0100, Dave Airlie wrote: > From: Dave Airlie > > This adds the ability for ttm common code to take an SG table > and use it as the backing for a slave TTM object. I took a look at both patches from the perspective of the TTM DMA pool code and it looks fine (thought I would prefer to test this first - but I don't have the hardware). What I am curious is that you are allowing to map two or more of SG pages to different PCI devices. And for that you are using the nouveau_gem_map_dma_buf, which does this (roughly) ttm->sg = sg_alloc_table(). for_each_sg() sg->dma_address[i] = dma_map(..) So I am seeing two potential issues: 1). ttm->sg = sg_alloc() is called on every new other device. In other words, if you end up with three of these attachment PCI devices you are going to cause an memory leak of the sg_alloc() and over-write the ttm->sg every time. But I might be misreading how the import code works. 2). You are going to put in sg->dma_address() in of different PCI devices. Meaning - the dma address might have a different value depending on whether there is an different IOMMU for each of the devices. On x86 that is usually not the case (the odd ball being the IBM high-end boxes that have an Calgary-X IOMMU for PCI buses). What this means is that the DMA address you are programming in the sub-sequent PCI devices might the DMA address for a previous PCI device. But both of these issues are only a problem if the slave cards have a different PCI device. If they are the same - then I think you are OK (except the multiple calls to import which would cause a memory leak). > > The drivers can then populate their GTT tables using the SG object. > > Signed-off-by: Dave Airlie > --- > drivers/gpu/drm/nouveau/nouveau_bo.c |2 +- > drivers/gpu/drm/radeon/radeon_object.c |2 +- > drivers/gpu/drm/ttm/ttm_bo.c | 14 +- > drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |2 +- > include/drm/ttm/ttm_bo_api.h |9 - > include/drm/ttm/ttm_bo_driver.h |2 ++ > 6 files changed, 26 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c > b/drivers/gpu/drm/nouveau/nouveau_bo.c > index 7d15a77..f8aa501 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -121,7 +121,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int > align, > > ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, > ttm_bo_type_device, &nvbo->placement, > - align >> PAGE_SHIFT, 0, false, NULL, acc_size, > + align >> PAGE_SHIFT, 0, false, NULL, acc_size, NULL, > nouveau_bo_del_ttm); > if (ret) { > /* ttm will call nouveau_bo_del_ttm if it fails.. */ > diff --git a/drivers/gpu/drm/radeon/radeon_object.c > b/drivers/gpu/drm/radeon/radeon_object.c > index df6a4db..1affbc9 100644 > --- a/drivers/gpu/drm/radeon/radeon_object.c > +++ b/drivers/gpu/drm/radeon/radeon_object.c > @@ -155,7 +155,7 @@ retry: > mutex_lock(&rdev->vram_mutex); > r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, > &bo->placement, page_align, 0, !kernel, NULL, > - acc_size, &radeon_ttm_bo_destroy); > + acc_size, NULL, &radeon_ttm_bo_destroy); > mutex_unlock(&rdev->vram_mutex); > if (unlikely(r != 0)) { > if (r != -ERESTARTSYS) { > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index 1f5c67c..289e27b 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -343,6 +343,16 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, > bool zero_alloc) > if (unlikely(bo->ttm == NULL)) > ret = -ENOMEM; > break; > + case ttm_bo_type_sg: > + bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << > PAGE_SHIFT, > + page_flags | > TTM_PAGE_FLAG_SG, > + glob->dummy_read_page); > + if (unlikely(bo->ttm == NULL)) { > + ret = -ENOMEM; > + break; > + } > + bo->ttm->sg = bo->sg; > + break; > default: > pr_err("Illegal buffer object type\n"); > ret = -EINVAL; > @@ -1169,6 +1179,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, > bool interruptible, > struct file *persistent_swap_storage, > size_t acc_size, > + struct sg_table *sg, > void (*destroy) (struct ttm_buffer_object *)) > { > int ret = 0; > @@ -1223,6 +1234,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, > bo->seq_valid = false; > bo->per
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
On Fre, 2012-05-04 at 10:28 -0400, j.glisse at gmail.com wrote: > From: Jerome Glisse > > It seems imac pannel doesn't like whe we change the hot plug setup > and then refuse to work. This should fix : > https://bugzilla.redhat.com/show_bug.cgi?id=726143 > > Signed-off-by: Matthew Garrett > Signed-off-by: Jerome Glisse [...] > + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || > + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { > + /* don't try to enable HDP on eDP or LVDS help to avoid I think this should say 'HPD', not 'HDP'. -- Earthling Michel D?nzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer
[PATCH 1/2] ttm: add prime sharing support to TTM
On Fri, May 4, 2012 at 3:33 PM, Konrad Rzeszutek Wilk wrote: > On Fri, May 04, 2012 at 02:46:54PM +0100, Dave Airlie wrote: >> From: Dave Airlie >> >> This adds the ability for ttm common code to take an SG table >> and use it as the backing for a slave TTM object. > > I took a look at both patches from the perspective of the TTM DMA pool > code and it looks fine (thought I would prefer to test this first - but > I don't have the hardware). > > What I am curious is that you are allowing to map two or more > of SG pages to different PCI devices. And for that you are using > the nouveau_gem_map_dma_buf, which does this (roughly) > > ?ttm->sg = sg_alloc_table(). > ?for_each_sg() > ? ? ? ?sg->dma_address[i] = dma_map(..) > > So I am seeing two potential issues: > ?1). ttm->sg = sg_alloc() is called on every new other device. > ? ?In other words, if you end up with three of these attachment PCI devices > ? ?you are going to cause an memory leak of the sg_alloc() and over-write > ? ?the ttm->sg every time. But I might be misreading how the import code > ? ?works. I think you are mixing up the export and import sides. The export side takes a TTM object, and create an sg table mapped into the importers address space. The import side takes an exported sg_table and wraps an object around it. So for multiple importers, there are multiple sg_tables. For one import there should only be one sg_table per object. > ?2). You are going to put in sg->dma_address() in of different PCI devices. > ? ? Meaning - the dma address might have a different value depending on > ? ? whether there is an different IOMMU for each of the devices. > ? ? On x86 that is usually not the case (the odd ball being the IBM high-end > ? ? boxes that have an Calgary-X IOMMU for PCI buses). > ? ?What this means is that the DMA address you are programming in > ? ?the sub-sequent PCI devices might the DMA address for a previous PCI > ? ?device. > > But both of these issues are only a problem if the slave cards have > a different PCI device. If they are the same - then I think you are OK > (except the multiple calls to import which would cause a memory leak). Yeah we need to stop a slave calling map_dma_buf multiple times, but we block that by keeping a list of currently imported buffer handles. Dave.
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector
On Fri, May 4, 2012 at 10:44 AM, Michel D?nzer wrote: > On Fre, 2012-05-04 at 10:28 -0400, j.glisse at gmail.com wrote: >> From: Jerome Glisse >> >> It seems imac pannel doesn't like whe we change the hot plug setup >> and then refuse to work. This should fix : >> https://bugzilla.redhat.com/show_bug.cgi?id=726143 >> >> Signed-off-by: Matthew Garrett >> Signed-off-by: Jerome Glisse > [...] >> + ? ? ? ? ? ? if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || >> + ? ? ? ? ? ? ? ? connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { >> + ? ? ? ? ? ? ? ? ? ? /* don't try to enable HDP on eDP or LVDS help to avoid > > I think this should say 'HPD', not 'HDP'. It should :) v2 on its way > > -- > Earthling Michel D?nzer ? ? ? ? ? | ? ? ? ? ? ? ? ? ? http://www.amd.com > Libre software enthusiast ? ? ? ? | ? ? ? ? ?Debian, X and DRI developer
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector v2
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This help but doesn't fully fix: https://bugzilla.redhat.com/show_bug.cgi?id=726143 v2: fix typo and improve commit message Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 694b6b2..a304c9d 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable hpd on eDP or LVDS avoid breaking the +* aux dp channel on imac and help (but not completely fix) +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.9.3
[PATCH] drm/radeon: don't mess with hot plug detect for eDP or LVDS connector v2
From: Jerome Glisse It seems imac pannel doesn't like whe we change the hot plug setup and then refuse to work. This help but doesn't fully fix: https://bugzilla.redhat.com/show_bug.cgi?id=726143 v2: fix typo and improve commit message Signed-off-by: Matthew Garrett Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/r600.c |8 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 694b6b2..a304c9d 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -713,6 +713,14 @@ void r600_hpd_init(struct radeon_device *rdev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || + connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { + /* don't try to enable hpd on eDP or LVDS avoid breaking the +* aux dp channel on imac and help (but not completely fix) +* https://bugzilla.redhat.com/show_bug.cgi?id=726143 +*/ + continue; + } if (ASIC_IS_DCE3(rdev)) { u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa); if (ASIC_IS_DCE32(rdev)) -- 1.7.9.3
[PATCH] drm/radeon: eliminate redundant connector_names table
connector_names table is just a repeat of information that already exists in drm_connector_enum_list and the same string can be retrieved using drm_get_connector_name function. Nuke the redundant table and use the proper function to retrieve the connector name. Signed-off-by: Ilija Hadzic --- drivers/gpu/drm/radeon/radeon_display.c | 20 +--- 1 files changed, 1 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8086c96..60aecc5 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -572,24 +572,6 @@ static const char *encoder_names[36] = { "TRAVIS", }; -static const char *connector_names[15] = { - "Unknown", - "VGA", - "DVI-I", - "DVI-D", - "DVI-A", - "Composite", - "S-video", - "LVDS", - "Component", - "DIN", - "DisplayPort", - "HDMI-A", - "HDMI-B", - "TV", - "eDP", -}; - static const char *hpd_names[6] = { "HPD1", "HPD2", @@ -612,7 +594,7 @@ static void radeon_print_display_setup(struct drm_device *dev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { radeon_connector = to_radeon_connector(connector); DRM_INFO("Connector %d:\n", i); - DRM_INFO(" %s\n", connector_names[connector->connector_type]); + DRM_INFO(" %s\n", drm_get_connector_name(connector)); if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) DRM_INFO(" %s\n", hpd_names[radeon_connector->hpd.hpd]); if (radeon_connector->ddc_bus) { -- 1.7.8.5
[Bug 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 --- Comment #1 from Michal Suchanek 2012-05-04 09:22:37 PDT --- Does not work with recent git either. Perhaps more useful is this part of the log: fixme:d3d:debug_d3dformat Unrecognized 0x34324644 (as fourcc: DF24) WINED3DFORMAT! fixme:d3d:wined3d_get_format Can't find format unrecognized (0x34324644) in the format lookup table -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[Bug 42678] [3.3-rc1] radeon stuck in kernel after lockup
https://bugzilla.kernel.org/show_bug.cgi?id=42678 Alexandre Demers changed: What|Removed |Added CC||alexandre.f.demers at gmail.co ||m --- Comment #20 from Alexandre Demers 2012-05-04 17:27:14 --- As a side note, it could be related to Bug 45018. For me, it all started at the same time. Since, it happens a lot less with latest drm, ddx, mesa, kernel and X server, but it still happens from time to time randomly. As I was saying it may be related, or not, but since everything happened at the same time as Bug 45018 and using a 3.2 kernel fixes most of what I see, I think there is a similar root to all this. I can usually reproduce the lockup followed by a stucked X by playing a movie (this is the easiest way I've been able to do it or with what I reported in bug 45018). It often locks up after nearly 40 minutes of video. In a few seconds, image skips, turns greenish on some parts, and BAM! Locks up, resets and hangs with X unable to come back on its feet. Lately, in some occasions, it was able to get in X, but everything related to 3D is then dead. I may have missed it, but which video card/chipset is Maciej using? Radeon 6950 over here. -- Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are watching the assignee of the bug.
[Bug 49484] invalid enum 0x500, invalid value 0x501
https://bugs.freedesktop.org/show_bug.cgi?id=49484 --- Comment #2 from Ian Romanick 2012-05-04 11:21:17 PDT --- Can you: - Run wine (and your app) in GDB. - Set a breakpoint at _mesa_warning. - Provide the output of 'bt full' -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug.
[Intel-gfx] [RFC] Reduce idle vblank wakeups
Anyone have any further thoughts on this? -- Matthew Garrett | mjg59 at srcf.ucam.org
[RFC] fence, sa allocator, ib pool, semaphore rework
First chunk rework fence to use uin64_t, unlike previous patch, we only emit the lower 32 bits with the hw. The upper 32bits is handled in the fence process function where a lenghty comment discuss all the possible things that can go wrong and why it doesn't matter. Then taking advantage of faster fence querying, the sa allocator is simplified and improved. The commit message describe the algorithm used. Taking advantage of that ib & semaphore is simplified to use the same temporary ring related manager. To finish all this, more code is axed and simplified. It all need the previous 17 patches and the various other small fixes. To make it easier i regrouped all the patch needed at : http://people.freedesktop.org/~glisse/reset5/base/ Those patch should hit next soon. The whole patchset can also be found at : http://people.freedesktop.org/~glisse/reset5/ It all got limited testing so far, but i tried hard to make sure that each step is working and thus bisectable. I split the fence rework in 2 part so one can bisect if either the move to 64bits fence or the complete change in fence handling logic is causing trouble. Cheers, Jerome
[PATCH 01/18] drm/radeon: replace the per ring mutex with a global one
From: Christian K?nig A single global mutex for ring submissions seems sufficient. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h |3 +- drivers/gpu/drm/radeon/radeon_device.c|3 +- drivers/gpu/drm/radeon/radeon_pm.c| 10 +- drivers/gpu/drm/radeon/radeon_ring.c | 28 +++--- drivers/gpu/drm/radeon/radeon_semaphore.c | 42 + 5 files changed, 41 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 729d332..71d8af8 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -667,7 +667,6 @@ struct radeon_ring { uint64_tgpu_addr; uint32_talign_mask; uint32_tptr_mask; - struct mutexmutex; boolready; u32 ptr_reg_shift; u32 ptr_reg_mask; @@ -806,6 +805,7 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsign int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw); void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp); void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp); +void radeon_ring_undo(struct radeon_ring *ring); void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp); int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp); void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring *ring); @@ -1516,6 +1516,7 @@ struct radeon_device { rwlock_tfence_lock; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; struct radeon_semaphore_driver semaphore_drv; + struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; struct radeon_ib_pool ib_pool; struct radeon_irq irq; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 93615d1..ad3a7fb 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -724,8 +724,7 @@ int radeon_device_init(struct radeon_device *rdev, * can recall function without having locking issues */ radeon_mutex_init(&rdev->cs_mutex); radeon_mutex_init(&rdev->ib_pool.mutex); - for (i = 0; i < RADEON_NUM_RINGS; ++i) - mutex_init(&rdev->ring[i].mutex); + mutex_init(&rdev->ring_lock); mutex_init(&rdev->dc_hw_i2c_mutex); if (rdev->family >= CHIP_R600) spin_lock_init(&rdev->ih.lock); diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index caa55d6..7c38745 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -252,10 +252,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) mutex_lock(&rdev->ddev->struct_mutex); mutex_lock(&rdev->vram_mutex); - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - if (rdev->ring[i].ring_obj) - mutex_lock(&rdev->ring[i].mutex); - } + mutex_lock(&rdev->ring_lock); /* gui idle int has issues on older chips it seems */ if (rdev->family >= CHIP_R600) { @@ -311,10 +308,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev) rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - if (rdev->ring[i].ring_obj) - mutex_unlock(&rdev->ring[i].mutex); - } + mutex_unlock(&rdev->ring_lock); mutex_unlock(&rdev->vram_mutex); mutex_unlock(&rdev->ddev->struct_mutex); } diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 2eb4c6e..a4d60ae 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -346,9 +346,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi if (ndw < ring->ring_free_dw) { break; } - mutex_unlock(&ring->mutex); + mutex_unlock(&rdev->ring_lock); r = radeon_fence_wait_next(rdev, radeon_ring_index(rdev, ring)); - mutex_lock(&ring->mutex); + mutex_lock(&rdev->ring_lock); if (r) return r; } @@ -361,10 +361,10 @@ int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *ring, unsig { int r; - mutex_lock(&ring->mutex); + mutex_lock(&rdev->ring_lock); r = radeon_ring_alloc(rdev, ring, ndw); if (r) { - mutex_unlock(&ring->mutex); + mutex_unlock(&rdev->ring_lock);
[PATCH 02/18] drm/radeon: convert fence to uint64_t v3
From: Jerome Glisse This convert fence to use uint64_t sequence number intention is to use the fact that uin64_t is big enough that we don't need to care about wrap around. Tested with and without writeback using 0xF000 as initial fence sequence and thus allowing to test the wrap around from 32bits to 64bits. v2: Add comment about possible race btw CPU & GPU, add comment stressing that we need 2 dword aligned for R600_WB_EVENT_OFFSET Read fence sequenc in reverse order of GPU write them so we mitigate the race btw CPU and GPU. v3: Drop the need for ring to emit the 64bits fence, and just have each ring emit the lower 32bits of the fence sequence. We handle the wrap over 32bits in fence_process. Signed-off-by: Jerome Glisse Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h | 39 ++- drivers/gpu/drm/radeon/radeon_fence.c | 116 +++-- drivers/gpu/drm/radeon/radeon_ring.c |9 ++- 3 files changed, 107 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 71d8af8..4d9c433 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -100,28 +100,32 @@ extern int radeon_lockup_timeout; * Copy from radeon_drv.h so we don't have to include both and have conflicting * symbol; */ -#define RADEON_MAX_USEC_TIMEOUT10 /* 100 ms */ -#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) +#define RADEON_MAX_USEC_TIMEOUT10 /* 100 ms */ +#define RADEON_FENCE_JIFFIES_TIMEOUT (HZ / 2) /* RADEON_IB_POOL_SIZE must be a power of 2 */ -#define RADEON_IB_POOL_SIZE16 -#define RADEON_DEBUGFS_MAX_COMPONENTS 32 -#define RADEONFB_CONN_LIMIT4 -#define RADEON_BIOS_NUM_SCRATCH8 +#define RADEON_IB_POOL_SIZE16 +#define RADEON_DEBUGFS_MAX_COMPONENTS 32 +#define RADEONFB_CONN_LIMIT4 +#define RADEON_BIOS_NUM_SCRATCH8 /* max number of rings */ -#define RADEON_NUM_RINGS 3 +#define RADEON_NUM_RINGS 3 + +/* fence seq are set to this number when signaled */ +#define RADEON_FENCE_SIGNALED_SEQ 0LL +#define RADEON_FENCE_NOTEMITED_SEQ (~0LL) /* internal ring indices */ /* r1xx+ has gfx CP ring */ -#define RADEON_RING_TYPE_GFX_INDEX 0 +#define RADEON_RING_TYPE_GFX_INDEX 0 /* cayman has 2 compute CP rings */ -#define CAYMAN_RING_TYPE_CP1_INDEX 1 -#define CAYMAN_RING_TYPE_CP2_INDEX 2 +#define CAYMAN_RING_TYPE_CP1_INDEX 1 +#define CAYMAN_RING_TYPE_CP2_INDEX 2 /* hardcode those limit for now */ -#define RADEON_VA_RESERVED_SIZE(8 << 20) -#define RADEON_IB_VM_MAX_SIZE (64 << 10) +#define RADEON_VA_RESERVED_SIZE(8 << 20) +#define RADEON_IB_VM_MAX_SIZE (64 << 10) /* * Errata workarounds. @@ -254,8 +258,9 @@ struct radeon_fence_driver { uint32_tscratch_reg; uint64_tgpu_addr; volatile uint32_t *cpu_addr; - atomic_tseq; - uint32_tlast_seq; + /* seq is protected by ring emission lock */ + uint64_tseq; + atomic64_t last_seq; unsigned long last_activity; wait_queue_head_t queue; struct list_heademitted; @@ -268,11 +273,9 @@ struct radeon_fence { struct kref kref; struct list_headlist; /* protected by radeon_fence.lock */ - uint32_tseq; - boolemitted; - boolsignaled; + uint64_tseq; /* RB, DMA, etc. */ - int ring; + unsignedring; struct radeon_semaphore *semaphore; }; diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 5bb78bf..0d3d226 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -66,14 +66,14 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) unsigned long irq_flags; write_lock_irqsave(&rdev->fence_lock, irq_flags); - if (fence->emitted) { + if (fence->seq && fence->seq < RADEON_FENCE_NOTEMITED_SEQ) { write_unlock_irqrestore(&rdev->fence_lock, irq_flags); return 0; } - fence->seq = atomic_add_return(1, &rdev->fence_drv[fence->ring].seq); + /* we are protected by the ring emission mutex */ + fence->seq = rdev->fence_drv[fence->ring].seq++; radeon_fence_ring_emit(rdev, fence->ring, fence)
[PATCH 03/18] drm/radeon: rework fence handling, drop fence list v5
From: Jerome Glisse Using 64bits fence sequence we can directly compare sequence number to know if a fence is signaled or not. Thus the fence list became useless, so does the fence lock that mainly protected the fence list. Things like ring.ready are no longer behind a lock, this should be ok as ring.ready is initialized once and will only change when facing lockup. Worst case is that we return an -EBUSY just after a successfull GPU reset, or we go into wait state instead of returning -EBUSY (thus delaying reporting -EBUSY to fence wait caller). v2: Remove left over comment, force using writeback on cayman and newer, thus not having to suffer from possibly scratch reg exhaustion v3: Rebase on top of change to uint64 fence patch v4: Change DCE5 test to force write back on cayman and newer but also any APU such as PALM or SUMO family v5: Rebase on top of new uint64 fence patch Signed-off-by: Jerome Glisse Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h|6 +- drivers/gpu/drm/radeon/radeon_device.c |8 +- drivers/gpu/drm/radeon/radeon_fence.c | 287 +--- 3 files changed, 123 insertions(+), 178 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4d9c433..2928139 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -263,15 +263,12 @@ struct radeon_fence_driver { atomic64_t last_seq; unsigned long last_activity; wait_queue_head_t queue; - struct list_heademitted; - struct list_headsignaled; boolinitialized; }; struct radeon_fence { struct radeon_device*rdev; struct kref kref; - struct list_headlist; /* protected by radeon_fence.lock */ uint64_tseq; /* RB, DMA, etc. */ @@ -291,7 +288,7 @@ int radeon_fence_wait_next(struct radeon_device *rdev, int ring); int radeon_fence_wait_empty(struct radeon_device *rdev, int ring); struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); void radeon_fence_unref(struct radeon_fence **fence); -int radeon_fence_count_emitted(struct radeon_device *rdev, int ring); +unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); /* * Tiling registers @@ -1516,7 +1513,6 @@ struct radeon_device { struct radeon_mode_info mode_info; struct radeon_scratch scratch; struct radeon_mman mman; - rwlock_tfence_lock; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; struct radeon_semaphore_driver semaphore_drv; struct mutexring_lock; diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ad3a7fb..cb4f9c2 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -225,9 +225,9 @@ int radeon_wb_init(struct radeon_device *rdev) /* disable event_write fences */ rdev->wb.use_event = false; /* disabled via module param */ - if (radeon_no_wb == 1) + if (radeon_no_wb == 1) { rdev->wb.enabled = false; - else { + } else { if (rdev->flags & RADEON_IS_AGP) { /* often unreliable on AGP */ rdev->wb.enabled = false; @@ -237,8 +237,9 @@ int radeon_wb_init(struct radeon_device *rdev) } else { rdev->wb.enabled = true; /* event_write fences are only available on r600+ */ - if (rdev->family >= CHIP_R600) + if (rdev->family >= CHIP_R600) { rdev->wb.use_event = true; + } } } /* always use writeback/events on NI, APUs */ @@ -731,7 +732,6 @@ int radeon_device_init(struct radeon_device *rdev, mutex_init(&rdev->gem.mutex); mutex_init(&rdev->pm.mutex); mutex_init(&rdev->vram_mutex); - rwlock_init(&rdev->fence_lock); rwlock_init(&rdev->semaphore_drv.lock); INIT_LIST_HEAD(&rdev->gem.objects); init_waitqueue_head(&rdev->irq.vblank_queue); diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 0d3d226..1610601 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -63,30 +63,18 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring) int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) { - unsigned long irq_flags; - - write_lock_irqsave(&rdev->fence_lock, irq_flags); + /* we are protected by the ring emission mutex */
[PATCH 04/18] drm/radeon: hold ring emission mutex for lockup detection
From: Christian K?nig We are locking the ring emission mutex anyway, so there is no harm in doing it a bit earlier and prevent multiple resets to happen at the same time. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon_fence.c | 10 +- drivers/gpu/drm/radeon/radeon_ring.c |2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 1610601..99c31b2 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -258,8 +258,11 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, if (seq != atomic64_read(&rdev->fence_drv[ring].last_seq)) { continue; } + + mutex_lock(&rdev->ring_lock); /* test if somebody else has already decided that this is a lockup */ if (last_activity != rdev->fence_drv[ring].last_activity) { + mutex_unlock(&rdev->ring_lock); continue; } @@ -273,15 +276,12 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, rdev->fence_drv[i].last_activity = jiffies; } - /* change last activity so nobody else think there is a lockup */ - for (i = 0; i < RADEON_NUM_RINGS; ++i) { - rdev->fence_drv[i].last_activity = jiffies; - } - /* mark the ring as not ready any more */ rdev->ring[ring].ready = false; + mutex_unlock(&rdev->ring_lock); return -EDEADLK; } + mutex_unlock(&rdev->ring_lock); } } return 0; diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 4ae222b..8b7f00e 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -408,7 +408,6 @@ void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring * { int r; - mutex_lock(&rdev->ring_lock); radeon_ring_free_size(rdev, ring); if (ring->rptr == ring->wptr) { r = radeon_ring_alloc(rdev, ring, 1); @@ -417,7 +416,6 @@ void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring * radeon_ring_commit(rdev, ring); } } - mutex_unlock(&rdev->ring_lock); } void radeon_ring_lockup_update(struct radeon_ring *ring) -- 1.7.7.6
[PATCH 05/18] drm/radeon: use inline functions to calc sa_bo addr
From: Christian K?nig Instead of hacking the calculation multiple times. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon_gart.c |6 ++ drivers/gpu/drm/radeon/radeon_object.h| 11 +++ drivers/gpu/drm/radeon/radeon_ring.c |6 ++ drivers/gpu/drm/radeon/radeon_semaphore.c |6 ++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index c58a036..4a5d9d4 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -404,10 +404,8 @@ retry: radeon_vm_unbind(rdev, vm_evict); goto retry; } - vm->pt = rdev->vm_manager.sa_manager.cpu_ptr; - vm->pt += (vm->sa_bo.offset >> 3); - vm->pt_gpu_addr = rdev->vm_manager.sa_manager.gpu_addr; - vm->pt_gpu_addr += vm->sa_bo.offset; + vm->pt = radeon_sa_bo_cpu_addr(&vm->sa_bo); + vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(&vm->sa_bo); memset(vm->pt, 0, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8)); retry_id: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index f9104be..c120ab9 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -146,6 +146,17 @@ extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, /* * sub allocation */ + +static inline uint64_t radeon_sa_bo_gpu_addr(struct radeon_sa_bo *sa_bo) +{ + return sa_bo->manager->gpu_addr + sa_bo->offset; +} + +static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo) +{ + return sa_bo->manager->cpu_ptr + sa_bo->offset; +} + extern int radeon_sa_bo_manager_init(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, unsigned size, u32 domain); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 8b7f00e..b4c8a67 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -127,10 +127,8 @@ retry: size, 256); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; - (*ib)->ptr = rdev->ib_pool.sa_manager.cpu_ptr; - (*ib)->ptr += ((*ib)->sa_bo.offset >> 2); - (*ib)->gpu_addr = rdev->ib_pool.sa_manager.gpu_addr; - (*ib)->gpu_addr += (*ib)->sa_bo.offset; + (*ib)->ptr = radeon_sa_bo_cpu_addr(&(*ib)->sa_bo); + (*ib)->gpu_addr = radeon_sa_bo_gpu_addr(&(*ib)->sa_bo); (*ib)->fence = fence; (*ib)->vm_id = 0; (*ib)->is_const_ib = false; diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index c5b3d8e..f312ba5 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c @@ -53,10 +53,8 @@ static int radeon_semaphore_add_bo(struct radeon_device *rdev) kfree(bo); return r; } - gpu_addr = rdev->ib_pool.sa_manager.gpu_addr; - gpu_addr += bo->ib->sa_bo.offset; - cpu_ptr = rdev->ib_pool.sa_manager.cpu_ptr; - cpu_ptr += (bo->ib->sa_bo.offset >> 2); + gpu_addr = radeon_sa_bo_gpu_addr(&bo->ib->sa_bo); + cpu_ptr = radeon_sa_bo_cpu_addr(&bo->ib->sa_bo); for (i = 0; i < (RADEON_SEMAPHORE_BO_SIZE/8); i++) { bo->semaphores[i].gpu_addr = gpu_addr; bo->semaphores[i].cpu_ptr = cpu_ptr; -- 1.7.7.6
[PATCH 06/18] drm/radeon: add proper locking to the SA v3
From: Christian K?nig Make the suballocator self containing to locking. v2: split the bugfix into a seperate patch. v3: remove some unreleated changes. Sig-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h|1 + drivers/gpu/drm/radeon/radeon_sa.c |6 ++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2928139..2621794 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -381,6 +381,7 @@ struct radeon_bo_list { * alignment). */ struct radeon_sa_manager { + spinlock_t lock; struct radeon_bo*bo; struct list_headsa_bo; unsignedsize; diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index 8fbfe69..aed0a8c 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -37,6 +37,7 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev, { int r; + spin_lock_init(&sa_manager->lock); sa_manager->bo = NULL; sa_manager->size = size; sa_manager->domain = domain; @@ -139,6 +140,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, BUG_ON(align > RADEON_GPU_PAGE_SIZE); BUG_ON(size > sa_manager->size); + spin_lock(&sa_manager->lock); /* no one ? */ head = sa_manager->sa_bo.prev; @@ -172,6 +174,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, offset += wasted; if ((sa_manager->size - offset) < size) { /* failed to find somethings big enough */ + spin_unlock(&sa_manager->lock); return -ENOMEM; } @@ -180,10 +183,13 @@ out: sa_bo->offset = offset; sa_bo->size = size; list_add(&sa_bo->list, head); + spin_unlock(&sa_manager->lock); return 0; } void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo) { + spin_lock(&sa_bo->manager->lock); list_del_init(&sa_bo->list); + spin_unlock(&sa_bo->manager->lock); } -- 1.7.7.6
[PATCH 07/18] drm/radeon: add sub allocator debugfs file
From: Christian K?nig Dumping the current allocations. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon_object.h |5 + drivers/gpu/drm/radeon/radeon_ring.c | 22 ++ drivers/gpu/drm/radeon/radeon_sa.c | 14 ++ 3 files changed, 41 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index c120ab9..d9fca1e 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -172,5 +172,10 @@ extern int radeon_sa_bo_new(struct radeon_device *rdev, unsigned size, unsigned align); extern void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo); +#if defined(CONFIG_DEBUG_FS) +extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, +struct seq_file *m); +#endif + #endif diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index b4c8a67..40a8528 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -603,6 +603,23 @@ static int radeon_debugfs_ib_info(struct seq_file *m, void *data) static struct drm_info_list radeon_debugfs_ib_list[RADEON_IB_POOL_SIZE]; static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32]; static unsigned radeon_debugfs_ib_idx[RADEON_IB_POOL_SIZE]; + +static int radeon_debugfs_sa_info(struct seq_file *m, void *data) +{ + struct drm_info_node *node = (struct drm_info_node *) m->private; + struct drm_device *dev = node->minor->dev; + struct radeon_device *rdev = dev->dev_private; + + radeon_sa_bo_dump_debug_info(&rdev->ib_pool.sa_manager, m); + + return 0; + +} + +static struct drm_info_list radeon_debugfs_sa_list[] = { +{"radeon_sa_info", &radeon_debugfs_sa_info, 0, NULL}, +}; + #endif int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring) @@ -629,6 +646,11 @@ int radeon_debugfs_ib_init(struct radeon_device *rdev) { #if defined(CONFIG_DEBUG_FS) unsigned i; + int r; + + r = radeon_debugfs_add_files(rdev, radeon_debugfs_sa_list, 1); + if (r) + return r; for (i = 0; i < RADEON_IB_POOL_SIZE; i++) { sprintf(radeon_debugfs_ib_names[i], "radeon_ib_%04u", i); diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index aed0a8c..1db0568 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -193,3 +193,17 @@ void radeon_sa_bo_free(struct radeon_device *rdev, struct radeon_sa_bo *sa_bo) list_del_init(&sa_bo->list); spin_unlock(&sa_bo->manager->lock); } + +#if defined(CONFIG_DEBUG_FS) +void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, + struct seq_file *m) +{ + struct radeon_sa_bo *i; + + spin_lock(&sa_manager->lock); + list_for_each_entry(i, &sa_manager->sa_bo, list) { + seq_printf(m, "offset %08d: size %4d\n", i->offset, i->size); + } + spin_unlock(&sa_manager->lock); +} +#endif -- 1.7.7.6
[PATCH 08/18] drm/radeon: keep start and end offset in the SA
From: Christian K?nig Instead of offset + size keep start and end offset directly. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h|4 ++-- drivers/gpu/drm/radeon/radeon_cs.c |4 ++-- drivers/gpu/drm/radeon/radeon_object.h |4 ++-- drivers/gpu/drm/radeon/radeon_sa.c | 13 +++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2621794..a90cabf 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -396,8 +396,8 @@ struct radeon_sa_bo; struct radeon_sa_bo { struct list_headlist; struct radeon_sa_manager*manager; - unsignedoffset; - unsignedsize; + unsignedsoffset; + unsignedeoffset; }; /* diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index dd0fdef..ac6c9e3 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -470,7 +470,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->const_ib->gpu_addr = parser->const_ib->sa_bo.offset; + parser->const_ib->gpu_addr = parser->const_ib->sa_bo.soffset; r = radeon_ib_schedule(rdev, parser->const_ib); if (r) goto out; @@ -480,7 +480,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->ib->gpu_addr = parser->ib->sa_bo.offset; + parser->ib->gpu_addr = parser->ib->sa_bo.soffset; parser->ib->is_const_ib = false; r = radeon_ib_schedule(rdev, parser->ib); out: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index d9fca1e..99ab46a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -149,12 +149,12 @@ extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, static inline uint64_t radeon_sa_bo_gpu_addr(struct radeon_sa_bo *sa_bo) { - return sa_bo->manager->gpu_addr + sa_bo->offset; + return sa_bo->manager->gpu_addr + sa_bo->soffset; } static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo) { - return sa_bo->manager->cpu_ptr + sa_bo->offset; + return sa_bo->manager->cpu_ptr + sa_bo->soffset; } extern int radeon_sa_bo_manager_init(struct radeon_device *rdev, diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c index 1db0568..3bea7ba 100644 --- a/drivers/gpu/drm/radeon/radeon_sa.c +++ b/drivers/gpu/drm/radeon/radeon_sa.c @@ -152,11 +152,11 @@ int radeon_sa_bo_new(struct radeon_device *rdev, offset = 0; list_for_each_entry(tmp, &sa_manager->sa_bo, list) { /* room before this object ? */ - if (offset < tmp->offset && (tmp->offset - offset) >= size) { + if (offset < tmp->soffset && (tmp->soffset - offset) >= size) { head = tmp->list.prev; goto out; } - offset = tmp->offset + tmp->size; + offset = tmp->eoffset; wasted = offset % align; if (wasted) { wasted = align - wasted; @@ -166,7 +166,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev, /* room at the end ? */ head = sa_manager->sa_bo.prev; tmp = list_entry(head, struct radeon_sa_bo, list); - offset = tmp->offset + tmp->size; + offset = tmp->eoffset; wasted = offset % align; if (wasted) { wasted = align - wasted; @@ -180,8 +180,8 @@ int radeon_sa_bo_new(struct radeon_device *rdev, out: sa_bo->manager = sa_manager; - sa_bo->offset = offset; - sa_bo->size = size; + sa_bo->soffset = offset; + sa_bo->eoffset = offset + size; list_add(&sa_bo->list, head); spin_unlock(&sa_manager->lock); return 0; @@ -202,7 +202,8 @@ void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, spin_lock(&sa_manager->lock); list_for_each_entry(i, &sa_manager->sa_bo, list) { - seq_printf(m, "offset %08d: size %4d\n", i->offset, i->size); + seq_printf(m, "[%08x %08x] size %4d [%p]\n", + i->soffset, i->eoffset, i->eoffset - i->soffset, i); } spin_unlock(&sa_manager->lock); } -- 1.7.7.6
[PATCH 09/18] drm/radeon: make sa bo a stand alone object
From: Christian K?nig Allocating and freeing it seperately. Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h |4 ++-- drivers/gpu/drm/radeon/radeon_cs.c|4 ++-- drivers/gpu/drm/radeon/radeon_gart.c |4 ++-- drivers/gpu/drm/radeon/radeon_object.h|4 ++-- drivers/gpu/drm/radeon/radeon_ring.c |6 +++--- drivers/gpu/drm/radeon/radeon_sa.c| 28 +++- drivers/gpu/drm/radeon/radeon_semaphore.c |4 ++-- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a90cabf..3519a52 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -629,7 +629,7 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc); */ struct radeon_ib { - struct radeon_sa_bo sa_bo; + struct radeon_sa_bo *sa_bo; unsignedidx; uint32_tlength_dw; uint64_tgpu_addr; @@ -684,7 +684,7 @@ struct radeon_vm { unsignedlast_pfn; u64 pt_gpu_addr; u64 *pt; - struct radeon_sa_bo sa_bo; + struct radeon_sa_bo *sa_bo; struct mutexmutex; /* last fence for cs using this vm */ struct radeon_fence *fence; diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index ac6c9e3..2aa3f89 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c @@ -470,7 +470,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->const_ib->gpu_addr = parser->const_ib->sa_bo.soffset; + parser->const_ib->gpu_addr = parser->const_ib->sa_bo->soffset; r = radeon_ib_schedule(rdev, parser->const_ib); if (r) goto out; @@ -480,7 +480,7 @@ static int radeon_cs_ib_vm_chunk(struct radeon_device *rdev, /* ib pool is bind at 0 in virtual address space to gpu_addr is the * offset inside the pool bo */ - parser->ib->gpu_addr = parser->ib->sa_bo.soffset; + parser->ib->gpu_addr = parser->ib->sa_bo->soffset; parser->ib->is_const_ib = false; r = radeon_ib_schedule(rdev, parser->ib); out: diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 4a5d9d4..c5789ef 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -404,8 +404,8 @@ retry: radeon_vm_unbind(rdev, vm_evict); goto retry; } - vm->pt = radeon_sa_bo_cpu_addr(&vm->sa_bo); - vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(&vm->sa_bo); + vm->pt = radeon_sa_bo_cpu_addr(vm->sa_bo); + vm->pt_gpu_addr = radeon_sa_bo_gpu_addr(vm->sa_bo); memset(vm->pt, 0, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8)); retry_id: diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 99ab46a..4fc7f07 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -168,10 +168,10 @@ extern int radeon_sa_bo_manager_suspend(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager); extern int radeon_sa_bo_new(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, - struct radeon_sa_bo *sa_bo, + struct radeon_sa_bo **sa_bo, unsigned size, unsigned align); extern void radeon_sa_bo_free(struct radeon_device *rdev, - struct radeon_sa_bo *sa_bo); + struct radeon_sa_bo **sa_bo); #if defined(CONFIG_DEBUG_FS) extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, struct seq_file *m); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 40a8528..739554c 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -127,8 +127,8 @@ retry: size, 256); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; - (*ib)->ptr = radeon_sa_bo_cpu_addr(&(*ib)->sa_bo); - (*ib)->gpu_addr = radeon_sa_bo_gpu_addr(&(*ib)->sa_bo); + (*ib)->ptr = radeon_sa_bo_cpu_addr((*ib)->sa_bo); + (*ib)->gpu_addr = radeon_sa_bo_gpu_addr((*ib)->sa
[PATCH 10/18] drm/radeon: define new SA interface v2
From: Christian K?nig Define the interface without modifying the allocation algorithm in any way. v2: rebase on top of fence new uint64 patch Signed-off-by: Jerome Glisse Signed-off-by: Christian K?nig --- drivers/gpu/drm/radeon/radeon.h |1 + drivers/gpu/drm/radeon/radeon_gart.c |6 +- drivers/gpu/drm/radeon/radeon_object.h|5 +- drivers/gpu/drm/radeon/radeon_ring.c |8 ++-- drivers/gpu/drm/radeon/radeon_sa.c| 60 drivers/gpu/drm/radeon/radeon_semaphore.c |2 +- 6 files changed, 63 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 3519a52..c78f15b 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -398,6 +398,7 @@ struct radeon_sa_bo { struct radeon_sa_manager*manager; unsignedsoffset; unsignedeoffset; + struct radeon_fence *fence; }; /* diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index c5789ef..53dba8e 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -326,7 +326,7 @@ static void radeon_vm_unbind_locked(struct radeon_device *rdev, rdev->vm_manager.use_bitmap &= ~(1 << vm->id); list_del_init(&vm->list); vm->id = -1; - radeon_sa_bo_free(rdev, &vm->sa_bo); + radeon_sa_bo_free(rdev, &vm->sa_bo, NULL); vm->pt = NULL; list_for_each_entry(bo_va, &vm->va, vm_list) { @@ -395,7 +395,7 @@ int radeon_vm_bind(struct radeon_device *rdev, struct radeon_vm *vm) retry: r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, &vm->sa_bo, RADEON_GPU_PAGE_ALIGN(vm->last_pfn * 8), -RADEON_GPU_PAGE_SIZE); +RADEON_GPU_PAGE_SIZE, false); if (r) { if (list_empty(&rdev->vm_manager.lru_vm)) { return r; @@ -426,7 +426,7 @@ retry_id: /* do hw bind */ r = rdev->vm_manager.funcs->bind(rdev, vm, id); if (r) { - radeon_sa_bo_free(rdev, &vm->sa_bo); + radeon_sa_bo_free(rdev, &vm->sa_bo, NULL); return r; } rdev->vm_manager.use_bitmap |= 1 << id; diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 4fc7f07..befec7d 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h @@ -169,9 +169,10 @@ extern int radeon_sa_bo_manager_suspend(struct radeon_device *rdev, extern int radeon_sa_bo_new(struct radeon_device *rdev, struct radeon_sa_manager *sa_manager, struct radeon_sa_bo **sa_bo, - unsigned size, unsigned align); + unsigned size, unsigned align, bool block); extern void radeon_sa_bo_free(struct radeon_device *rdev, - struct radeon_sa_bo **sa_bo); + struct radeon_sa_bo **sa_bo, + struct radeon_fence *fence); #if defined(CONFIG_DEBUG_FS) extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager, struct seq_file *m); diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 739554c..c84af9c 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -85,7 +85,7 @@ bool radeon_ib_try_free(struct radeon_device *rdev, struct radeon_ib *ib) if (ib->fence && ib->fence->seq < RADEON_FENCE_NOTEMITED_SEQ) { if (radeon_fence_signaled(ib->fence)) { radeon_fence_unref(&ib->fence); - radeon_sa_bo_free(rdev, &ib->sa_bo); + radeon_sa_bo_free(rdev, &ib->sa_bo, NULL); done = true; } } @@ -124,7 +124,7 @@ retry: if (rdev->ib_pool.ibs[idx].fence == NULL) { r = radeon_sa_bo_new(rdev, &rdev->ib_pool.sa_manager, &rdev->ib_pool.ibs[idx].sa_bo, -size, 256); +size, 256, false); if (!r) { *ib = &rdev->ib_pool.ibs[idx]; (*ib)->ptr = radeon_sa_bo_cpu_addr((*ib)->sa_bo); @@ -173,7 +173,7 @@ void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib) } radeon_mutex_lock(&rdev->ib_pool.mutex); if (tmp->fence && tmp->fence->seq == RADEON_FENCE_NOTEMITED_SEQ) { - radeon_sa_bo_free(rdev, &tmp->sa_bo); + radeon_sa_bo_free(rdev, &tmp->sa_bo, NULL);
[PATCH 11/18] drm/radeon: use one wait queue for all rings add fence_wait_any
From: Jerome Glisse Use one wait queue for all rings. When one ring progress, other likely does to and we are not expecting to have a lot of waiter anyway. Also add a fence_wait_any that will wait until the first fence in the fence array (one fence per ring) is signaled. This allow to wait on all rings. Signed-off-by: Christian K?nig Signed-off-by: Jerome Glisse --- drivers/gpu/drm/radeon/radeon.h |5 +- drivers/gpu/drm/radeon/radeon_fence.c | 151 +++- 2 files changed, 150 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index c78f15b..6f8d0f5 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -262,7 +262,6 @@ struct radeon_fence_driver { uint64_tseq; atomic64_t last_seq; unsigned long last_activity; - wait_queue_head_t queue; boolinitialized; }; @@ -286,6 +285,9 @@ bool radeon_fence_signaled(struct radeon_fence *fence); int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); int radeon_fence_wait_next(struct radeon_device *rdev, int ring); int radeon_fence_wait_empty(struct radeon_device *rdev, int ring); +int radeon_fence_wait_any(struct radeon_device *rdev, + struct radeon_fence **fences, + bool intr); struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); void radeon_fence_unref(struct radeon_fence **fence); unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring); @@ -1516,6 +1518,7 @@ struct radeon_device { struct radeon_scratch scratch; struct radeon_mman mman; struct radeon_fence_driver fence_drv[RADEON_NUM_RINGS]; + wait_queue_head_t fence_queue; struct radeon_semaphore_driver semaphore_drv; struct mutexring_lock; struct radeon_ring ring[RADEON_NUM_RINGS]; diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 99c31b2..9c2c1b3 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -233,11 +233,11 @@ static int radeon_wait_seq(struct radeon_device *rdev, u64 target_seq, trace_radeon_fence_wait_begin(rdev->ddev, seq); radeon_irq_kms_sw_irq_get(rdev, ring); if (intr) { - r = wait_event_interruptible_timeout(rdev->fence_drv[ring].queue, + r = wait_event_interruptible_timeout(rdev->fence_queue, (signaled = radeon_seq_signaled(rdev, target_seq, ring)), timeout); } else { - r = wait_event_timeout(rdev->fence_drv[ring].queue, + r = wait_event_timeout(rdev->fence_queue, (signaled = radeon_seq_signaled(rdev, target_seq, ring)), timeout); } @@ -304,6 +304,147 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr) return 0; } +bool radeon_seq_any_signaled(struct radeon_device *rdev, u64 *seq) +{ + unsigned i, j; + + for (i = 0; i < RADEON_NUM_RINGS; ++i) { + /* poll new last sequence at least once */ + for (j = 0; j < 2; j++) { + if (atomic64_read(&rdev->fence_drv[i].last_seq) >= seq[i]) { + return true; + } + radeon_fence_poll(rdev, i); + } + } + return false; +} + +static int radeon_wait_seq_any(struct radeon_device *rdev, u64 *target_seq, + bool intr) +{ + unsigned long timeout, last_activity, tmp; + unsigned i, ring = 0; + bool signaled; + int r; + + /* use the most recent one as indicator */ + for (i = 0, last_activity = 0; i < RADEON_NUM_RINGS; ++i) { + if (time_after(rdev->fence_drv[i].last_activity, last_activity)) { + last_activity = rdev->fence_drv[i].last_activity; + } + /* For lockup detection we just pick one of the ring we are +* actively waiting for +*/ + if (target_seq[i]) { + ring = i; + } + } + while (!radeon_seq_any_signaled(rdev, target_seq)) { + timeout = jiffies - RADEON_FENCE_JIFFIES_TIMEOUT; + if (time_after(last_activity, timeout)) { + /* the normal case, timeout is somewhere before last_activity */ + timeout = last_activity - timeout; +