configure.ac | 2 intel/Makefile.am | 3 intel/intel_bufmgr.c | 2 intel/intel_bufmgr.h | 2 intel/intel_bufmgr_gem.c | 170 +++++++++++++++++++++++++++----------------- intel/intel_debug.h | 44 +++++++++++ nouveau/nouveau_device.c | 4 - nouveau/nouveau_pushbuf.c | 3 tests/drmtest.c | 13 ++- tests/modeprint/modeprint.c | 7 + tests/modetest/modetest.c | 19 +++- tests/vbltest/vbltest.c | 22 ++++- xf86drm.h | 8 ++ xf86drmMode.c | 2 xf86drmMode.h | 8 ++ 15 files changed, 224 insertions(+), 85 deletions(-)
New commits: commit cc9b751e82c5a3525907bba30ba3c95246751824 Author: Eric Anholt <[email protected]> Date: Fri Oct 28 13:14:44 2011 -0700 configure: version bump for 2.4.27 release. Push the new Intel API for use by mesa. Reviewed-by: Daniel Vetter <[email protected]> diff --git a/configure.ac b/configure.ac index cd3ac23..95d64a7 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.26], + [2.4.27], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm]) commit d0ae6837d117881d9f1f9cc12d3f1012b6a46103 Author: Eric Anholt <[email protected]> Date: Fri Oct 28 13:13:08 2011 -0700 intel: Share the implementation of BO unmap between CPU and GTT mappings. Before this, consumers of the libdrm API that might map a buffer either way had to track which way was chosen at map time to call the appropriate unmap. This relaxes that requirement by making drm_intel_bo_unmap() always appropriate. Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Chris Wilson <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index cebf732..dd58c0c 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1134,21 +1134,6 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo) return 0; } -int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo) -{ - drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; - int ret = 0; - - if (bo == NULL) - return 0; - - pthread_mutex_lock(&bufmgr_gem->lock); - bo->virtual = NULL; - pthread_mutex_unlock(&bufmgr_gem->lock); - - return ret; -} - static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; @@ -1182,6 +1167,11 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) return ret; } +int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo) +{ + return drm_intel_gem_bo_unmap(bo); +} + static int drm_intel_gem_bo_subdata(drm_intel_bo *bo, unsigned long offset, unsigned long size, const void *data) commit 4cb01eeccfa6a5169edea07c339117cac1f7b261 Author: Eric Anholt <[email protected]> Date: Fri Oct 28 13:12:16 2011 -0700 intel: Don't call the SW_FINISH ioctl unless a CPU-mapped write was done. Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Chris Wilson <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 94549f8..cebf732 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -196,6 +196,9 @@ struct _drm_intel_bo_gem { * relocations. */ int reloc_tree_fences; + + /** Flags that we may need to do the SW_FINSIH ioctl on unmap. */ + bool mapped_cpu_write; }; static unsigned int @@ -1051,6 +1054,9 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable) strerror(errno)); } + if (write_enable) + bo_gem->mapped_cpu_write = true; + pthread_mutex_unlock(&bufmgr_gem->lock); return 0; @@ -1148,21 +1154,27 @@ static int drm_intel_gem_bo_unmap(drm_intel_bo *bo) drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; struct drm_i915_gem_sw_finish sw_finish; - int ret; + int ret = 0; if (bo == NULL) return 0; pthread_mutex_lock(&bufmgr_gem->lock); - /* Cause a flush to happen if the buffer's pinned for scanout, so the - * results show up in a timely manner. - */ - sw_finish.handle = bo_gem->gem_handle; - ret = drmIoctl(bufmgr_gem->fd, - DRM_IOCTL_I915_GEM_SW_FINISH, - &sw_finish); - ret = ret == -1 ? -errno : 0; + if (bo_gem->mapped_cpu_write) { + /* Cause a flush to happen if the buffer's pinned for + * scanout, so the results show up in a timely manner. + * Unlike GTT set domains, this only does work if the + * buffer should be scanout-related. + */ + sw_finish.handle = bo_gem->gem_handle; + ret = drmIoctl(bufmgr_gem->fd, + DRM_IOCTL_I915_GEM_SW_FINISH, + &sw_finish); + ret = ret == -1 ? -errno : 0; + + bo_gem->mapped_cpu_write = false; + } bo->virtual = NULL; pthread_mutex_unlock(&bufmgr_gem->lock); commit 77dc16f33d19195c7f7c569d877a6180ed1b9d54 Author: Eric Anholt <[email protected]> Date: Fri Oct 28 13:02:53 2011 -0700 intel: Remove stale comment. This used to be next to some map refcounting code, but that is long dead. Reviewed-by: Daniel Vetter <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 54433ea..94549f8 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1010,9 +1010,6 @@ static int drm_intel_gem_bo_map(drm_intel_bo *bo, int write_enable) pthread_mutex_lock(&bufmgr_gem->lock); - /* Allow recursive mapping. Mesa may recursively map buffers with - * nested display loops. - */ if (!bo_gem->mem_virtual) { struct drm_i915_gem_mmap mmap_arg; commit 515cea6ac67eb458c59fececc3c67411ee6fd3c3 Author: Eric Anholt <[email protected]> Date: Fri Oct 21 18:48:20 2011 -0700 intel: Add an interface for removing relocs after they're added. This lets us replace the current inner drawing loop of mesa: for each prim { compute bo list if (check_aperture_space(bo list)) { batch_flush() compute bo list if (check_aperture_space(bo list)) { whine_about_batch_size() fall back; } } upload state to BOs } with this inner loop: for each prim { retry: upload state to BOs if (check_aperture_space(batch)) { if (!retried) { reset_to_last_prim() batch_flush() } else { if (batch_flush()) whine_about_batch_size() goto retry; } } } This avoids having to implement code to walk over certain sets of GL state twice (the "compute bo list" step). While it's not a performance improvement, it's a significant win in code complexity: about -200 lines, and one place to make mistakes related to aperture space instead of N places to forget some BO we should have included. Note how if we do a reset in the new loop , we immediately flush. We don't need to check aperture space -- the kernel will tell us if we actually ran out of aperture or not. And if we did run out of aperture, it's because either the single prim was too big, or because check_aperture was wrong at the point of setting up the last primitive. Reviewed-by: Daniel Vetter <[email protected]> diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index 889ef46..abe9711 100644 --- a/intel/intel_bufmgr.h +++ b/intel/intel_bufmgr.h @@ -147,6 +147,8 @@ void drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr); void drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr); int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo); int drm_intel_gem_bo_unmap_gtt(drm_intel_bo *bo); +int drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo); +void drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start); void drm_intel_gem_bo_start_gtt_access(drm_intel_bo *bo, int write_enable); int drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id); diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 31ea26e..54433ea 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -1423,6 +1423,48 @@ drm_intel_gem_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset, read_domains, write_domain, true); } +int +drm_intel_gem_bo_get_reloc_count(drm_intel_bo *bo) +{ + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + + return bo_gem->reloc_count; +} + +/** + * Removes existing relocation entries in the BO after "start". + * + * This allows a user to avoid a two-step process for state setup with + * counting up all the buffer objects and doing a + * drm_intel_bufmgr_check_aperture_space() before emitting any of the + * relocations for the state setup. Instead, save the state of the + * batchbuffer including drm_intel_gem_get_reloc_count(), emit all the + * state, and then check if it still fits in the aperture. + * + * Any further drm_intel_bufmgr_check_aperture_space() queries + * involving this buffer in the tree are undefined after this call. + */ +void +drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start) +{ + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + int i; + struct timespec time; + + clock_gettime(CLOCK_MONOTONIC, &time); + + assert(bo_gem->reloc_count >= start); + /* Unreference the cleared target buffers */ + for (i = start; i < bo_gem->reloc_count; i++) { + if (bo_gem->reloc_target_info[i].bo != bo) { + drm_intel_gem_bo_unreference_locked_timed(bo_gem-> + reloc_target_info[i].bo, + time.tv_sec); + } + } + bo_gem->reloc_count = start; +} + /** * Walk the tree of relocations rooted at BO and accumulate the list of * validations to be performed and update the relocation buffers with commit 2c2bdb36c5b6bd7f8eac07cf163975b361114fb1 Author: Eric Anholt <[email protected]> Date: Fri Oct 21 16:53:16 2011 -0700 intel: Use stdbool.h for dealing with boolean values. A few of the bitfield-based booleans are left in place. Changing them to "bool" results in the same code size, so I'm erring on the side of not changing things. Reviewed-by: Daniel Vetter <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 1baa0b3..31ea26e 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -51,6 +51,7 @@ #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> +#include <stdbool.h> #include "errno.h" #include "libdrm_lists.h" @@ -105,7 +106,7 @@ typedef struct _drm_intel_bufmgr_gem { unsigned int has_blt : 1; unsigned int has_relaxed_fencing : 1; unsigned int bo_reuse : 1; - char fenced_relocs; + bool fenced_relocs; } drm_intel_bufmgr_gem; #define DRM_INTEL_RELOC_FENCE (1<<0) @@ -163,24 +164,24 @@ struct _drm_intel_bo_gem { * Boolean of whether this BO and its children have been included in * the current drm_intel_bufmgr_check_aperture_space() total. */ - char included_in_check_aperture; + bool included_in_check_aperture; /** * Boolean of whether this buffer has been used as a relocation * target and had its size accounted for, and thus can't have any * further relocations added to it. */ - char used_as_reloc_target; + bool used_as_reloc_target; /** * Boolean of whether we have encountered an error whilst building the relocation tree. */ - char has_error; + bool has_error; /** * Boolean of whether this buffer can be re-used */ - char reusable; + bool reusable; /** * Size in bytes of this buffer and its relocation descendents. @@ -507,7 +508,7 @@ drm_intel_setup_reloc_list(drm_intel_bo *bo) bo_gem->reloc_target_info = malloc(max_relocs * sizeof(drm_intel_reloc_target)); if (bo_gem->relocs == NULL || bo_gem->reloc_target_info == NULL) { - bo_gem->has_error = 1; + bo_gem->has_error = true; free (bo_gem->relocs); bo_gem->relocs = NULL; @@ -592,12 +593,12 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, unsigned int page_size = getpagesize(); int ret; struct drm_intel_gem_bo_bucket *bucket; - int alloc_from_cache; + bool alloc_from_cache; unsigned long bo_size; - int for_render = 0; + bool for_render = false; if (flags & BO_ALLOC_FOR_RENDER) - for_render = 1; + for_render = true; /* Round the allocated size up to a power of two number of pages. */ bucket = drm_intel_gem_bo_bucket_for_size(bufmgr_gem, size); @@ -616,7 +617,7 @@ drm_intel_gem_bo_alloc_internal(drm_intel_bufmgr *bufmgr, pthread_mutex_lock(&bufmgr_gem->lock); /* Get a buffer out of the cache if available */ retry: - alloc_from_cache = 0; + alloc_from_cache = false; if (bucket != NULL && !DRMLISTEMPTY(&bucket->head)) { if (for_render) { /* Allocate new render-target BOs from the tail (MRU) @@ -626,7 +627,7 @@ retry: bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.prev, head); DRMLISTDEL(&bo_gem->head); - alloc_from_cache = 1; + alloc_from_cache = true; } else { /* For non-render-target BOs (where we're probably * going to map it first thing in order to fill it @@ -638,7 +639,7 @@ retry: bo_gem = DRMLISTENTRY(drm_intel_bo_gem, bucket->head.next, head); if (!drm_intel_gem_bo_busy(&bo_gem->bo)) { - alloc_from_cache = 1; + alloc_from_cache = true; DRMLISTDEL(&bo_gem->head); } } @@ -702,9 +703,9 @@ retry: atomic_set(&bo_gem->refcount, 1); bo_gem->validate_index = -1; bo_gem->reloc_tree_fences = 0; - bo_gem->used_as_reloc_target = 0; - bo_gem->has_error = 0; - bo_gem->reusable = 1; + bo_gem->used_as_reloc_target = false; + bo_gem->has_error = false; + bo_gem->reusable = true; drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem); @@ -845,7 +846,7 @@ drm_intel_bo_gem_create_from_name(drm_intel_bufmgr *bufmgr, bo_gem->gem_handle = open_arg.handle; bo_gem->bo.handle = open_arg.handle; bo_gem->global_name = handle; - bo_gem->reusable = 0; + bo_gem->reusable = false; memset(&get_tiling, 0, sizeof(get_tiling)); get_tiling.handle = bo_gem->gem_handle; @@ -938,7 +939,7 @@ drm_intel_gem_bo_unreference_final(drm_intel_bo *bo, time_t time) } } bo_gem->reloc_count = 0; - bo_gem->used_as_reloc_target = 0; + bo_gem->used_as_reloc_target = false; DBG("bo_unreference final: %d (%s)\n", bo_gem->gem_handle, bo_gem->name); @@ -1329,28 +1330,28 @@ static int do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset, uint32_t read_domains, uint32_t write_domain, - int need_fence) + bool need_fence) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) target_bo; - int fenced_command; + bool fenced_command; if (bo_gem->has_error) return -ENOMEM; if (target_bo_gem->has_error) { - bo_gem->has_error = 1; + bo_gem->has_error = true; return -ENOMEM; } /* We never use HW fences for rendering on 965+ */ if (bufmgr_gem->gen >= 4) - need_fence = 0; + need_fence = false; fenced_command = need_fence; if (target_bo_gem->tiling_mode == I915_TILING_NONE) - need_fence = 0; + need_fence = false; /* Create a new relocation list if needed */ if (bo_gem->relocs == NULL && drm_intel_setup_reloc_list(bo)) @@ -1368,7 +1369,7 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, */ assert(!bo_gem->used_as_reloc_target); if (target_bo_gem != bo_gem) { - target_bo_gem->used_as_reloc_target = 1; + target_bo_gem->used_as_reloc_target = true; bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size; } /* An object needing a fence is a tiled buffer, so it won't have @@ -1419,7 +1420,7 @@ drm_intel_gem_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset, uint32_t read_domains, uint32_t write_domain) { return do_bo_emit_reloc(bo, offset, target_bo, target_offset, - read_domains, write_domain, 1); + read_domains, write_domain, true); } /** @@ -1800,7 +1801,7 @@ drm_intel_gem_bo_flink(drm_intel_bo *bo, uint32_t * name) if (ret != 0) return -errno; bo_gem->global_name = flink.name; - bo_gem->reusable = 0; + bo_gem->reusable = false; DRMLISTADDTAIL(&bo_gem->name_list, &bufmgr_gem->named); } @@ -1821,7 +1822,7 @@ drm_intel_bufmgr_gem_enable_reuse(drm_intel_bufmgr *bufmgr) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr; - bufmgr_gem->bo_reuse = 1; + bufmgr_gem->bo_reuse = true; } /** @@ -1837,7 +1838,7 @@ drm_intel_bufmgr_gem_enable_fenced_relocs(drm_intel_bufmgr *bufmgr) drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bufmgr; if (bufmgr_gem->bufmgr.bo_exec == drm_intel_gem_bo_exec2) - bufmgr_gem->fenced_relocs = 1; + bufmgr_gem->fenced_relocs = true; } /** @@ -1855,7 +1856,7 @@ drm_intel_gem_bo_get_aperture_space(drm_intel_bo *bo) return 0; total += bo->size; - bo_gem->included_in_check_aperture = 1; + bo_gem->included_in_check_aperture = true; for (i = 0; i < bo_gem->reloc_count; i++) total += @@ -1903,7 +1904,7 @@ drm_intel_gem_bo_clear_aperture_space_flag(drm_intel_bo *bo) if (bo == NULL || !bo_gem->included_in_check_aperture) return; - bo_gem->included_in_check_aperture = 0; + bo_gem->included_in_check_aperture = false; for (i = 0; i < bo_gem->reloc_count; i++) drm_intel_gem_bo_clear_aperture_space_flag(bo_gem-> @@ -2020,7 +2021,7 @@ drm_intel_gem_bo_disable_reuse(drm_intel_bo *bo) { drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; - bo_gem->reusable = 0; + bo_gem->reusable = false; return 0; } @@ -2116,7 +2117,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) struct drm_i915_gem_get_aperture aperture; drm_i915_getparam_t gp; int ret, tmp; - int exec2 = 0; + bool exec2 = false; bufmgr_gem = calloc(1, sizeof(*bufmgr_gem)); if (bufmgr_gem == NULL) @@ -2167,7 +2168,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) gp.param = I915_PARAM_HAS_EXECBUF2; ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); if (!ret) - exec2 = 1; + exec2 = true; gp.param = I915_PARAM_HAS_BSD; ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp); commit cc088f1721eaa5f8f1ba1932723882f92e34c39a Author: Dave Airlie <[email protected]> Date: Wed Oct 19 17:39:54 2011 +0100 nouveau: free in error path if drmAvailable fails. This was reported in coverity. Signed-off-by: Dave Airlie <[email protected]> diff --git a/nouveau/nouveau_device.c b/nouveau/nouveau_device.c index 2ffcba6..425c5d2 100644 --- a/nouveau/nouveau_device.c +++ b/nouveau/nouveau_device.c @@ -46,8 +46,10 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close, nvdev->needs_close = close; ver = drmGetVersion(fd); - if (!ver) + if (!ver) { + nouveau_device_close((void *)&nvdev); return -EINVAL; + } if ((ver->version_major == 0 && ver->version_patchlevel != 16) || ver->version_major > 1) { commit d23146f3f0ad14c8ad482a4832cae859c8d646f2 Author: Jakob Bornecrantz <[email protected]> Date: Wed Oct 19 13:32:43 2011 +0200 modetest: Call dirty fb on modeset Signed-off-by: Jakob Bornecrantz <[email protected]> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index f65a033..229ab8a 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -583,6 +583,10 @@ set_mode(struct connector *c, int count, int page_flip) ret = drmModeSetCrtc(fd, c[i].crtc, fb_id, x, 0, &c[i].id, 1, c[i].mode); + + /* XXX: Actually check if this is needed */ + drmModeDirtyFB(fd, fb_id, NULL, 0); + x += c[i].mode->hdisplay; if (ret) { commit 680b9c4fa3dfb329bd74ec08c17cfc876ea2fc5b Author: Jakob Bornecrantz <[email protected]> Date: Wed Oct 19 13:32:26 2011 +0200 modetest: Print extra info if we fail to create a framebuffer Signed-off-by: Jakob Bornecrantz <[email protected]> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 35045c8..f65a033 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -568,7 +568,8 @@ set_mode(struct connector *c, int count, int page_flip) kms_bo_get_prop(bo, KMS_HANDLE, &handle); ret = drmModeAddFB(fd, width, height, 24, 32, stride, handle, &fb_id); if (ret) { - fprintf(stderr, "failed to add fb: %s\n", strerror(errno)); + fprintf(stderr, "failed to add fb (%ux%u): %s\n", + width, height, strerror(errno)); return; } commit 3c8adda6e1e6b0471b3d70a63d795622bbeb1580 Author: Jakob Bornecrantz <[email protected]> Date: Wed Sep 28 23:34:09 2011 +0200 modetest: Check error message from pageflip ioctl Signed-off-by: Jakob Bornecrantz <[email protected]> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index f6fdcf4..35045c8 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -608,8 +608,12 @@ set_mode(struct connector *c, int count, int page_flip) if (c[i].mode == NULL) continue; - drmModePageFlip(fd, c[i].crtc, other_fb_id, - DRM_MODE_PAGE_FLIP_EVENT, &c[i]); + ret = drmModePageFlip(fd, c[i].crtc, other_fb_id, + DRM_MODE_PAGE_FLIP_EVENT, &c[i]); + if (ret) { + fprintf(stderr, "failed to page flip: %s\n", strerror(errno)); + return; + } gettimeofday(&c[i].start, NULL); c[i].swap_count = 0; c[i].fb_id[0] = fb_id; commit c2925e51979fcb829962e7bf66c13cbc96c39db1 Author: Jakob Bornecrantz <[email protected]> Date: Wed Sep 28 17:27:07 2011 +0200 vbltest: Check error codes returned from libdrm Signed-off-by: Jakob Bornecrantz <[email protected]> diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 2fe56b2..903ca0f 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -102,7 +102,7 @@ static void usage(char *name) int main(int argc, char **argv) { - int i, c, fd; + int i, c, fd, ret; char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" }; drmVBlank vbl; drmEventContext evctx; @@ -141,7 +141,11 @@ int main(int argc, char **argv) if (secondary) vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.sequence = 0; - drmWaitVBlank(fd, &vbl); + ret = drmWaitVBlank(fd, &vbl); + if (ret != 0) { + printf("drmWaitVBlank (relative) failed ret: %i\n", ret); + return -1; + } printf("starting count: %d\n", vbl.request.sequence); @@ -154,7 +158,11 @@ int main(int argc, char **argv) vbl.request.type |= DRM_VBLANK_SECONDARY; vbl.request.sequence = 1; vbl.request.signal = (unsigned long)&handler_info; - drmWaitVBlank(fd, &vbl); + ret = drmWaitVBlank(fd, &vbl); + if (ret != 0) { + printf("drmWaitVBlank (relative, event) failed ret: %i\n", ret); + return -1; + } /* Set up our event handler */ memset(&evctx, 0, sizeof evctx); @@ -181,7 +189,11 @@ int main(int argc, char **argv) break; } - drmHandleEvent(fd, &evctx); + ret = drmHandleEvent(fd, &evctx); + if (ret != 0) { + printf("drmHandleEvent failed: %i\n", ret); + return -1; + } } return 0; commit dc11db2e282c522219bb6e419eb648f3e836bdc0 Author: Jakob Bornecrantz <[email protected]> Date: Fri Sep 16 20:50:39 2011 +0200 tests: Add vmwgfx driver to probed drivers in tests Signed-off-by: Jakob Bornecrantz <[email protected]> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 88c5ce5..f6fdcf4 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -712,7 +712,7 @@ int main(int argc, char **argv) int c; int encoders = 0, connectors = 0, crtcs = 0, framebuffers = 0; int test_vsync = 0; - char *modules[] = { "i915", "radeon", "nouveau" }; + char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" }; char *modeset = NULL; int i, count = 0; struct connector con_args[2]; diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 1297da8..2fe56b2 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -103,7 +103,7 @@ static void usage(char *name) int main(int argc, char **argv) { int i, c, fd; - char *modules[] = { "i915", "radeon", "nouveau" }; + char *modules[] = { "i915", "radeon", "nouveau", "vmwgfx" }; drmVBlank vbl; drmEventContext evctx; struct vbl_info handler_info; commit b317c96361f88a0a4ccb2faeff09b0476d142c68 Author: Jesse Barnes <[email protected]> Date: Tue Oct 11 11:09:44 2011 -0700 modetest: use 24 bit depth on the framebuffer It's more compatible; at least the Intel driver now rejects 32 bit depths since it generally can't support real 32 bit framebuffers (supports 30, 36, and 64 bit, but not 32). diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index bd0f0a0..88c5ce5 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -566,7 +566,7 @@ set_mode(struct connector *c, int count, int page_flip) return; kms_bo_get_prop(bo, KMS_HANDLE, &handle); - ret = drmModeAddFB(fd, width, height, 32, 32, stride, handle, &fb_id); + ret = drmModeAddFB(fd, width, height, 24, 32, stride, handle, &fb_id); if (ret) { fprintf(stderr, "failed to add fb: %s\n", strerror(errno)); return; commit c82ef03e4c92017bf5644f294ea04e30500f8d4c Author: Dave Airlie <[email protected]> Date: Mon Sep 26 16:03:20 2011 +0100 drmtest: make check should fail so hard on unable to open device diff --git a/tests/drmtest.c b/tests/drmtest.c index a685102..022994a 100644 --- a/tests/drmtest.c +++ b/tests/drmtest.c @@ -62,7 +62,7 @@ int drm_open_matching(const char *pci_glob, int flags) struct udev_device *device, *parent; struct udev_list_entry *entry; const char *pci_id, *path; - const char *usub; + const char *usub, *dnode; int fd; udev = udev_new(); @@ -86,7 +86,10 @@ int drm_open_matching(const char *pci_glob, int flags) pci_id = udev_device_get_property_value(parent, "PCI_ID"); if (fnmatch(pci_glob, pci_id, 0) != 0) continue; - fd = open(udev_device_get_devnode(device), O_RDWR); + dnode = udev_device_get_devnode(device); + if (strstr(dnode, "control")) + continue; + fd = open(dnode, O_RDWR); if (fd < 0) continue; if ((flags & DRM_TEST_MASTER) && !is_master(fd)) { @@ -109,7 +112,7 @@ int drm_open_any(void) if (fd < 0) { fprintf(stderr, "failed to open any drm device\n"); - abort(); + exit(0); } return fd; @@ -124,7 +127,7 @@ int drm_open_any_master(void) if (fd < 0) { fprintf(stderr, "failed to open any drm device\n"); - abort(); + exit(0); } return fd; commit 3a551c127439b2d5cad5c7ca817feab1ca4c78c5 Author: Dave Airlie <[email protected]> Date: Mon Sep 26 15:54:13 2011 +0100 drm/test: handle usub being empty fixes a segfault on make check seen in tinderbox diff --git a/tests/drmtest.c b/tests/drmtest.c index 685a652..a685102 100644 --- a/tests/drmtest.c +++ b/tests/drmtest.c @@ -62,6 +62,7 @@ int drm_open_matching(const char *pci_glob, int flags) struct udev_device *device, *parent; struct udev_list_entry *entry; const char *pci_id, *path; + const char *usub; int fd; udev = udev_new(); @@ -78,8 +79,9 @@ int drm_open_matching(const char *pci_glob, int flags) path = udev_list_entry_get_name(entry); device = udev_device_new_from_syspath(udev, path); parent = udev_device_get_parent(device); + usub = udev_device_get_subsystem(parent); /* Filter out KMS output devices. */ - if (strcmp(udev_device_get_subsystem(parent), "pci") != 0) + if (!usub || (strcmp(usub, "pci") != 0)) continue; pci_id = udev_device_get_property_value(parent, "PCI_ID"); if (fnmatch(pci_glob, pci_id, 0) != 0) commit cfee5218b17a2741e5519ed44091171e01f0dbb2 Author: Tapani Pälli <[email protected]> Date: Fri Sep 23 14:17:42 2011 +0300 xf86drm.h : wrap C code for C++ compilation/linking To enable usage of xf86drm.h from C++ programs/frameworks. Signed-off-by: Tapani Pälli <[email protected]> [ickle: also wrap xf86drmMode.h] Signed-off-by: Chris Wilson <[email protected]> diff --git a/xf86drm.h b/xf86drm.h index 20f4c78..76eb94e 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -39,6 +39,10 @@ #include <stdint.h> #include <drm.h> +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + #ifndef DRM_MAX_MINOR #define DRM_MAX_MINOR 16 #endif @@ -723,4 +727,8 @@ extern int drmHandleEvent(int fd, drmEventContextPtr evctx); extern char *drmGetDeviceNameFromFd(int fd); +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + #endif diff --git a/xf86drmMode.h b/xf86drmMode.h index ee7c454..1b1e3e2 100644 --- a/xf86drmMode.h +++ b/xf86drmMode.h @@ -33,6 +33,10 @@ * */ +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + #include <drm.h> /* @@ -386,3 +390,7 @@ extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue); extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif commit 194aa1bee632c6dce19238664eb8373e3483de55 Author: Daniel Vetter <[email protected]> Date: Thu Sep 22 22:20:53 2011 +0200 drm/i915: y tiling on i915G/i915GM is different Luckily the kernel has become extremely paranoid about such matters. Signed-off-by: Daniel Vetter <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 22617ec..1baa0b3 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -275,7 +275,8 @@ drm_intel_gem_bo_tile_pitch(drm_intel_bufmgr_gem *bufmgr_gem, if (*tiling_mode == I915_TILING_NONE) return ALIGN(pitch, 64); - if (*tiling_mode == I915_TILING_X) + if (*tiling_mode == I915_TILING_X + || (IS_915(bufmgr_gem) && *tiling_mode == I915_TILING_Y)) tile_width = 512; else tile_width = 128; @@ -764,7 +765,8 @@ drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name, if (IS_GEN2(bufmgr_gem) && tiling != I915_TILING_NONE) height_alignment = 16; - else if (tiling == I915_TILING_X) + else if (tiling == I915_TILING_X + || (IS_915(bufmgr_gem) && tiling == I915_TILING_Y)) height_alignment = 8; else if (tiling == I915_TILING_Y) height_alignment = 32; commit 630dd26fb41c64c1e61be6e929e025c1528e9046 Author: Daniel Vetter <[email protected]> Date: Thu Sep 22 22:20:09 2011 +0200 drm/intel: don't clobber bufmgr->pci_device Otherwise it's pretty hard to differentiate the different chipset variants. Signed-off-by: Daniel Vetter <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 4f4de92..22617ec 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -2113,7 +2113,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) drm_intel_bufmgr_gem *bufmgr_gem; struct drm_i915_gem_get_aperture aperture; drm_i915_getparam_t gp; - int ret; -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

