[Mesa-dev] [PATCH 3/7] intel: implement createImageFromName2().
Gwenole Beauchesne
gb.devel at gmail.com
Tue Apr 24 08:30:35 PDT 2012
Add basic implementation for createImageFromName2() as the default
entry-point. i.e. wrap the older createImageFromName() into the new
function.
---
src/mesa/drivers/dri/intel/intel_screen.c | 38 ++++++++++++++++++++++------
1 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 7f9d037..d0bf4f5 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -176,11 +176,13 @@ static const struct __DRI2flushExtensionRec intelFlushExtension = {
};
static __DRIimage *
-intel_create_image_from_name(__DRIscreen *screen,
- int width, int height, int format,
- int name, int pitch, void *loaderPrivate)
+intel_create_image_from_name2(__DRIscreen *screen,
+ int name, unsigned int offset,
+ const __DRIimageAttrs *attrs,
+ void *loaderPrivate)
{
struct intel_screen *intelScreen = screen->driverPrivate;
+ struct intel_region_attributes region_attrs;
__DRIimage *image;
int cpp;
@@ -188,7 +190,7 @@ intel_create_image_from_name(__DRIscreen *screen,
if (image == NULL)
return NULL;
- switch (format) {
+ switch (attrs->format) {
case __DRI_IMAGE_FORMAT_RGB565:
image->format = MESA_FORMAT_RGB565;
image->internal_format = GL_RGB;
@@ -217,9 +219,12 @@ intel_create_image_from_name(__DRIscreen *screen,
image->data = loaderPrivate;
cpp = _mesa_get_format_bytes(image->format);
- image->region = intel_region_alloc_for_handle(intelScreen,
- cpp, width, height,
- pitch, name, "image");
+ region_attrs.cpp = cpp;
+ region_attrs.width = attrs->width;
+ region_attrs.height = attrs->height;
+ region_attrs.pitch = attrs->pitch;
+ image->region = intel_region_alloc_for_handle2(intelScreen, name, "image",
+ ®ion_attrs);
if (image->region == NULL) {
FREE(image);
return NULL;
@@ -229,6 +234,22 @@ intel_create_image_from_name(__DRIscreen *screen,
}
static __DRIimage *
+intel_create_image_from_name(__DRIscreen *screen,
+ int width, int height, int format,
+ int name, int pitch, void *loaderPrivate)
+{
+ __DRIimageAttrs attrs;
+
+ attrs.plane_id = 0;
+ attrs.format = format;
+ attrs.width = width;
+ attrs.height = height;
+ attrs.pitch = pitch;
+ attrs.structure = __DRI_IMAGE_STRUCTURE_FRAME;
+ return intel_create_image_from_name2(screen, name, 0, &attrs, loaderPrivate);
+}
+
+static __DRIimage *
intel_create_image_from_renderbuffer(__DRIcontext *context,
int renderbuffer, void *loaderPrivate)
{
@@ -390,7 +411,8 @@ static struct __DRIimageExtensionRec intelImageExtension = {
intel_create_image,
intel_query_image,
intel_dup_image,
- intel_validate_usage
+ intel_validate_usage,
+ intel_create_image_from_name2
};
static const __DRIextension *intelScreenExtensions[] = {
--
1.7.5.4
More information about the mesa-dev
mailing list