/* XXX: check relocs.
*/
- if (intel_batchbuffer_space( intel->batch ) < dwords * 4) {
+ if (intel_batchbuffer_space( intel->batch ) >= dwords * 4) {
/* XXX: Hmm, the driver can't really do much with this pointer:
*/
//return intel->batch->ptr;
unsigned delta )
{
struct intel_context *intel = intel_i915_winsys(sws)->intel;
- unsigned flags = 0;
- unsigned mask = 0;
+ unsigned flags = DRM_BO_FLAG_MEM_TT;
+ unsigned mask = DRM_BO_MASK_MEM;
+
+ if (access_flags & I915_BUFFER_ACCESS_WRITE) {
+ flags |= DRM_BO_FLAG_WRITE;
+ mask |= DRM_BO_FLAG_WRITE;
+ }
+
+ if (access_flags & I915_BUFFER_ACCESS_READ) {
+ flags |= DRM_BO_FLAG_READ;
+ mask |= DRM_BO_FLAG_READ;
+ }
intel_batchbuffer_emit_reloc( intel->batch,
dri_bo( buf ),
{
struct i915_context *i915 = i915_context( pipe );
-// if (i915->dirty)
-// i915_update_derived( i915 );
+ if (i915->dirty)
+ i915_update_derived( i915 );
draw_vb( i915->draw, VB );
}
#include "i915_winsys.h"
#include "i915_reg.h"
#include "i915_state.h"
+#include "i915_batch.h"
/* Hardcoded vertex format: xyz/rgba
*/
static inline void
-emit_hw_vertex( unsigned *ptr,
+emit_hw_vertex( struct i915_context *i915,
struct vertex_header *vertex )
{
- ptr[0] = fui( vertex->data[0][0] );
- ptr[1] = fui( vertex->data[0][1] );
- ptr[2] = fui( vertex->data[0][2] );
-
- ptr[3] = pack_ub4( float_to_ubyte( vertex->data[1][0] ),
- float_to_ubyte( vertex->data[1][1] ),
- float_to_ubyte( vertex->data[1][2] ),
- float_to_ubyte( vertex->data[1][3] ) );
+ OUT_BATCH( fui(vertex->data[0][0]) );
+ OUT_BATCH( fui(vertex->data[0][1]) );
+ OUT_BATCH( fui(vertex->data[0][2]) );
+
+ OUT_BATCH( pack_ub4(float_to_ubyte( vertex->data[1][0] ),
+ float_to_ubyte( vertex->data[1][1] ),
+ float_to_ubyte( vertex->data[1][2] ),
+ float_to_ubyte( vertex->data[1][3] )) );
}
/* Emit each triangle as a single primitive. I told you this was
* simple.
*/
- *ptr++ = (_3DPRIMITIVE |
+ OUT_BATCH(_3DPRIMITIVE |
hwprim |
((4 + vertex_size * nr)/4 - 2));
for (i = 0; i < nr; i++) {
- emit_hw_vertex(ptr, prim->v[i]);
+ emit_hw_vertex(i915, prim->v[i]);
ptr += vertex_size / sizeof(int);
}
}
static void calculate_vertex_layout( struct i915_context *i915 )
{
// const GLbitfield inputsRead = i915->fs.inputs_read;
- const GLbitfield inputsRead = (FRAG_ATTRIB_WPOS | FRAG_ATTRIB_COL0);
+ const GLbitfield inputsRead = (FRAG_BIT_WPOS | FRAG_BIT_COL0);
GLuint slot_to_vf_attr[VF_ATTRIB_MAX];
GLbitfield attr_mask = 0x0;
GLuint nr_attrs = 0;
static unsigned translate_format( unsigned format )
{
switch (format) {
- case PIPE_FORMAT_U_R8_G8_B8_A8:
+ case PIPE_FORMAT_U_A8_R8_G8_B8:
return COLOR_BUF_ARGB8888;
case PIPE_FORMAT_U_R5_G6_B5:
return COLOR_BUF_RGB565;
{
- unsigned cformat = i915->framebuffer.cbufs[0]->format;
- unsigned zformat = i915->framebuffer.zbuf->format;
+ unsigned cformat = translate_format( i915->framebuffer.cbufs[0]->format );
+ unsigned zformat = 0;
+
+ if (i915->framebuffer.zbuf)
+ zformat = translate_depth_format( i915->framebuffer.zbuf->format );
OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD);
DSTORG_VERT_BIAS(0x8) | /* .5 */
LOD_PRECLAMP_OGL |
TEX_DEFAULT_COLOR_OGL |
- translate_format( cformat ) |
- translate_depth_format( zformat ));
+ cformat |
+ zformat );
}
{