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