Переглянути джерело

gallium: softpipe runs gears with pipe_resources

gallium-buffer-usage-cleanup
Keith Whitwell 15 роки тому
джерело
коміт
ce418533be

+ 1
- 1
configs/default Переглянути файл

@@ -98,7 +98,7 @@ EGL_DRIVERS_DIRS = glx
# Gallium directories and
GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
GALLIUM_DRIVERS_DIRS = softpipe # trace identity svga i915 i965 r300
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = null xlib drm
GALLIUM_TARGET_DIRS = libgl-xlib

+ 1
- 1
src/gallium/auxiliary/util/u_inlines.h Переглянути файл

@@ -146,7 +146,7 @@ static INLINE struct pipe_resource *
pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size,
unsigned usage )
{
return screen->user_buffer_create(screen, ptr, size);
return screen->user_buffer_create(screen, ptr, size, usage);
}

static INLINE void *

+ 7
- 7
src/gallium/auxiliary/util/u_tile.c Переглянути файл

@@ -55,7 +55,7 @@ pipe_get_tile_raw(struct pipe_context *pipe,
if (dst_stride == 0)
dst_stride = util_format_get_stride(pt->resource->format, w);

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

src = pipe->transfer_map(pipe, pt);
@@ -84,7 +84,7 @@ pipe_put_tile_raw(struct pipe_context *pipe,
if (src_stride == 0)
src_stride = util_format_get_stride(format, w);

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

dst = pipe->transfer_map(pipe, pt);
@@ -1255,7 +1255,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
void *packed;
enum pipe_format format = pt->resource->format;

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
@@ -1293,7 +1293,7 @@ pipe_get_tile_swizzle(struct pipe_context *pipe,
uint i;
float rgba01[6];

if (pipe_clip_tile(x, y, &w, &h, pt)) {
if (u_clip_tile(x, y, &w, &h, &pt->box)) {
return;
}

@@ -1347,7 +1347,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
void *packed;
enum pipe_format format = pt->resource->format;

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
@@ -1449,7 +1449,7 @@ pipe_get_tile_z(struct pipe_context *pipe,
uint i, j;
enum pipe_format format = pt->resource->format;

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

map = (ubyte *)pipe->transfer_map(pipe, pt);
@@ -1534,7 +1534,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
uint i, j;
enum pipe_format format = pt->resource->format;

if (pipe_clip_tile(x, y, &w, &h, pt))
if (u_clip_tile(x, y, &w, &h, &pt->box))
return;

map = (ubyte *)pipe->transfer_map(pipe, pt);

+ 3
- 2
src/gallium/drivers/softpipe/sp_texture.c Переглянути файл

@@ -383,7 +383,8 @@ softpipe_transfer_unmap(struct pipe_context *pipe,
static struct pipe_resource *
softpipe_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes)
unsigned bytes,
unsigned usage)
{
struct softpipe_resource *buffer;

@@ -393,7 +394,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,

pipe_reference_init(&buffer->base.reference, 1);
buffer->base.screen = screen;
buffer->base.usage = PIPE_BUFFER_USAGE_CPU_READ;
buffer->base.usage = PIPE_BUFFER_USAGE_CPU_READ | usage;
buffer->base.width0 = bytes;
buffer->base.height0 = 1;
buffer->base.depth0 = 1;

+ 0
- 1
src/gallium/drivers/trace/Makefile Переглянути файл

@@ -4,7 +4,6 @@ include $(TOP)/configs/current
LIBNAME = trace

C_SOURCES = \
tr_buffer.c \
tr_context.c \
tr_dump.c \
tr_dump_state.c \

+ 0
- 1
src/gallium/drivers/trace/SConscript Переглянути файл

@@ -5,7 +5,6 @@ env = env.Clone()
trace = env.ConvenienceLibrary(
target = 'trace',
source = [
'tr_buffer.c',
'tr_context.c',
'tr_drm.c',
'tr_dump.c',

+ 0
- 76
src/gallium/drivers/trace/tr_buffer.c Переглянути файл

@@ -1,76 +0,0 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* 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 above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* 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 TUNGSTEN GRAPHICS 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.
*
**************************************************************************/


#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"

#include "tr_buffer.h"

struct pipe_buffer *
trace_buffer_create(struct trace_screen *tr_scr,
struct pipe_buffer *buffer)
{
struct trace_buffer *tr_buf;

if(!buffer)
goto error;

assert(buffer->screen == tr_scr->screen);

tr_buf = CALLOC_STRUCT(trace_buffer);
if(!tr_buf)
goto error;

memcpy(&tr_buf->base, buffer, sizeof(struct pipe_buffer));

pipe_reference_init(&tr_buf->base.reference, 1);
tr_buf->base.screen = &tr_scr->base;
tr_buf->buffer = buffer;

trace_screen_add_to_list(tr_scr, buffers, tr_buf);

return &tr_buf->base;

error:
pipe_buffer_reference(&buffer, NULL);
return NULL;
}


void
trace_buffer_destroy(struct trace_screen *tr_scr,
struct pipe_buffer *buffer)
{
struct trace_buffer *tr_buf = trace_buffer(buffer);

trace_screen_remove_from_list(tr_scr, buffers, tr_buf);

pipe_buffer_reference(&tr_buf->buffer, NULL);
FREE(tr_buf);
}

+ 0
- 70
src/gallium/drivers/trace/tr_buffer.h Переглянути файл

@@ -1,70 +0,0 @@
/**************************************************************************
*
* Copyright 2009 VMware, Inc.
* 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 above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* 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 TUNGSTEN GRAPHICS 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.
*
**************************************************************************/

#ifndef TR_BUFFER_H_
#define TR_BUFFER_H_


#include "pipe/p_compiler.h"
#include "pipe/p_state.h"

#include "tr_screen.h"


struct trace_buffer
{
struct pipe_buffer base;

struct pipe_buffer *buffer;

struct tr_list list;

void *map;
boolean range_flushed;
};


static INLINE struct trace_buffer *
trace_buffer(struct pipe_buffer *buffer)
{
if(!buffer)
return NULL;
(void)trace_screen(buffer->screen);
return (struct trace_buffer *)buffer;
}


struct pipe_buffer *
trace_buffer_create(struct trace_screen *tr_scr,
struct pipe_buffer *buffer);

void
trace_buffer_destroy(struct trace_screen *tr_scr,
struct pipe_buffer *buffer);


#endif

+ 2
- 1
src/gallium/include/pipe/p_screen.h Переглянути файл

@@ -167,7 +167,8 @@ struct pipe_screen {
*/
struct pipe_resource *(*user_buffer_create)(struct pipe_screen *screen,
void *ptr,
unsigned bytes);
unsigned bytes,
unsigned usage);

/**
* Create a video surface suitable for use as a decoding target by the

Завантаження…
Відмінити
Зберегти