DRI_CONF_DESC(en, "Enable Hierarchical Z on gen6+")
DRI_CONF_OPT_END
- DRI_CONF_OPT_BEGIN_B(early_z, "false")
- DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).")
- DRI_CONF_OPT_END
-
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
DRI_CONF_FORCE_S3TC_ENABLE("false")
- DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST("false")
DRI_CONF_SECTION_END
DRI_CONF_END;
-const GLuint __driNConfigOptions = 14;
-
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_bufmgr.h"
#include "intel_tex.h"
#include "intel_regions.h"
-#ifndef I915
#include "brw_context.h"
-#endif
#include "i915_drm.h"
};
static void
-intelDRI2Flush(__DRIdrawable *drawable)
+intel_dri2_flush_with_flags(__DRIcontext *cPriv,
+ __DRIdrawable *dPriv,
+ unsigned flags,
+ enum __DRI2throttleReason reason)
{
- GET_CURRENT_CONTEXT(ctx);
- struct intel_context *intel = intel_context(ctx);
- if (intel == NULL)
+ struct brw_context *brw = cPriv->driverPrivate;
+
+ if (!brw)
return;
- intel_resolve_for_dri2_flush(intel, drawable);
- intel->need_throttle = true;
+ struct gl_context *ctx = &brw->ctx;
- if (intel->batch.used)
- intel_batchbuffer_flush(intel);
+ FLUSH_VERTICES(ctx, 0);
+
+ if (flags & __DRI2_FLUSH_DRAWABLE)
+ intel_resolve_for_dri2_flush(brw, dPriv);
+
+ if (reason == __DRI2_THROTTLE_SWAPBUFFER ||
+ reason == __DRI2_THROTTLE_FLUSHFRONT) {
+ brw->need_throttle = true;
+ }
+
+ intel_batchbuffer_flush(brw);
if (INTEL_DEBUG & DEBUG_AUB) {
aub_dump_bmp(ctx);
}
}
+/**
+ * Provides compatibility with loaders that only support the older (version
+ * 1-3) flush interface.
+ *
+ * That includes libGL up to Mesa 9.0, and the X Server at least up to 1.13.
+ */
+static void
+intel_dri2_flush(__DRIdrawable *drawable)
+{
+ intel_dri2_flush_with_flags(drawable->driContextPriv, drawable,
+ __DRI2_FLUSH_DRAWABLE,
+ __DRI2_THROTTLE_SWAPBUFFER);
+}
+
static const struct __DRI2flushExtensionRec intelFlushExtension = {
- .base = { __DRI2_FLUSH, 3 },
+ .base = { __DRI2_FLUSH, 4 },
- .flush = intelDRI2Flush,
+ .flush = intel_dri2_flush,
.invalidate = dri2InvalidateDrawable,
+ .flush_with_flags = intel_dri2_flush_with_flags,
};
static struct intel_image_format intel_image_formats[] = {
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } }
};
+static struct intel_image_format *
+intel_image_format_lookup(int fourcc)
+{
+ struct intel_image_format *f = NULL;
+
+ for (unsigned i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
+ if (intel_image_formats[i].fourcc == fourcc) {
+ f = &intel_image_formats[i];
+ break;
+ }
+ }
+
+ return f;
+}
+
static __DRIimage *
intel_allocate_image(int dri_format, void *loaderPrivate)
{
* Sets up a DRIImage structure to point to our shared image in a region
*/
static void
-intel_setup_image_from_mipmap_tree(struct intel_context *intel, __DRIimage *image,
+intel_setup_image_from_mipmap_tree(struct brw_context *brw, __DRIimage *image,
struct intel_mipmap_tree *mt, GLuint level,
GLuint zoffset)
{
unsigned int draw_x, draw_y;
uint32_t mask_x, mask_y;
- intel_miptree_make_shareable(intel, mt);
+ intel_miptree_make_shareable(brw, mt);
intel_miptree_check_level_layer(mt, level, zoffset);
int renderbuffer, void *loaderPrivate)
{
__DRIimage *image;
- struct intel_context *intel = context->driverPrivate;
+ struct brw_context *brw = context->driverPrivate;
+ struct gl_context *ctx = &brw->ctx;
struct gl_renderbuffer *rb;
struct intel_renderbuffer *irb;
- rb = _mesa_lookup_renderbuffer(&intel->ctx, renderbuffer);
+ rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
if (!rb) {
- _mesa_error(&intel->ctx,
- GL_INVALID_OPERATION, "glRenderbufferExternalMESA");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glRenderbufferExternalMESA");
return NULL;
}
irb = intel_renderbuffer(rb);
- intel_miptree_make_shareable(intel, irb->mt);
+ intel_miptree_make_shareable(brw, irb->mt);
image = calloc(1, sizeof *image);
if (image == NULL)
return NULL;
void *loaderPrivate)
{
__DRIimage *image;
- struct intel_context *intel = context->driverPrivate;
+ struct brw_context *brw = context->driverPrivate;
struct gl_texture_object *obj;
struct intel_texture_object *iobj;
GLuint face = 0;
- obj = _mesa_lookup_texture(&intel->ctx, texture);
+ obj = _mesa_lookup_texture(&brw->ctx, texture);
if (!obj || obj->Target != target) {
*error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
return NULL;
if (target == GL_TEXTURE_CUBE_MAP)
face = zoffset;
- _mesa_test_texobj_completeness(&intel->ctx, obj);
+ _mesa_test_texobj_completeness(&brw->ctx, obj);
iobj = intel_texture_object(obj);
if (!obj->_BaseComplete || (level > 0 && !obj->_MipmapComplete)) {
*error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
image->internal_format = obj->Image[face][level]->InternalFormat;
image->format = obj->Image[face][level]->TexFormat;
image->data = loaderPrivate;
- intel_setup_image_from_mipmap_tree(intel, image, iobj->mt, level, zoffset);
+ intel_setup_image_from_mipmap_tree(brw, image, iobj->mt, level, zoffset);
image->dri_format = intel_dri_format(image->format);
image->has_depthstencil = iobj->mt->stencil_mt? true : false;
if (image->dri_format == MESA_FORMAT_NONE) {
tiling = I915_TILING_NONE;
}
+ if (use & __DRI_IMAGE_USE_LINEAR)
+ tiling = I915_TILING_NONE;
+
image = intel_allocate_image(format, loaderPrivate);
if (image == NULL)
return NULL;
if (screen == NULL || names == NULL || num_names != 1)
return NULL;
- for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
- if (intel_image_formats[i].fourcc == fourcc) {
- f = &intel_image_formats[i];
- }
- }
-
+ f = intel_image_format_lookup(fourcc);
if (f == NULL)
return NULL;
void *loaderPrivate)
{
struct intel_screen *intelScreen = screen->driverPrivate;
- struct intel_image_format *f = NULL;
+ struct intel_image_format *f;
__DRIimage *image;
int i, index;
if (fds == NULL || num_fds != 1)
return NULL;
- for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
- if (intel_image_formats[i].fourcc == fourcc) {
- f = &intel_image_formats[i];
- }
- }
-
+ f = intel_image_format_lookup(fourcc);
if (f == NULL)
return NULL;
- image = intel_allocate_image(__DRI_IMAGE_FORMAT_NONE, loaderPrivate);
+ if (f->nplanes == 1)
+ image = intel_allocate_image(f->planes[0].dri_format, loaderPrivate);
+ else
+ image = intel_allocate_image(__DRI_IMAGE_FORMAT_NONE, loaderPrivate);
+
if (image == NULL)
return NULL;
image->strides[index] = strides[index];
}
+ intel_setup_image_from_dimensions(image);
+
return image;
}
+static __DRIimage *
+intel_create_image_from_dma_bufs(__DRIscreen *screen,
+ int width, int height, int fourcc,
+ int *fds, int num_fds,
+ int *strides, int *offsets,
+ enum __DRIYUVColorSpace yuv_color_space,
+ enum __DRISampleRange sample_range,
+ enum __DRIChromaSiting horizontal_siting,
+ enum __DRIChromaSiting vertical_siting,
+ unsigned *error,
+ void *loaderPrivate)
+{
+ __DRIimage *image;
+ struct intel_image_format *f = intel_image_format_lookup(fourcc);
+
+ /* For now only packed formats that have native sampling are supported. */
+ if (!f || f->nplanes != 1) {
+ *error = __DRI_IMAGE_ERROR_BAD_MATCH;
+ return NULL;
+ }
+
+ image = intel_create_image_from_fds(screen, width, height, fourcc, fds,
+ num_fds, strides, offsets,
+ loaderPrivate);
+
+ /*
+ * Invalid parameters and any inconsistencies between are assumed to be
+ * checked by the caller. Therefore besides unsupported formats one can fail
+ * only in allocation.
+ */
+ if (!image) {
+ *error = __DRI_IMAGE_ERROR_BAD_ALLOC;
+ return NULL;
+ }
+
+ image->dma_buf_imported = true;
+ image->yuv_color_space = yuv_color_space;
+ image->sample_range = sample_range;
+ image->horizontal_siting = horizontal_siting;
+ image->vertical_siting = vertical_siting;
+
+ *error = __DRI_IMAGE_ERROR_SUCCESS;
+ return image;
+}
static __DRIimage *
intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
}
static struct __DRIimageExtensionRec intelImageExtension = {
- .base = { __DRI_IMAGE, 7 },
+ .base = { __DRI_IMAGE, 8 },
.createImageFromName = intel_create_image_from_name,
.createImageFromRenderbuffer = intel_create_image_from_renderbuffer,
.createImageFromNames = intel_create_image_from_names,
.fromPlanar = intel_from_planar,
.createImageFromTexture = intel_create_image_from_texture,
- .createImageFromFds = intel_create_image_from_fds
+ .createImageFromFds = intel_create_image_from_fds,
+ .createImageFromDmaBufs = intel_create_image_from_dma_bufs
};
static const __DRIextension *intelScreenExtensions[] = {
_mesa_reference_framebuffer(&fb, NULL);
}
-/* There are probably better ways to do this, such as an
- * init-designated function to register chipids and createcontext
- * functions.
- */
-extern bool
-i830CreateContext(int api,
- const struct gl_config *mesaVis,
- __DRIcontext *driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- unsigned *error,
- void *sharedContextPrivate);
-
-extern bool
-i915CreateContext(int api,
- const struct gl_config *mesaVis,
- __DRIcontext *driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- unsigned *error,
- void *sharedContextPrivate);
-extern bool
-brwCreateContext(int api,
- const struct gl_config *mesaVis,
- __DRIcontext *driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
- unsigned *error,
- void *sharedContextPrivate);
-
static GLboolean
intelCreateContext(gl_api api,
const struct gl_config * mesaVis,
{
bool success = false;
-#ifdef I915
- __DRIscreen *sPriv = driContextPriv->driScreenPriv;
- struct intel_screen *intelScreen = sPriv->driverPrivate;
-
- if (IS_9XX(intelScreen->deviceID)) {
- success = i915CreateContext(api, mesaVis, driContextPriv,
- major_version, minor_version, error,
- sharedContextPrivate);
- } else {
- intelScreen->no_vbo = true;
- success = i830CreateContext(api, mesaVis, driContextPriv,
- major_version, minor_version, error,
- sharedContextPrivate);
- }
-#else
success = brwCreateContext(api, mesaVis,
driContextPriv,
major_version, minor_version, flags,
error, sharedContextPrivate);
-#endif
if (success)
return true;
screen->max_gl_es1_version = 11;
screen->max_gl_es2_version = 20;
break;
- case 3: {
- screen->max_gl_core_version = 0;
- screen->max_gl_es1_version = 11;
- screen->max_gl_compat_version = 21;
- screen->max_gl_es2_version = 20;
-
- break;
- }
- case 2:
- screen->max_gl_core_version = 0;
- screen->max_gl_compat_version = 13;
- screen->max_gl_es1_version = 11;
- screen->max_gl_es2_version = 0;
- break;
default:
assert(!"unrecognized intel_screen::gen");
break;
return false;
}
/* parse information in __driConfigOptions */
- driParseOptionInfo(&intelScreen->optionCache,
- __driConfigOptions, __driNConfigOptions);
+ driParseOptionInfo(&intelScreen->optionCache, __driConfigOptions);
intelScreen->driScrnPriv = psp;
psp->driverPrivate = (void *) intelScreen;
intelScreen->gen = 6;
} else if (IS_GEN5(intelScreen->deviceID)) {
intelScreen->gen = 5;
- } else if (IS_965(intelScreen->deviceID)) {
- intelScreen->gen = 4;
- } else if (IS_9XX(intelScreen->deviceID)) {
- intelScreen->gen = 3;
} else {
- intelScreen->gen = 2;
+ intelScreen->gen = 4;
}
intelScreen->hw_has_separate_stencil = intelScreen->gen >= 6;