i965: Add an env var for forcing window system MSAA.
authorEric Anholt <eric@anholt.net>
Fri, 21 Mar 2014 23:36:22 +0000 (16:36 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 24 Mar 2014 18:15:04 +0000 (11:15 -0700)
Sometimes it would be nice to benchmark some app with MSAA versus not, but
it doesn't offer the controls you want.  Just provide a handy knob to
force the issue.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.h

index 4e9a77594b36dedfc701dd40e29d4972bd913ce7..0788a1b8e5f7fa1a355c80ffcdb40bc7f1e5fc6b 100644 (file)
@@ -975,6 +975,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
 
    _mesa_initialize_window_framebuffer(fb, mesaVis);
 
+   if (screen->winsys_msaa_samples_override != -1) {
+      num_samples = screen->winsys_msaa_samples_override;
+      fb->Visual.samples = num_samples;
+   }
+
    if (mesaVis->redBits == 5)
       rgbFormat = MESA_FORMAT_B5G6R5_UNORM;
    else if (mesaVis->sRGBCapable)
@@ -1335,6 +1340,16 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 
    intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
 
+   const char *force_msaa = getenv("INTEL_FORCE_MSAA");
+   if (force_msaa) {
+      intelScreen->winsys_msaa_samples_override =
+         intel_quantize_num_samples(intelScreen, atoi(force_msaa));
+      printf("Forcing winsys sample count to %d\n",
+             intelScreen->winsys_msaa_samples_override);
+   } else {
+      intelScreen->winsys_msaa_samples_override = -1;
+   }
+
    set_max_gl_versions(intelScreen);
 
    /* Notification of GPU resets requires hardware contexts and a kernel new
index 09690215dedc73e94c9527f17b3537ef13ce2236..945f6f5f43f01c6efc56f43c4ba5577c8914aaef 100644 (file)
@@ -62,6 +62,8 @@ struct intel_screen
     */
    unsigned program_id;
 
+   int winsys_msaa_samples_override;
+
    struct {
       struct ra_regs *regs;