Commit 1ead5459 authored by Austin Yuan's avatar Austin Yuan
parents 7e62098a 2135de7e
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define CMD_STATE_BASE_ADDRESS CMD(0, 1, 1) #define CMD_STATE_BASE_ADDRESS CMD(0, 1, 1)
#define CMD_STATE_SIP CMD(0, 1, 2) #define CMD_STATE_SIP CMD(0, 1, 2)
#define CMD_PIPELINE_SELECT CMD(1, 1, 4) #define CMD_PIPELINE_SELECT CMD(1, 1, 4)
#define CMD_SAMPLER_PALETTE_LOAD CMD(3, 3, 2) #define CMD_SAMPLER_PALETTE_LOAD CMD(3, 1, 2)
#define CMD_MEDIA_STATE_POINTERS CMD(2, 0, 0) #define CMD_MEDIA_STATE_POINTERS CMD(2, 0, 0)
#define CMD_MEDIA_OBJECT CMD(2, 1, 0) #define CMD_MEDIA_OBJECT CMD(2, 1, 0)
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "i965_media.h" #include "i965_media.h"
#include "i965_drv_video.h" #include "i965_drv_video.h"
#include "i965_defines.h"
#define CONFIG_ID_OFFSET 0x01000000 #define CONFIG_ID_OFFSET 0x01000000
#define CONTEXT_ID_OFFSET 0x02000000 #define CONTEXT_ID_OFFSET 0x02000000
...@@ -47,6 +48,48 @@ ...@@ -47,6 +48,48 @@
#define IMAGE_ID_OFFSET 0x0a000000 #define IMAGE_ID_OFFSET 0x0a000000
#define SUBPIC_ID_OFFSET 0x10000000 #define SUBPIC_ID_OFFSET 0x10000000
enum {
I965_SURFACETYPE_RGBA = 1,
I965_SURFACETYPE_YUV,
I965_SURFACETYPE_INDEXED
};
/* List of supported subpicture formats */
typedef struct {
unsigned int type;
unsigned int format;
VAImageFormat va_format;
unsigned int va_flags;
} i965_subpic_format_map_t;
static const i965_subpic_format_map_t
i965_subpic_formats_map[I965_MAX_SUBPIC_FORMATS + 1] = {
{ I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_P4A4_UNORM,
{ VA_FOURCC('I','A','4','4'), VA_MSB_FIRST, 8, },
0 },
{ I965_SURFACETYPE_INDEXED, I965_SURFACEFORMAT_A4P4_UNORM,
{ VA_FOURCC('A','I','4','4'), VA_MSB_FIRST, 8, },
0 },
};
static const i965_subpic_format_map_t *
get_subpic_format(const VAImageFormat *va_format)
{
unsigned int i;
for (i = 0; i < sizeof(i965_subpic_formats_map)/sizeof(i965_subpic_formats_map[0]); i++) {
const i965_subpic_format_map_t * const m = &i965_subpic_formats_map[i];
if (m->va_format.fourcc == va_format->fourcc &&
(m->type == I965_SURFACETYPE_RGBA ?
(m->va_format.byte_order == va_format->byte_order &&
m->va_format.red_mask == va_format->red_mask &&
m->va_format.green_mask == va_format->green_mask &&
m->va_format.blue_mask == va_format->blue_mask &&
m->va_format.alpha_mask == va_format->alpha_mask) : 1))
return m;
}
return NULL;
}
VAStatus VAStatus
i965_QueryConfigProfiles(VADriverContextP ctx, i965_QueryConfigProfiles(VADriverContextP ctx,
VAProfile *profile_list, /* out */ VAProfile *profile_list, /* out */
...@@ -293,6 +336,7 @@ i965_CreateSurfaces(VADriverContextP ctx, ...@@ -293,6 +336,7 @@ i965_CreateSurfaces(VADriverContextP ctx,
surfaces[i] = surfaceID; surfaces[i] = surfaceID;
obj_surface->status = VASurfaceReady; obj_surface->status = VASurfaceReady;
obj_surface->subpic = VA_INVALID_ID;
obj_surface->width = width; obj_surface->width = width;
obj_surface->height = height; obj_surface->height = height;
obj_surface->size = SIZE_YUV420(width, height); obj_surface->size = SIZE_YUV420(width, height);
...@@ -346,6 +390,9 @@ i965_QueryImageFormats(VADriverContextP ctx, ...@@ -346,6 +390,9 @@ i965_QueryImageFormats(VADriverContextP ctx,
VAImageFormat *format_list, /* out */ VAImageFormat *format_list, /* out */
int *num_formats) /* out */ int *num_formats) /* out */
{ {
if (num_formats)
*num_formats = 0;
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -371,12 +418,19 @@ i965_QuerySubpictureFormats(VADriverContextP ctx, ...@@ -371,12 +418,19 @@ i965_QuerySubpictureFormats(VADriverContextP ctx,
unsigned int *flags, /* out */ unsigned int *flags, /* out */
unsigned int *num_formats) /* out */ unsigned int *num_formats) /* out */
{ {
/*support 2 subpicture formats*/ int n;
*num_formats = 2;
format_list[0].fourcc=FOURCC_IA44; for (n = 0; i965_subpic_formats_map[n].va_format.fourcc != 0; n++) {
format_list[0].byte_order=VA_LSB_FIRST; const i965_subpic_format_map_t * const m = &i965_subpic_formats_map[n];
format_list[1].fourcc=FOURCC_AI44; if (format_list)
format_list[1].byte_order=VA_LSB_FIRST; format_list[n] = m->va_format;
if (flags)
flags[n] = m->va_flags;
}
if (num_formats)
*num_formats = n;
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -394,25 +448,27 @@ i965_CreateSubpicture(VADriverContextP ctx, ...@@ -394,25 +448,27 @@ i965_CreateSubpicture(VADriverContextP ctx,
VASubpictureID *subpicture) /* out */ VASubpictureID *subpicture) /* out */
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
VAStatus vaStatus = VA_STATUS_SUCCESS;
VASubpictureID subpicID = NEW_SUBPIC_ID() VASubpictureID subpicID = NEW_SUBPIC_ID()
struct object_subpic *obj_subpic = SUBPIC(subpicID); struct object_subpic *obj_subpic = SUBPIC(subpicID);
if (!obj_subpic)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
struct object_image *obj_image = IMAGE(image); struct object_image *obj_image = IMAGE(image);
if (!obj_image)
return VA_STATUS_ERROR_INVALID_IMAGE;
const i965_subpic_format_map_t * const m = get_subpic_format(&obj_image->image.format);
if (!m)
return VA_STATUS_ERROR_UNKNOWN; /* XXX: VA_STATUS_ERROR_UNSUPPORTED_FORMAT? */
if (NULL == obj_subpic) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
}
if (NULL == obj_image) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
}
*subpicture = subpicID; *subpicture = subpicID;
obj_subpic->image = image; obj_subpic->image = image;
obj_subpic->width = obj_image->width; obj_subpic->format = m->format;
obj_subpic->height = obj_image->height; obj_subpic->width = obj_image->image.width;
obj_subpic->height = obj_image->image.height;
obj_subpic->bo = obj_image->bo; obj_subpic->bo = obj_image->bo;
return VA_STATUS_SUCCESS;
return vaStatus;
} }
VAStatus VAStatus
...@@ -434,27 +490,6 @@ i965_SetSubpictureImage(VADriverContextP ctx, ...@@ -434,27 +490,6 @@ i965_SetSubpictureImage(VADriverContextP ctx,
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VASubpicture struct
*/
VAStatus
i965_SetSubpicturePalette(VADriverContextP ctx,
VASubpictureID subpicture,
unsigned char *palette)
{
/*set palette in shader,so the following code is unused*/
struct i965_driver_data *i965 = i965_driver_data(ctx);
VAStatus vaStatus = VA_STATUS_SUCCESS;
struct object_subpic *obj_subpic = SUBPIC(subpicture);
if (NULL == obj_subpic) {
vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
}
memcpy(obj_subpic->palette, palette, 3*16);
return VA_STATUS_SUCCESS;
}
VAStatus VAStatus
i965_SetSubpictureChromakey(VADriverContextP ctx, i965_SetSubpictureChromakey(VADriverContextP ctx,
VASubpictureID subpicture, VASubpictureID subpicture,
...@@ -486,8 +521,6 @@ i965_AssociateSubpicture(VADriverContextP ctx, ...@@ -486,8 +521,6 @@ i965_AssociateSubpicture(VADriverContextP ctx,
short dest_y, short dest_y,
unsigned short dest_width, unsigned short dest_width,
unsigned short dest_height, unsigned short dest_height,
unsigned short width,
unsigned short height,
/* /*
* whether to enable chroma-keying or global-alpha * whether to enable chroma-keying or global-alpha
* see VA_SUBPICTURE_XXX values * see VA_SUBPICTURE_XXX values
...@@ -495,22 +528,24 @@ i965_AssociateSubpicture(VADriverContextP ctx, ...@@ -495,22 +528,24 @@ i965_AssociateSubpicture(VADriverContextP ctx,
unsigned int flags) unsigned int flags)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
VAStatus vaStatus = VA_STATUS_SUCCESS;
/*only ipicture*/
struct object_surface *obj_surface = SURFACE(*target_surfaces);
struct object_subpic *obj_subpic = SUBPIC(subpicture); struct object_subpic *obj_subpic = SUBPIC(subpicture);
int i;
if (NULL == obj_surface) { obj_subpic->src_rect.x = src_x;
vaStatus = VA_STATUS_ERROR_INVALID_CONFIG; obj_subpic->src_rect.y = src_y;
return vaStatus; obj_subpic->src_rect.width = src_width;
} obj_subpic->src_rect.height = src_height;
obj_subpic->dst_rect.x = dest_x;
obj_subpic->dstx = dest_x; obj_subpic->dst_rect.y = dest_y;
obj_subpic->dsty = dest_y; obj_subpic->dst_rect.width = dest_width;
obj_subpic->dst_rect.height = dest_height;
for (i = 0; i < num_surfaces; i++) {
struct object_surface *obj_surface = SURFACE(target_surfaces[i]);
if (!obj_surface)
return VA_STATUS_ERROR_INVALID_SURFACE;
obj_surface->subpic = subpicture; obj_surface->subpic = subpicture;
}
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -521,6 +556,16 @@ i965_DeassociateSubpicture(VADriverContextP ctx, ...@@ -521,6 +556,16 @@ i965_DeassociateSubpicture(VADriverContextP ctx,
VASurfaceID *target_surfaces, VASurfaceID *target_surfaces,
int num_surfaces) int num_surfaces)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx);
int i;
for (i = 0; i < num_surfaces; i++) {
struct object_surface *obj_surface = SURFACE(target_surfaces[i]);
if (!obj_surface)
return VA_STATUS_ERROR_INVALID_SURFACE;
if (obj_surface->subpic == subpicture)
obj_surface->subpic = VA_INVALID_ID;
}
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -1031,8 +1076,10 @@ i965_QueryDisplayAttributes(VADriverContextP ctx, ...@@ -1031,8 +1076,10 @@ i965_QueryDisplayAttributes(VADriverContextP ctx,
VADisplayAttribute *attr_list, /* out */ VADisplayAttribute *attr_list, /* out */
int *num_attributes) /* out */ int *num_attributes) /* out */
{ {
/* TODO */ if (num_attributes)
return VA_STATUS_ERROR_UNKNOWN; *num_attributes = 0;
return VA_STATUS_SUCCESS;
} }
/* /*
...@@ -1116,43 +1163,89 @@ i965_destroy_heap(struct object_heap *heap, ...@@ -1116,43 +1163,89 @@ i965_destroy_heap(struct object_heap *heap,
} }
VAStatus
i965_DestroyImage(VADriverContextP ctx, VAImageID image);
VAStatus VAStatus
i965_CreateImage(VADriverContextP ctx, i965_CreateImage(VADriverContextP ctx,
VAImageFormat *format, VAImageFormat *format,
int width, int width,
int height, int height,
VAImage *image) /* out */ VAImage *out_image) /* out */
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
VAStatus va_status; struct object_image *obj_image;
/*we will receive the actual subpicture size from the player,now we assume it is 720*32*/ VAStatus va_status = VA_STATUS_ERROR_OPERATION_FAILED;
char subpic_buf[width*height]; VAImageID image_id;
int subpic_size = 720*32; unsigned int width2, height2, size2, size;
unsigned int img_buf_id;
image->image_id = NEW_IMAGE_ID(); out_image->image_id = VA_INVALID_ID;
struct object_image *obj_image = IMAGE(image->image_id); out_image->buf = VA_INVALID_ID;
/*assume we got IA44 in format[0]*/ image_id = NEW_IMAGE_ID();
image->format = *format; if (image_id == VA_INVALID_ID)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
obj_image = IMAGE(image_id);
if (!obj_image)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
obj_image->bo = NULL;
obj_image->palette = NULL;
VAImage * const image = &obj_image->image;
image->image_id = image_id;
image->buf = VA_INVALID_ID;
size = width * height;
width2 = (width + 1) / 2;
height2 = (height + 1) / 2;
size2 = width2 * height2;
image->num_palette_entries = 0;
image->entry_bytes = 0;
memset(image->component_order, 0, sizeof(image->component_order));
switch (format->fourcc) {
case VA_FOURCC('I','A','4','4'):
case VA_FOURCC('A','I','4','4'):
image->num_planes = 1;
image->pitches[0] = width;
image->offsets[0] = 0;
image->data_size = image->offsets[0] + image->pitches[0] * height;
image->num_palette_entries = 16;
image->entry_bytes = 3;
image->component_order[0] = 'R';
image->component_order[1] = 'G';
image->component_order[2] = 'B';
break;
default:
goto error;
}
/*create empty buffer*/
va_status = i965_CreateBuffer(ctx, 0, VAImageBufferType, va_status = i965_CreateBuffer(ctx, 0, VAImageBufferType,
subpic_size, 1, subpic_buf, &img_buf_id); image->data_size, 1, NULL, &image->buf);
assert( VA_STATUS_SUCCESS == va_status ); if (va_status != VA_STATUS_SUCCESS)
struct object_buffer *obj_buf = BUFFER(img_buf_id); goto error;
image->buf = img_buf_id; obj_image->bo = BUFFER(image->buf)->buffer_store->bo;
if (image->num_palette_entries > 0 && image->entry_bytes > 0) {
obj_image->palette = malloc(image->num_palette_entries * sizeof(obj_image->palette));
if (!obj_image->palette)
goto error;
}
image->image_id = image_id;
image->format = *format;
image->width = width; image->width = width;
image->height = height; image->height = height;
obj_image->width = width; *out_image = *image;
obj_image->height = height;
obj_image->size = subpic_size;
obj_image->bo = obj_buf->buffer_store->bo;
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
error:
i965_DestroyImage(ctx, image_id);
return va_status;
} }
VAStatus i965_DeriveImage(VADriverContextP ctx, VAStatus i965_DeriveImage(VADriverContextP ctx,
...@@ -1175,18 +1268,48 @@ i965_DestroyImage(VADriverContextP ctx, VAImageID image) ...@@ -1175,18 +1268,48 @@ i965_DestroyImage(VADriverContextP ctx, VAImageID image)
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_image *obj_image = IMAGE(image); struct object_image *obj_image = IMAGE(image);
i965_DestroyBuffer(ctx, image); if (!obj_image)
return VA_STATUS_SUCCESS;
if (obj_image->image.buf != VA_INVALID_ID) {
i965_DestroyBuffer(ctx, obj_image->image.buf);
obj_image->image.buf = VA_INVALID_ID;
}
if (obj_image->palette) {
free(obj_image->palette);
obj_image->palette = NULL;
}
i965_destroy_image(&i965->image_heap, (struct object_base *)obj_image); i965_destroy_image(&i965->image_heap, (struct object_base *)obj_image);
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VASubpicture struct
*/
VAStatus VAStatus
i965_SetImagePalette(VADriverContextP ctx, i965_SetImagePalette(VADriverContextP ctx,
VAImageID image, VAImageID image,
unsigned char *palette) unsigned char *palette)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx);
unsigned int i;
struct object_image *obj_image = IMAGE(image);
if (!obj_image)
return VA_STATUS_ERROR_INVALID_IMAGE;
if (!obj_image->palette)
return VA_STATUS_ERROR_ALLOCATION_FAILED; /* XXX: unpaletted/error */
for (i = 0; i < obj_image->image.num_palette_entries; i++)
obj_image->palette[i] = (((unsigned int)palette[3*i + 0] << 16) |
((unsigned int)palette[3*i + 1] << 8) |
(unsigned int)palette[3*i + 2]);
return VA_STATUS_SUCCESS; return VA_STATUS_SUCCESS;
} }
...@@ -1274,7 +1397,7 @@ i965_PutSurface(VADriverContextP ctx, ...@@ -1274,7 +1397,7 @@ i965_PutSurface(VADriverContextP ctx,
srcx, srcy, srcw, srch, srcx, srcy, srcw, srch,
destx, desty, destw, desth); destx, desty, destw, desth);
obj_surface = SURFACE(surface); obj_surface = SURFACE(surface);
if(obj_surface->subpic != 0) { if(obj_surface->subpic != VA_INVALID_ID) {
i965_render_put_subpic(ctx, surface, i965_render_put_subpic(ctx, surface,
srcx, srcy, srcw, srch, srcx, srcy, srcw, srch,
destx, desty, destw, desth); destx, desty, destw, desth);
...@@ -1317,8 +1440,8 @@ __vaDriverInit_0_31( VADriverContextP ctx ) ...@@ -1317,8 +1440,8 @@ __vaDriverInit_0_31( VADriverContextP ctx )
struct i965_driver_data *i965; struct i965_driver_data *i965;
int result; int result;
ctx->version_major = 0; ctx->version_major = VA_MAJOR_VERSION;
ctx->version_minor = 29; ctx->version_minor = VA_MINOR_VERSION;
ctx->max_profiles = I965_MAX_PROFILES; ctx->max_profiles = I965_MAX_PROFILES;
ctx->max_entrypoints = I965_MAX_ENTRYPOINTS; ctx->max_entrypoints = I965_MAX_ENTRYPOINTS;
ctx->max_attributes = I965_MAX_CONFIG_ATTRIBUTES; ctx->max_attributes = I965_MAX_CONFIG_ATTRIBUTES;
...@@ -1361,7 +1484,6 @@ __vaDriverInit_0_31( VADriverContextP ctx ) ...@@ -1361,7 +1484,6 @@ __vaDriverInit_0_31( VADriverContextP ctx )
ctx->vtable.vaCreateSubpicture = i965_CreateSubpicture; ctx->vtable.vaCreateSubpicture = i965_CreateSubpicture;
ctx->vtable.vaDestroySubpicture = i965_DestroySubpicture; ctx->vtable.vaDestroySubpicture = i965_DestroySubpicture;
ctx->vtable.vaSetSubpictureImage = i965_SetSubpictureImage; ctx->vtable.vaSetSubpictureImage = i965_SetSubpictureImage;
//ctx->vtable.vaSetSubpicturePalette = i965_SetSubpicturePalette;
ctx->vtable.vaSetSubpictureChromakey = i965_SetSubpictureChromakey; ctx->vtable.vaSetSubpictureChromakey = i965_SetSubpictureChromakey;
ctx->vtable.vaSetSubpictureGlobalAlpha = i965_SetSubpictureGlobalAlpha; ctx->vtable.vaSetSubpictureGlobalAlpha = i965_SetSubpictureGlobalAlpha;
ctx->vtable.vaAssociateSubpicture = i965_AssociateSubpicture; ctx->vtable.vaAssociateSubpicture = i965_AssociateSubpicture;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_ENTRYPOINTS 5
#define I965_MAX_CONFIG_ATTRIBUTES 10 #define I965_MAX_CONFIG_ATTRIBUTES 10
#define I965_MAX_IMAGE_FORMATS 10 #define I965_MAX_IMAGE_FORMATS 10
#define I965_MAX_SUBPIC_FORMATS 4 #define I965_MAX_SUBPIC_FORMATS 2
#define I965_MAX_DISPLAY_ATTRIBUTES 4 #define I965_MAX_DISPLAY_ATTRIBUTES 4
#define I965_STR_VENDOR "i965 Driver 0.1" #define I965_STR_VENDOR "i965 Driver 0.1"
...@@ -106,23 +106,24 @@ struct object_buffer ...@@ -106,23 +106,24 @@ struct object_buffer
int size_element; int size_element;
VABufferType type; VABufferType type;
}; };
struct object_image struct object_image
{ {
struct object_base base; struct object_base base;
int width; VAImage image;
int height;
int size;
dri_bo *bo; dri_bo *bo;
unsigned int *palette;
}; };
struct object_subpic struct object_subpic
{ {
struct object_base base; struct object_base base;
VAImageID image; VAImageID image;
int dstx; VARectangle src_rect;
int dsty; VARectangle dst_rect;
unsigned int format;
int width; int width;
int height; int height;
unsigned char palette[3][16];
dri_bo *bo; dri_bo *bo;
}; };
......
...@@ -868,7 +868,7 @@ i965_media_mpeg2_objects(VADriverContextP ctx, struct decode_state *decode_state ...@@ -868,7 +868,7 @@ i965_media_mpeg2_objects(VADriverContextP ctx, struct decode_state *decode_state
I915_GEM_DOMAIN_SAMPLER, 0, I915_GEM_DOMAIN_SAMPLER, 0,
slice_param->slice_data_offset + (slice_param->macroblock_offset >> 3)); slice_param->slice_data_offset + (slice_param->macroblock_offset >> 3));
OUT_BATCH(ctx, OUT_BATCH(ctx,
((0 << 24) | ((slice_param->slice_horizontal_position << 24) |
(slice_param->slice_vertical_position << 16) | (slice_param->slice_vertical_position << 16) |
(127 << 8) | (127 << 8) |
(slice_param->macroblock_offset & 0x7))); (slice_param->macroblock_offset & 0x7)));
......
...@@ -70,7 +70,7 @@ static const unsigned int ps_subpic_kernel_static[][4] = ...@@ -70,7 +70,7 @@ static const unsigned int ps_subpic_kernel_static[][4] =
{ {
#include "shaders/render/exa_wm_xy.g4b" #include "shaders/render/exa_wm_xy.g4b"
#include "shaders/render/exa_wm_src_affine.g4b" #include "shaders/render/exa_wm_src_affine.g4b"
#include "shaders/render/exa_wm_blend_subpicture.g4b" #include "shaders/render/exa_wm_src_sample_argb.g4b"
#include "shaders/render/exa_wm_write.g4b" #include "shaders/render/exa_wm_write.g4b"
}; };
...@@ -92,7 +92,7 @@ static const unsigned int ps_subpic_kernel_static_gen5[][4] = ...@@ -92,7 +92,7 @@ static const unsigned int ps_subpic_kernel_static_gen5[][4] =
{ {
#include "shaders/render/exa_wm_xy.g4b.gen5" #include "shaders/render/exa_wm_xy.g4b.gen5"
#include "shaders/render/exa_wm_src_affine.g4b.gen5" #include "shaders/render/exa_wm_src_affine.g4b.gen5"
#include "shaders/render/exa_wm_blend_subpicture.g4b.gen5" #include "shaders/render/exa_wm_src_sample_argb.g4b.gen5"
#include "shaders/render/exa_wm_write.g4b.gen5" #include "shaders/render/exa_wm_write.g4b.gen5"
}; };
...@@ -580,12 +580,13 @@ i965_render_src_surface_state(VADriverContextP ctx, ...@@ -580,12 +580,13 @@ i965_render_src_surface_state(VADriverContextP ctx,
render_state->wm.surface[index] = ss_bo; render_state->wm.surface[index] = ss_bo;
render_state->wm.sampler_count++; render_state->wm.sampler_count++;
} }
static void static void
i965_subpic_render_src_surface_state(VADriverContextP ctx, i965_subpic_render_src_surface_state(VADriverContextP ctx,
int index, int index,
dri_bo *region, dri_bo *region,
unsigned long offset, unsigned long offset,
int w, int h) int w, int h, int format)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state; struct i965_render_state *render_state = &i965->render_state;
...@@ -601,7 +602,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx, ...@@ -601,7 +602,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
ss = ss_bo->virtual; ss = ss_bo->virtual;
memset(ss, 0, sizeof(*ss)); memset(ss, 0, sizeof(*ss));
ss->ss0.surface_type = I965_SURFACE_2D; ss->ss0.surface_type = I965_SURFACE_2D;
ss->ss0.surface_format = I965_SURFACEFORMAT_R8_UNORM; ss->ss0.surface_format = format;
ss->ss0.writedisable_alpha = 0; ss->ss0.writedisable_alpha = 0;
ss->ss0.writedisable_red = 0; ss->ss0.writedisable_red = 0;
ss->ss0.writedisable_green = 0; ss->ss0.writedisable_green = 0;
...@@ -677,8 +678,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx, ...@@ -677,8 +678,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx,
region = obj_surface->bo; region = obj_surface->bo;
subpic_region = obj_image->bo; subpic_region = obj_image->bo;
/*subpicture surface*/ /*subpicture surface*/
i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_image->width, obj_image->height); i965_subpic_render_src_surface_state(ctx, 1, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format);
i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_image->width, obj_image->height); i965_subpic_render_src_surface_state(ctx, 2, subpic_region, 0, obj_subpic->width, obj_subpic->height, obj_subpic->format);
} }
static void static void
...@@ -789,57 +790,56 @@ i965_render_binding_table(VADriverContextP ctx) ...@@ -789,57 +790,56 @@ i965_render_binding_table(VADriverContextP ctx)
static void static void
i965_subpic_render_upload_vertex(VADriverContextP ctx, i965_subpic_render_upload_vertex(VADriverContextP ctx,
VASurfaceID surface, VASurfaceID surface,
short srcx, const VARectangle *output_rect)
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_render_state *render_state = &i965->render_state; struct i965_render_state *render_state = &i965->render_state;
struct intel_region *dest_region = render_state->draw_region; struct object_surface *obj_surface = SURFACE(surface);
struct object_surface *obj_surface; struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
struct object_subpic *obj_subpic;
float *vb;
float src_scale_x, src_scale_y;
int i, width, height;
obj_surface = SURFACE(surface);
obj_subpic = SUBPIC(obj_surface->subpic);
assert(obj_surface);
assert(obj_subpic);
int box_x1 = dest_region->x + obj_subpic->dstx;
int box_y1 = dest_region->y + obj_subpic->dsty;
int box_x2 = box_x1 + obj_subpic->width;
int box_y2 = box_y1 + obj_subpic->height;
width = obj_surface->width; const float psx = (float)obj_surface->width / (float)obj_subpic->width;
height = obj_surface->height; const float psy = (float)obj_surface->height / (float)obj_subpic->height;
src_scale_x = ((float)srcw / width) / (float)destw; const float ssx = (float)output_rect->width / (float)obj_surface->width;
src_scale_y = ((float)srch / height) / (float)desth; const float ssy = (float)output_rect->height / (float)obj_surface->height;
const float sx = psx * ssx;
const float sy = psy * ssy;
float *vb, tx1, tx2, ty1, ty2, x1, x2, y1, y2;
int i = 0;
VARectangle dst_rect;
dst_rect.x = output_rect->x + sx * (float)obj_subpic->dst_rect.x;
dst_rect.y = output_rect->y + sx * (float)obj_subpic->dst_rect.y;
dst_rect.width = sx * (float)obj_subpic->dst_rect.width;
dst_rect.height = sy * (float)obj_subpic->dst_rect.height;
dri_bo_map(render_state->vb.vertex_buffer, 1); dri_bo_map(render_state->vb.vertex_buffer, 1);
assert(render_state->vb.vertex_buffer->virtual); assert(render_state->vb.vertex_buffer->virtual);
vb = render_state->vb.vertex_buffer->virtual; vb = render_state->vb.vertex_buffer->virtual;
/*vertex covers the full subpicture*/
i = 0;
vb[i++] = 1;
vb[i++] = 1;
vb[i++] = (float)box_x2;
vb[i++] = (float)box_y2;
vb[i++] = 0.0;
vb[i++] = 1;
vb[i++] = (float)box_x1;
vb[i++] = (float)box_y2;
vb[i++] = 0.0; tx1 = (float)obj_subpic->src_rect.x / (float)obj_subpic->width;
vb[i++] = 0.0; ty1 = (float)obj_subpic->src_rect.y / (float)obj_subpic->height;
vb[i++] = (float)box_x1; tx2 = (float)(obj_subpic->src_rect.x + obj_subpic->src_rect.width) / (float)obj_subpic->width;
vb[i++] = (float)box_y1; ty2 = (float)(obj_subpic->src_rect.y + obj_subpic->src_rect.height) / (float)obj_subpic->height;
x1 = (float)dst_rect.x;
y1 = (float)dst_rect.y;
x2 = (float)(dst_rect.x + dst_rect.width);
y2 = (float)(dst_rect.y + dst_rect.height);
vb[i++] = tx2;
vb[i++] = ty2;
vb[i++] = x2;
vb[i++] = y2;
vb[i++] = tx1;
vb[i++] = ty2;
vb[i++] = x1;
vb[i++] = y2;
vb[i++] = tx1;
vb[i++] = ty1;
vb[i++] = x1;
vb[i++] = y1;
dri_bo_unmap(render_state->vb.vertex_buffer); dri_bo_unmap(render_state->vb.vertex_buffer);
} }
...@@ -947,9 +947,13 @@ i965_subpic_render_state_setup(VADriverContextP ctx, ...@@ -947,9 +947,13 @@ i965_subpic_render_state_setup(VADriverContextP ctx,
i965_render_cc_viewport(ctx); i965_render_cc_viewport(ctx);
i965_subpic_render_cc_unit(ctx); i965_subpic_render_cc_unit(ctx);
i965_render_binding_table(ctx); i965_render_binding_table(ctx);
i965_subpic_render_upload_vertex(ctx, surface,
srcx, srcy, srcw, srch, VARectangle output_rect;
destx, desty, destw, desth); output_rect.x = destx;
output_rect.y = desty;
output_rect.width = destw;
output_rect.height = desth;
i965_subpic_render_upload_vertex(ctx, surface, &output_rect);
} }
...@@ -1162,21 +1166,31 @@ i965_render_vertex_elements(VADriverContextP ctx) ...@@ -1162,21 +1166,31 @@ i965_render_vertex_elements(VADriverContextP ctx)
} }
} }
void static void
i965_render_upload_palette(VADriverContextP ctx) i965_render_upload_image_palette(
VADriverContextP ctx,
VAImageID image_id,
unsigned int alpha
)
{ {
BEGIN_BATCH(ctx, 17); struct i965_driver_data *i965 = i965_driver_data(ctx);
OUT_BATCH(ctx, CMD_SAMPLER_PALETTE_LOAD | 15); unsigned int i;
struct object_image *obj_image = IMAGE(image_id);
assert(obj_image);
if (obj_image->image.num_palette_entries == 0)
return;
BEGIN_BATCH(ctx, 1 + obj_image->image.num_palette_entries);
OUT_BATCH(ctx, CMD_SAMPLER_PALETTE_LOAD | (obj_image->image.num_palette_entries - 1));
/*fill palette*/ /*fill palette*/
//int32_t out[16]; //0-23:color 23-31:alpha //int32_t out[16]; //0-23:color 23-31:alpha
int32_t i,c; for (i = 0; i < obj_image->image.num_palette_entries; i++)
for(i = 0; i < 16; i ++){ OUT_BATCH(ctx, (alpha << 24) | obj_image->palette[i]);
c = i*16; //16 colors
OUT_BATCH(ctx,c<<24/*alpha*/|c<<16/*R*/|c<<8/*G*/|c/*B*/);//c<<24/*alpha*/|c<<16/*R*/|c<<8/*G*/|c/*B*/);
}
ADVANCE_BATCH(ctx); ADVANCE_BATCH(ctx);
} }
static void static void
i965_render_startup(VADriverContextP ctx) i965_render_startup(VADriverContextP ctx)
{ {
...@@ -1284,7 +1298,6 @@ i965_subpic_render_pipeline_setup(VADriverContextP ctx) ...@@ -1284,7 +1298,6 @@ i965_subpic_render_pipeline_setup(VADriverContextP ctx)
i965_render_binding_table_pointers(ctx); i965_render_binding_table_pointers(ctx);
i965_render_constant_color(ctx); i965_render_constant_color(ctx);
i965_render_pipelined_pointers(ctx); i965_render_pipelined_pointers(ctx);
//i965_render_upload_palette(ctx);
i965_render_urb_layout(ctx); i965_render_urb_layout(ctx);
i965_render_cs_urb_layout(ctx); i965_render_cs_urb_layout(ctx);
i965_render_drawing_rectangle(ctx); i965_render_drawing_rectangle(ctx);
...@@ -1412,11 +1425,17 @@ i965_render_put_subpic(VADriverContextP ctx, ...@@ -1412,11 +1425,17 @@ i965_render_put_subpic(VADriverContextP ctx,
unsigned short destw, unsigned short destw,
unsigned short desth) unsigned short desth)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct object_surface *obj_surface = SURFACE(surface);
struct object_subpic *obj_subpic = SUBPIC(obj_surface->subpic);
assert(obj_subpic);
i965_render_initialize(ctx); i965_render_initialize(ctx);
i965_subpic_render_state_setup(ctx, surface, i965_subpic_render_state_setup(ctx, surface,
srcx, srcy, srcw, srch, srcx, srcy, srcw, srch,
destx, desty, destw, desth); destx, desty, destw, desth);
i965_subpic_render_pipeline_setup(ctx); i965_subpic_render_pipeline_setup(ctx);
i965_render_upload_image_palette(ctx, obj_subpic->image, 0xff);
intel_batchbuffer_flush(ctx); intel_batchbuffer_flush(ctx);
} }
......
...@@ -43,6 +43,7 @@ struct intel_batchbuffer; ...@@ -43,6 +43,7 @@ struct intel_batchbuffer;
#define ALIGN(i, n) (((i) + (n) - 1) & ~((n) - 1)) #define ALIGN(i, n) (((i) + (n) - 1) & ~((n) - 1))
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define SET_BLOCKED_SIGSET() do { \ #define SET_BLOCKED_SIGSET() do { \
sigset_t bl_mask; \ sigset_t bl_mask; \
......
...@@ -7,27 +7,27 @@ INTEL_G4A = \ ...@@ -7,27 +7,27 @@ INTEL_G4A = \
exa_sf.g4a \ exa_sf.g4a \
exa_wm_xy.g4a \ exa_wm_xy.g4a \
exa_wm_src_affine.g4a \ exa_wm_src_affine.g4a \
exa_wm_src_sample_argb.g4a \
exa_wm_src_sample_planar.g4a \ exa_wm_src_sample_planar.g4a \
exa_wm_yuv_rgb.g4a \ exa_wm_yuv_rgb.g4a \
exa_wm_blend_subpicture.g4a \
exa_wm_write.g4a exa_wm_write.g4a
INTEL_G4B = \ INTEL_G4B = \
exa_sf.g4b \ exa_sf.g4b \
exa_wm_xy.g4b \ exa_wm_xy.g4b \
exa_wm_src_affine.g4b \ exa_wm_src_affine.g4b \
exa_wm_src_sample_argb.g4b \
exa_wm_src_sample_planar.g4b \ exa_wm_src_sample_planar.g4b \
exa_wm_yuv_rgb.g4b \ exa_wm_yuv_rgb.g4b \
exa_wm_blend_subpicture.g4b \
exa_wm_write.g4b exa_wm_write.g4b
INTEL_G4B_GEN5 = \ INTEL_G4B_GEN5 = \
exa_sf.g4b.gen5 \ exa_sf.g4b.gen5 \
exa_wm_xy.g4b.gen5 \ exa_wm_xy.g4b.gen5 \
exa_wm_src_affine.g4b.gen5 \ exa_wm_src_affine.g4b.gen5 \
exa_wm_src_sample_argb.g4b.gen5 \
exa_wm_src_sample_planar.g4b.gen5 \ exa_wm_src_sample_planar.g4b.gen5 \
exa_wm_yuv_rgb.g4b.gen5 \ exa_wm_yuv_rgb.g4b.gen5 \
exa_wm_blend_subpicture.g4b.gen5 \
exa_wm_write.g4b.gen5 exa_wm_write.g4b.gen5
EXTRA_DIST = $(INTEL_G4I) \ EXTRA_DIST = $(INTEL_G4I) \
......
{ 0x00000201, 0x20080061, 0x00000000, 0x0000e000 },
{ 0x01800031, 0x22001d29, 0x008d0000, 0x02520001 },
{ 0x01800031, 0x21c01d29, 0x008d0000, 0x02520201 },
{ 0x01800031, 0x22401d29, 0x008d0000, 0x02520401 },
{ 0x00600001, 0x228003bd, 0x008d01c0, 0x00000000 },
{ 0x00600001, 0x22a003bd, 0x008d01e0, 0x00000000 },
{ 0x00600040, 0x21c07fbd, 0x008d01c0, 0x3f000000 },
{ 0x00600040, 0x21e07fbd, 0x008d01e0, 0x3f000000 },
{ 0x00600040, 0x22007fbd, 0x008d0200, 0x3f000000 },
{ 0x00600040, 0x22207fbd, 0x008d0220, 0x3f000000 },
{ 0x00600040, 0x22407fbd, 0x008d0240, 0x3f000000 },
{ 0x00600040, 0x22607fbd, 0x008d0260, 0x3f000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x00000201, 0x20080061, 0x00000000, 0x0000e000 },
{ 0x01800031, 0x22001d29, 0x208d0000, 0x0a2a0001 },
{ 0x01800031, 0x21c01d29, 0x208d0000, 0x0a2a0201 },
{ 0x01800031, 0x22401d29, 0x208d0000, 0x0a2a0401 },
{ 0x00600001, 0x228003bd, 0x008d01c0, 0x00000000 },
{ 0x00600001, 0x22a003bd, 0x008d01e0, 0x00000000 },
{ 0x00600040, 0x21c07fbd, 0x008d01c0, 0x3f000000 },
{ 0x00600040, 0x21e07fbd, 0x008d01e0, 0x3f000000 },
{ 0x00600040, 0x22007fbd, 0x008d0200, 0x3f000000 },
{ 0x00600040, 0x22207fbd, 0x008d0220, 0x3f000000 },
{ 0x00600040, 0x22407fbd, 0x008d0240, 0x3f000000 },
{ 0x00600040, 0x22607fbd, 0x008d0260, 0x3f000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
{ 0x0000007e, 0x00000000, 0x00000000, 0x00000000 },
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
* Keith Packard <keithp@keithp.com> * Keith Packard <keithp@keithp.com>
*/ */
/* Sample the src surface in planar format */ /* Sample the src surface */
include(`exa_wm.g4i') include(`exa_wm.g4i')
/* prepare sampler read back gX register, which would be written back to output */ /* prepare sampler read back gX register, which would be written back to output */
...@@ -33,51 +34,14 @@ include(`exa_wm.g4i') ...@@ -33,51 +34,14 @@ include(`exa_wm.g4i')
/* use simd16 sampler, param 0 is u, param 1 is v. */ /* use simd16 sampler, param 0 is u, param 1 is v. */
/* 'payload' loading, assuming tex coord start from g4 */ /* 'payload' loading, assuming tex coord start from g4 */
/* load r */ /* load argb */
mov (1) g0.8<1>UD 0x0000e000UD { align1 mask_disable }; mov (1) g0.8<1>UD 0x00000000UD { align1 mask_disable };
/* src_msg will be copied with g0, as it contains send desc */ /* src_msg will be copied with g0, as it contains send desc */
/* emit sampler 'send' cmd */ /* emit sampler 'send' cmd */
/* sample Y */
send (16) src_msg_ind /* msg reg index */
src_sample_g<1>UW /* readback */
g0<8,8,1>UW /* copy to msg start reg*/
sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype)*/
mlen 5 rlen 2 {align1};
/* sample U (Cr) */
send (16) src_msg_ind /* msg reg index */ send (16) src_msg_ind /* msg reg index */
src_sample_r<1>UW /* readback */ src_sample_base<1>UW /* readback */
g0<8,8,1>UW /* copy to msg start reg*/ g0<8,8,1>UW /* copy to msg start reg*/
sampler (1,2,F) /* sampler message description, (binding_table,sampler_index,datatype) sampler (1,0,F) /* sampler message description, (binding_table,sampler_index,datatype)
/* here(src->dst) we should use src_sampler and src_surface */ /* here(src->dst) we should use src_sampler and src_surface */
mlen 5 rlen 2 { align1 }; /* required message len 5, readback len 8 */ mlen 5 rlen 8 { align1 }; /* required message len 5, readback len 8 */
/* sample V (Cb) */
send (16) src_msg_ind /* msg reg index */
src_sample_b<1>UW /* readback */
g0<8,8,1>UW /* copy to msg start reg*/
sampler (1,4,F) /* sampler message description, (binding_table,sampler_index,datatype)
/* here(src->dst) we should use src_sampler and src_surface */
mlen 5 rlen 2 { align1 }; /* required message len 5, readback len 8 */
/*extract alpha value, alpha value stores in one float with color value, because the color value is small,
we can neglect it when doing alpha blend*/
mov (8) src_sample_a<1>F g14<8,8,1>F { align1 };
mov (8) src_sample_a_23<1>F g15<8,8,1>F { align1 };
/*set subtitle color*/
add (8) g14<1>F g14<8,8,1>F 0.5F { align1 };
add (8) g15<1>F g15<8,8,1>F 0.5F { align1 };
add (8) g16<1>F g16<8,8,1>F 0.5F { align1 };
add (8) g17<1>F g17<8,8,1>F 0.5F { align1 };
add (8) g18<1>F g18<8,8,1>F 0.5F { align1 };
add (8) g19<1>F g19<8,8,1>F 0.5F { align1 };
nop;
nop;
nop;
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x01800031, 0x21c01d29, 0x008d0000, 0x02580001 },
{ 0x00000201, 0x20080061, 0x00000000, 0x00000000 },
{ 0x01800031, 0x21c01d29, 0x208d0000, 0x0a8a0001 },
...@@ -313,6 +313,8 @@ const char *vaErrorStr(VAStatus error_status) ...@@ -313,6 +313,8 @@ const char *vaErrorStr(VAStatus error_status)
return "resolution not supported"; return "resolution not supported";
case VA_STATUS_ERROR_UNIMPLEMENTED: case VA_STATUS_ERROR_UNIMPLEMENTED:
return "the requested function is not implemented"; return "the requested function is not implemented";
case VA_STATUS_ERROR_SURFACE_IN_DISPLAYING:
return "surface is in displaying (may by overlay)" ;
case VA_STATUS_ERROR_UNKNOWN: case VA_STATUS_ERROR_UNKNOWN:
return "unknown libva error"; return "unknown libva error";
} }
......
...@@ -128,6 +128,7 @@ typedef int VAStatus; /* Return status type from functions */ ...@@ -128,6 +128,7 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012 #define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012
#define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
#define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
#define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
#define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
/* /*
...@@ -569,6 +570,7 @@ typedef struct _VASliceParameterBufferMPEG2 ...@@ -569,6 +570,7 @@ typedef struct _VASliceParameterBufferMPEG2
unsigned int slice_data_offset;/* the offset to the first byte of slice data */ unsigned int slice_data_offset;/* the offset to the first byte of slice data */
unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */ unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */ unsigned int macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
unsigned int slice_horizontal_position;
unsigned int slice_vertical_position; unsigned int slice_vertical_position;
int quantiser_scale_code; int quantiser_scale_code;
int intra_slice_flag; int intra_slice_flag;
......
...@@ -107,7 +107,6 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name) ...@@ -107,7 +107,6 @@ isDRI1Connected(VADriverContextP ctx, char **driver_name)
dri_state->fd = drmOpenOnce(NULL, BusID, &newlyopened); dri_state->fd = drmOpenOnce(NULL, BusID, &newlyopened);
XFree(BusID); XFree(BusID);
assert(dri_state->fd >= 0);
if (dri_state->fd < 0) if (dri_state->fd < 0)
goto err_out1; goto err_out1;
......
...@@ -42,26 +42,6 @@ ...@@ -42,26 +42,6 @@
static VADisplayContextP pDisplayContexts = NULL; static VADisplayContextP pDisplayContexts = NULL;
static void va_errorMessage(const char *msg, ...)
{
va_list args;
fprintf(stderr, "libva error: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
}
static void va_infoMessage(const char *msg, ...)
{
va_list args;
fprintf(stderr, "libva: ");
va_start(args, msg);
vfprintf(stderr, msg, args);
va_end(args);
}
static int va_DisplayContextIsValid ( static int va_DisplayContextIsValid (
VADisplayContextP pDisplayContext VADisplayContextP pDisplayContext
) )
...@@ -132,49 +112,21 @@ static VAStatus va_NVCTRL_GetDriverName ( ...@@ -132,49 +112,21 @@ static VAStatus va_NVCTRL_GetDriverName (
) )
{ {
VADriverContextP ctx = pDisplayContext->pDriverContext; VADriverContextP ctx = pDisplayContext->pDriverContext;
VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN; int direct_capable, driver_major, driver_minor, driver_patch;
int direct_capable; Bool result;
int driver_major;
int driver_minor;
int driver_patch;
Bool result = True;
char *nvidia_driver_name = NULL;
if (result) result = VA_NVCTRLQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen,
{ &direct_capable);
result = VA_NVCTRLQueryDirectRenderingCapable(ctx->x11_dpy, ctx->x11_screen, &direct_capable); if (!result || !direct_capable)
if (!result) return VA_STATUS_ERROR_UNKNOWN;
{
va_errorMessage("VA_NVCTRLQueryDirectRenderingCapable failed\n"); result = VA_NVCTRLGetClientDriverName(ctx->x11_dpy, ctx->x11_screen,
} &driver_major, &driver_minor,
} &driver_patch, driver_name);
if (result)
{
result = direct_capable;
if (!result)
{
va_errorMessage("VA_NVCTRLQueryDirectRenderingCapable returned false\n");
}
}
if (result)
{
result = VA_NVCTRLGetClientDriverName(ctx->x11_dpy, ctx->x11_screen, &driver_major, &driver_minor,
&driver_patch, &nvidia_driver_name);
if (!result) if (!result)
{ return VA_STATUS_ERROR_UNKNOWN;
va_errorMessage("VA_NVCTRLGetClientDriverName returned false\n");
} return VA_STATUS_SUCCESS;
}
if (result)
{
vaStatus = VA_STATUS_SUCCESS;
va_infoMessage("va_NVCTRL_GetDriverName: %d.%d.%d %s (screen %d)\n",
driver_major, driver_minor, driver_patch,
nvidia_driver_name, ctx->x11_screen);
if (driver_name)
*driver_name = nvidia_driver_name;
}
return vaStatus;
} }
static VAStatus va_DisplayContextGetDriverName ( static VAStatus va_DisplayContextGetDriverName (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment