diff options
author | Marek Olšák <[email protected]> | 2014-01-22 02:12:51 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-01-28 01:39:46 +0100 |
commit | d41bd71bcfa43b3aad5abbb0da9f716e631042c4 (patch) | |
tree | c99a53445eb8cef35ec69c4027b5e35bfdfd4a3c /src/gallium | |
parent | a4c218f398a6176f2ecbe7e295020d348670a957 (diff) |
r600g,radeonsi: consolidate get_paramf and get_video_param
radeonsi now reports PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = true if UVD support
isn't available. It's what all the other drivers do.
Also, some #include directives were missing in radeon_uvd.h.
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r600/r600_pipe.c | 64 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 67 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/radeon_uvd.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 54 |
4 files changed, 70 insertions, 118 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index eec04bfaebb..87f3711224c 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -447,34 +447,6 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 0; } -static float r600_get_paramf(struct pipe_screen* pscreen, - enum pipe_capf param) -{ - struct r600_screen *rscreen = (struct r600_screen *)pscreen; - enum radeon_family family = rscreen->b.family; - - switch (param) { - case PIPE_CAPF_MAX_LINE_WIDTH: - case PIPE_CAPF_MAX_LINE_WIDTH_AA: - case PIPE_CAPF_MAX_POINT_WIDTH: - case PIPE_CAPF_MAX_POINT_WIDTH_AA: - if (family >= CHIP_CEDAR) - return 16384.0f; - else - return 8192.0f; - case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY: - return 16.0f; - case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS: - return 16.0f; - case PIPE_CAPF_GUARD_BAND_LEFT: - case PIPE_CAPF_GUARD_BAND_TOP: - case PIPE_CAPF_GUARD_BAND_RIGHT: - case PIPE_CAPF_GUARD_BAND_BOTTOM: - return 0.0f; - } - return 0.0f; -} - static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) { switch(shader) @@ -538,34 +510,6 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e return 0; } -static int r600_get_video_param(struct pipe_screen *screen, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_cap param) -{ - switch (param) { - case PIPE_VIDEO_CAP_SUPPORTED: - return vl_profile_supported(screen, profile, entrypoint); - case PIPE_VIDEO_CAP_NPOT_TEXTURES: - return 1; - case PIPE_VIDEO_CAP_MAX_WIDTH: - case PIPE_VIDEO_CAP_MAX_HEIGHT: - return vl_video_buffer_max_size(screen); - case PIPE_VIDEO_CAP_PREFERED_FORMAT: - return PIPE_FORMAT_NV12; - case PIPE_VIDEO_CAP_PREFERS_INTERLACED: - return false; - case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED: - return false; - case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE: - return true; - case PIPE_VIDEO_CAP_MAX_LEVEL: - return vl_level_supported(screen, profile); - default: - return 0; - } -} - const char * r600_llvm_gpu_string(enum radeon_family family) { const char * gpu_family; @@ -777,20 +721,12 @@ struct pipe_screen *r600_screen_create(struct radeon_winsys *ws) rscreen->b.b.destroy = r600_destroy_screen; rscreen->b.b.get_param = r600_get_param; rscreen->b.b.get_shader_param = r600_get_shader_param; - rscreen->b.b.get_paramf = r600_get_paramf; rscreen->b.b.get_compute_param = r600_get_compute_param; if (rscreen->b.info.chip_class >= EVERGREEN) { rscreen->b.b.is_format_supported = evergreen_is_format_supported; } else { rscreen->b.b.is_format_supported = r600_is_format_supported; } - if (rscreen->b.info.has_uvd) { - rscreen->b.b.get_video_param = ruvd_get_video_param; - rscreen->b.b.is_video_format_supported = ruvd_is_format_supported; - } else { - rscreen->b.b.get_video_param = r600_get_video_param; - rscreen->b.b.is_video_format_supported = vl_video_buffer_is_format_supported; - } rscreen->b.b.resource_create = r600_resource_create; if (!r600_common_screen_init(&rscreen->b, ws)) { diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index ccd27fdff31..7447eea0031 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -24,12 +24,15 @@ * */ +#include "radeon/radeon_uvd.h" #include "r600_pipe_common.h" #include "r600_cs.h" #include "tgsi/tgsi_parse.h" #include "util/u_memory.h" #include "util/u_format_s3tc.h" #include "util/u_upload_mgr.h" +#include "vl/vl_decoder.h" +#include "vl/vl_video_buffer.h" #include <inttypes.h> /* @@ -189,6 +192,61 @@ static const char* r600_get_name(struct pipe_screen* pscreen) } } +static float r600_get_paramf(struct pipe_screen* pscreen, + enum pipe_capf param) +{ + struct r600_common_screen *rscreen = (struct r600_common_screen *)pscreen; + + switch (param) { + case PIPE_CAPF_MAX_LINE_WIDTH: + case PIPE_CAPF_MAX_LINE_WIDTH_AA: + case PIPE_CAPF_MAX_POINT_WIDTH: + case PIPE_CAPF_MAX_POINT_WIDTH_AA: + if (rscreen->family >= CHIP_CEDAR) + return 16384.0f; + else + return 8192.0f; + case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY: + return 16.0f; + case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS: + return 16.0f; + case PIPE_CAPF_GUARD_BAND_LEFT: + case PIPE_CAPF_GUARD_BAND_TOP: + case PIPE_CAPF_GUARD_BAND_RIGHT: + case PIPE_CAPF_GUARD_BAND_BOTTOM: + return 0.0f; + } + return 0.0f; +} + +static int r600_get_video_param(struct pipe_screen *screen, + enum pipe_video_profile profile, + enum pipe_video_entrypoint entrypoint, + enum pipe_video_cap param) +{ + switch (param) { + case PIPE_VIDEO_CAP_SUPPORTED: + return vl_profile_supported(screen, profile, entrypoint); + case PIPE_VIDEO_CAP_NPOT_TEXTURES: + return 1; + case PIPE_VIDEO_CAP_MAX_WIDTH: + case PIPE_VIDEO_CAP_MAX_HEIGHT: + return vl_video_buffer_max_size(screen); + case PIPE_VIDEO_CAP_PREFERED_FORMAT: + return PIPE_FORMAT_NV12; + case PIPE_VIDEO_CAP_PREFERS_INTERLACED: + return false; + case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED: + return false; + case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE: + return true; + case PIPE_VIDEO_CAP_MAX_LEVEL: + return vl_level_supported(screen, profile); + default: + return 0; + } +} + static uint64_t r600_get_timestamp(struct pipe_screen *screen) { struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; @@ -374,6 +432,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.get_name = r600_get_name; rscreen->b.get_vendor = r600_get_vendor; + rscreen->b.get_paramf = r600_get_paramf; rscreen->b.get_driver_query_info = r600_get_driver_query_info; rscreen->b.get_timestamp = r600_get_timestamp; rscreen->b.fence_finish = r600_fence_finish; @@ -382,6 +441,14 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.resource_create = r600_resource_create_common; rscreen->b.resource_destroy = u_resource_destroy_vtbl; + if (rscreen->info.has_uvd) { + rscreen->b.get_video_param = ruvd_get_video_param; + rscreen->b.is_video_format_supported = ruvd_is_format_supported; + } else { + rscreen->b.get_video_param = r600_get_video_param; + rscreen->b.is_video_format_supported = vl_video_buffer_is_format_supported; + } + r600_init_texture_functions(rscreen); rscreen->ws = ws; diff --git a/src/gallium/drivers/radeon/radeon_uvd.h b/src/gallium/drivers/radeon/radeon_uvd.h index b0135bac5d7..6278f12a8ae 100644 --- a/src/gallium/drivers/radeon/radeon_uvd.h +++ b/src/gallium/drivers/radeon/radeon_uvd.h @@ -34,6 +34,9 @@ #ifndef RADEON_UVD_H #define RADEON_UVD_H +#include "../../winsys/radeon/drm/radeon_winsys.h" +#include "vl/vl_video_buffer.h" + /* UVD uses PM4 packet type 0 and 2 */ #define RUVD_PKT_TYPE_S(x) (((x) & 0x3) << 30) #define RUVD_PKT_TYPE_G(x) (((x) >> 30) & 0x3) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 6aaf59568c4..0c4ea73b16e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -363,28 +363,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 0; } -static float si_get_paramf(struct pipe_screen* pscreen, - enum pipe_capf param) -{ - switch (param) { - case PIPE_CAPF_MAX_LINE_WIDTH: - case PIPE_CAPF_MAX_LINE_WIDTH_AA: - case PIPE_CAPF_MAX_POINT_WIDTH: - case PIPE_CAPF_MAX_POINT_WIDTH_AA: - return 16384.0f; - case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY: - return 16.0f; - case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS: - return 16.0f; - case PIPE_CAPF_GUARD_BAND_LEFT: - case PIPE_CAPF_GUARD_BAND_TOP: - case PIPE_CAPF_GUARD_BAND_RIGHT: - case PIPE_CAPF_GUARD_BAND_BOTTOM: - return 0.0f; - } - return 0.0f; -} - static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) { switch(shader) @@ -450,28 +428,6 @@ static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enu return 0; } -static int si_get_video_param(struct pipe_screen *screen, - enum pipe_video_profile profile, - enum pipe_video_entrypoint entrypoint, - enum pipe_video_cap param) -{ - switch (param) { - case PIPE_VIDEO_CAP_SUPPORTED: - return vl_profile_supported(screen, profile, entrypoint); - case PIPE_VIDEO_CAP_NPOT_TEXTURES: - return 1; - case PIPE_VIDEO_CAP_MAX_WIDTH: - case PIPE_VIDEO_CAP_MAX_HEIGHT: - return vl_video_buffer_max_size(screen); - case PIPE_VIDEO_CAP_PREFERED_FORMAT: - return PIPE_FORMAT_NV12; - case PIPE_VIDEO_CAP_MAX_LEVEL: - return vl_level_supported(screen, profile); - default: - return 0; - } -} - static int si_get_compute_param(struct pipe_screen *screen, enum pipe_compute_cap param, void *ret) @@ -581,23 +537,13 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) return NULL; } - ws->query_info(ws, &sscreen->b.info); - /* Set functions first. */ sscreen->b.b.context_create = si_create_context; sscreen->b.b.destroy = si_destroy_screen; sscreen->b.b.get_param = si_get_param; sscreen->b.b.get_shader_param = si_get_shader_param; - sscreen->b.b.get_paramf = si_get_paramf; sscreen->b.b.get_compute_param = si_get_compute_param; sscreen->b.b.is_format_supported = si_is_format_supported; - if (sscreen->b.info.has_uvd) { - sscreen->b.b.get_video_param = ruvd_get_video_param; - sscreen->b.b.is_video_format_supported = ruvd_is_format_supported; - } else { - sscreen->b.b.get_video_param = si_get_video_param; - sscreen->b.b.is_video_format_supported = vl_video_buffer_is_format_supported; - } if (!r600_common_screen_init(&sscreen->b, ws)) { FREE(sscreen); |