1/* 2 * Copyright 2003 VMware, Inc. 3 * All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sublicense, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial portions 15 * of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 */ 25 26#include "main/mtypes.h" 27#include "main/enums.h" 28#include "main/image.h" 29#include "main/teximage.h" 30#include "main/texobj.h" 31#include "main/texstate.h" 32#include "main/fbobject.h" 33 34#include "drivers/common/meta.h" 35 36#include "intel_screen.h" 37#include "intel_mipmap_tree.h" 38#include "intel_fbo.h" 39#include "intel_tex.h" 40#include "brw_context.h" 41 42#define FILE_DEBUG_FLAG DEBUG_TEXTURE 43 44 45static void 46intelCopyTexSubImage(struct gl_context *ctx, GLuint dims, 47 struct gl_texture_image *texImage, 48 GLint xoffset, GLint yoffset, GLint slice, 49 struct gl_renderbuffer *rb, 50 GLint x, GLint y, 51 GLsizei width, GLsizei height) 52{ 53 struct brw_context *brw = brw_context(ctx); 54 55 /* Try BLORP first. It can handle almost everything. */ 56 if (brw_blorp_copytexsubimage(brw, rb, texImage, slice, x, y, 57 xoffset, yoffset, width, height)) 58 return; 59 60 /* Finally, fall back to meta. This will likely be slow. */ 61 perf_debug("%s - fallback to swrast\n", __func__); 62 _mesa_meta_CopyTexSubImage(ctx, dims, texImage, 63 xoffset, yoffset, slice, 64 rb, x, y, width, height); 65} 66 67 68void 69intelInitTextureCopyImageFuncs(struct dd_function_table *functions) 70{ 71 functions->CopyTexSubImage = intelCopyTexSubImage; 72} 73