r300g: do not use ioctl thread offloading on single-core machines
authorMarek Olšák <maraeo@gmail.com>
Wed, 2 Mar 2011 16:37:52 +0000 (17:37 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 2 Mar 2011 16:54:36 +0000 (17:54 +0100)
src/gallium/winsys/radeon/drm/radeon_drm_common.c
src/gallium/winsys/radeon/drm/radeon_drm_cs.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 4676c2a1ea977a87b2f76af5150fa7718375e4a8..c0044d399c4bd1e32072e440e986dcc21c94adff 100644 (file)
@@ -157,6 +157,8 @@ static void do_ioctls(struct radeon_drm_winsys *winsys)
     winsys->vram_size = gem_info.vram_size;
 
     drmFreeVersion(version);
+
+    winsys->num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 }
 
 static void radeon_winsys_destroy(struct r300_winsys_screen *rws)
index a38b01048b2c124ea7436caec1c3d68bbc4877ca..9ee800f5950b7328c213bf332cf238302ab35d5f 100644 (file)
@@ -384,7 +384,7 @@ void radeon_drm_cs_flush(struct r300_winsys_cs *rcs)
         for (i = 0; i < crelocs; i++)
             p_atomic_inc(&cs->csc->relocs_bo[i]->num_active_ioctls);
 
-        if (debug_get_option_thread()) {
+        if (cs->ws->num_cpus > 1 && debug_get_option_thread()) {
             cs->thread = pipe_thread_create(radeon_drm_cs_emit_ioctl, cs->csc);
             assert(cs->thread);
         } else {
index f8a89abcfe45922c040055e3ba3c46aba0902f79..9ecbb0745724482dda06595763c0d2876cbcbb8a 100644 (file)
@@ -46,6 +46,7 @@ struct radeon_drm_winsys {
     uint32_t z_pipes;       /* Z pipe count (rv530 only) */
     uint32_t gart_size;     /* GART size. */
     uint32_t vram_size;     /* VRAM size. */
+    uint32_t num_cpus;      /* Number of CPUs. */
 
     unsigned drm_major;
     unsigned drm_minor;