blob: 335afad8b9b363252eaa24f3fc98a5eaa123d47c [file] [log] [blame]
From ea82a2289fffe011267c64ce5d7d3e337d6201ac Mon Sep 17 00:00:00 2001
From: Lepton Wu <lepton@chromium.org>
Date: Fri, 5 Mar 2021 16:31:44 -0800
Subject: [PATCH] CHROMIUM: hack: Override GL_RENDERER for kindle app
We need this hack before Amazon fixes it at their side. We can't use
dirconf since it's disabled in Android for now. This is a quick hack
and should be removed soon.
---
src/gallium/drivers/virgl/virgl_screen.c | 10 ++++++++++
src/gallium/drivers/virgl/virgl_screen.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 30fa47a8fef..fb7b8a936ea 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -23,6 +23,7 @@
#include "util/u_memory.h"
#include "util/format/u_format.h"
#include "util/format/u_format_s3tc.h"
+#include "util/u_process.h"
#include "util/u_screen.h"
#include "util/u_video.h"
#include "util/u_math.h"
@@ -63,6 +64,12 @@ virgl_get_vendor(struct pipe_screen *screen)
static const char *
virgl_get_name(struct pipe_screen *screen)
{
+ struct virgl_screen *vscreen = virgl_screen(screen);
+ if (vscreen->renderer_override)
+ return "Intel";
+ else
+ return "virgl";
+
return "virgl";
}
@@ -957,6 +964,9 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
&screen->caps.caps.v2.supported_readback_formats);
fixup_formats(&screen->caps.caps, &screen->caps.caps.v2.scanout);
+ const char *proc = util_get_process_name();
+ screen->renderer_override = proc && !strcmp("com.amazon.kindle", proc);
+
union virgl_caps *caps = &screen->caps.caps;
screen->tweak_gles_emulate_bgra &= !virgl_format_check_bitmask(PIPE_FORMAT_B8G8R8A8_SRGB, caps->v1.render.bitmask, false);
screen->refcnt = 1;
diff --git a/src/gallium/drivers/virgl/virgl_screen.h b/src/gallium/drivers/virgl/virgl_screen.h
index 22275cbea1c..966830067e2 100644
--- a/src/gallium/drivers/virgl/virgl_screen.h
+++ b/src/gallium/drivers/virgl/virgl_screen.h
@@ -56,6 +56,7 @@ struct virgl_screen {
uint32_t sub_ctx_id;
bool tweak_gles_emulate_bgra;
bool tweak_gles_apply_bgra_dest_swizzle;
+ bool renderer_override;
int32_t tweak_gles_tf3_value;
struct disk_cache *disk_cache;
--
2.31.1.498.g6c1eba8ee3d-goog