mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
cogl: add new UNSTABLE_TEXTURES feature
The proprietary nvidia driver garbles texture memory on suspend. Before we can address that, we need to be able to detect it. This commit adds a new UNSTABLE_TEXTURES feature that gets set if the proprietary nvidia driver is in use.
This commit is contained in:
parent
18b68e3a84
commit
ea6535c639
@ -263,6 +263,7 @@ typedef enum _CoglFeatureID
|
||||
COGL_FEATURE_ID_TEXTURE_RG,
|
||||
COGL_FEATURE_ID_BUFFER_AGE,
|
||||
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
|
||||
COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
||||
|
||||
/*< private >*/
|
||||
_COGL_N_FEATURE_IDS /*< skip >*/
|
||||
|
@ -398,6 +398,8 @@ typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
|
||||
* supported with CoglBufferAccess including write support.
|
||||
* @COGL_FEATURE_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering the
|
||||
* depth buffer to a texture.
|
||||
* @COGL_FEATURE_UNSTABLE_TEXTURES: Whether textures require redrawing on
|
||||
* resume or not.
|
||||
*
|
||||
* Flags for the supported features.
|
||||
*
|
||||
@ -428,7 +430,8 @@ typedef enum
|
||||
COGL_FEATURE_MAP_BUFFER_FOR_READ = (1 << 21),
|
||||
COGL_FEATURE_MAP_BUFFER_FOR_WRITE = (1 << 22),
|
||||
COGL_FEATURE_ONSCREEN_MULTIPLE = (1 << 23),
|
||||
COGL_FEATURE_DEPTH_TEXTURE = (1 << 24)
|
||||
COGL_FEATURE_DEPTH_TEXTURE = (1 << 24),
|
||||
COGL_FEATURE_UNSTABLE_TEXTURES = (1 << 25)
|
||||
} CoglFeatureFlags;
|
||||
|
||||
/**
|
||||
|
@ -502,6 +502,7 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||
CoglRenderer *renderer = context->display->renderer;
|
||||
CoglDisplayEGL *egl_display = context->display->winsys;
|
||||
CoglRendererEGL *egl_renderer = renderer->winsys;
|
||||
CoglGpuInfo *info;
|
||||
|
||||
context->winsys = g_new0 (CoglContextEGL, 1);
|
||||
|
||||
@ -514,6 +515,16 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
|
||||
if (!_cogl_context_update_features (context, error))
|
||||
return FALSE;
|
||||
|
||||
info = &context->gpu;
|
||||
|
||||
if (info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
||||
{
|
||||
context->feature_flags |= COGL_FEATURE_UNSTABLE_TEXTURES;
|
||||
COGL_FLAGS_SET (context->features,
|
||||
COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
if (egl_renderer->private_features & COGL_EGL_WINSYS_FEATURE_SWAP_REGION)
|
||||
{
|
||||
COGL_FLAGS_SET (context->winsys_features,
|
||||
|
@ -832,12 +832,15 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
||||
{
|
||||
CoglGLXDisplay *glx_display = context->display->winsys;
|
||||
CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
|
||||
CoglGpuInfo *info;
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE);
|
||||
|
||||
if (!_cogl_context_update_features (context, error))
|
||||
return FALSE;
|
||||
|
||||
info = &context->gpu;
|
||||
|
||||
memcpy (context->winsys_features,
|
||||
glx_renderer->base_winsys_features,
|
||||
sizeof (context->winsys_features));
|
||||
@ -850,7 +853,6 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
||||
|
||||
if (glx_renderer->glXCopySubBuffer || context->glBlitFramebuffer)
|
||||
{
|
||||
CoglGpuInfo *info = &context->gpu;
|
||||
CoglGpuInfoArchitecture arch = info->architecture;
|
||||
|
||||
COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_REGION, TRUE);
|
||||
@ -899,7 +901,6 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
||||
}
|
||||
else
|
||||
{
|
||||
CoglGpuInfo *info = &context->gpu;
|
||||
if (glx_display->have_vblank_counter &&
|
||||
context->display->renderer->xlib_enable_threaded_swap_wait &&
|
||||
info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
||||
@ -921,6 +922,14 @@ update_winsys_features (CoglContext *context, CoglError **error)
|
||||
}
|
||||
}
|
||||
|
||||
if (info->vendor == COGL_GPU_INFO_VENDOR_NVIDIA)
|
||||
{
|
||||
context->feature_flags |= COGL_FEATURE_UNSTABLE_TEXTURES;
|
||||
COGL_FLAGS_SET (context->features,
|
||||
COGL_FEATURE_ID_UNSTABLE_TEXTURES,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
/* We'll manually handle queueing dirty events in response to
|
||||
* Expose events from X */
|
||||
COGL_FLAGS_SET (context->private_features,
|
||||
|
Loading…
Reference in New Issue
Block a user