diff options
Diffstat (limited to 'src/mesa/drivers/dri/intel')
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 6 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_chipset.h | 4 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.c | 5 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 14 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_extensions.c | 4 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 18 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 3 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_regions.c | 67 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_regions.h | 7 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 73 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.h | 2 |
11 files changed, 151 insertions, 52 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 8ab41f8d27..117d4daf3b 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -202,6 +202,9 @@ intel_bufferobj_subdata(GLcontext * ctx, struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); + if (size == 0) + return; + assert(intel_obj); if (intel_obj->region) @@ -426,6 +429,9 @@ intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target, if (intel_obj->range_map_buffer == NULL) return; + if (length == 0) + return; + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "range map flush", length, 64); drm_intel_bo_subdata(temp_bo, 0, length, intel_obj->range_map_buffer); diff --git a/src/mesa/drivers/dri/intel/intel_chipset.h b/src/mesa/drivers/dri/intel/intel_chipset.h index 72a74322ee..b5f180bbc8 100644 --- a/src/mesa/drivers/dri/intel/intel_chipset.h +++ b/src/mesa/drivers/dri/intel/intel_chipset.h @@ -73,6 +73,7 @@ #define PCI_CHIP_SANDYBRIDGE 0x0102 #define PCI_CHIP_SANDYBRIDGE_M 0x0106 +#define PCI_CHIP_SANDYBRIDGE_M_D0 0x0126 #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -119,7 +120,8 @@ #define IS_IRONLAKE(devid) IS_GEN5(devid) #define IS_GEN6(devid) (devid == PCI_CHIP_SANDYBRIDGE || \ - devid == PCI_CHIP_SANDYBRIDGE_M) + devid == PCI_CHIP_SANDYBRIDGE_M || \ + devid == PCI_CHIP_SANDYBRIDGE_M_D0) #define IS_965(devid) (IS_GEN4(devid) || \ IS_G4X(devid) || \ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index e19f44035f..a9ba93d24b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -377,7 +377,8 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) intel_region_reference(®ion, depth_region); } else - region = intel_region_alloc_for_handle(intel, buffers[i].cpp, + region = intel_region_alloc_for_handle(intel->intelScreen, + buffers[i].cpp, drawable->w, drawable->h, buffers[i].pitch / buffers[i].cpp, @@ -720,6 +721,8 @@ intelInitContext(struct intel_context *intel, ctx->Const.MaxPointSizeAA = 3.0; ctx->Const.PointSizeGranularity = 1.0; + ctx->Const.MaxSamples = 1.0; + /* reinitialize the context point state. * It depend on constants in __GLcontextRec::Const */ diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index c7ac2de01e..28d53284fd 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -32,14 +32,26 @@ #include "main/mtypes.h" #include "main/mm.h" -#include "texmem.h" #include "dri_metaops.h" + +#ifdef __cplusplus +extern "C" { + /* Evil hack for using libdrm in a c++ compiler. */ + #define virtual virt +#endif + #include "drm.h" #include "intel_bufmgr.h" #include "intel_screen.h" #include "intel_tex_obj.h" #include "i915_drm.h" + +#ifdef __cplusplus + #undef virtual +} +#endif + #include "tnl/t_vertex.h" #define TAG(x) intel##x diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index edba1fc2f2..bf22a423fc 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -50,8 +50,9 @@ #define need_GL_EXT_cull_vertex #define need_GL_EXT_draw_buffers2 #define need_GL_EXT_fog_coord -#define need_GL_EXT_framebuffer_object #define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_framebuffer_multisample +#define need_GL_EXT_framebuffer_object #define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_point_parameters #define need_GL_EXT_provoking_vertex @@ -111,6 +112,7 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_packed_depth_stencil", NULL }, diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 4a83886fc1..2693b5fa72 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -137,27 +137,21 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Format = MESA_FORMAT_A8; rb->DataType = GL_UNSIGNED_BYTE; break; + case GL_DEPTH_COMPONENT16: + rb->Format = MESA_FORMAT_Z16; + rb->DataType = GL_UNSIGNED_SHORT; + break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: - /* alloc a depth+stencil buffer */ - rb->Format = MESA_FORMAT_S8_Z24; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - break; - case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; - rb->DataType = GL_UNSIGNED_SHORT; - break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_S8_Z24; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: + /* alloc a depth+stencil buffer */ rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; break; @@ -182,7 +176,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* alloc hardware renderbuffer */ DBG("Allocating %d x %d Intel RBO\n", width, height); - irb->region = intel_region_alloc(intel, I915_TILING_NONE, cpp, + irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp, width, height, GL_TRUE); if (!irb->region) return GL_FALSE; /* out of memory? */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 39ac0205fa..d316d34d69 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -30,6 +30,7 @@ #include "intel_regions.h" #include "intel_tex_layout.h" #include "main/enums.h" +#include "main/formats.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE @@ -136,7 +137,7 @@ intel_miptree_create(struct intel_context *intel, return NULL; } - mt->region = intel_region_alloc(intel, + mt->region = intel_region_alloc(intel->intelScreen, tiling, mt->cpp, mt->total_width, diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 680d18ba29..e87e29462c 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -142,10 +142,10 @@ intel_region_unmap(struct intel_context *intel, struct intel_region *region) } static struct intel_region * -intel_region_alloc_internal(struct intel_context *intel, +intel_region_alloc_internal(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, - drm_intel_bo *buffer) + uint32_t tiling, drm_intel_bo *buffer) { struct intel_region *region; @@ -164,44 +164,52 @@ intel_region_alloc_internal(struct intel_context *intel, region->pitch = pitch; region->refcount = 1; region->buffer = buffer; - - /* Default to no tiling */ - region->tiling = I915_TILING_NONE; + region->tiling = tiling; + region->screen = screen; _DBG("%s <-- %p\n", __FUNCTION__, region); return region; } struct intel_region * -intel_region_alloc(struct intel_context *intel, +intel_region_alloc(struct intel_screen *screen, uint32_t tiling, GLuint cpp, GLuint width, GLuint height, GLboolean expect_accelerated_upload) { drm_intel_bo *buffer; - struct intel_region *region; unsigned long flags = 0; unsigned long aligned_pitch; if (expect_accelerated_upload) flags |= BO_ALLOC_FOR_RENDER; - buffer = drm_intel_bo_alloc_tiled(intel->bufmgr, "region", + buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region", width, height, cpp, &tiling, &aligned_pitch, flags); - region = intel_region_alloc_internal(intel, cpp, width, height, - aligned_pitch / cpp, buffer); - if (region == NULL) - return region; + return intel_region_alloc_internal(screen, cpp, width, height, + aligned_pitch / cpp, tiling, buffer); +} - region->tiling = tiling; +GLboolean +intel_region_flink(struct intel_region *region, uint32_t *name) +{ + if (region->name == 0) { + if (drm_intel_bo_flink(region->buffer, ®ion->name)) + return GL_FALSE; + + _mesa_HashInsert(region->screen->named_regions, + region->name, region); + } - return region; + *name = region->name; + + return GL_TRUE; } struct intel_region * -intel_region_alloc_for_handle(struct intel_context *intel, +intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, GLuint handle, const char *name) @@ -209,9 +217,9 @@ intel_region_alloc_for_handle(struct intel_context *intel, struct intel_region *region, *dummy; drm_intel_bo *buffer; int ret; - uint32_t bit_6_swizzle; + uint32_t bit_6_swizzle, tiling; - region = _mesa_HashLookup(intel->intelScreen->named_regions, handle); + region = _mesa_HashLookup(screen->named_regions, handle); if (region != NULL) { dummy = NULL; if (region->width != width || region->height != height || @@ -225,25 +233,26 @@ intel_region_alloc_for_handle(struct intel_context *intel, return dummy; } - buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle); - - region = intel_region_alloc_internal(intel, cpp, - width, height, pitch, buffer); - if (region == NULL) - return region; - - ret = drm_intel_bo_get_tiling(region->buffer, ®ion->tiling, - &bit_6_swizzle); + buffer = intel_bo_gem_create_from_name(screen->bufmgr, name, handle); + if (buffer == NULL) + return NULL; + ret = drm_intel_bo_get_tiling(buffer, &tiling, &bit_6_swizzle); if (ret != 0) { fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n", handle, name, strerror(-ret)); - intel_region_release(®ion); + drm_intel_bo_unreference(buffer); + return NULL; + } + + region = intel_region_alloc_internal(screen, cpp, + width, height, pitch, tiling, buffer); + if (region == NULL) { + drm_intel_bo_unreference(buffer); return NULL; } region->name = handle; - region->screen = intel->intelScreen; - _mesa_HashInsert(intel->intelScreen->named_regions, handle, region); + _mesa_HashInsert(screen->named_regions, handle, region); return region; } diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 6bbed32f2a..8464a5e937 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -76,18 +76,21 @@ struct intel_region /* Allocate a refcounted region. Pointers to regions should only be * copied by calling intel_reference_region(). */ -struct intel_region *intel_region_alloc(struct intel_context *intel, +struct intel_region *intel_region_alloc(struct intel_screen *screen, uint32_t tiling, GLuint cpp, GLuint width, GLuint height, GLboolean expect_accelerated_upload); struct intel_region * -intel_region_alloc_for_handle(struct intel_context *intel, +intel_region_alloc_for_handle(struct intel_screen *screen, GLuint cpp, GLuint width, GLuint height, GLuint pitch, unsigned int handle, const char *name); +GLboolean +intel_region_flink(struct intel_region *region, uint32_t *name); + void intel_region_reference(struct intel_region **dst, struct intel_region *src); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 15a465c640..0a542a7303 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -70,7 +70,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") DRI_CONF_OPT_END - DRI_CONF_OPT_BEGIN(fragment_shader, bool, false) + DRI_CONF_OPT_BEGIN(fragment_shader, bool, true) DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.") DRI_CONF_OPT_END @@ -159,7 +159,8 @@ intel_create_image_from_name(__DRIcontext *context, image->data = loaderPrivate; cpp = _mesa_get_format_bytes(image->format); - image->region = intel_region_alloc_for_handle(intel, cpp, width, height, + image->region = intel_region_alloc_for_handle(intel->intelScreen, + cpp, width, height, pitch, name, "image"); if (image->region == NULL) { FREE(image); @@ -206,11 +207,79 @@ intel_destroy_image(__DRIimage *image) FREE(image); } +static __DRIimage * +intel_create_image(__DRIscreen *screen, + int width, int height, int format, + unsigned int use, + void *loaderPrivate) +{ + __DRIimage *image; + struct intel_screen *intelScreen = screen->private; + int cpp; + + image = CALLOC(sizeof *image); + if (image == NULL) + return NULL; + + switch (format) { + case __DRI_IMAGE_FORMAT_RGB565: + image->format = MESA_FORMAT_RGB565; + image->internal_format = GL_RGB; + image->data_type = GL_UNSIGNED_BYTE; + break; + case __DRI_IMAGE_FORMAT_XRGB8888: + image->format = MESA_FORMAT_XRGB8888; + image->internal_format = GL_RGB; + image->data_type = GL_UNSIGNED_BYTE; + break; + case __DRI_IMAGE_FORMAT_ARGB8888: + image->format = MESA_FORMAT_ARGB8888; + image->internal_format = GL_RGBA; + image->data_type = GL_UNSIGNED_BYTE; + break; + default: + free(image); + return NULL; + } + + image->data = loaderPrivate; + cpp = _mesa_get_format_bytes(image->format); + + image->region = + intel_region_alloc(intelScreen, I915_TILING_NONE, + cpp, width, height, GL_TRUE); + if (image->region == NULL) { + FREE(image); + return NULL; + } + + return image; +} + +static GLboolean +intel_query_image(__DRIimage *image, int attrib, int *value) +{ + switch (attrib) { + case __DRI_IMAGE_ATTRIB_STRIDE: + *value = image->region->pitch * image->region->cpp; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_HANDLE: + *value = image->region->buffer->handle; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_NAME: + return intel_region_flink(image->region, (uint32_t *) value); + default: + return GL_FALSE; + } +} + static struct __DRIimageExtensionRec intelImageExtension = { { __DRI_IMAGE, __DRI_IMAGE_VERSION }, intel_create_image_from_name, intel_create_image_from_renderbuffer, intel_destroy_image, + intel_create_image, + intel_query_image }; static const __DRIextension *intelScreenExtensions[] = { diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 4bb012dc65..cd77dd5b8e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -31,8 +31,6 @@ #include "main/mtypes.h" #include "main/formats.h" #include "intel_context.h" -#include "texmem.h" - void intelInitTextureFuncs(struct dd_function_table *functions); |
