st/dri: simplify throttling code
authorMarek Olšák <marek.olsak@amd.com>
Mon, 22 Apr 2019 21:05:18 +0000 (17:05 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 24 Apr 2019 01:19:48 +0000 (21:19 -0400)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/dri/dri_drawable.c
src/gallium/state_trackers/dri/dri_screen.h

index efb43c0d7973c533324b9827aba3b0c16adb1fc2..7edef415505abccc54afcc7f5724bbc000257ca2 100644 (file)
@@ -1933,10 +1933,8 @@ dri2_init_screen(__DRIscreen * sPriv)
    throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
    dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
 
-   if (throttle_ret && throttle_ret->val.val_int != -1) {
-      screen->throttling_enabled = TRUE;
+   if (throttle_ret && throttle_ret->val.val_int > 0)
       screen->default_throttle_frames = throttle_ret->val.val_int;
-   }
 
    if (pscreen->resource_create_with_modifiers)
       dri2ImageExtension.createImageWithModifiers =
index 92047584224ffeb50d78b6aa88805e7f57f7018a..26bfdbecc539734ae89c07e781cd719adf23e10a 100644 (file)
@@ -547,7 +547,7 @@ dri_flush(__DRIcontext *cPriv,
       flush_flags |= ST_FLUSH_END_OF_FRAME;
 
    /* Flush the context and throttle if needed. */
-   if (dri_screen(ctx->sPriv)->throttling_enabled &&
+   if (dri_screen(ctx->sPriv)->default_throttle_frames &&
        drawable &&
        (reason == __DRI2_THROTTLE_SWAPBUFFER ||
         reason == __DRI2_THROTTLE_FLUSHFRONT)) {
index 30bde45ce423ccef7838bca8558437cb19a8d1ac..85372cb97c889f76a4c178668edcd61a91e27895 100644 (file)
@@ -57,8 +57,7 @@ struct dri_screen
 
    /* dri */
    __DRIscreen *sPriv;
-   boolean throttling_enabled;
-   int default_throttle_frames;
+   unsigned default_throttle_frames;
 
    struct st_config_options options;