It seems to me that the resource management code is the most blurry.
Also some of my notes about fastfill are wrong, removing them too.
* 2) ZB_DEPTHCLEARVALUE is used to clear a zbuffer and Z Mask must be
* equal to 0.
*
- * 3) RB3D_COLOR_CLEAR_VALUE is used to clear a colorbuffer and
- * RB3D_COLOR_CHANNEL_MASK must be equal to 0.
- *
- * 4) ZB_CB_CLEAR can be used to make the ZB units help in clearing
- * the colorbuffer. The color clear value is supplied through both
- * RB3D_COLOR_CLEAR_VALUE and ZB_DEPTHCLEARVALUE, and the colorbuffer
- * must be set in ZB_DEPTHOFFSET and ZB_DEPTHPITCH in addition to
- * RB3D_COLOROFFSET and RB3D_COLORPITCH. It's obvious that the zbuffer
- * will not be cleared and multiple render targets cannot be cleared
- * this way either.
- *
- * 5) For 16-bit integer buffering, compression causes a hung with one or
+ * 3) For 16-bit integer buffering, compression causes a hung with one or
* two samples and should not be used.
*
- * 6) Fastfill must not be used if reading of compressed Z data is disabled
+ * 4) Fastfill must not be used if reading of compressed Z data is disabled
* and writing of compressed Z data is enabled (RD/WR_COMP_ENABLE),
* i.e. it cannot be used to compress the zbuffer.
* (what the hell does that mean and how does it fit in clearing
FREE(r300);
}
-
static void r300_flush_cb(void *data)
{
struct r300_context* const cs_context_copy = data;
#define R300_RESOURCE_FLAG_TRANSFER PIPE_RESOURCE_FLAG_DRV_PRIV
+/* XXX: this is just a bandaid on larger problems in
+ * r300_screen_buffer.h which doesn't seem to be fully ported to
+ * gallium-resources.
+ */
+#define R300_BIND_OQBO (1<<21)
+
/* Tiling flags. */
enum r300_buffer_tiling {
R300_BUFFER_LINEAR = 0,
}
}
-
void r300_init_flush_functions(struct r300_context* r300)
{
r300->context.flush = r300_flush;
/* XXX The DRM rejects VAP_ALT_NUM_VERTICES.. */
//#define ENABLE_ALT_NUM_VERTS
-uint32_t r300_translate_primitive(unsigned prim)
+static uint32_t r300_translate_primitive(unsigned prim)
{
switch (prim) {
case PIPE_PRIM_POINTS:
#ifndef R300_RENDER_H
#define R300_RENDER_H
-uint32_t r300_translate_primitive(unsigned prim);
-
void r500_emit_draw_arrays_immediate(struct r300_context *r300,
unsigned mode,
unsigned start,
return r300_texture_from_handle(screen, templ, whandle);
}
-
-
-void
-r300_init_resource_functions(struct r300_context *r300)
+void r300_init_resource_functions(struct r300_context *r300)
{
r300->context.get_transfer = u_get_transfer_vtbl;
r300->context.transfer_map = u_transfer_map_vtbl;
r300->context.is_resource_referenced = u_is_resource_referenced_vtbl;
}
-void
-r300_init_screen_resource_functions(struct r300_screen *r300screen)
+void r300_init_screen_resource_functions(struct r300_screen *r300screen)
{
r300screen->screen.resource_create = r300_resource_create;
r300screen->screen.resource_from_handle = r300_resource_from_handle;
void r300_init_screen_resource_functions(struct r300_screen *r300screen);
#endif /* R300_SCREEN_H */
-
*
* Authors: Dave Airlie
*/
+
#include <stdio.h>
#include "util/u_inlines.h"
#include "util/u_math.h"
#include "r300_screen_buffer.h"
-
#include "r300_winsys.h"
static unsigned r300_buffer_is_referenced(struct pipe_context *context,
return ret;
}
-/* External helper, not required to implent u_resource_vtbl:
+/* External helper, not required to implement u_resource_vtbl:
*/
int r300_upload_user_buffers(struct r300_context *r300)
{
nr = r300->vertex_buffer_count;
for (i = 0; i < nr; i++) {
-
if (r300_buffer_is_user_buffer(r300->vertex_buffer[i].buffer)) {
struct pipe_resource *upload_buffer = NULL;
unsigned offset = 0; /*r300->vertex_buffer[i].buffer_offset * 4;*/
}
}
-
static void r300_buffer_destroy(struct pipe_screen *screen,
struct pipe_resource *buf)
{
u_default_transfer_inline_write /* transfer_inline_write */
};
-
-
-
struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
rbuf->b.b.screen = screen;
if (rbuf->b.b.bind & R300_BIND_OQBO)
- alignment = 4096;
+ alignment = 4096;
rbuf->buf = r300_winsys_buffer_create(r300screen,
alignment,
return NULL;
}
-
struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
void *ptr,
unsigned bytes,
no_rbuf:
return NULL;
}
-
+/*
+ * Copyright 2010 Red Hat Inc.
+ *
+ * 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
+ * on 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
+ * THE AUTHOR(S) AND/OR THEIR 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.
+ *
+ * Authors: Dave Airlie
+ */
+
#ifndef R300_SCREEN_BUFFER_H
#define R300_SCREEN_BUFFER_H
+
#include <stdio.h>
#include "pipe/p_compiler.h"
#include "pipe/p_state.h"
#include "util/u_transfer.h"
-#include "r300_screen.h"
+#include "r300_screen.h"
#include "r300_winsys.h"
#include "r300_context.h"
#define R300_BUFFER_MAGIC 0xabcd1234
+#define R300_BUFFER_MAX_RANGES 32
struct r300_buffer_range {
uint32_t start;
uint32_t end;
};
-#define R300_BUFFER_MAX_RANGES 32
+/* Vertex buffer. */
struct r300_buffer
{
struct u_resource b;
void *map;
};
-static INLINE struct r300_buffer *
-r300_buffer(struct pipe_resource *buffer)
+/* Functions. */
+
+int r300_upload_user_buffers(struct r300_context *r300);
+
+int r300_upload_index_buffer(struct r300_context *r300,
+ struct pipe_resource **index_buffer,
+ unsigned index_size,
+ unsigned start,
+ unsigned count);
+
+struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
+ const struct pipe_resource *templ);
+
+struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes,
+ unsigned usage);
+
+/* Inline functions. */
+
+static INLINE struct r300_buffer *r300_buffer(struct pipe_resource *buffer)
{
if (buffer) {
assert(((struct r300_buffer *)buffer)->magic == R300_BUFFER_MAGIC);
return NULL;
}
-static INLINE boolean
-r300_buffer_is_user_buffer(struct pipe_resource *buffer)
+static INLINE boolean r300_buffer_is_user_buffer(struct pipe_resource *buffer)
{
return r300_buffer(buffer)->user_buffer ? true : false;
}
return rws->add_buffer(rws, buf->buf, rd, wr);
}
-
static INLINE boolean r300_add_texture(struct r300_winsys_screen *rws,
struct r300_texture *tex,
int rd, int wr)
return rws->add_buffer(rws, tex->buffer, rd, wr);
}
-
static INLINE void r300_buffer_write_reloc(struct r300_winsys_screen *rws,
struct r300_buffer *buf,
uint32_t rd, uint32_t wd, uint32_t flags)
rws->write_cs_reloc(rws, texture->buffer, rd, wd, flags);
}
-int r300_upload_user_buffers(struct r300_context *r300);
-
-int r300_upload_index_buffer(struct r300_context *r300,
- struct pipe_resource **index_buffer,
- unsigned index_size,
- unsigned start,
- unsigned count);
-
-
-struct pipe_resource *r300_buffer_create(struct pipe_screen *screen,
- const struct pipe_resource *templ);
-
-struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
- void *ptr,
- unsigned bytes,
- unsigned usage);
-
#endif
FREE(tex);
}
-
-
-
-static boolean
- r300_texture_get_handle(struct pipe_screen* screen,
- struct pipe_resource *texture,
- struct winsys_handle *whandle)
+static boolean r300_texture_get_handle(struct pipe_screen* screen,
+ struct pipe_resource *texture,
+ struct winsys_handle *whandle)
{
struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
struct r300_texture* tex = (struct r300_texture*)texture;
return TRUE;
}
-
-
struct u_resource_vtbl r300_texture_vtbl =
{
r300_texture_get_handle, /* get_handle */
u_default_transfer_inline_write /* transfer_inline_write */
};
-
-
/* Create a new texture. */
struct pipe_resource* r300_texture_create(struct pipe_screen* screen,
const struct pipe_resource* base)
return (struct pipe_resource*)tex;
}
-
-
/* Not required to implement u_resource_vtbl, consider moving to another file:
*/
struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
}
return (struct pipe_resource*)tex;
}
-
#include "r300_defines.h"
-struct r300_winsys_screen;
-
-/* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws);
-
struct r300_winsys_buffer;
-/* XXX: this is just a bandaid on larger problems in
- * r300_screen_buffer.h which doesn't seem to be fully ported to
- * gallium-resources.
- */
-#define R300_BIND_OQBO (1<<21)
-
-
enum r300_value_id {
R300_VID_PCI_ID,
R300_VID_GB_PIPES,
struct r300_winsys_screen *
r300_winsys_screen(struct pipe_screen *screen);
+/* Creates a new r300 screen. */
+struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws);
+
#endif /* R300_WINSYS_H */