projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i965: Expose logic telling if non-msrt mcs is supported
[mesa.git]
/
src
/
mesa
/
drivers
/
dri
/
i965
/
intel_fbo.c
diff --git
a/src/mesa/drivers/dri/i965/intel_fbo.c
b/src/mesa/drivers/dri/i965/intel_fbo.c
index 57cf583cbe8672dcf047f2742b34291d7d248f5e..3a4a53a07e6e237c76289b1eba03672ca211fefa 100644
(file)
--- a/
src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/
src/mesa/drivers/dri/i965/intel_fbo.c
@@
-1,5
+1,4
@@
-/**************************************************************************
- *
+/*
* Copyright 2006 VMware, Inc.
* All Rights Reserved.
*
* Copyright 2006 VMware, Inc.
* All Rights Reserved.
*
@@
-7,7
+6,7
@@
* 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,
* 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
+ * distribute, sublicense, 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:
*
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
@@
-17,14
+16,12
@@
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
*
* 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.
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL VMWARE 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.
* IN NO EVENT SHALL VMWARE 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 "main/enums.h"
#include "main/imports.h"
#include "main/enums.h"
#include "main/imports.h"
@@
-55,19
+52,6
@@
#define FILE_DEBUG_FLAG DEBUG_FBO
#define FILE_DEBUG_FLAG DEBUG_FBO
-/**
- * Create a new framebuffer object.
- */
-static struct gl_framebuffer *
-intel_new_framebuffer(struct gl_context * ctx, GLuint name)
-{
- /* Only drawable state in intel_framebuffer at this time, just use Mesa's
- * class
- */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
/** Called by gl_renderbuffer::Delete() */
static void
intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
/** Called by gl_renderbuffer::Delete() */
static void
intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
@@
-190,7
+174,7
@@
intel_map_renderbuffer(struct gl_context *ctx,
}
DBG("%s: rb %d (%s) mt mapped: (%d, %d) (%dx%d) -> %p/%"PRIdPTR"\n",
}
DBG("%s: rb %d (%s) mt mapped: (%d, %d) (%dx%d) -> %p/%"PRIdPTR"\n",
- __
FUNCTION
__, rb->Name, _mesa_get_format_name(rb->Format),
+ __
func
__, rb->Name, _mesa_get_format_name(rb->Format),
x, y, w, h, map, stride);
*out_map = map;
x, y, w, h, map, stride);
*out_map = map;
@@
-214,7
+198,7
@@
intel_unmap_renderbuffer(struct gl_context *ctx,
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
struct intel_mipmap_tree *mt;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
struct intel_mipmap_tree *mt;
- DBG("%s: rb %d (%s)\n", __
FUNCTION
__,
+ DBG("%s: rb %d (%s)\n", __
func
__,
rb->Name, _mesa_get_format_name(rb->Format));
if (srb->Buffer) {
rb->Name, _mesa_get_format_name(rb->Format));
if (srb->Buffer) {
@@
-309,8
+293,8
@@
intel_alloc_private_renderbuffer_storage(struct gl_context * ctx, struct gl_rend
intel_miptree_release(&irb->mt);
intel_miptree_release(&irb->mt);
- DBG("%s: %s: %s (%dx%d)\n", __
FUNCTION
__,
- _mesa_
lookup_enum_by_nr
(internalFormat),
+ DBG("%s: %s: %s (%dx%d)\n", __
func
__,
+ _mesa_
enum_to_string
(internalFormat),
_mesa_get_format_name(rb->Format), width, height);
if (width == 0 || height == 0)
_mesa_get_format_name(rb->Format), width, height);
if (width == 0 || height == 0)
@@
-359,30
+343,25
@@
intel_image_target_renderbuffer_storage(struct gl_context *ctx,
if (image->planar_format && image->planar_format->nplanes > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetRenderbufferStorage(planar buffers are not "
if (image->planar_format && image->planar_format->nplanes > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetRenderbufferStorage(planar buffers are not "
- "supported as render targets.");
- return;
- }
-
- /* Buffers originating from outside are for read-only. */
- if (image->dma_buf_imported) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glEGLImageTargetRenderbufferStorage(dma buffers are read-only)");
+ "supported as render targets.)");
return;
}
/* __DRIimage is opaque to the core so it has to be checked here */
return;
}
/* __DRIimage is opaque to the core so it has to be checked here */
- switch (image->format) {
- case MESA_FORMAT_R8G8B8A8_UNORM:
+ if (!brw->format_supported_as_render_target[image->format]) {
_mesa_error(ctx, GL_INVALID_OPERATION,
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glEGLImageTargetRenderbufferStorage(unsupported image format");
+ "glEGLImageTargetRenderbufferStorage(unsupported image format
)
");
return;
return;
- break;
- default:
- break;
}
irb = intel_renderbuffer(rb);
intel_miptree_release(&irb->mt);
}
irb = intel_renderbuffer(rb);
intel_miptree_release(&irb->mt);
+
+ /* Disable creation of the miptree's aux buffers because the driver exposes
+ * no EGL API to manage them. That is, there is no API for resolving the aux
+ * buffer's content to the main buffer nor for invalidating the aux buffer's
+ * content.
+ */
irb->mt = intel_miptree_create_for_bo(brw,
image->bo,
image->format,
irb->mt = intel_miptree_create_for_bo(brw,
image->bo,
image->format,
@@
-390,7
+369,8
@@
intel_image_target_renderbuffer_storage(struct gl_context *ctx,
image->width,
image->height,
1,
image->width,
image->height,
1,
- image->pitch);
+ image->pitch,
+ MIPTREE_LAYOUT_DISABLE_AUX);
if (!irb->mt)
return;
if (!irb->mt)
return;
@@
-415,6
+395,7
@@
static GLboolean
intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
+ (void) ctx;
assert(rb->Name == 0);
rb->Width = width;
rb->Height = height;
assert(rb->Name == 0);
rb->Width = width;
rb->Height = height;
@@
-428,6
+409,10
@@
static GLboolean
intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
+ (void) rb;
+ (void) internalFormat;
+ (void) width;
+ (void) height;
_mesa_problem(ctx, "intel_nop_alloc_storage should never be called.");
return false;
}
_mesa_problem(ctx, "intel_nop_alloc_storage should never be called.");
return false;
}
@@
-551,19
+536,21
@@
intel_renderbuffer_update_wrapper(struct brw_context *brw,
irb->mt_layer = layer_multiplier * layer;
irb->mt_layer = layer_multiplier * layer;
- if (layered) {
- irb->layer_count = image->TexObject->NumLayers ?: mt->level[level].depth / layer_multiplier;
- } else {
+ if (!layered) {
irb->layer_count = 1;
irb->layer_count = 1;
+ } else if (image->TexObject->NumLayers > 0) {
+ irb->layer_count = image->TexObject->NumLayers;
+ } else {
+ irb->layer_count = mt->level[level].depth / layer_multiplier;
}
intel_miptree_reference(&irb->mt, mt);
intel_renderbuffer_set_draw_offset(irb);
}
intel_miptree_reference(&irb->mt, mt);
intel_renderbuffer_set_draw_offset(irb);
- if (
mt->hiz_mt == NULL && brw_is_hiz_depth_format(brw, rb->Forma
t)) {
+ if (
intel_miptree_wants_hiz_buffer(brw, m
t)) {
intel_miptree_alloc_hiz(brw, mt);
intel_miptree_alloc_hiz(brw, mt);
- if (!mt->hiz_
mt
)
+ if (!mt->hiz_
buf
)
return false;
}
return false;
}
@@
-660,9
+647,9
@@
intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
struct intel_renderbuffer *stencilRb =
intel_get_renderbuffer(fb, BUFFER_STENCIL);
struct intel_mipmap_tree *depth_mt = NULL, *stencil_mt = NULL;
struct intel_renderbuffer *stencilRb =
intel_get_renderbuffer(fb, BUFFER_STENCIL);
struct intel_mipmap_tree *depth_mt = NULL, *stencil_mt = NULL;
-
int
i;
+
unsigned
i;
- DBG("%s() on fb %p (%s)\n", __
FUNCTION
__,
+ DBG("%s() on fb %p (%s)\n", __
func
__,
fb, (fb == ctx->DrawBuffer ? "drawbuffer" :
(fb == ctx->ReadBuffer ? "readbuffer" : "other buffer")));
fb, (fb == ctx->DrawBuffer ? "drawbuffer" :
(fb == ctx->ReadBuffer ? "readbuffer" : "other buffer")));
@@
-785,7
+772,7
@@
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
GLint dstX1, GLint dstY1,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
GLint dstX1, GLint dstY1,
- GLbitfield mask
, GLenum filter
)
+ GLbitfield mask)
{
struct brw_context *brw = brw_context(ctx);
{
struct brw_context *brw = brw_context(ctx);
@@
-795,7
+782,7
@@
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
intel_prepare_render(brw);
if (mask & GL_COLOR_BUFFER_BIT) {
intel_prepare_render(brw);
if (mask & GL_COLOR_BUFFER_BIT) {
-
GLint
i;
+
unsigned
i;
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
@@
-905,7
+892,7
@@
intel_blit_framebuffer(struct gl_context *ctx,
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
- mask
, filter
);
+ mask);
if (mask == 0x0)
return;
if (mask == 0x0)
return;
@@
-943,7
+930,7
@@
gen4_blit_framebuffer(struct gl_context *ctx,
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
- mask
, filter
);
+ mask);
if (mask == 0x0)
return;
if (mask == 0x0)
return;
@@
-1020,19
+1007,20
@@
intel_renderbuffer_move_to_temp(struct brw_context *brw,
struct intel_mipmap_tree *new_mt;
int width, height, depth;
struct intel_mipmap_tree *new_mt;
int width, height, depth;
- intel_miptree_get_dimensions_for_image(rb->TexImage, &width, &height, &depth);
+ uint32_t layout_flags = MIPTREE_LAYOUT_ACCELERATED_UPLOAD |
+ MIPTREE_LAYOUT_TILING_ANY;
+
+ intel_get_image_dims(rb->TexImage, &width, &height, &depth);
new_mt = intel_miptree_create(brw, rb->TexImage->TexObject->Target,
intel_image->base.Base.TexFormat,
intel_image->base.Base.Level,
intel_image->base.Base.Level,
width, height, depth,
new_mt = intel_miptree_create(brw, rb->TexImage->TexObject->Target,
intel_image->base.Base.TexFormat,
intel_image->base.Base.Level,
intel_image->base.Base.Level,
width, height, depth,
- true,
irb->mt->num_samples,
irb->mt->num_samples,
- INTEL_MIPTREE_TILING_ANY,
- false);
+ layout_flags);
- if (
brw_is_hiz_depth_format(brw, new_mt->forma
t)) {
+ if (
intel_miptree_wants_hiz_buffer(brw, new_m
t)) {
intel_miptree_alloc_hiz(brw, new_mt);
}
intel_miptree_alloc_hiz(brw, new_mt);
}
@@
-1077,7
+1065,7
@@
brw_render_cache_set_check_flush(struct brw_context *brw, drm_intel_bo *bo)
if (!_mesa_set_search(brw->render_cache, bo))
return;
if (!_mesa_set_search(brw->render_cache, bo))
return;
-
intel_batchbuffer
_emit_mi_flush(brw);
+
brw
_emit_mi_flush(brw);
}
/**
}
/**
@@
-1088,7
+1076,6
@@
void
intel_fbo_init(struct brw_context *brw)
{
struct dd_function_table *dd = &brw->ctx.Driver;
intel_fbo_init(struct brw_context *brw)
{
struct dd_function_table *dd = &brw->ctx.Driver;
- dd->NewFramebuffer = intel_new_framebuffer;
dd->NewRenderbuffer = intel_new_renderbuffer;
dd->MapRenderbuffer = intel_map_renderbuffer;
dd->UnmapRenderbuffer = intel_unmap_renderbuffer;
dd->NewRenderbuffer = intel_new_renderbuffer;
dd->MapRenderbuffer = intel_map_renderbuffer;
dd->UnmapRenderbuffer = intel_unmap_renderbuffer;