kdrive: Do a little more cleanup from the XV struct deduplication.
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
1d90e8811a
commit
0edc0a78fb
|
@ -69,7 +69,7 @@ static Bool ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this);
|
||||||
static Bool ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this,
|
static Bool ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this,
|
||||||
ScreenPtr a_screen);
|
ScreenPtr a_screen);
|
||||||
|
|
||||||
static Bool ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
|
static Bool ephyrXVPrivIsAttrValueValid(XvAttributePtr a_attrs,
|
||||||
int a_attrs_len,
|
int a_attrs_len,
|
||||||
const char *a_attr_name,
|
const char *a_attr_name,
|
||||||
int a_attr_value, Bool *a_is_valid);
|
int a_attr_value, Bool *a_is_valid);
|
||||||
|
@ -363,7 +363,7 @@ translate_xv_attributes(KdVideoAdaptorPtr adaptor,
|
||||||
|
|
||||||
it = xcb_xv_query_port_attributes_attributes_iterator(reply);
|
it = xcb_xv_query_port_attributes_attributes_iterator(reply);
|
||||||
for (i = 0; i < reply->num_attributes; i++) {
|
for (i = 0; i < reply->num_attributes; i++) {
|
||||||
KdAttributePtr attribute = &adaptor->pAttributes[i];
|
XvAttributePtr attribute = &adaptor->pAttributes[i];
|
||||||
|
|
||||||
attribute->flags = it.data->flags;
|
attribute->flags = it.data->flags;
|
||||||
attribute->min_value = it.data->min;
|
attribute->min_value = it.data->min;
|
||||||
|
@ -397,7 +397,7 @@ translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
adaptor->nImages = reply->num_formats;
|
adaptor->nImages = reply->num_formats;
|
||||||
adaptor->pImages = calloc(reply->num_formats, sizeof(KdImageRec));
|
adaptor->pImages = calloc(reply->num_formats, sizeof(XvImageRec));
|
||||||
if (!adaptor->pImages) {
|
if (!adaptor->pImages) {
|
||||||
free(reply);
|
free(reply);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -405,7 +405,7 @@ translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
|
||||||
|
|
||||||
formats = xcb_xv_list_image_formats_format(reply);
|
formats = xcb_xv_list_image_formats_format(reply);
|
||||||
for (i = 0; i < reply->num_formats; i++) {
|
for (i = 0; i < reply->num_formats; i++) {
|
||||||
KdImagePtr image = &adaptor->pImages[i];
|
XvImagePtr image = &adaptor->pImages[i];
|
||||||
|
|
||||||
image->id = formats[i].id;
|
image->id = formats[i].id;
|
||||||
image->type = formats[i].type;
|
image->type = formats[i].type;
|
||||||
|
@ -655,7 +655,7 @@ ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
|
ephyrXVPrivIsAttrValueValid(XvAttributePtr a_attrs,
|
||||||
int a_attrs_len,
|
int a_attrs_len,
|
||||||
const char *a_attr_name,
|
const char *a_attr_name,
|
||||||
int a_attr_value, Bool *a_is_valid)
|
int a_attr_value, Bool *a_is_valid)
|
||||||
|
|
|
@ -295,15 +295,11 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
|
||||||
XvPortRecPrivatePtr portPriv;
|
XvPortRecPrivatePtr portPriv;
|
||||||
XvPortPtr pPort, pp;
|
XvPortPtr pPort, pp;
|
||||||
int numPort;
|
int numPort;
|
||||||
KdAttributePtr attributePtr;
|
|
||||||
XvAttributePtr pAttribute, pat;
|
|
||||||
KdVideoFormatPtr formatPtr;
|
KdVideoFormatPtr formatPtr;
|
||||||
XvFormatPtr pFormat, pf;
|
XvFormatPtr pFormat, pf;
|
||||||
int numFormat, totFormat;
|
int numFormat, totFormat;
|
||||||
KdVideoEncodingPtr encodingPtr;
|
KdVideoEncodingPtr encodingPtr;
|
||||||
XvEncodingPtr pEncode, pe;
|
XvEncodingPtr pEncode, pe;
|
||||||
KdImagePtr imagePtr;
|
|
||||||
XvImagePtr pImage, pi;
|
|
||||||
int numVisuals;
|
int numVisuals;
|
||||||
VisualPtr pVisual;
|
VisualPtr pVisual;
|
||||||
int i;
|
int i;
|
||||||
|
@ -381,26 +377,24 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adaptorPtr->nImages &&
|
if (adaptorPtr->nImages &&
|
||||||
(pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
|
(pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
|
||||||
|
memcpy(pa->pImages, adaptorPtr->pImages,
|
||||||
for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
|
adaptorPtr->nImages * sizeof(XvImageRec));
|
||||||
i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
|
|
||||||
memcpy(pi, imagePtr, sizeof(*pi));
|
|
||||||
}
|
|
||||||
pa->nImages = adaptorPtr->nImages;
|
pa->nImages = adaptorPtr->nImages;
|
||||||
pa->pImages = pImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adaptorPtr->nAttributes &&
|
if (adaptorPtr->nAttributes &&
|
||||||
(pAttribute =
|
(pa->pAttributes = calloc(adaptorPtr->nAttributes,
|
||||||
calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
|
sizeof(XvAttributeRec)))) {
|
||||||
for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
|
memcpy(pa->pAttributes, adaptorPtr->pAttributes,
|
||||||
0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
|
adaptorPtr->nAttributes * sizeof(XvAttributeRec));
|
||||||
memcpy(pat, attributePtr, sizeof(*pat));
|
|
||||||
pat->name = strdup(attributePtr->name);
|
for (i = 0; i < adaptorPtr->nAttributes; i++) {
|
||||||
|
pa->pAttributes[i].name =
|
||||||
|
strdup(adaptorPtr->pAttributes[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
pa->nAttributes = adaptorPtr->nAttributes;
|
pa->nAttributes = adaptorPtr->nAttributes;
|
||||||
pa->pAttributes = pAttribute;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
totFormat = adaptorPtr->nFormats;
|
totFormat = adaptorPtr->nFormats;
|
||||||
|
|
|
@ -56,8 +56,6 @@ of the copyright holder.
|
||||||
#define VIDEO_OVERLAID_STILLS 0x00000008
|
#define VIDEO_OVERLAID_STILLS 0x00000008
|
||||||
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
|
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
|
||||||
|
|
||||||
typedef XvImageRec KdImageRec, *KdImagePtr;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
KdScreenInfo *screen;
|
KdScreenInfo *screen;
|
||||||
int id;
|
int id;
|
||||||
|
@ -131,8 +129,6 @@ typedef struct {
|
||||||
short class;
|
short class;
|
||||||
} KdVideoFormatRec, *KdVideoFormatPtr;
|
} KdVideoFormatRec, *KdVideoFormatPtr;
|
||||||
|
|
||||||
typedef XvAttributeRec KdAttributeRec, *KdAttributePtr;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -144,9 +140,9 @@ typedef struct {
|
||||||
int nPorts;
|
int nPorts;
|
||||||
DevUnion *pPortPrivates;
|
DevUnion *pPortPrivates;
|
||||||
int nAttributes;
|
int nAttributes;
|
||||||
KdAttributePtr pAttributes;
|
XvAttributePtr pAttributes;
|
||||||
int nImages;
|
int nImages;
|
||||||
KdImagePtr pImages;
|
XvImagePtr pImages;
|
||||||
PutVideoFuncPtr PutVideo;
|
PutVideoFuncPtr PutVideo;
|
||||||
PutStillFuncPtr PutStill;
|
PutStillFuncPtr PutStill;
|
||||||
GetVideoFuncPtr GetVideo;
|
GetVideoFuncPtr GetVideo;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user