Re: [PATCH] Set RADEON_GEM_NO_CPU_ACCESS flag for BOs which don't need CPU access

2016-01-28 Thread Alex Deucher
On Thu, Jan 28, 2016 at 4:34 AM, Michel Dänzer  wrote:
> From: Michel Dänzer 
>
> Failing to do this was resulting in the kernel driver unnecessarily
> leaving open the possibility of CPU access to those BOs.
>
> Signed-off-by: Michel Dänzer 

Reviewed-by: Alex Deucher 

> ---
>  src/drmmode_display.c  | 6 --
>  src/radeon.h   | 4 
>  src/radeon_bo_helper.c | 7 +--
>  src/radeon_kms.c   | 3 ++-
>  4 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 0424dbd..14f6a55 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -549,7 +549,8 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
> size = RADEON_ALIGN(rotate_pitch * aligned_height, 
> RADEON_GPU_PAGE_SIZE);
>
> scanout->bo = radeon_bo_open(drmmode->bufmgr, 0, size, base_align,
> -RADEON_GEM_DOMAIN_VRAM, 0);
> +RADEON_GEM_DOMAIN_VRAM,
> +RADEON_GEM_NO_CPU_ACCESS);
> if (scanout->bo == NULL)
> return NULL;
>
> @@ -1917,7 +1918,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, 
> int height)
> info->front_bo = radeon_bo_open(info->bufmgr, 0, screen_size, 
> base_align,
> info->shadow_primary ?
> RADEON_GEM_DOMAIN_GTT :
> -   RADEON_GEM_DOMAIN_VRAM, 0);
> +   RADEON_GEM_DOMAIN_VRAM,
> +   tiling_flags ? 
> RADEON_GEM_NO_CPU_ACCESS : 0);
> if (!info->front_bo)
> goto fail;
>
> diff --git a/src/radeon.h b/src/radeon.h
> index 0ee6adc..5cec12b 100644
> --- a/src/radeon.h
> +++ b/src/radeon.h
> @@ -66,6 +66,10 @@
>  #include "xf86drm.h"
>  #include "radeon_drm.h"
>
> +#ifndef RADEON_GEM_NO_CPU_ACCESS
> +#define RADEON_GEM_NO_CPU_ACCESS   (1 << 4)
> +#endif
> +
>  #ifdef DAMAGE
>  #include "damage.h"
>  #include "globals.h"
> diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c
> index ce964e0..531bc45 100644
> --- a/src/radeon_bo_helper.c
> +++ b/src/radeon_bo_helper.c
> @@ -74,7 +74,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int 
> height, int depth,
>  int pitch, base_align;
>  uint32_t size, heighta;
>  int cpp = bitsPerPixel / 8;
> -uint32_t tiling = 0;
> +uint32_t tiling = 0, flags = 0;
>  struct radeon_surface surface;
>  struct radeon_bo *bo;
>  int domain = RADEON_GEM_DOMAIN_VRAM;
> @@ -181,8 +181,11 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int 
> height, int depth,
> }
> }
>
> +if (tiling)
> +   flags |= RADEON_GEM_NO_CPU_ACCESS;
> +
>  bo = radeon_bo_open(info->bufmgr, 0, size, base_align,
> -   domain, 0);
> +   domain, flags);
>
>  if (bo && tiling && radeon_bo_set_tiling(bo, tiling, pitch) == 0)
> *new_tiling = tiling;
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index 971f11c..38f5c4e 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -1981,7 +1981,8 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
>  base_align,
>  info->shadow_primary ?
>  RADEON_GEM_DOMAIN_GTT :
> -RADEON_GEM_DOMAIN_VRAM, 0);
> +RADEON_GEM_DOMAIN_VRAM,
> +tiling_flags ? 
> RADEON_GEM_NO_CPU_ACCESS : 0);
>  if (info->r600_shadow_fb == TRUE) {
>  if (radeon_bo_map(info->front_bo, 1)) {
>  ErrorF("Failed to map cursor buffer memory\n");
> --
> 2.7.0
>
> ___
> xorg-driver-ati mailing list
> xorg-driver-ati@lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 93746] Black screen when reconnecting display

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93746

--- Comment #9 from Bernd Steinhauser  ---
(In reply to Michel Dänzer from comment #8)
> (In reply to Bernd Steinhauser from comment #7)
> > I'm not a 100% sure, but quite certain, that I couldn't reproduce this bug
> > with kernel 4.2.5, so I think it's at least related to the linked email.
> 
> The problem referenced there was only introduced in 4.4, so if you can
> reproduce this with 4.3, it's probably a different issue; can you bisect in
> that case?

Will try, but it could take a while, don't know if I find time for that during
the weekend.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 93746] Black screen when reconnecting display with DRI3

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93746

--- Comment #7 from Bernd Steinhauser  ---
I'm not a 100% sure, but quite certain, that I couldn't reproduce this bug with
kernel 4.2.5, so I think it's at least related to the linked email.

I also was able to reproduce this in such a way, that all screens go black.
>From the description of the option, I think that this was because I didn't have
TearFree set.

So I'm not sure anymore if it is really a separate bug or a dupe of 90987.
Could be that the options just change the buffer behavior in such a way that it
can either be fixed by switching to VT2 or not.
If it's the same, I would have been able to reproduce with 4.2.5, with the
effect described in bug 90987.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 93746] Black screen when reconnecting display

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93746

Bernd Steinhauser  changed:

   What|Removed |Added

Summary|Black screen when   |Black screen when
   |reconnecting display with   |reconnecting display
   |DRI3|

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH] Set RADEON_GEM_NO_CPU_ACCESS flag for BOs which don't need CPU access

2016-01-28 Thread Michel Dänzer
From: Michel Dänzer 

Failing to do this was resulting in the kernel driver unnecessarily
leaving open the possibility of CPU access to those BOs.

Signed-off-by: Michel Dänzer 
---
 src/drmmode_display.c  | 6 --
 src/radeon.h   | 4 
 src/radeon_bo_helper.c | 7 +--
 src/radeon_kms.c   | 3 ++-
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0424dbd..14f6a55 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -549,7 +549,8 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
size = RADEON_ALIGN(rotate_pitch * aligned_height, 
RADEON_GPU_PAGE_SIZE);
 
scanout->bo = radeon_bo_open(drmmode->bufmgr, 0, size, base_align,
-RADEON_GEM_DOMAIN_VRAM, 0);
+RADEON_GEM_DOMAIN_VRAM,
+RADEON_GEM_NO_CPU_ACCESS);
if (scanout->bo == NULL)
return NULL;
 
@@ -1917,7 +1918,8 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int 
height)
info->front_bo = radeon_bo_open(info->bufmgr, 0, screen_size, 
base_align,
info->shadow_primary ?
RADEON_GEM_DOMAIN_GTT :
-   RADEON_GEM_DOMAIN_VRAM, 0);
+   RADEON_GEM_DOMAIN_VRAM,
+   tiling_flags ? RADEON_GEM_NO_CPU_ACCESS 
: 0);
if (!info->front_bo)
goto fail;
 
diff --git a/src/radeon.h b/src/radeon.h
index 0ee6adc..5cec12b 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -66,6 +66,10 @@
 #include "xf86drm.h"
 #include "radeon_drm.h"
 
+#ifndef RADEON_GEM_NO_CPU_ACCESS
+#define RADEON_GEM_NO_CPU_ACCESS   (1 << 4)
+#endif
+
 #ifdef DAMAGE
 #include "damage.h"
 #include "globals.h"
diff --git a/src/radeon_bo_helper.c b/src/radeon_bo_helper.c
index ce964e0..531bc45 100644
--- a/src/radeon_bo_helper.c
+++ b/src/radeon_bo_helper.c
@@ -74,7 +74,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int 
height, int depth,
 int pitch, base_align;
 uint32_t size, heighta;
 int cpp = bitsPerPixel / 8;
-uint32_t tiling = 0;
+uint32_t tiling = 0, flags = 0;
 struct radeon_surface surface;
 struct radeon_bo *bo;
 int domain = RADEON_GEM_DOMAIN_VRAM;
@@ -181,8 +181,11 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int 
height, int depth,
}
}
 
+if (tiling)
+   flags |= RADEON_GEM_NO_CPU_ACCESS;
+
 bo = radeon_bo_open(info->bufmgr, 0, size, base_align,
-   domain, 0);
+   domain, flags);
 
 if (bo && tiling && radeon_bo_set_tiling(bo, tiling, pitch) == 0)
*new_tiling = tiling;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 971f11c..38f5c4e 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1981,7 +1981,8 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 base_align,
 info->shadow_primary ?
 RADEON_GEM_DOMAIN_GTT :
-RADEON_GEM_DOMAIN_VRAM, 0);
+RADEON_GEM_DOMAIN_VRAM,
+tiling_flags ? 
RADEON_GEM_NO_CPU_ACCESS : 0);
 if (info->r600_shadow_fb == TRUE) {
 if (radeon_bo_map(info->front_bo, 1)) {
 ErrorF("Failed to map cursor buffer memory\n");
-- 
2.7.0

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[PATCH xf86-video-amdgpu] Only map front buffer if glamor acceleration is disabled (v2)

2016-01-28 Thread Michel Dänzer
From: Michel Dänzer 

Otherwise the front buffer may not be accessible by the CPU, because Mesa
sets the AMDGPU_GEM_CREATE_NO_CPU_ACCESS flag for tiled buffers, because
accessing tiled buffers with the CPU makes little sense.

v2: Also handle Option "AccelMethod" "none"
Signed-off-by: Michel Dänzer 
---
 src/amdgpu_kms.c  | 3 ++-
 src/drmmode_display.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index e090c25..b9e4eb7 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1431,7 +1431,8 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
return FALSE;
}
 
-   if (amdgpu_bo_map(pScrn, info->front_buffer)) {
+   if (!info->use_glamor &&
+   amdgpu_bo_map(pScrn, info->front_buffer) != 0) {
ErrorF("Failed to map front buffer memory\n");
return FALSE;
}
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 3f015f9..40a134c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1741,7 +1741,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int 
width, int height)
goto fail;
}
 
-   if (amdgpu_bo_map(scrn, info->front_buffer)) {
+   if (!info->use_glamor && amdgpu_bo_map(scrn, info->front_buffer) != 0) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
   "Failed to map front buffer memory\n");
goto fail;
-- 
2.7.0

___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 90987] xorg black screen after monitor power off, AMD r9 270X, aoc u2868pqu, displayport

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90987

--- Comment #9 from Bernd Steinhauser  ---
Created attachment 121360
  --> https://bugs.freedesktop.org/attachment.cgi?id=121360=edit
dmesg output

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 90987] xorg black screen after monitor power off, AMD r9 270X, aoc u2868pqu, displayport

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90987

--- Comment #10 from Bernd Steinhauser  ---
Created attachment 121361
  --> https://bugs.freedesktop.org/attachment.cgi?id=121361=edit
Xorg log

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 90987] xorg black screen after monitor power off, AMD r9 270X, aoc u2868pqu, displayport

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90987

--- Comment #11 from Bernd Steinhauser  ---
I think I was able to reproduce this bug with linux 4.2.5, but the behavior was
slightly different.
The screens went black for about 2s (pointer was still visible), just like
described, but then things returned to normal.
This was with the pageflip option set to on. With off, I wasn't able to
reproduce this.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


[Bug 93746] Black screen when reconnecting display

2016-01-28 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93746

--- Comment #8 from Michel Dänzer  ---
(In reply to Bernd Steinhauser from comment #7)
> I'm not a 100% sure, but quite certain, that I couldn't reproduce this bug
> with kernel 4.2.5, so I think it's at least related to the linked email.

The problem referenced there was only introduced in 4.4, so if you can
reproduce this with 4.3, it's probably a different issue; can you bisect in
that case?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati


Re: [PATCH xf86-video-amdgpu] Only map front buffer if glamor acceleration is disabled (v2)

2016-01-28 Thread Alex Deucher
On Thu, Jan 28, 2016 at 3:23 AM, Michel Dänzer  wrote:
> From: Michel Dänzer 
>
> Otherwise the front buffer may not be accessible by the CPU, because Mesa
> sets the AMDGPU_GEM_CREATE_NO_CPU_ACCESS flag for tiled buffers, because
> accessing tiled buffers with the CPU makes little sense.
>
> v2: Also handle Option "AccelMethod" "none"
> Signed-off-by: Michel Dänzer 

Reviewed-by: Alex Deucher 

> ---
>  src/amdgpu_kms.c  | 3 ++-
>  src/drmmode_display.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
> index e090c25..b9e4eb7 100644
> --- a/src/amdgpu_kms.c
> +++ b/src/amdgpu_kms.c
> @@ -1431,7 +1431,8 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen)
> return FALSE;
> }
>
> -   if (amdgpu_bo_map(pScrn, info->front_buffer)) {
> +   if (!info->use_glamor &&
> +   amdgpu_bo_map(pScrn, info->front_buffer) != 0) {
> ErrorF("Failed to map front buffer memory\n");
> return FALSE;
> }
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 3f015f9..40a134c 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1741,7 +1741,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, 
> int width, int height)
> goto fail;
> }
>
> -   if (amdgpu_bo_map(scrn, info->front_buffer)) {
> +   if (!info->use_glamor && amdgpu_bo_map(scrn, info->front_buffer) != 
> 0) {
> xf86DrvMsg(scrn->scrnIndex, X_ERROR,
>"Failed to map front buffer memory\n");
> goto fail;
> --
> 2.7.0
>
> ___
> xorg-driver-ati mailing list
> xorg-driver-ati@lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-driver-ati
___
xorg-driver-ati mailing list
xorg-driver-ati@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-ati