This removes quite a bit of code duplicated in the drivers.
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-
-#include "pipe/softpipe/sp_rgba_tile.h" /* XXX TEMPORARY */
-
-
-#define CLIP_TILE \
- do { \
- if (x >= ps->width) \
- return; \
- if (y >= ps->height) \
- return; \
- if (x + w > ps->width) \
- w = ps->width - x; \
- if (y + h > ps->height) \
- h = ps->height -y; \
- } while(0)
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-i915_get_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- void *p, int dst_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (dst_stride == 0) {
- dst_stride = w0 * cpp;
- }
-
- pSrc = ps->map + (y * ps->pitch + x) * cpp;
- pDest = (ubyte *) p;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += dst_stride;
- pSrc += ps->pitch * cpp;
- }
-}
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-i915_put_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- const void *p, int src_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (src_stride == 0) {
- src_stride = w0 * cpp;
- }
-
- pSrc = (const ubyte *) p;
- pDest = ps->map + (y * ps->pitch + x) * cpp;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->pitch * cpp;
- pSrc += src_stride;
- }
-}
+#include "pipe/util/p_tile.h"
/*
i915_init_surface_functions(struct i915_context *i915)
{
i915->pipe.get_tex_surface = i915_get_tex_surface;
- i915->pipe.get_tile = i915_get_tile;
- i915->pipe.put_tile = i915_put_tile;
- i915->pipe.get_tile_rgba = softpipe_get_tile_rgba;
- i915->pipe.put_tile_rgba = softpipe_put_tile_rgba;
+ i915->pipe.get_tile = pipe_get_tile_raw;
+ i915->pipe.put_tile = pipe_put_tile_raw;
+ i915->pipe.get_tile_rgba = pipe_get_tile_rgba;
+ i915->pipe.put_tile_rgba = pipe_put_tile_rgba;
i915->pipe.surface_data = i915_surface_data;
i915->pipe.surface_copy = i915_surface_copy;
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
-
-#include "pipe/softpipe/sp_rgba_tile.h" /* XXX TEMPORARY */
-
-
-#define CLIP_TILE \
- do { \
- if (x >= ps->width) \
- return; \
- if (y >= ps->height) \
- return; \
- if (x + w > ps->width) \
- w = ps->width - x; \
- if (y + h > ps->height) \
- h = ps->height -y; \
- } while(0)
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-brw_get_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- void *p, int dst_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (dst_stride == 0) {
- dst_stride = w0 * cpp;
- }
-
- pSrc = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
- pDest = (ubyte *) p;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += dst_stride;
- pSrc += ps->pitch * cpp;
- }
-}
-
-
-/*
- * XXX note: same as code in sp_surface.c
- */
-static void
-brw_put_tile(struct pipe_context *pipe,
- struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- const void *p, int src_stride)
-{
- const uint cpp = ps->cpp;
- const uint w0 = w;
- const ubyte *pSrc;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- CLIP_TILE;
-
- if (src_stride == 0) {
- src_stride = w0 * cpp;
- }
-
- pSrc = (const ubyte *) p;
- pDest = ps->map + ps->offset + (y * ps->pitch + x) * cpp;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w0 * cpp);
- pDest += ps->pitch * cpp;
- pSrc += src_stride;
- }
-}
+#include "pipe/util/p_tile.h"
/*
brw_init_surface_functions(struct brw_context *brw)
{
brw->pipe.get_tex_surface = brw_get_tex_surface;
- brw->pipe.get_tile = brw_get_tile;
- brw->pipe.put_tile = brw_put_tile;
- brw->pipe.get_tile_rgba = softpipe_get_tile_rgba;
- brw->pipe.put_tile_rgba = softpipe_put_tile_rgba;
+ brw->pipe.get_tile = pipe_get_tile_raw;
+ brw->pipe.put_tile = pipe_put_tile_raw;
+ brw->pipe.get_tile_rgba = pipe_get_tile_rgba;
+ brw->pipe.put_tile_rgba = pipe_put_tile_rgba;
brw->pipe.surface_data = brw_surface_data;
brw->pipe.surface_copy = brw_surface_copy;
sp_quad_output.c \
sp_quad_stencil.c \
sp_quad_stipple.c \
- sp_rgba_tile.c \
sp_state_blend.c \
sp_state_clip.c \
sp_state_derived.c \
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
#include "pipe/p_winsys.h"
+#include "pipe/util/p_tile.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_texture.h"
-#include "sp_rgba_tile.h"
-
-
-
-#define CLIP_TILE \
- do { \
- if (x >= ps->width) \
- return; \
- if (y >= ps->height) \
- return; \
- if (x + w > ps->width) \
- w = ps->width - x; \
- if (y + h > ps->height) \
- h = ps->height - y; \
- } while(0)
/**
}
-/**
- * Move raw block of pixels from surface to user memory.
- */
-void
-softpipe_get_tile(struct pipe_context *pipe, struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- void *p, int dst_stride)
-{
- const uint cpp = ps->cpp;
- const ubyte *pSrc;
- const uint src_stride = ps->pitch * cpp;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- if (dst_stride == 0) {
- dst_stride = w * cpp;
- }
-
- CLIP_TILE;
-
- pSrc = ps->map + (y * ps->pitch + x) * cpp;
- pDest = (ubyte *) p;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w * cpp);
- pDest += dst_stride;
- pSrc += src_stride;
- }
-}
-
-
-/**
- * Move raw block of pixels from user memory to surface.
- */
-void
-softpipe_put_tile(struct pipe_context *pipe, struct pipe_surface *ps,
- uint x, uint y, uint w, uint h,
- const void *p, int src_stride)
-{
- const uint cpp = ps->cpp;
- const ubyte *pSrc;
- const uint dst_stride = ps->pitch * cpp;
- ubyte *pDest;
- uint i;
-
- assert(ps->map);
-
- if (src_stride == 0) {
- src_stride = w * cpp;
- }
-
- CLIP_TILE;
-
- pSrc = (const ubyte *) p;
- pDest = ps->map + (y * ps->pitch + x) * cpp;
-
- for (i = 0; i < h; i++) {
- memcpy(pDest, pSrc, w * cpp);
- pDest += dst_stride;
- pSrc += src_stride;
- }
-}
-
-
/**
* Copy 2D rect from one place to another.
* Position and sizes are in pixels.
ushort val1 = UBYTE_TO_USHORT((value >> 8) & 0xff);
ushort val2 = UBYTE_TO_USHORT((value >> 16) & 0xff);
ushort val3 = UBYTE_TO_USHORT((value >> 24) & 0xff);
+ val0 = (val0 << 8) | val0;
+ val1 = (val1 << 8) | val1;
+ val2 = (val2 << 8) | val2;
+ val3 = (val3 << 8) | val3;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
row[j*4+0] = val0;
void
sp_init_surface_functions(struct softpipe_context *sp)
{
- sp->pipe.get_tile = softpipe_get_tile;
- sp->pipe.put_tile = softpipe_put_tile;
-
- sp->pipe.get_tile_rgba = softpipe_get_tile_rgba;
- sp->pipe.put_tile_rgba = softpipe_put_tile_rgba;
+ sp->pipe.get_tile = pipe_get_tile_raw;
+ sp->pipe.put_tile = pipe_put_tile_raw;
+ sp->pipe.get_tile_rgba = pipe_get_tile_rgba;
+ sp->pipe.put_tile_rgba = pipe_put_tile_rgba;
sp->pipe.surface_data = sp_surface_data;
sp->pipe.surface_copy = sp_surface_copy;
pipe/cso_cache/cso_hash.c \
pipe/cso_cache/cso_cache.c
+PIPEUTIL_SOURCES = \
+ pipe/util/p_tile.c
+
STATETRACKER_SOURCES = \
state_tracker/st_atom.c \
state_tracker/st_atom_alphatest.c \
$(DRAW_SOURCES) \
$(TGSIEXEC_SOURCES) \
$(TGSIUTIL_SOURCES) \
+ $(PIPEUTIL_SOURCES) \
$(STATECACHE_SOURCES) \
$(STATETRACKER_SOURCES) \
$(TNL_SOURCES) \