[Bug 82588] X fails to start with linus-tip or drm-next

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=82588

--- Comment #9 from jospezial  ---
Reverting these two patches did not help. Tested with 3.17.0-rc3 .

Btw, reverting the second patch was not so easy.

radeon_ring.c was splitted up and the patch had to be applied to radeon_ib.c .

the first patch has been reverted here:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=b738ca5d68e4051c86e32f46f67a69f3bb9cee5e

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/3aa4cca6/attachment.html>


[PATCH 18/18] intel: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 intel/intel_bufmgr_gem.c | 15 +++
 intel/test_decode.c  |  4 ++--
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 0e1cb0d..a527f41 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -48,7 +48,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -955,11 +954,11 @@ drm_intel_gem_bo_free(drm_intel_bo *bo)
DRMLISTDEL(_gem->vma_list);
if (bo_gem->mem_virtual) {
VG(VALGRIND_FREELIKE_BLOCK(bo_gem->mem_virtual, 0));
-   munmap(bo_gem->mem_virtual, bo_gem->bo.size);
+   drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size);
bufmgr_gem->vma_count--;
}
if (bo_gem->gtt_virtual) {
-   munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
+   drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
bufmgr_gem->vma_count--;
}

@@ -1044,12 +1043,12 @@ static void 
drm_intel_gem_bo_purge_vma_cache(drm_intel_bufmgr_gem *bufmgr_gem)
DRMLISTDELINIT(_gem->vma_list);

if (bo_gem->mem_virtual) {
-   munmap(bo_gem->mem_virtual, bo_gem->bo.size);
+   drm_munmap(bo_gem->mem_virtual, bo_gem->bo.size);
bo_gem->mem_virtual = NULL;
bufmgr_gem->vma_count--;
}
if (bo_gem->gtt_virtual) {
-   munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
+   drm_munmap(bo_gem->gtt_virtual, bo_gem->bo.size);
bo_gem->gtt_virtual = NULL;
bufmgr_gem->vma_count--;
}
@@ -1271,9 +1270,9 @@ map_gtt(drm_intel_bo *bo)
}

/* and mmap it */
-   bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
-  MAP_SHARED, bufmgr_gem->fd,
-  mmap_arg.offset);
+   bo_gem->gtt_virtual = drm_mmap(0, bo->size, PROT_READ | 
PROT_WRITE,
+  MAP_SHARED, bufmgr_gem->fd,
+  mmap_arg.offset);
if (bo_gem->gtt_virtual == MAP_FAILED) {
bo_gem->gtt_virtual = NULL;
ret = -errno;
diff --git a/intel/test_decode.c b/intel/test_decode.c
index bef9d99..d7025f0 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -32,9 +32,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 

+#include "libdrm.h"
 #include "intel_bufmgr.h"
 #include "intel_chipset.h"

@@ -64,7 +64,7 @@ read_file(const char *filename, void **ptr, size_t *size)
errx(1, "couldn't stat `%s'", filename);

*size = st.st_size;
-   *ptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+   *ptr = drm_mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (*ptr == MAP_FAILED)
errx(1, "couldn't map `%s'", filename);

-- 
2.0.2



[PATCH 17/18] freedreno: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 freedreno/freedreno_bo.c | 4 ++--
 freedreno/freedreno_priv.h   | 1 -
 freedreno/kgsl/kgsl_bo.c | 2 +-
 freedreno/kgsl/kgsl_ringbuffer.c | 4 ++--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index 3a2e464..89d3330 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -288,7 +288,7 @@ out:
 static void bo_del(struct fd_bo *bo)
 {
if (bo->map)
-   munmap(bo->map, bo->size);
+   drm_munmap(bo->map, bo->size);

/* TODO probably bo's in bucket list get removed from
 * handle table??
@@ -351,7 +351,7 @@ drm_public void * fd_bo_map(struct fd_bo *bo)
return NULL;
}

-   bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
+   bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE, 
MAP_SHARED,
bo->dev->fd, offset);
if (bo->map == MAP_FAILED) {
ERROR_MSG("mmap failed: %s", strerror(errno));
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 416a3b3..48bff13 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c
index c868097..4e492dd 100644
--- a/freedreno/kgsl/kgsl_bo.c
+++ b/freedreno/kgsl/kgsl_bo.c
@@ -186,7 +186,7 @@ fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t 
size)
 * thinks the buffer hasn't be allocate and fails
 */
if (bo) {
-   void *fbmem = mmap(NULL, size, PROT_READ | PROT_WRITE,
+   void *fbmem = drm_mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fbfd, 0);
struct kgsl_map_user_mem req = {
.memtype = KGSL_USER_MEM_TYPE_ADDR,
diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c
index dc3c9c2..da99741 100644
--- a/freedreno/kgsl/kgsl_ringbuffer.c
+++ b/freedreno/kgsl/kgsl_ringbuffer.c
@@ -60,7 +60,7 @@ static void kgsl_rb_bo_del(struct kgsl_rb_bo *bo)
};
int ret;

-   munmap(bo->hostptr, bo->size);
+   drm_munmap(bo->hostptr, bo->size);

ret = ioctl(bo->pipe->fd, IOCTL_KGSL_SHAREDMEM_FREE, );
if (ret) {
@@ -93,7 +93,7 @@ static struct kgsl_rb_bo * kgsl_rb_bo_new(struct kgsl_pipe 
*pipe, uint32_t size)
bo->pipe = pipe;
bo->gpuaddr = req.gpuaddr;
bo->size = size;
-   bo->hostptr = mmap(NULL, size, PROT_WRITE|PROT_READ,
+   bo->hostptr = drm_mmap(NULL, size, PROT_WRITE|PROT_READ,
MAP_SHARED, pipe->fd, req.gpuaddr);

return bo;
-- 
2.0.2



[PATCH 16/18] radeon: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 radeon/radeon_bo_gem.c  | 7 +++
 radeon/radeon_cs_gem.c  | 1 -
 radeon/radeon_surface.c | 1 -
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c
index 251ec1b..e78303a 100644
--- a/radeon/radeon_bo_gem.c
+++ b/radeon/radeon_bo_gem.c
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "libdrm.h"
 #include "xf86drm.h"
@@ -135,7 +134,7 @@ static struct radeon_bo *bo_unref(struct radeon_bo_int *boi)
 return (struct radeon_bo *)boi;
 }
 if (bo_gem->priv_ptr) {
-munmap(bo_gem->priv_ptr, boi->size);
+drm_munmap(bo_gem->priv_ptr, boi->size);
 }

 /* Zero out args to make valgrind happy */
@@ -179,7 +178,7 @@ static int bo_map(struct radeon_bo_int *boi, int write)
 boi, boi->handle, r);
 return r;
 }
-ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, 
args.addr_ptr);
+ptr = drm_mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, 
boi->bom->fd, args.addr_ptr);
 if (ptr == MAP_FAILED)
 return -errno;
 bo_gem->priv_ptr = ptr;
@@ -198,7 +197,7 @@ static int bo_unmap(struct radeon_bo_int *boi)
 if (--bo_gem->map_count > 0) {
 return 0;
 }
-//munmap(bo->ptr, bo->size);
+//drm_munmap(bo->ptr, bo->size);
 boi->ptr = NULL;
 return 0;
 }
diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c
index 2020e1a..705ee05 100644
--- a/radeon/radeon_cs_gem.c
+++ b/radeon/radeon_cs_gem.c
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "radeon_cs.h"
 #include "radeon_cs_int.h"
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index 40a544a..0723425 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "drm.h"
 #include "libdrm.h"
-- 
2.0.2



[PATCH 15/18] nouveau: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 nouveau/nouveau.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 43f0d3c..da49e17 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -33,11 +33,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 

 #include 
 #include 
+#include "libdrm.h"
 #include "libdrm_lists.h"
 #include "nouveau_drm.h"

@@ -381,7 +381,7 @@ nouveau_bo_del(struct nouveau_bo *bo)
drmIoctl(bo->device->fd, DRM_IOCTL_GEM_CLOSE, );
}
if (bo->map)
-   munmap(bo->map, bo->size);
+   drm_munmap(bo->map, bo->size);
free(nvbo);
 }

@@ -607,7 +607,7 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t access,
 {
struct nouveau_bo_priv *nvbo = nouveau_bo(bo);
if (bo->map == NULL) {
-   bo->map = mmap(0, bo->size, PROT_READ | PROT_WRITE,
+   bo->map = drm_mmap(0, bo->size, PROT_READ | PROT_WRITE,
   MAP_SHARED, bo->device->fd, nvbo->map_handle);
if (bo->map == MAP_FAILED) {
bo->map = NULL;
-- 
2.0.2



[PATCH 14/18] libkms: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
... for all by exynos.

Signed-off-by: Emil Velikov 
---
 libkms/dumb.c| 8 +++-
 libkms/intel.c   | 6 +++---
 libkms/nouveau.c | 6 +++---
 libkms/radeon.c  | 8 
 libkms/vmwgfx.c  | 6 +++---
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/libkms/dumb.c b/libkms/dumb.c
index 5702543..f9c16e1 100644
--- a/libkms/dumb.c
+++ b/libkms/dumb.c
@@ -36,11 +36,9 @@
 #include 
 #include "internal.h"

-#include 
 #include 
 #include "xf86drm.h"
-
-#include "i915_drm.h"
+#include "libdrm.h"

 struct dumb_bo
 {
@@ -149,7 +147,7 @@ dumb_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return ret;

-   map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, arg.offset);
+   map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, arg.offset);
if (map == MAP_FAILED)
return -errno;

@@ -177,7 +175,7 @@ dumb_bo_destroy(struct kms_bo *_bo)

if (bo->base.ptr) {
/* XXX Sanity check map_count */
-   munmap(bo->base.ptr, bo->base.size);
+   drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

diff --git a/libkms/intel.c b/libkms/intel.c
index b006ea4..51a7fd2 100644
--- a/libkms/intel.c
+++ b/libkms/intel.c
@@ -36,9 +36,9 @@
 #include 
 #include "internal.h"

-#include 
 #include 
 #include "xf86drm.h"
+#include "libdrm.h"

 #include "i915_drm.h"

@@ -173,7 +173,7 @@ intel_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return ret;

-   map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, arg.offset);
+   map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, arg.offset);
if (map == MAP_FAILED)
return -errno;

@@ -201,7 +201,7 @@ intel_bo_destroy(struct kms_bo *_bo)

if (bo->base.ptr) {
/* XXX Sanity check map_count */
-   munmap(bo->base.ptr, bo->base.size);
+   drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

diff --git a/libkms/nouveau.c b/libkms/nouveau.c
index 15c012e..228903f 100644
--- a/libkms/nouveau.c
+++ b/libkms/nouveau.c
@@ -36,9 +36,9 @@
 #include 
 #include "internal.h"

-#include 
 #include 
 #include "xf86drm.h"
+#include "libdrm.h"

 #include "nouveau_drm.h"

@@ -155,7 +155,7 @@ nouveau_bo_map(struct kms_bo *_bo, void **out)
return 0;
}

-   map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, bo->map_handle);
+   map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, bo->map_handle);
if (map == MAP_FAILED)
return -errno;

@@ -183,7 +183,7 @@ nouveau_bo_destroy(struct kms_bo *_bo)

if (bo->base.ptr) {
/* XXX Sanity check map_count */
-   munmap(bo->base.ptr, bo->base.size);
+   drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

diff --git a/libkms/radeon.c b/libkms/radeon.c
index 938321b..9383a0a 100644
--- a/libkms/radeon.c
+++ b/libkms/radeon.c
@@ -36,9 +36,9 @@
 #include 
 #include "internal.h"

-#include 
 #include 
 #include "xf86drm.h"
+#include "libdrm.h"

 #include "radeon_drm.h"

@@ -172,7 +172,7 @@ radeon_bo_map(struct kms_bo *_bo, void **out)
if (ret)
return -errno;

-   map = mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED,
+   map = drm_mmap(0, arg.size, PROT_READ | PROT_WRITE, MAP_SHARED,
   bo->base.kms->fd, arg.addr_ptr);
if (map == MAP_FAILED)
return -errno;
@@ -189,7 +189,7 @@ radeon_bo_unmap(struct kms_bo *_bo)
 {
struct radeon_bo *bo = (struct radeon_bo *)_bo;
if (--bo->map_count == 0) {
-   munmap(bo->base.ptr, bo->base.size);
+   drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}
return 0;
@@ -204,7 +204,7 @@ radeon_bo_destroy(struct kms_bo *_bo)

if (bo->base.ptr) {
/* XXX Sanity check map_count */
-   munmap(bo->base.ptr, bo->base.size);
+   drm_munmap(bo->base.ptr, bo->base.size);
bo->base.ptr = NULL;
}

diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c
index 08163a1..bc04133 100644
--- a/libkms/vmwgfx.c
+++ b/libkms/vmwgfx.c
@@ -35,8 +35,8 @@
 #include 
 #include "internal.h"

-#include 
 #include "xf86drm.h"
+#include "libdrm.h"
 #include "vmwgfx_drm.h"

 struct vmwgfx_bo
@@ -146,7 +146,7 @@ vmwgfx_bo_map(struct kms_bo *_bo, void **out)
return 0;
}

-   map = mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, bo->map_handle);
+   map = drm_mmap(NULL, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, 
bo->base.kms->fd, bo->map_handle);
if (map == 

[PATCH 13/18] drm: use drm_mmap/drm_munmap wrappers

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 xf86drm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 85beb8c..d900b4b 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -48,7 +48,6 @@
 #include 
 #define stat_t struct stat
 #include 
-#include 
 #include 
 #include 

@@ -58,6 +57,7 @@
 #endif

 #include "xf86drm.h"
+#include "libdrm.h"

 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__)
 #define DRM_MAJOR 145
@@ -1137,7 +1137,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, 
drmAddressPtr address)

 size = (size + pagesize_mask) & ~pagesize_mask;

-*address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
+*address = drm_mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
 if (*address == MAP_FAILED)
return -errno;
 return 0;
@@ -1157,7 +1157,7 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, 
drmAddressPtr address)
  */
 int drmUnmap(drmAddress address, drmSize size)
 {
-return munmap(address, size);
+return drm_munmap(address, size);
 }

 drmBufInfoPtr drmGetBufInfo(int fd)
@@ -1264,7 +1264,7 @@ int drmUnmapBufs(drmBufMapPtr bufs)
 int i;

 for (i = 0; i < bufs->count; i++) {
-   munmap(bufs->list[i].address, bufs->list[i].total);
+   drm_munmap(bufs->list[i].address, bufs->list[i].total);
 }

 drmFree(bufs->list);
-- 
2.0.2



[PATCH 12/18] Add private mmap/munmap wrappers

2014-09-07 Thread Emil Velikov
Unlike Linux, Android (bionic) has separate functions - mmap & mmap64.
Add a local wrapper (inspired by gallium) that will be used throughout
libdrm to combat this bionic feature.

Signed-off-by: Emil Velikov 
---
 libdrm.h | 45 +
 1 file changed, 45 insertions(+)

diff --git a/libdrm.h b/libdrm.h
index 23926e6..33acfa9 100644
--- a/libdrm.h
+++ b/libdrm.h
@@ -31,4 +31,49 @@
 #  define drm_public
 #endif

+
+/**
+ * Static (compile-time) assertion.
+ * Basically, use COND to dimension an array.  If COND is false/zero the
+ * array size will be -1 and we'll get a compilation error.
+ */
+#define STATIC_ASSERT(COND) \
+   do { \
+  (void) sizeof(char [1 - 2*!(COND)]); \
+   } while (0)
+
+
+#include 
+
+#if defined(ANDROID)
+#include  /* for EINVAL */
+
+extern void *__mmap2(void *, size_t, int, int, int, size_t);
+
+static inline void *drm_mmap(void *addr, size_t length, int prot, int flags, 
int fd, loff_t offset)
+{
+   /* offset must be aligned to 4096 (not necessarily the page size) */
+   if (unlikely(offset & 4095)) {
+  errno = EINVAL;
+  return MAP_FAILED;
+   }
+
+   return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12));
+}
+
+#else
+/* assume large file support exists */
+#  define drm_mmap(addr, length, prot, flags, fd, offset) mmap(addr, length, 
prot, flags, fd, offset)
+#endif
+
+static inline int drm_munmap(void *addr, size_t length)
+{
+   /* Copied from configure code generated by AC_SYS_LARGEFILE */
+#define LARGE_OFF_T off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+   STATIC_ASSERT(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 
== 1);
+#undef LARGE_OFF_T
+
+   return munmap(addr, length);
+}
+
 #endif
-- 
2.0.2



[PATCH 11/18] automake: pick up all files for distribution.

2014-09-07 Thread Emil Velikov
Autotools is already smart enough to pick the *.pc.in files but it
needs some help with the Android.mk ones.

Signed-off-by: Emil Velikov 
---
 Makefile.am| 2 +-
 freedreno/Makefile.am  | 2 ++
 intel/Makefile.am  | 3 ++-
 libkms/Makefile.am | 2 +-
 nouveau/Makefile.am| 2 ++
 radeon/Makefile.am | 2 +-
 tests/modetest/Makefile.am | 2 ++
 7 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 884841f..3952a88 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES)
 libdrmincludedir = ${includedir}
 libdrminclude_HEADERS = $(LIBDRM_H_FILES)

-EXTRA_DIST = libdrm.pc.in
+EXTRA_DIST = Android.mk

 klibdrmincludedir = ${includedir}/libdrm
 klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES)
diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
index 0c7db81..4818431 100644
--- a/freedreno/Makefile.am
+++ b/freedreno/Makefile.am
@@ -21,3 +21,5 @@ libdrm_freedrenocommoninclude_HEADERS = 
$(LIBDRM_FREEDRENO_H_FILES)

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_freedreno.pc
+
+EXTRA_DIST = Android.mk
diff --git a/intel/Makefile.am b/intel/Makefile.am
index 846695d..ca4ed84 100644
--- a/intel/Makefile.am
+++ b/intel/Makefile.am
@@ -68,7 +68,8 @@ EXTRA_DIST = \
$(BATCHES:.batch=.batch.sh) \
$(BATCHES:.batch=.batch-ref.txt) \
$(BATCHES:.batch=.batch-ref.txt) \
-   tests/test-batch.sh
+   tests/test-batch.sh \
+   Android.mk

 test_decode_LDADD = libdrm_intel.la ../libdrm.la

diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 21c65ae..4baf4fc 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -43,4 +43,4 @@ libkmsinclude_HEADERS = $(LIBKMS_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libkms.pc

-EXTRA_DIST = libkms.pc.in
+EXTRA_DIST = Android.mk
diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
index a7df1ab..7543e43 100644
--- a/nouveau/Makefile.am
+++ b/nouveau/Makefile.am
@@ -21,3 +21,5 @@ libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES)

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_nouveau.pc
+
+EXTRA_DIST = Android.mk
diff --git a/radeon/Makefile.am b/radeon/Makefile.am
index aa66ca3..4575065 100644
--- a/radeon/Makefile.am
+++ b/radeon/Makefile.am
@@ -45,4 +45,4 @@ libdrm_radeoninclude_HEADERS = $(LIBDRM_RADEON_H_FILES)
 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libdrm_radeon.pc

-EXTRA_DIST = libdrm_radeon.pc.in
+EXTRA_DIST = Android.mk
diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am
index d551fe4..0a6af01 100644
--- a/tests/modetest/Makefile.am
+++ b/tests/modetest/Makefile.am
@@ -25,3 +25,5 @@ if HAVE_CAIRO
 AM_CFLAGS += $(CAIRO_CFLAGS)
 modetest_LDADD += $(CAIRO_LIBS)
 endif
+
+EXTRA_DIST = Android.mk
-- 
2.0.2



[PATCH 10/18] modetest: Add support of STI driver

2014-09-07 Thread Emil Velikov
From: Benjamin Gaignard 

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 92efb82..6d06e3f 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1437,7 +1437,7 @@ int main(int argc, char **argv)
int drop_master = 0;
int test_vsync = 0;
int test_cursor = 0;
-   const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", 
"omapdrm", "exynos", "tilcdc", "msm" };
+   const char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx", 
"omapdrm", "exynos", "tilcdc", "msm", "sti" };
char *device = NULL;
char *module = NULL;
unsigned int i;
-- 
2.0.2



[PATCH 09/18] modetest: add Android build

2014-09-07 Thread Emil Velikov
Cc: Benjamin Gaignard 
Signed-off-by: Emil Velikov 
---
 Android.mk|  3 ++-
 tests/modetest/Android.mk | 14 ++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 tests/modetest/Android.mk

diff --git a/Android.mk b/Android.mk
index 4d02b05..63f031c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -56,7 +56,8 @@ SUBDIRS := \
intel \
nouveau \
radeon \
-   libkms
+   libkms \
+   tests/modeset

 mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS))
 include $(mkfiles)
diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk
new file mode 100644
index 000..0a32b5f
--- /dev/null
+++ b/tests/modetest/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/Makefile.sources
+
+LOCAL_SRC_FILES := $(MODETEST_FILES)
+
+LOCAL_MODULE := modetest
+
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
+
+LOCAL_SHARED_LIBRARIES := libdrm libkms
+
+include $(BUILD_EXECUTABLE)
-- 
2.0.2



[PATCH 08/18] modetest: move sources lists to makefiles.sources

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 tests/modetest/Makefile.am  | 7 +++
 tests/modetest/Makefile.sources | 6 ++
 2 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 tests/modetest/Makefile.sources

diff --git a/tests/modetest/Makefile.am b/tests/modetest/Makefile.am
index fd6ebb2..d551fe4 100644
--- a/tests/modetest/Makefile.am
+++ b/tests/modetest/Makefile.am
@@ -1,3 +1,5 @@
+include Makefile.sources
+
 AM_CFLAGS = $(filter-out -Wpointer-arith, $(WARN_CFLAGS))

 AM_CFLAGS += \
@@ -13,10 +15,7 @@ noinst_PROGRAMS = \
modetest
 endif

-modetest_SOURCES = \
-   buffers.c buffers.h \
-   cursor.c cursor.h \
-   modetest.c
+modetest_SOURCES = $(MODETEST_FILES)

 modetest_LDADD = \
$(top_builddir)/libdrm.la \
diff --git a/tests/modetest/Makefile.sources b/tests/modetest/Makefile.sources
new file mode 100644
index 000..399af0d
--- /dev/null
+++ b/tests/modetest/Makefile.sources
@@ -0,0 +1,6 @@
+MODETEST_FILES := \
+   buffers.c \
+   buffers.h \
+   cursor.c \
+   cursor.h \
+   modetest.c
-- 
2.0.2



[PATCH 07/18] libkms: add Android build

2014-09-07 Thread Emil Velikov
Cc: Benjamin Gaignard 
Signed-off-by: Emil Velikov 
---
 Android.mk|  3 ++-
 libkms/Android.mk | 53 +
 2 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 libkms/Android.mk

diff --git a/Android.mk b/Android.mk
index 97a7d75..4d02b05 100644
--- a/Android.mk
+++ b/Android.mk
@@ -55,7 +55,8 @@ SUBDIRS := \
freedreno \
intel \
nouveau \
-   radeon
+   radeon \
+   libkms

 mkfiles := $(patsubst %,$(LIBDRM_TOP)/%/Android.mk,$(SUBDIRS))
 include $(mkfiles)
diff --git a/libkms/Android.mk b/libkms/Android.mk
new file mode 100644
index 000..d2df32a
--- /dev/null
+++ b/libkms/Android.mk
@@ -0,0 +1,53 @@
+DRM_GPU_DRIVERS := $(strip $(filter-out swrast, $(BOARD_GPU_DRIVERS)))
+
+intel_drivers := i915 i965 i915g ilo
+radeon_drivers := r300g r600g radeonsi
+nouveau_drivers := nouveau
+vmwgfx_drivers := vmwgfx
+
+valid_drivers := \
+   $(intel_drivers) \
+   $(radeon_drivers) \
+   $(nouveau_drivers) \
+   $(vmwgfx_drivers)
+
+# warn about invalid drivers
+invalid_drivers := $(filter-out $(valid_drivers), $(DRM_GPU_DRIVERS))
+ifneq ($(invalid_drivers),)
+$(warning invalid GPU drivers: $(invalid_drivers))
+# tidy up
+DRM_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(DRM_GPU_DRIVERS))
+endif
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+include $(LOCAL_PATH)/Makefile.sources
+
+LOCAL_SRC_FILES := $(LIBKMS_FILES)
+
+ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
+LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES)
+endif
+
+ifneq ($(filter $(intel_drivers), $(DRM_GPU_DRIVERS)),)
+LOCAL_SRC_FILES += $(LIBKMS_INTEL_FILES)
+endif
+
+ifneq ($(filter $(nouveau_drivers), $(DRM_GPU_DRIVERS)),)
+LOCAL_SRC_FILES += $(LIBKMS_NOUVEAU_FILES)
+endif
+
+ifneq ($(filter $(radeon_drivers), $(DRM_GPU_DRIVERS)),)
+LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
+endif
+
+LOCAL_MODULE := libkms
+LOCAL_SHARED_LIBRARIES := libdrm
+
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
+
+LOCAL_COPY_HEADERS_TO := libdrm
+LOCAL_COPY_HEADERS := $(LIBKMS_H_FILES)
+
+include $(BUILD_SHARED_LIBRARY)
-- 
2.0.2



[PATCH 06/18] libkms: move sources lists to makefile.sources

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 libkms/Makefile.am  | 20 +---
 libkms/Makefile.sources | 23 +++
 2 files changed, 32 insertions(+), 11 deletions(-)
 create mode 100644 libkms/Makefile.sources

diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index dae44e9..21c65ae 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -1,3 +1,5 @@
+include Makefile.sources
+
 AM_CFLAGS = \
$(WARN_CFLAGS) \
-I$(top_srcdir)/include/drm \
@@ -12,35 +14,31 @@ libkms_la_LIBADD = ../libdrm.la
 #libkms_la_LIBADD += $(LIBUDEV_LIBS)
 #endif

-libkms_la_SOURCES = \
-   internal.h \
-   linux.c \
-   dumb.c \
-   api.c
+libkms_la_SOURCES = $(LIBKMS_FILES)

 if HAVE_VMWGFX
-libkms_la_SOURCES += vmwgfx.c
+libkms_la_SOURCES += $(LIBKMS_VMWGFX_FILES)
 endif

 if HAVE_INTEL
-libkms_la_SOURCES += intel.c
+libkms_la_SOURCES += $(LIBKMS_INTEL_FILES)
 endif

 if HAVE_NOUVEAU
-libkms_la_SOURCES += nouveau.c
+libkms_la_SOURCES += $(LIBKMS_NOUVEAU_FILES)
 endif

 if HAVE_RADEON
-libkms_la_SOURCES += radeon.c
+libkms_la_SOURCES += $(LIBKMS_RADEON_FILES)
 endif

 if HAVE_EXYNOS
-libkms_la_SOURCES += exynos.c
+libkms_la_SOURCES += $(LIBKMS_EXYNOS_FILES)
 AM_CFLAGS += -I$(top_srcdir)/exynos
 endif

 libkmsincludedir = ${includedir}/libkms
-libkmsinclude_HEADERS = libkms.h
+libkmsinclude_HEADERS = $(LIBKMS_H_FILES)

 pkgconfigdir = @pkgconfigdir@
 pkgconfig_DATA = libkms.pc
diff --git a/libkms/Makefile.sources b/libkms/Makefile.sources
new file mode 100644
index 000..3191f51
--- /dev/null
+++ b/libkms/Makefile.sources
@@ -0,0 +1,23 @@
+LIBKMS_FILES := \
+   internal.h \
+   linux.c \
+   dumb.c \
+   api.c
+
+LIBKMS_VMWGFX_FILES := \
+   vmwgfx.c
+
+LIBKMS_INTEL_FILES := \
+   intel.c
+
+LIBKMS_NOUVEAU_FILES := \
+   nouveau.c
+
+LIBKMS_RADEON_FILES := \
+   radeon.c
+
+LIBKMS_EXYNOS_FILES := \
+   exynos.c
+
+LIBKMS_H_FILES := \
+   libkms.h
-- 
2.0.2



[PATCH 05/18] libkms: build the intel backend only when needed

2014-09-07 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 configure.ac   |  3 +++
 libkms/Makefile.am |  5 -
 libkms/linux.c | 16 +++-
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 484084f..f1d3451 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,9 @@ fi
 AM_CONDITIONAL(HAVE_LIBKMS, [test "x$LIBKMS" = xyes])

 AM_CONDITIONAL(HAVE_INTEL, [test "x$INTEL" = xyes])
+if test "x$INTEL" = xyes; then
+   AC_DEFINE(HAVE_INTEL, 1, [Have intel support])
+fi

 AM_CONDITIONAL(HAVE_VMWGFX, [test "x$VMWGFX" = xyes])
 if test "x$VMWGFX" = xyes; then
diff --git a/libkms/Makefile.am b/libkms/Makefile.am
index 449a73b..dae44e9 100644
--- a/libkms/Makefile.am
+++ b/libkms/Makefile.am
@@ -15,7 +15,6 @@ libkms_la_LIBADD = ../libdrm.la
 libkms_la_SOURCES = \
internal.h \
linux.c \
-   intel.c \
dumb.c \
api.c

@@ -23,6 +22,10 @@ if HAVE_VMWGFX
 libkms_la_SOURCES += vmwgfx.c
 endif

+if HAVE_INTEL
+libkms_la_SOURCES += intel.c
+endif
+
 if HAVE_NOUVEAU
 libkms_la_SOURCES += nouveau.c
 endif
diff --git a/libkms/linux.c b/libkms/linux.c
index 17e1d58..77a0bbe 100644
--- a/libkms/linux.c
+++ b/libkms/linux.c
@@ -103,25 +103,31 @@ linux_from_sysfs(int fd, struct kms_driver **out)
if (ret)
return ret;

+#ifdef HAVE_INTEL
if (!strcmp(name, "intel"))
ret = intel_create(fd, out);
+   else
+#endif
 #ifdef HAVE_VMWGFX
-   else if (!strcmp(name, "vmwgfx"))
+   if (!strcmp(name, "vmwgfx"))
ret = vmwgfx_create(fd, out);
+   else
 #endif
 #ifdef HAVE_NOUVEAU
-   else if (!strcmp(name, "nouveau"))
+   if (!strcmp(name, "nouveau"))
ret = nouveau_create(fd, out);
+   else
 #endif
 #ifdef HAVE_RADEON
-   else if (!strcmp(name, "radeon"))
+   if (!strcmp(name, "radeon"))
ret = radeon_create(fd, out);
+   else
 #endif
 #ifdef HAVE_EXYNOS
-   else if (!strcmp(name, "exynos"))
+   if (!strcmp(name, "exynos"))
ret = exynos_create(fd, out);
-#endif
else
+#endif
ret = -ENOSYS;

free(name);
-- 
2.0.2



[PATCH 04/18] configure: unconditionally check for atomic ops/primitives

2014-09-07 Thread Emil Velikov
Just have the check once, and let new drivers opt-in if they want
to use them. Move the block further up the script, to tie nicely
with the actual usage of $HW defines.

Move the final $HW users to be alongside their brethren.

Signed-off-by: Emil Velikov 
---
 configure.ac | 167 +--
 1 file changed, 82 insertions(+), 85 deletions(-)

diff --git a/configure.ac b/configure.ac
index 16625a5..484084f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,81 @@ AC_CACHE_CHECK([for supported warning flags], 
libdrm_cv_warn_cflags, [
AC_MSG_CHECKING([which warning flags were supported])])
 WARN_CFLAGS="$libdrm_cv_warn_cflags"

+# Check for atomic intrinsics
+AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
+   drm_cv_atomic_primitives="none"
+
+   AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+   int atomic_add(int i) { return __sync_fetch_and_add (, 1); }
+   int atomic_cmpxchg(int i, int j, int k) { return 
__sync_val_compare_and_swap (, j, k); }
+ ]],[[]])], 
[drm_cv_atomic_primitives="Intel"],[])
+
+   if test "x$drm_cv_atomic_primitives" = "xnone"; then
+   AC_CHECK_HEADER([atomic_ops.h], 
drm_cv_atomic_primitives="libatomic-ops")
+   fi
+
+   # atomic functions defined in  & libc on Solaris
+   if test "x$drm_cv_atomic_primitives" = "xnone"; then
+   AC_CHECK_FUNC([atomic_cas_uint], 
drm_cv_atomic_primitives="Solaris")
+   fi
+])
+
+if test "x$drm_cv_atomic_primitives" = xIntel; then
+   AC_DEFINE(HAVE_LIBDRM_ATOMIC_PRIMITIVES, 1,
+   [Enable if your compiler supports the Intel __sync_* atomic 
primitives])
+fi
+if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; then
+   AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev 
installed])
+fi
+
+if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then
+   if test "x$drm_cv_atomic_primitives" = "xnone"; then
+   if test "x$INTEL" != "xauto"; then
+   if test "x$INTEL" != "xno"; then
+   AC_MSG_ERROR([libdrm_intel depends upon atomic 
operations, which were not found for your compiler/cpu. Try compiling with 
-march=native, or install the libatomics-op-dev package, or, failing both of 
those, disable support for Intel GPUs by passing --disable-intel to 
./configure])
+   fi
+   else
+   AC_MSG_WARN([Disabling libdrm_intel. It depends on 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package.])
+   INTEL=no
+   fi
+   if test "x$RADEON" != "xauto"; then
+   if test "x$RADEON" != "xno"; then
+   AC_MSG_ERROR([libdrm_radeon depends upon atomic 
operations, which were not found for your compiler/cpu. Try compiling with 
-march=native, or install the libatomics-op-dev package, or, failing both of 
those, disable support for Radeon GPUs by passing --disable-radeon to 
./configure])
+   fi
+   else
+   AC_MSG_WARN([Disabling libdrm_radeon. It depends on 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package.])
+   RADEON=no
+   fi
+   if test "x$NOUVEAU" != "xauto"; then
+   if test "x$NOUVEAU" != "xno"; then
+   AC_MSG_ERROR([libdrm_nouveau depends upon 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package, or, failing both 
of those, disable support for NVIDIA GPUs by passing --disable-nouveau to 
./configure])
+   fi
+   else
+   AC_MSG_WARN([Disabling libdrm_nouveau. It depends on 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package.])
+   NOUVEAU=no
+   fi
+   else
+   if test "x$INTEL" != "xno"; then
+   case $host_cpu in
+   i?86|x86_64) INTEL=yes ;;
+   *) INTEL=no ;;
+   esac
+   fi
+   if test "x$RADEON" != "xno"; then
+   RADEON=yes
+   fi
+   if test "x$NOUVEAU" != "xno"; then
+   NOUVEAU=yes
+   fi
+   fi
+fi
+
+if test "x$INTEL" != "xno"; then
+   PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
+fi
+AC_SUBST(PCIACCESS_CFLAGS)
+AC_SUBST(PCIACCESS_LIBS)
+
 if test "x$UDEV" = xyes; then
AC_DEFINE(UDEV, 1, [Have UDEV 

[PATCH 03/18] automake: fix 'make commit-headers'

2014-09-07 Thread Emil Velikov
Not too long ago the in-kernel drm public headers were moved. Since then
we could no longer fetch/update the ones in libdrm using the command.

Signed-off-by: Emil Velikov 
---
 Makefile.am | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a9ec25b..884841f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -80,8 +80,8 @@ endif


 copy-headers :
-   cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include
+   cp -r $(kernel_source)/include/uapi/drm/*.h $(top_srcdir)/include/drm/

 commit-headers : copy-headers
-   git add include
+   git add include/drm/*.h
git commit -am "Copy headers from kernel 
$$(GIT_DIR=$(kernel_source)/.git git describe)"
-- 
2.0.2



[PATCH 02/18] Remove i810_drm.h and i830_drm.h from the distribution tarball

2014-09-07 Thread Emil Velikov
Both of these headers are not installed since they were imported.
They  are not even used internally. The latter does not exist in the
kernel...

Note the * symbol in EXTRA_DIST causes 'make distcheck' fail. When was
the last time we ran it ?

Cc: Ville Syrj?l? 
Cc: Damien Lespiau 
Cc: Daniel Vetter 
Signed-off-by: Emil Velikov 
---
 Makefile.am|   2 +-
 include/drm/i810_drm.h | 281 
 include/drm/i830_drm.h | 342 -
 3 files changed, 1 insertion(+), 624 deletions(-)
 delete mode 100644 include/drm/i810_drm.h
 delete mode 100644 include/drm/i830_drm.h

diff --git a/Makefile.am b/Makefile.am
index 083861f..a9ec25b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,7 +69,7 @@ libdrm_la_SOURCES = $(LIBDRM_FILES)
 libdrmincludedir = ${includedir}
 libdrminclude_HEADERS = $(LIBDRM_H_FILES)

-EXTRA_DIST = libdrm.pc.in include/drm/*
+EXTRA_DIST = libdrm.pc.in

 klibdrmincludedir = ${includedir}/libdrm
 klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES)
diff --git a/include/drm/i810_drm.h b/include/drm/i810_drm.h
deleted file mode 100644
index 7a10bb6..000
--- a/include/drm/i810_drm.h
+++ /dev/null
@@ -1,281 +0,0 @@
-#ifndef _I810_DRM_H_
-#define _I810_DRM_H_
-
-/* WARNING: These defines must be the same as what the Xserver uses.
- * if you change them, you must change the defines in the Xserver.
- */
-
-#ifndef _I810_DEFINES_
-#define _I810_DEFINES_
-
-#define I810_DMA_BUF_ORDER 12
-#define I810_DMA_BUF_SZ(1<

[PATCH 01/18] automake: remove obsolete makefiles

2014-09-07 Thread Emil Velikov
Rather than having two extra makefiles in order to ship ~10 headers
just fold its 5 lines of code into the top one makefile.

Signed-off-by: Emil Velikov 
---
 Android.mk   |  8 +++-
 Makefile.am  | 10 +-
 Makefile.sources | 19 +++
 configure.ac |  2 --
 include/Makefile.am  |  1 -
 include/drm/Makefile.am  | 32 
 include/drm/Makefile.sources | 18 --
 7 files changed, 31 insertions(+), 59 deletions(-)
 delete mode 100644 include/Makefile.am
 delete mode 100644 include/drm/Makefile.am
 delete mode 100644 include/drm/Makefile.sources

diff --git a/Android.mk b/Android.mk
index bb49b0b..97a7d75 100644
--- a/Android.mk
+++ b/Android.mk
@@ -26,10 +26,8 @@ include $(CLEAR_VARS)

 LIBDRM_TOP := $(LOCAL_PATH)

-# Import variables LIBDRM_FILES, LIBDRM_H_FILES
+# Import variables LIBDRM_{,H_,INCLUDE_H_,INCLUDE_VMWGFX_H_}FILES
 include $(LOCAL_PATH)/Makefile.sources
-# Import variables LIBDRM_INCLUDE_H_FILES, LIBDRM_INCLUDE_VMWGFX_H_FILES
-include $(LOCAL_PATH)/include/drm/Makefile.sources

 LOCAL_MODULE := libdrm
 LOCAL_MODULE_TAGS := optional
@@ -47,8 +45,8 @@ LOCAL_CFLAGS := \

 LOCAL_COPY_HEADERS := \
$(LIBDRM_H_FILES) \
-   $(addprefix include/drm/,$(LIBDRM_INCLUDE_H_FILES)) \
-   $(addprefix include/drm/,$(LIBDRM_INCLUDE_VMWGFX_H_FILES))
+   $(LIBDRM_INCLUDE_H_FILES) \
+   $(LIBDRM_INCLUDE_VMWGFX_H_FILES)

 LOCAL_COPY_HEADERS_TO := libdrm
 include $(BUILD_SHARED_LIBRARY)
diff --git a/Makefile.am b/Makefile.am
index fab2a9a..083861f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,7 +53,7 @@ if HAVE_FREEDRENO
 FREEDRENO_SUBDIR = freedreno
 endif

-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) 
$(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests 
include man
+SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) 
$(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests man

 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
@@ -71,6 +71,14 @@ libdrminclude_HEADERS = $(LIBDRM_H_FILES)

 EXTRA_DIST = libdrm.pc.in include/drm/*

+klibdrmincludedir = ${includedir}/libdrm
+klibdrminclude_HEADERS = $(LIBDRM_INCLUDE_H_FILES)
+
+if HAVE_VMWGFX
+klibdrminclude_HEADERS += $(LIBDRM_INCLUDE_VMWGFX_H_FILES)
+endif
+
+
 copy-headers :
cp -r $(kernel_source)/usr/include/drm $(top_srcdir)/include

diff --git a/Makefile.sources b/Makefile.sources
index d078ca9..d86fb2a 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -11,3 +11,22 @@ LIBDRM_FILES := \
 LIBDRM_H_FILES := \
xf86drm.h \
xf86drmMode.h
+
+LIBDRM_INCLUDE_H_FILES := \
+   include/drm/drm.h \
+   include/drm/drm_fourcc.h \
+   include/drm/drm_mode.h \
+   include/drm/drm_sarea.h \
+   include/drm/i915_drm.h \
+   include/drm/mach64_drm.h \
+   include/drm/mga_drm.h \
+   include/drm/nouveau_drm.h \
+   include/drm/qxl_drm.h \
+   include/drm/r128_drm.h \
+   include/drm/radeon_drm.h \
+   include/drm/savage_drm.h \
+   include/drm/sis_drm.h \
+   include/drm/via_drm.h
+
+LIBDRM_INCLUDE_VMWGFX_H_FILES := \
+   include/drm/vmwgfx_drm.h
diff --git a/configure.ac b/configure.ac
index bb0559a..16625a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -410,8 +410,6 @@ AC_CONFIG_FILES([
tests/radeon/Makefile
tests/vbltest/Makefile
tests/exynos/Makefile
-   include/Makefile
-   include/drm/Makefile
man/Makefile
libdrm.pc])
 AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
deleted file mode 100644
index 55ea506..000
--- a/include/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = drm
diff --git a/include/drm/Makefile.am b/include/drm/Makefile.am
deleted file mode 100644
index 7a246ae..000
--- a/include/drm/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-#  Copyright 2005 Adam Jackson.
-#
-#  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
-#  on the rights to use, copy, modify, merge, publish, distribute, sub
-#  license, and/or sell copies of the Software, and to permit persons to whom
-#  the Software is furnished to do so, subject to the following conditions:
-#
-#  The above copyright notice and this permission notice (including the next
-#  paragraph) shall be included in all copies or substantial portions of the
-#  Software.
-#
-#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
-#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 

[PATCH 00/18] Final batch of Android related fixes

2014-09-07 Thread Emil Velikov
Hello list,

Here is the final batch that I've been planning to get upstreamed. 
Everything else that remains are some custom downstream "hacks" that 
will get upstreamed by their original authors in due time :)


Highlights:
 - Drop a few unneeded Makefiles.
 - Android support for libkms & modetest. Inspired by Benjamin 
Gaignard's work.
 - Private mmap/munmap wrappers to hide all the love that bionic has for 
us :)


The series is available in branch 'android-final-fixes' at
https://github.com/evelikov/libdrm


Any comments, reviews, it builds or it works are appreciated.

-Emil



[Bug 83436] Sudden framerate drops in multiple games

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=83436

--- Comment #27 from smoki  ---
 OpenJK even with -O0 is ~2.5x times faster then -O2 -mtune=generic :)

 Anyway, just found code example from bug 83442 is useful here too, so maybe
more people can easely test if they are affected.

32bit on commit 37d43ebb28ce8be38f3d9b0805b8b14354ce786d:

 -mtune=generic 4-7ms
 -mtune=native  6-10ms
 -O06-10ms

32bit current git:

 -mtune=generic  197-200ms
 -mtune=native  5-8ms

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/30afa266/attachment.html>


[Bug 75276] Implement VGPR Register Spilling

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=75276

--- Comment #42 from darkbasic  ---
The Witcher 2 is full of spilling warnings too.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/58c1e61b/attachment.html>


[PATCH] drm/radeon: fix semaphore value init

2014-09-07 Thread Grigori Goronzy
On 07.09.2014 12:06, Christian K?nig wrote:
> From: Christian K?nig 
> 
> Semaphore values have 64 bits, not 32. This fixes a very subtle bug
> that disables synchronization when the upper 32bits wasn't zero.
>

So essentially, half the semaphore values were never properly
initialized and some loads with a lot of semaphore synchronization going
on tried to use the uninitialized semaphores. I think the description in
the commit could be improved according to that.

I didn't get any DMA L2T copy hangs with semaphores disabled completely,
but unfortunately this doesn't fix the hangs.

Anyway,
Reviewed-By: Grigori Goronzy 

Grigori

> Signed-off-by: Christian K?nig 
> Cc: stable at vger.kernel.org
> ---
>  drivers/gpu/drm/radeon/radeon_semaphore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c 
> b/drivers/gpu/drm/radeon/radeon_semaphore.c
> index 56d9fd6..abd6753 100644
> --- a/drivers/gpu/drm/radeon/radeon_semaphore.c
> +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c
> @@ -34,7 +34,7 @@
>  int radeon_semaphore_create(struct radeon_device *rdev,
>   struct radeon_semaphore **semaphore)
>  {
> - uint32_t *cpu_addr;
> + uint64_t *cpu_addr;
>   int i, r;
>  
>   *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
> 


-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/f31afac5/attachment.sig>


[Bug 84041] Possible deadlock when using dri PRIME, caught by lockdep while playing video via vdpau

2014-09-07 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=84041

yshuiv7 at gmail.com changed:

   What|Removed |Added

 Kernel Version|Possible deadlock when  |3.16.1
   |using dri PRIME |
Summary|I built my kernel with  |Possible deadlock when
   |lockdep, and caught a   |using dri PRIME, caught by
   |possible deadlock while |lockdep while playing video
   |playing video using vdpau   |via vdpau
   |on radeon driver.   |

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 84041] New: I built my kernel with lockdep, and caught a possible deadlock while playing video using vdpau on radeon driver.

2014-09-07 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=84041

Bug ID: 84041
   Summary: I built my kernel with lockdep, and caught a possible
deadlock while playing video using vdpau on radeon
driver.
   Product: Drivers
   Version: 2.5
Kernel Version: Possible deadlock when using dri PRIME
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-dri at kernel-bugs.osdl.org
  Reporter: yshuiv7 at gmail.com
Regression: No

dmesg:

[  166.768423] =
[  166.768424] [ INFO: possible recursive locking detected ]
[  166.768429] 3.16.1 #7 Not tainted
[  166.768430] -
[  166.768432] Xorg.bin/319 is trying to acquire lock:
[  166.768435]  (>struct_mutex){+.+.+.}, at: []
i915_gem_unmap_dma_buf+0x33/0xd0
[  166.768461] 
but task is already holding lock:
[  166.768462]  (>struct_mutex){+.+.+.}, at: []
drm_gem_object_handle_unreference_unlocked+0x102/0x130
[  166.768475] 
other info that might help us debug this:
[  166.768477]  Possible unsafe locking scenario:

[  166.768479]CPU0
[  166.768480]
[  166.768481]   lock(>struct_mutex);
[  166.768483]   lock(>struct_mutex);
[  166.768484] 
 *** DEADLOCK ***

[  166.768486]  May be due to missing lock nesting notation

[  166.768488] 1 lock held by Xorg.bin/319:
[  166.768489]  #0:  (>struct_mutex){+.+.+.}, at: []
drm_gem_object_handle_unreference_unlocked+0x102/0x130
[  166.768493] 
stack backtrace:
[  166.768496] CPU: 0 PID: 319 Comm: Xorg.bin Not tainted 3.16.1-zen-v7+ #7
[  166.768499] Hardware name: LENOVO 20347/Lenovo Y40-70, BIOS 99CN24WW(V1.07)
07/28/2014
[  166.768500]  825f02c0 880098dcfae0 8174e942
88024f065fa0
[  166.768504]  880098dcfbb0 810ca996 8802553b8e88
f200
[  166.768506]  880098dcfb20 810c8abd 8802553b8ea8
88024f066878
[  166.768510] Call Trace:
[  166.768520]  [] dump_stack+0x4d/0x6f
[  166.768528]  [] __lock_acquire+0x1b06/0x1fa0
[  166.768531]  [] ? trace_hardirqs_on_caller+0x15d/0x200
[  166.768534]  [] lock_acquire+0x95/0x130
[  166.768537]  [] ? i915_gem_unmap_dma_buf+0x33/0xd0
[  166.768542]  [] mutex_lock_nested+0x63/0x410
[  166.768544]  [] ? i915_gem_unmap_dma_buf+0x33/0xd0
[  166.768546]  [] ? mark_held_locks+0x75/0xa0
[  166.768549]  [] i915_gem_unmap_dma_buf+0x33/0xd0
[  166.768556]  [] dma_buf_unmap_attachment+0x4c/0x70
[  166.768564]  [] drm_prime_gem_destroy+0x22/0x40
[  166.768662]  [] radeon_gem_object_free+0x33/0x40 [radeon]
[  166.768665]  [] drm_gem_object_free+0x27/0x40
[  166.768667]  []
drm_gem_object_handle_unreference_unlocked+0x120/0x130
[  166.768671]  [] drm_gem_handle_delete+0xba/0x110
[  166.768674]  [] drm_gem_close_ioctl+0x25/0x30
[  166.768676]  [] drm_ioctl+0x197/0x680
[  166.768680]  [] ? _raw_spin_unlock_irqrestore+0x55/0x70
[  166.768682]  [] ? trace_hardirqs_on_caller+0x15d/0x200
[  166.768684]  [] ? trace_hardirqs_on+0xd/0x10
[  166.768703]  [] radeon_drm_ioctl+0x4c/0x80 [radeon]
[  166.768708]  [] do_vfs_ioctl+0x2f0/0x4f0
[  166.768710]  [] ? __fget+0xac/0xf0
[  166.768712]  [] ? __fget+0x5/0xf0
[  166.768714]  [] SyS_ioctl+0x41/0x80
[  166.768717]  [] tracesys+0xd4/0xd9

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 75276] Implement VGPR Register Spilling

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=75276

--- Comment #41 from Daniel Scharrer  ---
s/r202464/commit 3666e7f4c161c50e5f6dcb0e015ca16bf69fb941/ ;-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/73a8b961/attachment.html>


[Bug 75276] Implement VGPR Register Spilling

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=75276

--- Comment #40 from Daniel Scharrer  ---
It's still reproducible in Painkiller H with LLVM r202464 (ie. current
trunk).

While some previously broken PP effects now work, dynamic lighting is still
messed up and there's plenty of this in the log:

LLVM triggered Diagnostic Handler: SIInstrInfo::storeRegToStackSlot - Can't
spill VGPR!
LLVM triggered Diagnostic Handler: SIInstrInfo::loadRegToStackSlot - Can't
retrieve spilled VGPR!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/b050164b/attachment.html>


[no subject]

2014-09-07 Thread Markus Trippelsdorf
On 2014.08.25 at 11:10 +0200, Christian K?nig wrote:
> Let me know if it works for you, cause we don't really have any hardware 
> any more to test it.

I've tested your patch series today (using drm-next-3.18 from
~agd5f/linux) on a RS780D/Radeon HD 3300 system with a couple of H264
videos. While it sometimes works as expected, it stalled the GPU far too
often to be usable. The stalls are not recoverable and the machine ends
up with a black sreen, but still accepts SysRq keyboard inputs.

Here are some logs:

vdpauinfo:
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
---
420 8192  8192  NV12 YV12 
422 8192  8192  UYVY YUYV 
444 8192  8192  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name   level macbs width height
---
MPEG1 0  9216  2048  1152
MPEG2_SIMPLE  3  9216  2048  1152
MPEG2_MAIN3  9216  2048  1152
H264_BASELINE41  9216  2048  1152
H264_MAIN41  9216  2048  1152
H264_HIGH41  9216  2048  1152
VC1_ADVANCED  4  9216  2048  1152

Output surface:

name  width height nat types

B8G8R8A8  8192  8192y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 
R8G8B8A8  8192  8192y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 
R10G10B10A2   8192  8192y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 
B10G10R10A2   8192  8192y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 

Bitmap surface:

name  width height
--
B8G8R8A8  8192  8192
R8G8B8A8  8192  8192
R10G10B10A2   8192  8192
B10G10R10A2   8192  8192
A88192  8192

Video mixer:

feature namesup

DEINTERLACE_TEMPORAL y
DEINTERLACE_TEMPORAL_SPATIAL -
INVERSE_TELECINE -
NOISE_REDUCTION  y
SHARPNESSy
LUMA_KEY -
HIGH QUALITY SCALING - L1-
HIGH QUALITY SCALING - L2-
HIGH QUALITY SCALING - L3-
HIGH QUALITY SCALING - L4-
HIGH QUALITY SCALING - L5-
HIGH QUALITY SCALING - L6-
HIGH QUALITY SCALING - L7-
HIGH QUALITY SCALING - L8-
HIGH QUALITY SCALING - L9-

parameter name  sup  min  max
-
VIDEO_SURFACE_WIDTH  y48 2048
VIDEO_SURFACE_HEIGHT y48 1152
CHROMA_TYPE  y  
LAYERS   y 04

attribute name  sup  min  max
-
BACKGROUND_COLOR y  
CSC_MATRIX   y  
NOISE_REDUCTION_LEVELy  0.00 1.00
SHARPNESS_LEVEL  y -1.00 1.00
LUMA_KEY_MIN_LUMAy  
LUMA_KEY_MAX_LUMAy  


Sep  7 14:03:45 x4 kernel: [drm] Initialized drm 1.1.0 20060810
Sep  7 14:03:45 x4 kernel: [drm] radeon kernel modesetting enabled.
Sep  7 14:03:45 x4 kernel: [drm] initializing kernel modesetting (RS780 
0x1002:0x9614 0x1043:0x834D).
Sep  7 14:03:45 x4 kernel: [drm] register mmio base: 0xFBEE
Sep  7 14:03:45 x4 kernel: [drm] register mmio size: 65536
Sep  7 14:03:45 x4 kernel: ATOM BIOS: 113
Sep  7 14:03:45 x4 kernel: radeon :01:05.0: VRAM: 128M 0xC000 - 
0xC7FF (128M used)
Sep  7 14:03:45 x4 kernel: radeon :01:05.0: GTT: 512M 0xA000 - 
0xBFFF
Sep  7 14:03:45 x4 kernel: [drm] Detected VRAM RAM=128M, BAR=128M
Sep  7 14:03:45 x4 kernel: [drm] RAM width 32bits DDR
Sep  7 14:03:45 x4 kernel: [TTM] Zone  kernel: Available graphics memory: 
4083350 kiB
Sep  7 14:03:45 x4 kernel: [TTM] Zone   dma32: Available graphics memory: 
2097152 kiB
Sep  7 14:03:45 x4 kernel: [TTM] Initializing pool allocator
Sep  7 14:03:45 x4 kernel: [TTM] Initializing DMA pool allocator
Sep  7 14:03:45 x4 kernel: [drm] radeon: 128M of VRAM memory ready
Sep  7 14:03:45 x4 kernel: [drm] radeon: 512M of GTT memory ready.
Sep  7 14:03:45 x4 kernel: [drm] Loading RS780 Microcode
Sep  7 14:03:45 x4 kernel: == power state 0 ==
Sep  7 14:03:45 x4 kernel:  ui class: none
Sep  7 14:03:45 x4 kernel:  internal class: boot 
Sep  7 14:03:45 x4 kernel:  caps: video 
Sep  7 14:03:45 x4 kernel:  uvdvclk: 0 dclk: 0
Sep  7 14:03:45 x4 kernel:  power level 0sclk: 5 
vddc_index: 2
Sep  7 14:03:45 x4 kernel:  power level 1sclk: 5 
vddc_index: 2
Sep  7 14:03:45 x4 kernel:  status: c r b 
Sep  7 14:03:45 x4 kernel: == power state 1 ==
Sep  7 14:03:45 x4 kernel:  ui class: performance
Sep  7 14:03:45 x4 kernel:  internal class: none
Sep  7 

[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #29 from Martin Peres  ---
(In reply to comment #28)
> (In reply to comment #27)
> 
> P.S. You should remember that my implementation is highly experimental and
> naive (it's even tested only on my card). I can't expose some particular
> values or allow to write them. E.g. I don't know how to enable automatic fan
> management again after I've disabled it for now. What should I return in
> such case?

No need to hurry, finish entirely your REing before proposing an implementation
for your hardware (all the cards radeon GPUs you have). Please then ask others
with different cards to check if your implementation works on their card too.
When you got sufficient testing, propose this patch for inclusion.

Have fun!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/79e7d75e/attachment.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #28 from Chernovsky Oleg  ---
(In reply to comment #27)

I think I got your point. So I'll read through documentation you provided and
expose these values as hwmon interface.

> I know it is a lot of changes I am asking you to do, but consistency across 
> drivers is great feature!

Agreed, and thanks for the hint. 

P.S. You should remember that my implementation is highly experimental and
naive (it's even tested only on my card). I can't expose some particular values
or allow to write them. E.g. I don't know how to enable automatic fan
management again after I've disabled it for now. What should I return in such
case?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/356c1224/attachment.html>


[Bug 75276] Implement VGPR Register Spilling

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=75276

--- Comment #39 from J. Andrew Lanz-O'Brien  ---
This bug appears to be resolved for me now, as of LLVM 3.5 and Mesa 10.2.7 on
Arch Linux. Thanks for the hard work!!!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/5ede78ae/attachment.html>


[PATCH] drm/radeon: fix semaphore value init

2014-09-07 Thread Christian König
From: Christian K?nig 

Semaphore values have 64 bits, not 32. This fixes a very subtle bug
that disables synchronization when the upper 32bits wasn't zero.

Signed-off-by: Christian K?nig 
Cc: stable at vger.kernel.org
---
 drivers/gpu/drm/radeon/radeon_semaphore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c 
b/drivers/gpu/drm/radeon/radeon_semaphore.c
index 56d9fd6..abd6753 100644
--- a/drivers/gpu/drm/radeon/radeon_semaphore.c
+++ b/drivers/gpu/drm/radeon/radeon_semaphore.c
@@ -34,7 +34,7 @@
 int radeon_semaphore_create(struct radeon_device *rdev,
struct radeon_semaphore **semaphore)
 {
-   uint32_t *cpu_addr;
+   uint64_t *cpu_addr;
int i, r;

*semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
-- 
1.9.1



[RFC v2] device coredump: add new device coredump class

2014-09-07 Thread Johannes Berg
On Fri, 2014-09-05 at 15:13 -0700, Greg Kroah-Hartman wrote:

> > +MODULE_AUTHOR("Johannes Berg ");
> > +MODULE_DESCRIPTION("Device Coredump support");
> > +MODULE_LICENSE("GPL");
> 
> As you only allow Y or N as build options, it's not really a "module" :)

Umm, yeah. I went back and forth on whether this should be allowed to be
modular, but then decided it wasn't big enough to be worth it.

> > +   /*
> > +* this seems racy, but I don't see a notifier or such on
> > +* a struct device to know when it goes away?
> > +*/
> > +   if (devcd->failing_dev->kobj.sd)
> > +   sysfs_delete_link(>failing_dev->kobj, >kobj,
> > + "dev_coredump");
> 
> What is this link?  It should "just go away" if this:
> 
> > +   put_device(devcd->failing_dev);
> 
> was the last put_device() call on the failing_dev, right?  So you
> shouldn't need to make this call to sysfs_delete_link().

Oh, thanks, I'll try that. I did something slightly different first and
ended up with dead symlinks, but in that case I think I was actually
removing the bus/class of the device while the device was still alive or
something - that was a big mess.

> > +void dev_coredumpm(struct device *dev, struct module *owner,
> > +  const void *data, size_t datalen, gfp_t gfp,
> > +  ssize_t (*read)(char *buffer, loff_t offset, size_t count,
> > +  const void *data, size_t datalen),
> > +  void (*free)(const void *data))
> > +{
> > +   static atomic_t devcd_count = ATOMIC_INIT(0);
> > +   struct devcd_entry *devcd;
> > +   struct device *existing;
> > +
> > +   existing = class_find_device(_class, NULL, dev,
> > +devcd_match_failing);
> > +   if (existing) {
> > +   put_device(existing);
> > +   return;
> > +   }
> 
> I thought multiple dumps per "device" would throw away the older ones?
> It's fine if you don't, but you might want to document this behavior in
> the kerneldoc for the function.

I ... umm ... Yeah. I need to free the new one here. I actually wanted
to keep the first one because it seems likely that the driver would
attempt some sort of recovery and then if it happens to crash the device
again it's probably not very helpful to see the last crash.

But I definitely need to free the new one and document the behaviour.
Maybe if somebody needs something else we can make it configurable, but
for now I think all potential users have indicated that they'd prefer
keeping the first dump.

> Other than those very minor things, looks good to me, want to resend it
> cleaned up and without the "RFC" in the Subject?

Tomorrow :)

johannes



[PATCH] drm: use trylock to avoid fault injection antics

2014-09-07 Thread Rob Clark
On Fri, Sep 5, 2014 at 8:25 AM, Daniel Vetter  wrote:
> On Fri, Sep 05, 2014 at 07:59:45AM -0400, Rob Clark wrote:
>> While in real life, we could never fail to grab the newly created mutex,
>> ww_mutex fault injection has no way to know this.  Which could result
>> that kernels built with CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y might fail to
>> acquire the new crtc lock.  Which results in bad things when the locks
>> are dropped.
>>
>> See: https://bugzilla.kernel.org/show_bug.cgi?id=83341
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  drivers/gpu/drm/drm_crtc.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>> index 7d7c1fd..8bb11fa 100644
>> --- a/drivers/gpu/drm/drm_crtc.c
>> +++ b/drivers/gpu/drm/drm_crtc.c
>> @@ -682,7 +682,15 @@ int drm_crtc_init_with_planes(struct drm_device *dev, 
>> struct drm_crtc *crtc,
>>   drm_modeset_lock_all(dev);
>>   drm_modeset_lock_init(>mutex);
>>   /* dropped by _unlock_all(): */
>> - drm_modeset_lock(>mutex, config->acquire_ctx);
>> + /* NOTE: use trylock here for the benefit of ww_mutex fault
>> +  * injection.  We cannot actually fail to grab this lock (as
>> +  * it has only just been created), but fault injection does
>> +  * not know this, which can result in the this lock failing,
>> +  * and hilarity when we later try to drop the locks.  See:
>> +  * https://bugzilla.kernel.org/show_bug.cgi?id=83341
>> +  */
>> + ret = ww_mutex_trylock(>mutex.mutex);
>> + WARN_ON(ret);
>
> Hm, I've thought on our quick discussion on irc we've agreed that the
> locking here in the init path is useless anyway and best dropped? Not just
> remove the crtc locking, but the entire modeset_lock_all.

well, 0day appears to disagree with you..   I still think we should go
the trylock route for 3.17, as it is more the more conservative patch.

I'm not against getting rid of that locking (which is in fact
overkill) once the other fallout is fixed up.  But that seems more
like a merge-window thing, so probably best to wait for 3.18.

BR,
-R


> -Daniel
>
>>
>>   ret = drm_mode_object_get(dev, >base, DRM_MODE_OBJECT_CRTC);
>>   if (ret)
>> --
>> 1.9.3
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch


[RFC v2] device coredump: add new device coredump class

2014-09-07 Thread Arik Nemtsov
On Fri, Sep 5, 2014 at 11:50 AM, Johannes Berg
 wrote:
> From: Johannes Berg 
>
> Many devices run firmware and/or complex hardware, and most of that
> can have bugs. When it misbehaves, however, it is often much harder
> to debug than software running on the host.
>

Very nice concept IMO :)

[]
> +void dev_coredumpm(struct device *dev, struct module *owner,
> +  const void *data, size_t datalen, gfp_t gfp,
> +  ssize_t (*read)(char *buffer, loff_t offset, size_t count,
> +  const void *data, size_t datalen),
> +  void (*free)(const void *data))
> +{
> +   static atomic_t devcd_count = ATOMIC_INIT(0);
> +   struct devcd_entry *devcd;
> +   struct device *existing;
> +
> +   existing = class_find_device(_class, NULL, dev,
> +devcd_match_failing);
> +   if (existing) {
> +   put_device(existing);
> +   return;
> +   }
> +
> +   if (!try_module_get(owner))
> +   return;
> +
> +   devcd = kzalloc(sizeof(*devcd), gfp);
> +   if (!devcd)
> +   goto put_module;
> +
> +   devcd->owner = owner;
> +   devcd->data = data;
> +   devcd->datalen = datalen;
> +   devcd->read = read;
> +   devcd->free = free;
> +   devcd->failing_dev = get_device(dev);
> +
> +   device_initialize(>devcd_dev);
> +
> +   dev_set_name(>devcd_dev, "devcd%d",
> +atomic_inc_return(_count));
> +   devcd->devcd_dev.class = _class;
> +
> +   if (device_add(>devcd_dev))
> +   goto put_device;
> +
> +   if (sysfs_create_link(>devcd_dev.kobj, >kobj,
> + "failing_device"))
> +   /* nothing - symlink will be missing */;
> +
> +   if (sysfs_create_link(>kobj, >devcd_dev.kobj,
> + "dev_coredump"))
> +   /* nothing - symlink will be missing */;

Aren't you confusing the compiler here and above, doing the
INIT_DELAYED_WORK only when link creation failed? I would have thought
some braces are necessary..

> +
> +   INIT_DELAYED_WORK(>del_wk, devcd_del);
> +   schedule_delayed_work(>del_wk, DEVCD_TIMEOUT);
> +
> +   return;
> + put_device:
> +   put_device(>devcd_dev);
> + put_module:
> +   module_put(owner);
> +}
> +EXPORT_SYMBOL(dev_coredumpm);


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #27 from Martin Peres  ---
(In reply to comment #26)
> (In reply to comment #25)
> 
> > I am the Nouveau developer who added fan management support. I would really
> > advice you follow the hwmon recommendations and name this file pwm1.
> 
> Sorry, I'm novice, didn't know about these. 

Don't feel bad, you cannot know possibly know everything ;)

> Though it's not a hw interface
> really, the exchange is done through io-mapped SMC registers...

Not sure how more hw-oriented the interface could get :D That is still
irrelevant to the discussion though. HWMON is software interface for the
userspace.

> 
> Ok, I'll make necessary changes. I assume it will allow lm-sensors to pick
> it up automatically, is it correct?

Yes, it will!

Just to make sure we understood each others:
- pwm1 (RW) exposes the current pwm value (what you called power)
- pwm1_min(RW) min exposes the mininimum power that should be used by the fan
- pwm1_max(RW) min exposes the maximum power that should be used by the fan
- pwm1_enable (RW) exposes the current fan mode. 0 = DISABLED, 1 = MANUAL (the
user writes the fan power he/she wants to pwm1), 2 = AUTOMATIC (linear fan
management?).

Here is Nouveau's documentation on fan management:
http://cgit.freedesktop.org/nouveau/linux-2.6/tree/Documentation/thermal/nouveau_thermal

I know it is a lot of changes I am asking you to do, but consistency across
drivers is great feature!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/bf174e44/attachment.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #26 from Chernovsky Oleg  ---
(In reply to comment #25)

> I am the Nouveau developer who added fan management support. I would really
> advice you follow the hwmon recommendations and name this file pwm1.

Sorry, I'm novice, didn't know about these. Though it's not a hw interface
really, the exchange is done through io-mapped SMC registers...

Ok, I'll make necessary changes. I assume it will allow lm-sensors to pick it
up automatically, is it correct?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/b8a0685d/attachment.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #25 from Martin Peres  ---
(In reply to comment #24)
> Created attachment 105853 [details] [review]
> experimental patch for CI (BONAIRE etc.) for enabling fan control
> 
> So I've come up with patch that enables manual fan override for CI family at
> least. I've tested it on my BONAIRE card, Radeon R7 260X.
> 
> INSTALLATION:
> After compile and reboot there will be new debugfs file,
> /sys/class/drm/card0/device/power_fan_control

Hey,

I am the Nouveau developer who added fan management support. I would really
advice you follow the hwmon recommendations and name this file pwm1.

More information about this:
https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/f4e05b95/attachment-0001.html>


[Bug 73338] Fan speed in idle at 40% with radeonsi and at 18% with catalyst

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73338

--- Comment #24 from Chernovsky Oleg  ---
Created attachment 105853
  --> https://bugs.freedesktop.org/attachment.cgi?id=105853=edit
experimental patch for CI (BONAIRE etc.) for enabling fan control

So I've come up with patch that enables manual fan override for CI family at
least. I've tested it on my BONAIRE card, Radeon R7 260X.

INSTALLATION:
After compile and reboot there will be new debugfs file,
/sys/class/drm/card0/device/power_fan_control

READ:
cat /sys/class/drm/card0/device/power_fan_control
correct values are 0 to 100
on first reads it'll probably show some incorrect percentage value due to
manual control not yet enabled

WRITE:
echo 40 > /sys/class/drm/card0/device/power_fan_control
correct values are 0 to 100

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/b1a26eed/attachment.html>


[Bug 80618] [r600g] XCOM Ennemy Unknown crash (RV770)

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=80618

--- Comment #3 from nicolas  ---
(In reply to comment #2)
> Does XCOM still crash when you use the memory corruption workaround from
> https://github.com/knecht/xcom-hacks
> ?
> See also:
> http://steamcommunity.com/app/200510/discussions/0/522730700169435716/

hie, since my bug repport the game had an update but this doesn' solved my bug.

I have try to use this library, but because i only own Xcom ennemy unknown this
won't work.

If i try to run like the explanations for ennemy within i have the splash
screen and it quits, that is normal cause i don't have this game.
So i tried to adapt to the game folders of ennemy unknown.
What i've done is :

export
LD_LIBRARY_PATH="~/.steam/steam/SteamApps/common/XCom-Enemy-Unknown/binaries/linux/x86_64/"
cd ~/.steam/steam/SteamApps/common/XCom-Enemy-Unknown
LD_PRELOAD=~/T?l?chargements/xcom-hacks-master/libxcomfix.so
binaries/linux/game.x86_64 
szCmd: /bin/sh -c '"/home/nicolas/.steam/steam.sh" "steam://run/200510"' &
sh: symbol lookup error:
/home/nicolas/T?l?chargements/xcom-hacks-master/libxcomfix.so: undefined
symbol: dlsym
Dumped crashlog to
/home/nicolas/.local/share/feral-interactive/XCOM/crashes//19054cf4-ca78-8195-5d709904-5aa26fac.dmp
Abandon (core dumped)

I assume there need to adapt libxcomfix.so to ennemy unknown, but i have no
idea how to do that.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140907/5bad2a3c/attachment.html>


[Bug 80015] Transparency glitches in native Civilization 5 (Civ5) port

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=80015

smoki  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 



[Bug 80015] Transparency glitches in native Civilization 5 (Civ5) port

2014-09-07 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=80015

--- Comment #9 from smoki  ---
(In reply to comment #8)
> I have the same withe glitch on Civ5 shown on the CivV.png with AMD radeonsi
> open source driver.
> I don't have the problem with Intel open source drivers.
> I use Debian Jessie with mesa 10.2.6

 Fix is there for upstream 10.2 but it only aplay if mesa is bulded against
llvm 3.5, Debian Jessie version is currently builded against llvm-3.4. 

 So i think you can request that on Debian bugzilla.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: