2007-08-10 12:57:14 +01:00
|
|
|
/**************************************************************************
|
2019-03-07 23:44:06 +00:00
|
|
|
*
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Copyright 2007 VMware, Inc.
|
2007-08-10 12:57:14 +01:00
|
|
|
* All Rights Reserved.
|
2019-03-07 23:44:06 +00:00
|
|
|
*
|
2007-08-10 12:57:14 +01:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
2019-03-07 23:44:06 +00:00
|
|
|
*
|
2007-08-10 12:57:14 +01:00
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
2019-03-07 23:44:06 +00:00
|
|
|
*
|
2007-08-10 12:57:14 +01:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
2007-08-10 12:57:14 +01:00
|
|
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2019-03-07 23:44:06 +00:00
|
|
|
*
|
2007-08-10 12:57:14 +01:00
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Authors:
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Keith Whitwell <keithw@vmware.com>
|
2007-08-10 12:57:14 +01:00
|
|
|
* Brian Paul
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "main/glheader.h"
|
|
|
|
#include "main/macros.h"
|
2007-11-02 18:11:40 +00:00
|
|
|
#include "main/context.h"
|
2007-08-10 12:57:14 +01:00
|
|
|
#include "st_context.h"
|
2008-03-28 20:53:47 +00:00
|
|
|
#include "st_cb_bitmap.h"
|
2007-08-10 12:57:14 +01:00
|
|
|
#include "st_cb_flush.h"
|
2008-12-12 16:46:34 +00:00
|
|
|
#include "st_cb_clear.h"
|
2019-03-12 15:13:00 +00:00
|
|
|
#include "st_context.h"
|
2010-02-07 11:20:52 +00:00
|
|
|
#include "st_manager.h"
|
2007-08-10 12:57:14 +01:00
|
|
|
#include "pipe/p_context.h"
|
|
|
|
#include "pipe/p_defines.h"
|
2009-01-30 20:56:00 +00:00
|
|
|
#include "pipe/p_screen.h"
|
2008-12-12 16:46:34 +00:00
|
|
|
#include "util/u_gen_mipmap.h"
|
2007-08-10 12:57:14 +01:00
|
|
|
|
|
|
|
|
2019-03-07 23:44:06 +00:00
|
|
|
void
|
|
|
|
st_flush(struct st_context *st,
|
|
|
|
struct pipe_fence_handle **fence,
|
|
|
|
unsigned flags)
|
2008-04-09 23:26:56 +01:00
|
|
|
{
|
2019-03-12 15:13:00 +00:00
|
|
|
/* We want to call this function periodically.
|
|
|
|
* Typically, it has nothing to do so it shouldn't be expensive.
|
|
|
|
*/
|
|
|
|
st_context_free_zombie_objects(st);
|
|
|
|
|
2021-06-12 17:28:41 +01:00
|
|
|
st_flush_bitmap_cache(st);
|
2012-12-21 16:03:22 +00:00
|
|
|
st->pipe->flush(st->pipe, fence, flags);
|
2008-04-09 23:26:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-09 23:59:14 +01:00
|
|
|
/**
|
|
|
|
* Flush, and wait for completion.
|
|
|
|
*/
|
2019-03-07 23:44:06 +00:00
|
|
|
void
|
|
|
|
st_finish(struct st_context *st)
|
2008-04-09 23:32:46 +01:00
|
|
|
{
|
|
|
|
struct pipe_fence_handle *fence = NULL;
|
|
|
|
|
2017-11-09 13:34:20 +00:00
|
|
|
st_flush(st, &fence, PIPE_FLUSH_ASYNC | PIPE_FLUSH_HINT_FINISH);
|
2008-04-09 23:32:46 +01:00
|
|
|
|
2019-03-07 23:44:06 +00:00
|
|
|
if (fence) {
|
2020-11-29 08:27:37 +00:00
|
|
|
st->screen->fence_finish(st->screen, NULL, fence,
|
|
|
|
PIPE_TIMEOUT_INFINITE);
|
|
|
|
st->screen->fence_reference(st->screen, &fence, NULL);
|
2008-11-24 04:44:30 +00:00
|
|
|
}
|
2017-06-20 17:36:08 +01:00
|
|
|
|
|
|
|
st_manager_flush_swapbuffers();
|
2008-04-09 23:32:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-07 01:37:07 +00:00
|
|
|
void
|
2021-06-12 17:20:06 +01:00
|
|
|
st_glFlush(struct gl_context *ctx, unsigned gallium_flush_flags)
|
2007-11-02 17:41:32 +00:00
|
|
|
{
|
2010-04-23 21:00:50 +01:00
|
|
|
struct st_context *st = st_context(ctx);
|
2008-04-09 23:30:28 +01:00
|
|
|
|
2009-03-13 15:45:21 +00:00
|
|
|
/* Don't call st_finish() here. It is not the state tracker's
|
|
|
|
* responsibilty to inject sleeps in the hope of avoiding buffer
|
|
|
|
* synchronization issues. Calling finish() here will just hide
|
|
|
|
* problems that need to be fixed elsewhere.
|
|
|
|
*/
|
2021-06-12 17:20:06 +01:00
|
|
|
st_flush(st, NULL, gallium_flush_flags);
|
2010-02-18 12:37:09 +00:00
|
|
|
|
2017-06-20 20:12:50 +01:00
|
|
|
st_manager_flush_frontbuffer(st);
|
2008-03-26 09:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-07 01:37:07 +00:00
|
|
|
void
|
2019-03-07 23:44:06 +00:00
|
|
|
st_glFinish(struct gl_context *ctx)
|
2007-08-10 12:57:14 +01:00
|
|
|
{
|
2010-04-23 21:00:50 +01:00
|
|
|
struct st_context *st = st_context(ctx);
|
2008-04-09 23:32:22 +01:00
|
|
|
|
2008-04-09 23:59:14 +01:00
|
|
|
st_finish(st);
|
2010-02-18 12:37:09 +00:00
|
|
|
|
2017-06-20 20:12:50 +01:00
|
|
|
st_manager_flush_frontbuffer(st);
|
2007-08-10 12:57:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-29 14:05:19 +01:00
|
|
|
static GLenum
|
2016-09-30 12:02:00 +01:00
|
|
|
gl_reset_status_from_pipe_reset_status(enum pipe_reset_status status)
|
2015-04-29 14:05:19 +01:00
|
|
|
{
|
|
|
|
switch (status) {
|
|
|
|
case PIPE_NO_RESET:
|
|
|
|
return GL_NO_ERROR;
|
|
|
|
case PIPE_GUILTY_CONTEXT_RESET:
|
|
|
|
return GL_GUILTY_CONTEXT_RESET_ARB;
|
|
|
|
case PIPE_INNOCENT_CONTEXT_RESET:
|
|
|
|
return GL_INNOCENT_CONTEXT_RESET_ARB;
|
|
|
|
case PIPE_UNKNOWN_CONTEXT_RESET:
|
|
|
|
return GL_UNKNOWN_CONTEXT_RESET_ARB;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
return GL_NO_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-16 22:12:43 +01:00
|
|
|
static void
|
|
|
|
st_device_reset_callback(void *data, enum pipe_reset_status status)
|
|
|
|
{
|
|
|
|
struct st_context *st = data;
|
|
|
|
|
|
|
|
assert(status != PIPE_NO_RESET);
|
|
|
|
|
|
|
|
st->reset_status = status;
|
|
|
|
_mesa_set_context_lost_dispatch(st->ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-30 12:02:00 +01:00
|
|
|
/**
|
|
|
|
* Query information about GPU resets observed by this context
|
|
|
|
*
|
|
|
|
* Called via \c dd_function_table::GetGraphicsResetStatus.
|
|
|
|
*/
|
|
|
|
static GLenum
|
|
|
|
st_get_graphics_reset_status(struct gl_context *ctx)
|
|
|
|
{
|
|
|
|
struct st_context *st = st_context(ctx);
|
|
|
|
enum pipe_reset_status status;
|
|
|
|
|
2016-09-30 13:06:04 +01:00
|
|
|
if (st->reset_status != PIPE_NO_RESET) {
|
|
|
|
status = st->reset_status;
|
|
|
|
st->reset_status = PIPE_NO_RESET;
|
|
|
|
} else {
|
|
|
|
status = st->pipe->get_device_reset_status(st->pipe);
|
2019-10-16 22:12:43 +01:00
|
|
|
if (status != PIPE_NO_RESET)
|
|
|
|
st_device_reset_callback(st, status);
|
2016-09-30 13:06:04 +01:00
|
|
|
}
|
2016-09-30 12:02:00 +01:00
|
|
|
|
|
|
|
return gl_reset_status_from_pipe_reset_status(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-30 13:06:04 +01:00
|
|
|
void
|
|
|
|
st_install_device_reset_callback(struct st_context *st)
|
|
|
|
{
|
|
|
|
if (st->pipe->set_device_reset_callback) {
|
|
|
|
struct pipe_device_reset_callback cb;
|
|
|
|
cb.reset = st_device_reset_callback;
|
|
|
|
cb.data = st;
|
|
|
|
st->pipe->set_device_reset_callback(st->pipe, &cb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-03-07 23:44:06 +00:00
|
|
|
void
|
|
|
|
st_init_flush_functions(struct pipe_screen *screen,
|
|
|
|
struct dd_function_table *functions)
|
2007-08-10 12:57:14 +01:00
|
|
|
{
|
2015-04-29 14:05:19 +01:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY))
|
|
|
|
functions->GetGraphicsResetStatus = st_get_graphics_reset_status;
|
2007-08-10 12:57:14 +01:00
|
|
|
}
|