summaryrefslogtreecommitdiff
path: root/hw/kdrive/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-04-06 08:12:35 +0100
committerEric Anholt <eric@anholt.net>2014-06-15 23:19:54 +0100
commit0edc0a78fbfac4578b0f809aef17332c1eb461e3 (patch)
treebc759fc4c416ddaef34b9f70e02f84c84ea04a8c /hw/kdrive/src
parent1d90e8811a7d4db328c0c944bec0aa3ed6afb70d (diff)
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>
Diffstat (limited to 'hw/kdrive/src')
-rw-r--r--hw/kdrive/src/kxv.c30
-rw-r--r--hw/kdrive/src/kxv.h8
2 files changed, 14 insertions, 24 deletions
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 9cc0edd8a..508577034 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -295,15 +295,11 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
XvPortRecPrivatePtr portPriv;
XvPortPtr pPort, pp;
int numPort;
- KdAttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
KdVideoFormatPtr formatPtr;
XvFormatPtr pFormat, pf;
int numFormat, totFormat;
KdVideoEncodingPtr encodingPtr;
XvEncodingPtr pEncode, pe;
- KdImagePtr imagePtr;
- XvImagePtr pImage, pi;
int numVisuals;
VisualPtr pVisual;
int i;
@@ -381,26 +377,24 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
}
if (adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
- memcpy(pi, imagePtr, sizeof(*pi));
- }
+ (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+ memcpy(pa->pImages, adaptorPtr->pImages,
+ adaptorPtr->nImages * sizeof(XvImageRec));
pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
}
if (adaptorPtr->nAttributes &&
- (pAttribute =
- calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
- for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
- 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
- memcpy(pat, attributePtr, sizeof(*pat));
- pat->name = strdup(attributePtr->name);
+ (pa->pAttributes = calloc(adaptorPtr->nAttributes,
+ sizeof(XvAttributeRec)))) {
+ memcpy(pa->pAttributes, adaptorPtr->pAttributes,
+ adaptorPtr->nAttributes * sizeof(XvAttributeRec));
+
+ for (i = 0; i < adaptorPtr->nAttributes; i++) {
+ pa->pAttributes[i].name =
+ strdup(adaptorPtr->pAttributes[i].name);
}
+
pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
}
totFormat = adaptorPtr->nFormats;
diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
index 85a030ee9..f479de131 100644
--- a/hw/kdrive/src/kxv.h
+++ b/hw/kdrive/src/kxv.h
@@ -56,8 +56,6 @@ of the copyright holder.
#define VIDEO_OVERLAID_STILLS 0x00000008
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-typedef XvImageRec KdImageRec, *KdImagePtr;
-
typedef struct {
KdScreenInfo *screen;
int id;
@@ -131,8 +129,6 @@ typedef struct {
short class;
} KdVideoFormatRec, *KdVideoFormatPtr;
-typedef XvAttributeRec KdAttributeRec, *KdAttributePtr;
-
typedef struct {
unsigned int type;
int flags;
@@ -144,9 +140,9 @@ typedef struct {
int nPorts;
DevUnion *pPortPrivates;
int nAttributes;
- KdAttributePtr pAttributes;
+ XvAttributePtr pAttributes;
int nImages;
- KdImagePtr pImages;
+ XvImagePtr pImages;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;