00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "brw_blit.h"
00029 #include "brw_context.h"
00030 #include "brw_state.h"
00031 #include "pipe/p_defines.h"
00032 #include "pipe/p_inlines.h"
00033 #include "pipe/p_winsys.h"
00034 #include "util/u_tile.h"
00035 #include "util/u_rect.h"
00036
00037
00038
00039
00040
00041
00042 static void
00043 brw_surface_copy(struct pipe_context *pipe,
00044 boolean do_flip,
00045 struct pipe_surface *dst,
00046 unsigned dstx, unsigned dsty,
00047 struct pipe_surface *src,
00048 unsigned srcx, unsigned srcy, unsigned width, unsigned height)
00049 {
00050 assert( dst != src );
00051 assert( dst->block.size == src->block.size );
00052 assert( dst->block.width == src->block.height );
00053 assert( dst->block.height == src->block.height );
00054
00055 if (0) {
00056 void *dst_map = pipe->screen->surface_map( pipe->screen,
00057 dst,
00058 PIPE_BUFFER_USAGE_CPU_WRITE );
00059
00060 const void *src_map = pipe->screen->surface_map( pipe->screen,
00061 src,
00062 PIPE_BUFFER_USAGE_CPU_READ );
00063
00064 pipe_copy_rect(dst_map,
00065 &dst->block,
00066 dst->stride,
00067 dstx, dsty,
00068 width, height,
00069 src_map,
00070 do_flip ? -(int) src->stride : src->stride,
00071 srcx, do_flip ? height - 1 - srcy : srcy);
00072
00073 pipe->screen->surface_unmap(pipe->screen, src);
00074 pipe->screen->surface_unmap(pipe->screen, dst);
00075 }
00076 else {
00077 assert(dst->block.width == 1);
00078 assert(dst->block.height == 1);
00079 brw_copy_blit(brw_context(pipe),
00080 do_flip,
00081 dst->block.size,
00082 (short) src->stride/src->block.size, src->buffer, src->offset, FALSE,
00083 (short) dst->stride/dst->block.size, dst->buffer, dst->offset, FALSE,
00084 (short) srcx, (short) srcy, (short) dstx, (short) dsty,
00085 (short) width, (short) height, PIPE_LOGICOP_COPY);
00086 }
00087 }
00088
00089
00090 static void
00091 brw_surface_fill(struct pipe_context *pipe,
00092 struct pipe_surface *dst,
00093 unsigned dstx, unsigned dsty,
00094 unsigned width, unsigned height, unsigned value)
00095 {
00096 if (0) {
00097 void *dst_map = pipe->screen->surface_map( pipe->screen,
00098 dst,
00099 PIPE_BUFFER_USAGE_CPU_WRITE );
00100
00101 pipe_fill_rect(dst_map, &dst->block, dst->stride, dstx, dsty, width, height, value);
00102
00103 pipe->screen->surface_unmap(pipe->screen, dst);
00104 }
00105 else {
00106 assert(dst->block.width == 1);
00107 assert(dst->block.height == 1);
00108 brw_fill_blit(brw_context(pipe),
00109 dst->block.size,
00110 (short) dst->stride/dst->block.size,
00111 dst->buffer, dst->offset, FALSE,
00112 (short) dstx, (short) dsty,
00113 (short) width, (short) height,
00114 value);
00115 }
00116 }
00117
00118
00119 void
00120 brw_init_surface_functions(struct brw_context *brw)
00121 {
00122 brw->pipe.surface_copy = brw_surface_copy;
00123 brw->pipe.surface_fill = brw_surface_fill;
00124 }