Merge branch 'mesa_7_7_branch'

Conflicts:
	src/gallium/auxiliary/draw/draw_context.c
	src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
	src/gallium/auxiliary/pipebuffer/Makefile
	src/gallium/auxiliary/pipebuffer/SConscript
	src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
	src/gallium/auxiliary/tgsi/tgsi_scan.c
	src/gallium/drivers/i915/i915_surface.c
	src/gallium/drivers/i915/i915_texture.c
	src/gallium/drivers/llvmpipe/lp_setup.c
	src/gallium/drivers/llvmpipe/lp_tex_sample_c.c
	src/gallium/drivers/llvmpipe/lp_texture.c
	src/gallium/drivers/softpipe/sp_prim_vbuf.c
	src/gallium/state_trackers/xorg/xorg_dri2.c
	src/gallium/winsys/drm/intel/gem/intel_drm_api.c
	src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
	src/gallium/winsys/drm/radeon/core/radeon_drm.c
	src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
	src/mesa/state_tracker/st_cb_clear.c
This commit is contained in:
Brian Paul 2010-01-22 12:17:02 -07:00
commit cd8614b028
217 changed files with 3215 additions and 1151 deletions

View file

@ -13,36 +13,41 @@
</p>
<ul>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce"
target="_parent">mesa3d-announce</a> - announcements of new Mesa
versions are sent to this list.
</li>
<br>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users"
target="_parent">mesa3d-users</a> - intended for users of the Mesa and DRI.
Newbie questions are appropriate, but please try the general OpenGL
target="_parent">mesa3d-users</a> - intended for end-users of Mesa and DRI
drivers. Newbie questions are OK, but please try the general OpenGL
resources and Mesa/DRI documentation first.
</li>
<br>
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev"
target="_parent">mesa3d-dev</a> - for discussion of Mesa and Direct Rendering
Infrastructure development. Not for beginners.
target="_parent">mesa3d-dev</a> - for Mesa, Gallium and DRI development
discussion. Not for beginners.
</li>
<br>
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit"
target="_parent">mesa-commit</a> - relays git check-in messages
(for developers).
In general, people should not post to this list.
</li>
<br>
Note: the old mesa3d-cvs list is no longer in use.
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce"
target="_parent">mesa3d-announce</a> - announcements of new Mesa
versions are sent to this list. Very low traffic.
</li>
</ul>
<p>
Follow the links above for list archives.
</p>
<p>For mailing lists about Direct Rendering Modules (drm) in Linux/BSD
kernels, see <a href="http://dri.freedesktop.org/wiki/MailingLists">wiki</a>.
kernels, see the
<a href="http://dri.freedesktop.org/wiki/MailingLists" target="_parent">
DRI wiki</a>.
</p>
<p>
<b>Notice</b>: non-member posts to any of these lists will be automatically
rejected.
<b>Notice</b>: You must subscribe to these lists in order to post to them.
</p>

View file

@ -6,7 +6,6 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* For debug */

View file

@ -771,6 +771,7 @@ main(int argc, char *argv[])
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
glXMakeCurrent(dpy, None, NULL);
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);

View file

@ -48,12 +48,10 @@ C_SOURCES = \
draw/draw_vs_sse.c \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
pipebuffer/pb_buffer_fenced.c \
pipebuffer/pb_buffer_malloc.c \
pipebuffer/pb_bufmgr_alt.c \
pipebuffer/pb_bufmgr_cache.c \
pipebuffer/pb_bufmgr_debug.c \
pipebuffer/pb_bufmgr_fenced.c \
pipebuffer/pb_bufmgr_mm.c \
pipebuffer/pb_bufmgr_ondemand.c \
pipebuffer/pb_bufmgr_pool.c \

View file

@ -34,7 +34,6 @@
#include "util/u_memory.h"
#include "util/u_math.h"
#include "draw_context.h"
#include "draw_vbuf.h"
#include "draw_vs.h"
#include "draw_gs.h"
#include "draw_pt.h"

View file

@ -106,10 +106,9 @@ void draw_pipeline_destroy( struct draw_context *draw )
/**
* Build primitive to render a point with vertex at v0.
*/
static void do_point( struct draw_context *draw,
const char *v0 )
{
@ -123,6 +122,10 @@ static void do_point( struct draw_context *draw,
}
/**
* Build primitive to render a line with vertices at v0, v1.
* \param flags bitmask of DRAW_PIPE_EDGE_x, DRAW_PIPE_RESET_STIPPLE
*/
static void do_line( struct draw_context *draw,
ushort flags,
const char *v0,
@ -139,6 +142,10 @@ static void do_line( struct draw_context *draw,
}
/**
* Build primitive to render a triangle with vertices at v0, v1, v2.
* \param flags bitmask of DRAW_PIPE_EDGE_x, DRAW_PIPE_RESET_STIPPLE
*/
static void do_triangle( struct draw_context *draw,
ushort flags,
char *v0,
@ -157,7 +164,10 @@ static void do_triangle( struct draw_context *draw,
}
/*
* Set up macros for draw_pt_decompose.h template code.
* This code uses vertex indexes / elements.
*/
#define QUAD(i0,i1,i2,i3) \
do_triangle( draw, \
( DRAW_PIPE_RESET_STIPPLE | \
@ -175,16 +185,16 @@ static void do_triangle( struct draw_context *draw,
#define TRIANGLE(flags,i0,i1,i2) \
do_triangle( draw, \
elts[i0], /* flags */ \
elts[i0], /* flags */ \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
verts + stride * elts[i1], \
verts + stride * elts[i2])
verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK), \
verts + stride * (elts[i2] & ~DRAW_PIPE_FLAG_MASK) );
#define LINE(flags,i0,i1) \
do_line( draw, \
elts[i0], \
elts[i0], \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
verts + stride * elts[i1])
verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK) );
#define POINT(i0) \
do_point( draw, \
@ -213,7 +223,9 @@ static void do_triangle( struct draw_context *draw,
/* Code to run the pipeline on a fairly arbitary collection of vertices.
/**
* Code to run the pipeline on a fairly arbitary collection of vertices.
* For drawing indexed primitives.
*
* Vertex headers must be pre-initialized with the
* UNDEFINED_VERTEX_ID, this code will cause that id to become
@ -243,6 +255,12 @@ void draw_pipeline_run( struct draw_context *draw,
draw->pipeline.vertex_count = 0;
}
/*
* Set up macros for draw_pt_decompose.h template code.
* This code is for non-indexed rendering (no elts).
*/
#define QUAD(i0,i1,i2,i3) \
do_triangle( draw, \
( DRAW_PIPE_RESET_STIPPLE | \
@ -293,6 +311,10 @@ void draw_pipeline_run( struct draw_context *draw,
#include "draw_pt_decompose.h"
/*
* For drawing non-indexed primitives.
*/
void draw_pipeline_run_linear( struct draw_context *draw,
unsigned prim,
struct vertex_header *vertices,

View file

@ -33,7 +33,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
#include "tgsi/tgsi_dump.h"
#include "util/u_math.h"
#include "util/u_prim.h"

View file

@ -30,7 +30,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_vbuf.h"
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "translate/translate.h"
#include "translate/translate_cache.h"

View file

@ -40,7 +40,6 @@
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
#include "translate/translate.h"
struct fetch_shade_emit;

View file

@ -30,7 +30,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_vbuf.h"
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
struct pt_post_vs {

View file

@ -38,7 +38,6 @@
#include "draw/draw_vertex.h"
#include "draw/draw_vs.h"
#include "translate/translate.h"
#include "translate/translate_cache.h"
/* A first pass at incorporating vertex fetch/emit functionality into
*/

View file

@ -0,0 +1,18 @@
TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = pipebuffer
C_SOURCES = \
pb_buffer_fenced.c \
pb_buffer_malloc.c \
pb_bufmgr_alt.c \
pb_bufmgr_cache.c \
pb_bufmgr_debug.c \
pb_bufmgr_mm.c \
pb_bufmgr_ondemand.c \
pb_bufmgr_pool.c \
pb_bufmgr_slab.c \
pb_validate.c
include ../../Makefile.template

View file

@ -0,0 +1,18 @@
Import('*')
pipebuffer = env.ConvenienceLibrary(
target = 'pipebuffer',
source = [
'pb_buffer_fenced.c',
'pb_buffer_malloc.c',
'pb_bufmgr_alt.c',
'pb_bufmgr_cache.c',
'pb_bufmgr_debug.c',
'pb_bufmgr_mm.c',
'pb_bufmgr_ondemand.c',
'pb_bufmgr_pool.c',
'pb_bufmgr_slab.c',
'pb_validate.c',
])
auxiliaries.insert(0, pipebuffer)

File diff suppressed because it is too large Load diff

View file

@ -98,43 +98,6 @@ struct pb_fence_ops
};
/**
* Create a fenced buffer list.
*
* See also fenced_bufmgr_create for a more convenient way to use this.
*/
struct fenced_buffer_list *
fenced_buffer_list_create(struct pb_fence_ops *ops);
/**
* Walk the fenced buffer list to check and free signalled buffers.
*/
void
fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
int wait);
#ifdef DEBUG
void
fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list);
#endif
void
fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list);
/**
* Wrap a buffer in a fenced buffer.
*
* NOTE: this will not increase the buffer reference count.
*/
struct pb_buffer *
fenced_buffer_create(struct fenced_buffer_list *fenced,
struct pb_buffer *buffer);
#ifdef __cplusplus
}
#endif

View file

@ -175,7 +175,9 @@ struct pb_fence_ops;
*/
struct pb_manager *
fenced_bufmgr_create(struct pb_manager *provider,
struct pb_fence_ops *ops);
struct pb_fence_ops *ops,
pb_size max_buffer_size,
pb_size max_cpu_total_size);
struct pb_manager *

View file

@ -371,6 +371,9 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
struct pb_desc real_desc;
pb_size real_size;
assert(size);
assert(desc->alignment);
buf = CALLOC_STRUCT(pb_debug_buffer);
if(!buf)
return NULL;

View file

@ -1,152 +0,0 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
* All Rights Reserved.
*
* 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:
*
* 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. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
*
**************************************************************************/
/**
* \file
* A buffer manager that wraps buffers in fenced buffers.
*
* \author Jose Fonseca <jrfonseca@tungstengraphics.dot.com>
*/
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "pb_buffer.h"
#include "pb_buffer_fenced.h"
#include "pb_bufmgr.h"
struct fenced_pb_manager
{
struct pb_manager base;
struct pb_manager *provider;
struct fenced_buffer_list *fenced_list;
};
static INLINE struct fenced_pb_manager *
fenced_pb_manager(struct pb_manager *mgr)
{
assert(mgr);
return (struct fenced_pb_manager *)mgr;
}
static struct pb_buffer *
fenced_bufmgr_create_buffer(struct pb_manager *mgr,
pb_size size,
const struct pb_desc *desc)
{
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
struct pb_buffer *buf;
struct pb_buffer *fenced_buf;
/* check for free buffers before allocating new ones */
fenced_buffer_list_check_free(fenced_mgr->fenced_list, 0);
buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
if(!buf) {
/* try harder to get a buffer */
fenced_buffer_list_check_free(fenced_mgr->fenced_list, 1);
buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
if(!buf) {
#if 0
fenced_buffer_list_dump(fenced_mgr->fenced_list);
#endif
/* give up */
return NULL;
}
}
fenced_buf = fenced_buffer_create(fenced_mgr->fenced_list, buf);
if(!fenced_buf) {
pb_reference(&buf, NULL);
}
return fenced_buf;
}
static void
fenced_bufmgr_flush(struct pb_manager *mgr)
{
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
fenced_buffer_list_check_free(fenced_mgr->fenced_list, TRUE);
assert(fenced_mgr->provider->flush);
if(fenced_mgr->provider->flush)
fenced_mgr->provider->flush(fenced_mgr->provider);
}
static void
fenced_bufmgr_destroy(struct pb_manager *mgr)
{
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
fenced_buffer_list_destroy(fenced_mgr->fenced_list);
if(fenced_mgr->provider)
fenced_mgr->provider->destroy(fenced_mgr->provider);
FREE(fenced_mgr);
}
struct pb_manager *
fenced_bufmgr_create(struct pb_manager *provider,
struct pb_fence_ops *ops)
{
struct fenced_pb_manager *fenced_mgr;
if(!provider)
return NULL;
fenced_mgr = CALLOC_STRUCT(fenced_pb_manager);
if (!fenced_mgr)
return NULL;
fenced_mgr->base.destroy = fenced_bufmgr_destroy;
fenced_mgr->base.create_buffer = fenced_bufmgr_create_buffer;
fenced_mgr->base.flush = fenced_bufmgr_flush;
fenced_mgr->provider = provider;
fenced_mgr->fenced_list = fenced_buffer_list_create(ops);
if(!fenced_mgr->fenced_list) {
FREE(fenced_mgr);
return NULL;
}
return &fenced_mgr->base;
}

View file

@ -39,7 +39,6 @@
#include "util/u_debug.h"
#include "pb_buffer.h"
#include "pb_buffer_fenced.h"
#include "pb_validate.h"

View file

@ -101,12 +101,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
src->Register.File == TGSI_FILE_SYSTEM_VALUE) {
const int ind = src->Register.Index;
if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FOG) {
if (src->Register.SwizzleX == TGSI_SWIZZLE_X) {
info->uses_fogcoord = TRUE;
}
else if (src->Register.SwizzleX == TGSI_SWIZZLE_Y) {
info->uses_frontfacing = TRUE;
}
info->uses_fogcoord = TRUE;
}
else if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FACE) {
info->uses_frontfacing = TRUE;
}
}
}

View file

@ -226,8 +226,8 @@ setup_vertex_data_tex(struct blit_state *ctx,
offset = get_next_slot( ctx );
pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
offset, sizeof(ctx->vertices), ctx->vertices);
pipe_buffer_write_nooverlap(ctx->pipe->screen, ctx->vbuf,
offset, sizeof(ctx->vertices), ctx->vertices);
return offset;
}

View file

@ -1411,8 +1411,8 @@ set_vertex_data(struct gen_mipmap_state *ctx,
offset = get_next_slot( ctx );
pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
offset, sizeof(ctx->vertices), ctx->vertices);
pipe_buffer_write_nooverlap(ctx->pipe->screen, ctx->vbuf,
offset, sizeof(ctx->vertices), ctx->vertices);
return offset;
}

View file

@ -85,7 +85,9 @@ my_buffer_write(struct pipe_screen *screen,
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
PIPE_BUFFER_USAGE_DISCARD |
PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
if (map == NULL)
return PIPE_ERROR_OUT_OF_MEMORY;

View file

@ -32,7 +32,6 @@
#include "util/u_clear.h"
#include "i915_context.h"
#include "i915_state.h"
/**

View file

@ -29,12 +29,9 @@
#include "i915_state.h"
#include "i915_screen.h"
#include "i915_batch.h"
#include "i915_texture.h"
#include "i915_reg.h"
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"

View file

@ -29,7 +29,6 @@
#include "i915_context.h"
#include "i915_debug.h"
#include "i915_batch.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_debug.h"

View file

@ -29,7 +29,6 @@
#include "i915_reg.h"
#include "i915_debug.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
static void

View file

@ -30,7 +30,6 @@
#include "draw/draw_context.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@ -38,7 +37,6 @@
#include "i915_context.h"
#include "i915_reg.h"
#include "i915_state.h"
#include "i915_state_inlines.h"
#include "i915_fpc.h"

View file

@ -33,7 +33,6 @@
#include "i915_context.h"
#include "i915_state.h"
#include "i915_reg.h"
#include "i915_fpc.h"

View file

@ -27,7 +27,6 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/u_memory.h"
#include "i915_state_inlines.h"
#include "i915_context.h"

View file

@ -27,14 +27,10 @@
#include "i915_context.h"
#include "i915_blit.h"
#include "i915_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_inlines.h"
#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
/* Assumes all values are within bounds -- no checking at this level -

View file

@ -41,7 +41,6 @@
#include "i915_context.h"
#include "i915_texture.h"
#include "i915_debug.h"
#include "i915_screen.h"
#include "intel_winsys.h"

View file

@ -35,7 +35,6 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_arit.h"
#include "lp_bld_logic.h"
#include "lp_bld_flow.h"
#include "lp_bld_debug.h"

View file

@ -56,7 +56,6 @@
#include "lp_bld_intr.h"
#include "lp_bld_logic.h"
#include "lp_bld_pack.h"
#include "lp_bld_debug.h"
#include "lp_bld_arit.h"

View file

@ -71,7 +71,6 @@
#include "pipe/p_state.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_arit.h"
#include "lp_bld_blend.h"

View file

@ -63,11 +63,9 @@
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_cpu_detect.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_intr.h"
#include "lp_bld_arit.h"
#include "lp_bld_pack.h"
#include "lp_bld_conv.h"

View file

@ -38,7 +38,6 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_format.h"

View file

@ -47,13 +47,11 @@
#include "tgsi/tgsi_exec.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_intr.h"
#include "lp_bld_arit.h"
#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_flow.h"
#include "lp_bld_tgsi.h"
#include "lp_bld_debug.h"
#define LP_MAX_TEMPS 256

View file

@ -33,8 +33,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_prim.h"
#include "lp_buffer.h"

View file

@ -37,8 +37,6 @@
#include "lp_surface.h"
#include "lp_state.h"
#include "lp_tile_cache.h"
#include "lp_tex_cache.h"
#include "lp_winsys.h"
void

View file

@ -39,7 +39,6 @@
#include "util/u_cpu_detect.h"
#include "lp_screen.h"
#include "lp_bld_intr.h"
#include "lp_bld_misc.h"
#include "lp_jit.h"

View file

@ -62,7 +62,6 @@
#include "util/u_memory.h"
#include "util/u_format.h"
#include "util/u_debug_dump.h"
#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
@ -85,7 +84,6 @@
#include "lp_context.h"
#include "lp_buffer.h"
#include "lp_state.h"
#include "lp_quad.h"
#include "lp_tex_sample.h"
#include "lp_debug.h"

View file

@ -30,7 +30,6 @@
#include "lp_context.h"
#include "lp_state.h"
#include "lp_surface.h"
#include "lp_tile_cache.h"
#include "draw/draw_context.h"

View file

@ -31,7 +31,6 @@
#include "lp_context.h"
#include "lp_state.h"
#include "lp_surface.h"
#include "draw/draw_context.h"

View file

@ -38,7 +38,6 @@
#include "lp_bld_type.h"
#include "lp_bld_arit.h"
#include "lp_bld_blend.h"
#include "lp_bld_debug.h"
#include "lp_test.h"

View file

@ -38,7 +38,6 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "lp_context.h"
#include "lp_surface.h"
#include "lp_texture.h"
#include "lp_tex_cache.h"

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,6 @@
#include "pipe/p_shader_tokens.h"
#include "lp_bld_debug.h"
#include "lp_bld_type.h"
#include "lp_bld_intr.h"
#include "lp_bld_sample.h"
#include "lp_bld_tgsi.h"
#include "lp_state.h"

View file

@ -42,7 +42,6 @@
#include "lp_context.h"
#include "lp_state.h"
#include "lp_texture.h"
#include "lp_tex_cache.h"
#include "lp_screen.h"
#include "lp_winsys.h"

View file

@ -38,8 +38,6 @@
#include "util/u_tile.h"
#include "util/u_rect.h"
#include "lp_context.h"
#include "lp_surface.h"
#include "lp_texture.h"
#include "lp_tile_soa.h"
#include "lp_tile_cache.h"

View file

@ -43,7 +43,6 @@
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
#include "sp_texture.h"
#include "sp_winsys.h"
#include "sp_query.h"

View file

@ -34,11 +34,9 @@
#include "draw/draw_context.h"
#include "sp_flush.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_state.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
#include "sp_winsys.h"
void

View file

@ -526,7 +526,8 @@ static void
sp_vbuf_destroy(struct vbuf_render *vbr)
{
struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
align_free(cvbr->vertex_buffer);
if(cvbr->vertex_buffer)
align_free(cvbr->vertex_buffer);
sp_setup_destroy_context(cvbr->setup);
FREE(cvbr);
}

View file

@ -35,7 +35,6 @@
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_quad.h"
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_quad_pipe.h"

View file

@ -30,11 +30,11 @@
*/
#include "pipe/p_defines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_scan.h"
#include "sp_context.h"
#include "sp_quad.h"
#include "sp_surface.h"
#include "sp_quad_pipe.h"
#include "sp_tile_cache.h"
#include "sp_state.h" /* for sp_fragment_shader */
@ -651,6 +651,20 @@ static unsigned mask_count[16] =
/** helper to get number of Z buffer bits */
static unsigned
get_depth_bits(struct quad_stage *qs)
{
struct pipe_surface *zsurf = qs->softpipe->framebuffer.zsbuf;
if (zsurf)
return util_format_get_component_bits(zsurf->format,
UTIL_FORMAT_COLORSPACE_ZS, 0);
else
return 0;
}
static void
depth_test_quads_fallback(struct quad_stage *qs,
struct quad_header *quads[],
@ -666,7 +680,7 @@ depth_test_quads_fallback(struct quad_stage *qs,
nr = alpha_test_quads(qs, quads, nr);
}
if (qs->softpipe->framebuffer.zsbuf &&
if (get_depth_bits(qs) > 0 &&
(qs->softpipe->depth_stencil->depth.enabled ||
qs->softpipe->depth_stencil->stencil[0].enabled)) {
@ -884,7 +898,7 @@ choose_depth_test(struct quad_stage *qs,
boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
boolean depth = (qs->softpipe->framebuffer.zsbuf &&
boolean depth = (get_depth_bits(qs) > 0 &&
qs->softpipe->depth_stencil->depth.enabled);
unsigned depthfunc = qs->softpipe->depth_stencil->depth.func;
@ -895,7 +909,6 @@ choose_depth_test(struct quad_stage *qs,
boolean occlusion = qs->softpipe->active_query_count;
if (!alpha &&
!depth &&
!stencil) {

View file

@ -45,8 +45,6 @@
#include "sp_state.h"
#include "sp_quad.h"
#include "sp_quad_pipe.h"
#include "sp_texture.h"
#include "sp_tex_sample.h"
struct quad_shade_stage

View file

@ -41,7 +41,6 @@
#include "draw/draw_private.h"
#include "draw/draw_vertex.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"

View file

@ -30,7 +30,6 @@
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "draw/draw_context.h"

View file

@ -31,7 +31,6 @@
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
#include "draw/draw_context.h"

View file

@ -37,7 +37,6 @@
#include "util/u_tile.h"
#include "util/u_math.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_texture.h"
#include "sp_tex_tile_cache.h"

View file

@ -38,7 +38,6 @@
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_state.h"
#include "sp_texture.h"
#include "sp_screen.h"
#include "sp_winsys.h"

View file

@ -26,7 +26,6 @@
#include "svga_cmd.h"
#include "pipe/p_inlines.h"
#include "util/u_prim.h"
#include "indices/u_indices.h"
#include "svga_hw_reg.h"

View file

@ -24,7 +24,6 @@
**********************************************************/
#include "pipe/p_inlines.h"
#include "util/u_prim.h"
#include "util/u_upload_mgr.h"
#include "indices/u_indices.h"

View file

@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_hw_reg.h"

View file

@ -30,9 +30,6 @@
#include "tgsi/tgsi_parse.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_hw_reg.h"
#include "svga_cmd.h"
/***********************************************************************
* Constant buffers

View file

@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_hw_reg.h"

View file

@ -33,7 +33,6 @@
#include "svga_hw_reg.h"
#include "svga_context.h"
#include "svga_screen.h"
#include "svga_winsys.h"
#include "svga_draw.h"
#include "svga_state.h"
#include "svga_swtnl.h"

View file

@ -28,13 +28,8 @@
#include "svga_screen_texture.h"
#include "svga_context.h"
#include "svga_winsys.h"
#include "svga_draw.h"
#include "svga_debug.h"
#include "svga_hw_reg.h"
static void svga_flush( struct pipe_context *pipe,
unsigned flags,

View file

@ -32,11 +32,9 @@
#include "svga_screen.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_tgsi.h"
#include "svga_hw_reg.h"
#include "svga_cmd.h"
#include "svga_draw.h"
#include "svga_debug.h"

View file

@ -27,12 +27,6 @@
#include "svga_context.h"
#include "svga_screen_texture.h"
#include "svga_state.h"
#include "svga_winsys.h"
#include "svga_hw_reg.h"
static void svga_set_scissor_state( struct pipe_context *pipe,

View file

@ -32,7 +32,6 @@
#include "svga_screen.h"
#include "svga_screen_buffer.h"
#include "svga_winsys.h"
#include "svga_draw.h"
#include "svga_debug.h"

View file

@ -30,7 +30,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_hw_reg.h"

View file

@ -32,9 +32,6 @@
#include "svga_context.h"
#include "svga_screen_texture.h"
#include "svga_state.h"
#include "svga_hw_reg.h"
#include "svga_debug.h"

View file

@ -32,10 +32,6 @@
#include "svga_screen.h"
#include "svga_screen_buffer.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_winsys.h"
#include "svga_hw_reg.h"
static void svga_set_vertex_buffers(struct pipe_context *pipe,

View file

@ -33,7 +33,6 @@
#include "svga_screen.h"
#include "svga_context.h"
#include "svga_state.h"
#include "svga_tgsi.h"
#include "svga_hw_reg.h"
#include "svga_cmd.h"

View file

@ -33,10 +33,8 @@
#include "svga_screen.h"
#include "svga_screen_texture.h"
#include "svga_screen_buffer.h"
#include "svga_cmd.h"
#include "svga_debug.h"
#include "svga_hw_reg.h"
#include "svga3d_shaderdefs.h"
@ -393,8 +391,6 @@ svga_screen_create(struct svga_winsys_screen *sws)
pipe_mutex_init(svgascreen->tex_mutex);
pipe_mutex_init(svgascreen->swc_mutex);
LIST_INITHEAD(&svgascreen->cached_buffers);
svga_screen_cache_init(svgascreen);
return screen;

View file

@ -68,12 +68,6 @@ struct svga_screen
pipe_mutex tex_mutex;
pipe_mutex swc_mutex; /* Protects the use of swc and dirty_buffers */
/**
* List of buffers with cached GMR. Ordered from the most recently used to
* the least recently used
*/
struct list_head cached_buffers;
struct svga_host_surface_cache cache;
};

View file

@ -113,68 +113,9 @@ svga_buffer_destroy_hw_storage(struct svga_screen *ss, struct svga_buffer *sbuf)
if(sbuf->hw.buf) {
sws->buffer_destroy(sws, sbuf->hw.buf);
sbuf->hw.buf = NULL;
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
#ifdef DEBUG
sbuf->head.next = sbuf->head.prev = NULL;
#endif
}
}
static INLINE enum pipe_error
svga_buffer_backup(struct svga_screen *ss, struct svga_buffer *sbuf)
{
if (sbuf->hw.buf && sbuf->hw.num_ranges) {
void *src;
if (!sbuf->swbuf)
sbuf->swbuf = align_malloc(sbuf->base.size, sbuf->base.alignment);
if (!sbuf->swbuf)
return PIPE_ERROR_OUT_OF_MEMORY;
src = ss->sws->buffer_map(ss->sws, sbuf->hw.buf,
PIPE_BUFFER_USAGE_CPU_READ);
if (!src)
return PIPE_ERROR;
memcpy(sbuf->swbuf, src, sbuf->base.size);
ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf);
}
return PIPE_OK;
}
/**
* Try to make GMR space available by freeing the hardware storage of
* unmapped
*/
boolean
svga_buffer_free_cached_hw_storage(struct svga_screen *ss)
{
struct list_head *curr;
struct svga_buffer *sbuf;
enum pipe_error ret = PIPE_OK;
curr = ss->cached_buffers.prev;
/* free the least recently used buffer's hw storage which is not mapped */
do {
if(curr == &ss->cached_buffers)
return FALSE;
sbuf = LIST_ENTRY(struct svga_buffer, curr, head);
curr = curr->prev;
if (sbuf->map.count == 0)
ret = svga_buffer_backup(ss, sbuf);
} while(sbuf->map.count != 0 || ret != PIPE_OK);
svga_buffer_destroy_hw_storage(ss, sbuf);
return TRUE;
}
struct svga_winsys_buffer *
svga_winsys_buffer_create( struct svga_screen *ss,
unsigned alignment,
@ -195,12 +136,6 @@ svga_winsys_buffer_create( struct svga_screen *ss,
svga_screen_flush(ss, NULL);
buf = sws->buffer_create(sws, alignment, usage, size);
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "evicting buffers to find %d bytes GMR\n",
size);
/* Try evicing all buffer storage */
while(!buf && svga_buffer_free_cached_hw_storage(ss))
buf = sws->buffer_create(sws, alignment, usage, size);
}
return buf;
@ -226,8 +161,6 @@ svga_buffer_create_hw_storage(struct svga_screen *ss,
return PIPE_ERROR_OUT_OF_MEMORY;
assert(!sbuf->needs_flush);
assert(!sbuf->head.prev && !sbuf->head.next);
LIST_ADD(&sbuf->head, &ss->cached_buffers);
}
return PIPE_OK;
@ -311,7 +244,6 @@ static void
svga_buffer_upload_flush(struct svga_context *svga,
struct svga_buffer *sbuf)
{
struct svga_screen *ss = svga_screen(svga->pipe.screen);
SVGA3dCopyBox *boxes;
unsigned i;
@ -348,13 +280,16 @@ svga_buffer_upload_flush(struct svga_context *svga,
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
#ifdef DEBUG
sbuf->head.next = sbuf->head.prev = NULL;
#endif
sbuf->needs_flush = FALSE;
/* XXX: do we care about cached_buffers any more ?*/
LIST_ADD(&sbuf->head, &ss->cached_buffers);
sbuf->hw.svga = NULL;
sbuf->hw.boxes = NULL;
sbuf->host_written = TRUE;
/* Decrement reference count */
pipe_reference(&(sbuf->base.reference), NULL);
sbuf = NULL;
@ -437,17 +372,17 @@ svga_buffer_map_range( struct pipe_screen *screen,
}
else {
if(!sbuf->hw.buf) {
struct svga_winsys_surface *handle = sbuf->handle;
if(svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK)
return NULL;
/* Populate the hardware storage if the host surface pre-existed */
if((usage & PIPE_BUFFER_USAGE_CPU_READ) && handle) {
if(sbuf->host_written) {
SVGA3dSurfaceDMAFlags flags;
enum pipe_error ret;
struct pipe_fence_handle *fence = NULL;
assert(sbuf->handle);
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p (buffer), bytes %u - %u\n",
sbuf->handle, 0, sbuf->base.size);
@ -478,17 +413,6 @@ svga_buffer_map_range( struct pipe_screen *screen,
sws->fence_reference(sws, &fence, NULL);
}
}
else {
if((usage & PIPE_BUFFER_USAGE_CPU_READ) && !sbuf->needs_flush) {
/* We already had the hardware storage but we would have to issue
* a download if we hadn't, so move the buffer to the begginning
* of the LRU list.
*/
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
LIST_ADD(&sbuf->head, &ss->cached_buffers);
}
}
map = sws->buffer_map(sws, sbuf->hw.buf, usage);
}
@ -572,10 +496,8 @@ svga_buffer_destroy( struct pipe_buffer *buf )
assert(!sbuf->needs_flush);
if(sbuf->handle) {
SVGA_DBG(DEBUG_DMA, "release sid %p sz %d\n", sbuf->handle, sbuf->base.size);
svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle);
}
if(sbuf->handle)
svga_buffer_destroy_host_surface(ss, sbuf);
if(sbuf->hw.buf)
svga_buffer_destroy_hw_storage(ss, sbuf);
@ -595,6 +517,9 @@ svga_buffer_create(struct pipe_screen *screen,
struct svga_screen *ss = svga_screen(screen);
struct svga_buffer *sbuf;
assert(size);
assert(alignment);
sbuf = CALLOC_STRUCT(svga_buffer);
if(!sbuf)
goto error1;
@ -755,8 +680,7 @@ svga_buffer_handle(struct svga_context *svga,
assert(sbuf->hw.svga == svga);
sbuf->needs_flush = TRUE;
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
assert(!sbuf->head.prev && !sbuf->head.next);
LIST_ADDTAIL(&sbuf->head, &svga->dirty_buffers);
}

View file

@ -135,6 +135,11 @@ struct svga_buffer
*/
struct svga_winsys_surface *handle;
/**
* Whether the host has been ever written.
*/
boolean host_written;
struct {
unsigned count;
boolean writing;
@ -178,9 +183,6 @@ svga_buffer_handle(struct svga_context *svga,
void
svga_context_flush_buffers(struct svga_context *svga);
boolean
svga_buffer_free_cached_hw_storage(struct svga_screen *ss);
struct svga_winsys_buffer *
svga_winsys_buffer_create(struct svga_screen *ss,
unsigned alignment,

View file

@ -306,11 +306,19 @@ svga_texture_create(struct pipe_screen *screen,
tex->key.numFaces = 1;
}
tex->key.cachable = 1;
if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER)
tex->key.flags |= SVGA3D_SURFACE_HINT_TEXTURE;
if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
if(templat->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
tex->key.cachable = 0;
}
if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) {
tex->key.flags |= SVGA3D_SURFACE_HINT_SCANOUT;
tex->key.cachable = 0;
}
/*
* XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
@ -333,8 +341,6 @@ svga_texture_create(struct pipe_screen *screen,
if(tex->key.format == SVGA3D_FORMAT_INVALID)
goto error2;
tex->key.cachable = 1;
SVGA_DBG(DEBUG_DMA, "surface_create for texture\n", tex->handle);
tex->handle = svga_screen_surface_create(svgascreen, &tex->key);
if (tex->handle)
@ -416,6 +422,62 @@ svga_texture_blanket(struct pipe_screen * screen,
}
struct pipe_texture *
svga_screen_texture_wrap_surface(struct pipe_screen *screen,
struct pipe_texture *base,
enum SVGA3dSurfaceFormat format,
struct svga_winsys_surface *srf)
{
struct svga_texture *tex;
assert(screen);
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
base->depth0 != 1) {
return NULL;
}
if (!srf)
return NULL;
if (svga_translate_format(base->format) != format) {
unsigned f1 = svga_translate_format(base->format);
unsigned f2 = format;
/* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */
if ( !( (f1 == SVGA3D_X8R8G8B8 && f2 == SVGA3D_A8R8G8B8) ||
(f1 == SVGA3D_A8R8G8B8 && f2 == SVGA3D_X8R8G8B8) ||
(f1 == SVGA3D_Z_D24X8 && f2 == SVGA3D_Z_D24S8) ) ) {
debug_printf("%s wrong format %u != %u\n", __FUNCTION__, f1, f2);
return NULL;
}
}
tex = CALLOC_STRUCT(svga_texture);
if (!tex)
return NULL;
tex->base = *base;
if (format == 1)
tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM;
else if (format == 2)
tex->base.format = PIPE_FORMAT_A8R8G8B8_UNORM;
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
SVGA_DBG(DEBUG_DMA, "wrap surface sid %p\n", srf);
tex->key.cachable = 0;
tex->handle = srf;
return &tex->base;
}
static void
svga_texture_destroy(struct pipe_texture *pt)
{

View file

@ -32,8 +32,6 @@
#include "svga_cmd.h"
#include "svga_debug.h"
#include "svga_hw_reg.h"
/***********************************************************************
* Hardware state update

View file

@ -31,9 +31,6 @@
#include "svga_state.h"
#include "svga_cmd.h"
#include "svga_hw_reg.h"
struct rs_queue {
unsigned rs_count;

View file

@ -33,8 +33,6 @@
#include "svga_state.h"
#include "svga_cmd.h"
#include "svga_hw_reg.h"
void svga_cleanup_tss_binding(struct svga_context *svga)
{

View file

@ -31,7 +31,6 @@
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_shaders.h"
#include "svga_context.h"
#include "svga_state.h"
@ -87,13 +86,13 @@ svga_vbuf_render_allocate_vertices( struct vbuf_render *render,
if (!svga_render->vbuf) {
svga_render->vbuf_size = MAX2(size, svga_render->vbuf_alloc_size);
svga_render->vbuf = pipe_buffer_create(screen,
0,
16,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->vbuf_size);
if(!svga_render->vbuf) {
svga_context_flush(svga, NULL);
svga_render->vbuf = pipe_buffer_create(screen,
0,
16,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->vbuf_size);
assert(svga_render->vbuf);
@ -123,7 +122,9 @@ svga_vbuf_render_map_vertices( struct vbuf_render *render )
char *ptr = (char*)pipe_buffer_map(screen,
svga_render->vbuf,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
PIPE_BUFFER_USAGE_DISCARD |
PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
return ptr + svga_render->vbuf_offset;
}
@ -259,14 +260,14 @@ svga_vbuf_render_draw( struct vbuf_render *render,
if (!svga_render->ibuf) {
svga_render->ibuf_size = MAX2(size, svga_render->ibuf_alloc_size);
svga_render->ibuf = pipe_buffer_create(screen,
0,
2,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->ibuf_size);
svga_render->ibuf_offset = 0;
}
pipe_buffer_write(screen, svga_render->ibuf,
svga_render->ibuf_offset, 2 * nr_indices, indices);
pipe_buffer_write_nooverlap(screen, svga_render->ibuf,
svga_render->ibuf_offset, 2 * nr_indices, indices);
/* off to hardware */

View file

@ -27,7 +27,6 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_swtnl.h"

View file

@ -27,7 +27,6 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_swtnl.h"

View file

@ -29,9 +29,6 @@
#include "util/u_memory.h"
#include "svga_tgsi_emit.h"
#include "svga_context.h"
static boolean ps20_input( struct svga_shader_emitter *emit,

View file

@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_tgsi_emit.h"
#include "svga_context.h"
static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semantic,
unsigned *usage,

View file

@ -296,4 +296,10 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture,
struct pipe_buffer **buffer,
unsigned *stride);
struct pipe_texture *
svga_screen_texture_wrap_surface(struct pipe_screen *screen,
struct pipe_texture *base,
enum SVGA3dSurfaceFormat format,
struct svga_winsys_surface *srf);
#endif /* SVGA_WINSYS_H_ */

View file

@ -173,6 +173,7 @@ trace_drm_create(struct drm_api *api)
if (!tr_api)
goto error;
tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
tr_api->base.create_context = trace_drm_create_context;
tr_api->base.texture_from_shared_handle = trace_drm_texture_from_shared_handle;

View file

@ -63,13 +63,6 @@ pipe_buffer_map(struct pipe_screen *screen,
if(screen->buffer_map_range) {
unsigned offset = 0;
unsigned length = buf->size;
/* XXX: Actually we should be using/detecting DISCARD
* instead of assuming that WRITE implies discard */
if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) &&
!(usage & PIPE_BUFFER_USAGE_DISCARD))
usage |= PIPE_BUFFER_USAGE_CPU_READ;
return screen->buffer_map_range(screen, buf, offset, length, usage);
}
else
@ -126,7 +119,39 @@ pipe_buffer_write(struct pipe_screen *screen,
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
PIPE_BUFFER_USAGE_DISCARD);
assert(map);
if(map) {
memcpy((uint8_t *)map + offset, data, size);
pipe_buffer_flush_mapped_range(screen, buf, offset, size);
pipe_buffer_unmap(screen, buf);
}
}
/**
* Special case for writing non-overlapping ranges.
*
* We can avoid GPU/CPU synchronization when writing range that has never
* been written before.
*/
static INLINE void
pipe_buffer_write_nooverlap(struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned offset, unsigned size,
const void *data)
{
void *map;
assert(offset < buf->size);
assert(offset + size <= buf->size);
assert(size);
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
PIPE_BUFFER_USAGE_DISCARD |
PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
assert(map);
if(map) {
memcpy((uint8_t *)map + offset, data, size);

View file

@ -30,6 +30,11 @@ struct drm_api
{
const char *name;
/**
* Kernel driver name, as accepted by drmOpenByName.
*/
const char *driver_name;
/**
* Special buffer functions
*/

View file

@ -101,6 +101,12 @@ dri_destroy_context(__DRIcontext * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);
/* note: we are freeing values and nothing more because
* driParseConfigFiles allocated values only - the rest
* is owned by screen optionCache.
*/
FREE(ctx->optionCache.values);
/* No particular reason to wait for command completion before
* destroying a context, but it is probably worthwhile flushing it
* to avoid having to add code elsewhere to cope with flushing a

View file

@ -123,11 +123,12 @@ dri_get_buffers(__DRIdrawable * dPriv)
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_surface *surface = NULL;
struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
struct dri_screen *st_screen = dri_screen(drawable->sPriv);
struct pipe_screen *screen = st_screen->pipe_screen;
__DRIbuffer *buffers = NULL;
__DRIscreen *dri_screen = drawable->sPriv;
__DRIdrawable *dri_drawable = drawable->dPriv;
struct drm_api *api = ((struct dri_screen*)(dri_screen->private))->api;
struct drm_api *api = st_screen->api;
boolean have_depth = FALSE;
int i, count;
@ -180,7 +181,9 @@ dri_get_buffers(__DRIdrawable * dPriv)
switch (buffers[i].attachment) {
case __DRI_BUFFER_FRONT_LEFT:
continue;
if (!st_screen->auto_fake_front)
continue;
/* fallthrough */
case __DRI_BUFFER_FAKE_FRONT_LEFT:
index = ST_SURFACE_FRONT_LEFT;
format = drawable->color_format;
@ -373,8 +376,8 @@ dri_create_buffer(__DRIscreen * sPriv,
/* TODO incase of double buffer visual, delay fake creation */
i = 0;
drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
if (!screen->auto_fake_front)
drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
if (visual->doubleBufferMode)
drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
if (visual->depthBits && visual->stencilBits)

View file

@ -292,6 +292,8 @@ dri_init_screen2(__DRIscreen * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
const __DRIdri2LoaderExtension *dri2_ext =
sPriv->dri2.loader;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@ -317,6 +319,9 @@ dri_init_screen2(__DRIscreen * sPriv)
driParseOptionInfo(&screen->optionCache,
__driConfigOptions, __driNConfigOptions);
screen->auto_fake_front = dri2_ext->base.version >= 3 &&
dri2_ext->getBuffersWithFormat != NULL;
return dri_fill_in_modes(screen, 32);
fail:
return NULL;
@ -326,8 +331,18 @@ static void
dri_destroy_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen = dri_screen(sPriv);
int i;
screen->pipe_screen->destroy(screen->pipe_screen);
for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) {
FREE(screen->optionCache.info[i].name);
FREE(screen->optionCache.info[i].ranges);
}
FREE(screen->optionCache.info);
FREE(screen->optionCache.values);
FREE(screen);
sPriv->private = NULL;
}

View file

@ -59,6 +59,7 @@ struct dri_screen
struct pipe_screen *pipe_screen;
boolean d_depth_bits_last;
boolean sd_depth_bits_last;
boolean auto_fake_front;
};
/** cast wrapper */

View file

@ -95,8 +95,6 @@ stw_pf_depth_stencil[] = {
{ PIPE_FORMAT_Z24X8_UNORM, {24, 0} },
{ PIPE_FORMAT_X8Z24_UNORM, {24, 0} },
{ PIPE_FORMAT_Z16_UNORM, {16, 0} },
/* pure stencil */
{ PIPE_FORMAT_S8_UNORM, { 0, 8} },
/* combined depth-stencil */
{ PIPE_FORMAT_S8Z24_UNORM, {24, 8} },
{ PIPE_FORMAT_Z24S8_UNORM, {24, 8} }
@ -220,7 +218,8 @@ stw_pixelformat_init( void )
const struct stw_pf_color_info *color = &stw_pf_color[j];
if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET, 0))
continue;
for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) {

View file

@ -4,10 +4,7 @@
#include "xorg_exa_tgsi.h"
#include "cso_cache/cso_context.h"
#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "pipe/p_inlines.h"
/*XXX also in Xrender.h but the including it here breaks compilition */
#define XFixedToDouble(f) (((double) (f)) / 65536.)

View file

@ -44,9 +44,12 @@
#include "util/u_rect.h"
/* Make all the #if cases in the code esier to read */
/* XXX can it be set to 1? */
#ifndef DRI2INFOREC_VERSION
#define DRI2INFOREC_VERSION 0
#define DRI2INFOREC_VERSION 1
#endif
#if DRI2INFOREC_VERSION == 2
static Bool set_format_in_do_create_buffer;
#endif
typedef struct {
@ -147,7 +150,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
buffer->driverPrivate = private;
buffer->flags = 0; /* not tiled */
#if DRI2INFOREC_VERSION == 2
((DRI2Buffer2Ptr)buffer)->format = 0;
/* ABI forwards/backwards compatibility */
if (set_format_in_do_create_buffer)
((DRI2Buffer2Ptr)buffer)->format = 0;
#elif DRI2INFOREC_VERSION >= 3
buffer->format = 0;
#endif
@ -211,7 +216,9 @@ dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
xfree(buffer);
}
#else /* DRI2INFOREC_VERSION < 2 */
#endif /* DRI2INFOREC_VERSION >= 2 */
#if DRI2INFOREC_VERSION <= 2
static DRI2BufferPtr
dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
@ -261,7 +268,7 @@ dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
}
}
#endif /* DRI2INFOREC_VERSION >= 2 */
#endif /* DRI2INFOREC_VERSION <= 2 */
static void
dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
@ -369,12 +376,17 @@ xorg_dri2_init(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
DRI2InfoRec dri2info;
int major, minor;
if (xf86LoaderCheckSymbol("DRI2Version")) {
DRI2Version(&major, &minor);
} else {
/* Assume version 1.0 */
major = 1;
minor = 0;
}
#if DRI2INFOREC_VERSION >= 2
dri2info.version = DRI2INFOREC_VERSION;
#else
dri2info.version = 1;
#endif
dri2info.fd = ms->fd;
dri2info.driverName = pScrn->driverName;
@ -383,7 +395,22 @@ xorg_dri2_init(ScreenPtr pScreen)
#if DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = dri2_create_buffer;
dri2info.DestroyBuffer = dri2_destroy_buffer;
#else
#endif
/* For X servers in the 1.6.x series there where two DRI2 version.
* This allows us to build one binary that works on both servers.
*/
#if DRI2INFOREC_VERSION == 2
if (minor == 0) {
set_format_in_do_create_buffer = FALSE;
dri2info.CreateBuffers = dri2_create_buffers;
dri2info.DestroyBuffers = dri2_destroy_buffers;
} else
set_format_in_do_create_buffer = FALSE;
#endif
/* For version 1 set these unconditionaly. */
#if DRI2INFOREC_VERSION == 1
dri2info.CreateBuffers = dri2_create_buffers;
dri2info.DestroyBuffers = dri2_destroy_buffers;
#endif

View file

@ -45,7 +45,6 @@
#include "miscstruct.h"
#include "dixstruct.h"
#include "xf86xv.h"
#include <X11/extensions/Xv.h>
#ifndef XSERVER_LIBPCIACCESS
#error "libpciaccess needed"
#endif
@ -206,15 +205,40 @@ drv_init_drm(ScrnInfoPtr pScrn)
ms->PciInfo->dev, ms->PciInfo->func
);
ms->fd = drmOpen(NULL, BusID);
if (ms->fd < 0)
return FALSE;
ms->api = drm_api_create();
ms->fd = drmOpen(ms->api ? ms->api->driver_name : NULL, BusID);
xfree(BusID);
if (ms->fd >= 0)
return TRUE;
if (ms->api && ms->api->destroy)
ms->api->destroy(ms->api);
ms->api = NULL;
return FALSE;
}
return TRUE;
}
static Bool
drv_close_drm(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
if (ms->api && ms->api->destroy)
ms->api->destroy(ms->api);
ms->api = NULL;
drmClose(ms->fd);
ms->fd = -1;
return TRUE;
}
static Bool
drv_init_resource_management(ScrnInfoPtr pScrn)
{
@ -229,7 +253,6 @@ drv_init_resource_management(ScrnInfoPtr pScrn)
if (ms->screen || ms->kms)
return TRUE;
ms->api = drm_api_create();
if (ms->api) {
ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
@ -269,10 +292,6 @@ drv_close_resource_management(ScrnInfoPtr pScrn)
}
ms->screen = NULL;
if (ms->api && ms->api->destroy)
ms->api->destroy(ms->api);
ms->api = NULL;
#ifdef HAVE_LIBKMS
if (ms->kms)
kms_destroy(&ms->kms);
@ -823,8 +842,7 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
drv_close_resource_management(pScrn);
drmClose(ms->fd);
ms->fd = -1;
drv_close_drm(pScrn);
pScrn->vtSema = FALSE;
pScreen->CloseScreen = ms->CloseScreen;

Some files were not shown because too many files have changed in this diff Show more