diff options
author | Christian König <[email protected]> | 2012-02-26 11:37:53 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2012-03-02 13:14:22 +0100 |
commit | bf19596870a61c615f12e593f4812052ce9d9721 (patch) | |
tree | 0ec2144fbfa57bd0698b546e4d6fa6e9ca6913a7 | |
parent | abf31e3822665b6bdf5ac78b757a21522c9448b1 (diff) |
st/vdpau: implement BitmapSurfaceQueryCapabilities
Signed-off-by: Christian König <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/vdpau/query.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index c5f7037594a..e7acddcc9e8 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -275,10 +275,44 @@ VdpStatus vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height) { + vlVdpDevice *dev; + struct pipe_screen *pscreen; + enum pipe_format format; + + dev = vlGetDataHTAB(device); + if (!dev) + return VDP_STATUS_INVALID_HANDLE; + + pscreen = dev->vscreen->pscreen; + if (!pscreen) + return VDP_STATUS_RESOURCES; + + format = FormatRGBAToPipe(surface_rgba_format); + if (format == PIPE_FORMAT_NONE) + return VDP_STATUS_INVALID_RGBA_FORMAT; + if (!(is_supported && max_width && max_height)) return VDP_STATUS_INVALID_POINTER; - return VDP_STATUS_NO_IMPLEMENTATION; + *is_supported = pscreen->is_format_supported + ( + pscreen, format, PIPE_TEXTURE_3D, 1, + PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET + ); + if (*is_supported) { + uint32_t max_2d_texture_level = pscreen->get_param( + pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); + + if (!max_2d_texture_level) + return VDP_STATUS_ERROR; + + *max_width = *max_height = pow(2, max_2d_texture_level - 1); + } else { + *max_width = 0; + *max_height = 0; + } + + return VDP_STATUS_OK; } /** |