|
|
88c283 |
From 78bb1fff1155462638b0d6037ccddf1328482842 Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
776610 |
Date: Tue, 15 Jan 2019 11:01:38 -0500
|
|
|
776610 |
Subject: [PATCH 1/9] cogl: add new UNSTABLE_TEXTURES feature
|
|
|
776610 |
|
|
|
776610 |
The proprietary nvidia driver garbles texture memory on suspend.
|
|
|
776610 |
|
|
|
776610 |
Before we can address that, we need to be able to detect it.
|
|
|
776610 |
|
|
|
776610 |
This commit adds a new UNSTABLE_TEXTURES feature that gets set if
|
|
|
776610 |
the proprietary nvidia driver is in use.
|
|
|
776610 |
---
|
|
|
776610 |
cogl/cogl/cogl-context.h | 1 +
|
|
|
776610 |
cogl/cogl/cogl-types.h | 5 ++++-
|
|
|
776610 |
cogl/cogl/winsys/cogl-winsys-egl.c | 11 +++++++++++
|
|
|
776610 |
cogl/cogl/winsys/cogl-winsys-glx.c | 13 +++++++++++--
|
|
|
776610 |
4 files changed, 27 insertions(+), 3 deletions(-)
|
|
|
776610 |
|
|
|
776610 |
diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h
|
|
|
88c283 |
index d4104625e..a20c54549 100644
|
|
|
776610 |
--- a/cogl/cogl/cogl-context.h
|
|
|
776610 |
+++ b/cogl/cogl/cogl-context.h
|
|
|
88c283 |
@@ -261,6 +261,7 @@ typedef enum _CoglFeatureID
|
|
|
776610 |
COGL_FEATURE_ID_TEXTURE_RG,
|
|
|
776610 |
COGL_FEATURE_ID_BUFFER_AGE,
|
|
|
776610 |
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
|
|
|
776610 |
+ COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
|
|
776610 |
|
|
|
776610 |
/*< private >*/
|
|
|
776610 |
_COGL_N_FEATURE_IDS /*< skip >*/
|
|
|
776610 |
diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h
|
|
|
88c283 |
index 690daa16a..5b980a43c 100644
|
|
|
776610 |
--- a/cogl/cogl/cogl-types.h
|
|
|
776610 |
+++ b/cogl/cogl/cogl-types.h
|
|
|
88c283 |
@@ -354,6 +354,8 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
|
|
776610 |
* supported with CoglBufferAccess including write support.
|
|
|
776610 |
* @COGL_FEATURE_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering the
|
|
|
776610 |
* depth buffer to a texture.
|
|
|
776610 |
+ * @COGL_FEATURE_UNSTABLE_TEXTURES: Whether textures require redrawing on
|
|
|
776610 |
+ * resume or not.
|
|
|
776610 |
*
|
|
|
776610 |
* Flags for the supported features.
|
|
|
776610 |
*
|
|
|
88c283 |
@@ -383,7 +385,8 @@ typedef enum
|
|
|
776610 |
COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21),
|
|
|
776610 |
COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22),
|
|
|
776610 |
COGL_FEATURE_ONSCREEN_MULTIPLE = (1 << 23),
|
|
|
776610 |
- COGL_FEATURE_DEPTH_TEXTURE = (1 << 24)
|
|
|
776610 |
+ COGL_FEATURE_DEPTH_TEXTURE = (1 << 24),
|
|
|
776610 |
+ COGL_FEATURE_UNSTABLE_TEXTURES = (1 << 25)
|
|
|
776610 |
} CoglFeatureFlags;
|
|
|
776610 |
|
|
|
776610 |
/**
|
|
|
776610 |
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
|
|
|
88c283 |
index 903c6492d..dd450d4f3 100644
|
|
|
776610 |
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
|
|
|
776610 |
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
|
|
|
88c283 |
@@ -499,6 +499,7 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
|
|
776610 |
CoglRenderer *renderer = context->display->renderer;
|
|
|
776610 |
CoglDisplayEGL *egl_display = context->display->winsys;
|
|
|
776610 |
CoglRendererEGL *egl_renderer = renderer->winsys;
|
|
|
776610 |
+ CoglGpuInfo *info;
|
|
|
776610 |
|
|
|
776610 |
context->winsys = g_new0 (CoglContextEGL, 1);
|
|
|
776610 |
|
|
|
88c283 |
@@ -511,6 +512,16 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
|
|
776610 |
if (!_cogl_context_update_features (context, error))
|
|
|
776610 |
return FALSE;
|
|
|
776610 |
|
|
|
776610 |
+ info = &context->gpu;
|
|
|
776610 |
+
|
|
|
776610 |
+ if (info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
|
|
776610 |
+ {
|
|
|
776610 |
+ context->feature_flags |= COGL_FEATURE_UNSTABLE_TEXTURES;
|
|
|
776610 |
+ COGL_FLAGS_SET (context->features,
|
|
|
776610 |
+ COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
|
|
776610 |
+ TRUE);
|
|
|
776610 |
+ }
|
|
|
776610 |
+
|
|
|
776610 |
if (egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_SWAP_REGION)
|
|
|
776610 |
{
|
|
|
776610 |
COGL_FLAGS_SET (context->winsys_features,
|
|
|
776610 |
diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c
|
|
|
88c283 |
index 235cfe81f..7e87dc15f 100644
|
|
|
776610 |
--- a/cogl/cogl/winsys/cogl-winsys-glx.c
|
|
|
776610 |
+++ b/cogl/cogl/winsys/cogl-winsys-glx.c
|
|
|
88c283 |
@@ -830,12 +830,15 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
|
|
776610 |
{
|
|
|
776610 |
CoglGLXDisplay *glx_display = context->display->winsys;
|
|
|
776610 |
CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
|
|
|
776610 |
+ CoglGpuInfo *info;
|
|
|
776610 |
|
|
|
776610 |
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE);
|
|
|
776610 |
|
|
|
776610 |
if (!_cogl_context_update_features (context, error))
|
|
|
776610 |
return FALSE;
|
|
|
776610 |
|
|
|
776610 |
+ info = &context->gpu;
|
|
|
776610 |
+
|
|
|
776610 |
memcpy (context->winsys_features,
|
|
|
776610 |
glx_renderer->base_winsys_features,
|
|
|
776610 |
sizeof (context->winsys_features));
|
|
|
88c283 |
@@ -848,7 +851,6 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
|
|
776610 |
|
|
|
776610 |
if (glx_renderer->glXCopySubBuffer || context->glBlitFramebuffer)
|
|
|
776610 |
{
|
|
|
776610 |
- CoglGpuInfo *info = &context->gpu;
|
|
|
776610 |
CoglGpuInfoArchitecture arch = info->architecture;
|
|
|
776610 |
|
|
|
776610 |
COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_REGION, TRUE);
|
|
|
88c283 |
@@ -897,7 +899,6 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
|
|
776610 |
}
|
|
|
776610 |
else
|
|
|
776610 |
{
|
|
|
776610 |
- CoglGpuInfo *info = &context->gpu;
|
|
|
776610 |
if (glx_display->have_vblank_counter &&
|
|
|
776610 |
context->display->renderer->xlib_enable_threaded_swap_wait &&
|
|
|
776610 |
info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
|
|
88c283 |
@@ -919,6 +920,14 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
|
|
776610 |
}
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
+ if (info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
|
|
776610 |
+ {
|
|
|
776610 |
+ context->feature_flags |= COGL_FEATURE_UNSTABLE_TEXTURES;
|
|
|
776610 |
+ COGL_FLAGS_SET (context->features,
|
|
|
776610 |
+ COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
|
|
776610 |
+ TRUE);
|
|
|
776610 |
+ }
|
|
|
776610 |
+
|
|
|
776610 |
/* We'll manually handle queueing dirty events in response to
|
|
|
776610 |
* Expose events from X */
|
|
|
776610 |
COGL_FLAGS_SET (context->private_features,
|
|
|
776610 |
--
|
|
|
88c283 |
2.21.0
|
|
|
776610 |
|