summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_screen.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-11-16 16:57:45 -0800
committerEric Anholt <[email protected]>2016-11-16 19:45:01 -0800
commit45c022f2b06967196516f0616a9e4959ddcd14da (patch)
treee2b86f3964f067f66788f18c9e33f9fa9e4c91a9 /src/gallium/drivers/vc4/vc4_screen.c
parent7130260d1212d84d046c67682cb4eed95c852657 (diff)
vc4: Add support for ETC1 textures if the kernel is new enough.
The kernel changes for exposing the param have now been merged, so we can expose it here.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_screen.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 82b50775cb4..9f852f0326d 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -418,6 +418,7 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
unsigned sample_count,
unsigned usage)
{
+ struct vc4_screen *screen = vc4_screen(pscreen);
unsigned retval = 0;
if (sample_count > 1 && sample_count != VC4_MAX_SAMPLES)
@@ -488,7 +489,7 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
vc4_tex_format_supported(format) &&
- format != PIPE_FORMAT_ETC1_RGB8) {
+ (format != PIPE_FORMAT_ETC1_RGB8 || screen->has_etc1)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
@@ -529,10 +530,10 @@ static int handle_compare(void *key1, void *key2)
}
static bool
-vc4_supports_branches(struct vc4_screen *screen)
+vc4_has_feature(struct vc4_screen *screen, uint32_t feature)
{
struct drm_vc4_get_param p = {
- .param = DRM_VC4_PARAM_SUPPORTS_BRANCHES,
+ .param = feature,
};
int ret = vc4_ioctl(screen->fd, DRM_IOCTL_VC4_GET_PARAM, &p);
@@ -609,8 +610,10 @@ vc4_screen_create(int fd)
pipe_mutex_init(screen->bo_handles_mutex);
screen->bo_handles = util_hash_table_create(handle_hash, handle_compare);
- if (vc4_supports_branches(screen))
- screen->has_control_flow = true;
+ screen->has_control_flow =
+ vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_BRANCHES);
+ screen->has_etc1 =
+ vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_ETC1);
if (!vc4_get_chip_info(screen))
goto fail;