diff options
author | Marek Olšák <[email protected]> | 2019-08-29 20:35:54 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-09-18 14:41:30 -0400 |
commit | d307aa56f9f92da79d4ebbf1f9a1b3e65156f258 (patch) | |
tree | 42ae1de067d2d65a19dc28c6c8209787a0192753 /src/gallium/state_trackers/dri | |
parent | aae35fbd3a3eba176ac6fdf6357be49002a561ee (diff) |
gallium: extend resource_get_param to be as capable as resource_get_handle
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 47b9f0f7393..574ddaea5c7 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1146,14 +1146,15 @@ dri2_query_image_by_resource_handle(__DRIimage *image, int attrib, int *value) static bool dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param, - uint64_t *value) + unsigned handle_usage, uint64_t *value) { struct pipe_screen *pscreen = image->texture->screen; if (!pscreen->resource_get_param) return false; - return pscreen->resource_get_param(pscreen, image->texture, image->plane, - param, value); + return pscreen->resource_get_param(pscreen, NULL, image->texture, + image->plane, 0, param, handle_usage, + value); } static bool @@ -1161,6 +1162,7 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value) { enum pipe_resource_param param; uint64_t res_param; + unsigned handle_usage; if (!image->texture->screen->resource_get_param) return false; @@ -1192,7 +1194,12 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value) return false; } - if (!dri2_resource_get_param(image, param, &res_param)) + if (image->use & __DRI_IMAGE_USE_BACKBUFFER) + handle_usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH; + else + handle_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE; + + if (!dri2_resource_get_param(image, param, handle_usage, &res_param)) return false; switch (attrib) { @@ -1330,7 +1337,7 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate) return NULL; } else if (plane > 0) { uint64_t planes; - if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_NPLANES, + if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_NPLANES, 0, &planes) || plane >= planes) { return NULL; @@ -1339,7 +1346,7 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate) if (image->dri_components == 0) { uint64_t modifier; - if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_MODIFIER, + if (!dri2_resource_get_param(image, PIPE_RESOURCE_PARAM_MODIFIER, 0, &modifier) || modifier == DRM_FORMAT_MOD_INVALID) { return NULL; |