drm: fixup some interfaces so test code works again

main
Dave Airlie 2008-06-02 10:41:12 +10:00
parent e439e74776
commit dba95ec343
4 changed files with 7 additions and 21 deletions

View File

@ -254,10 +254,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
struct drm_mode_crtc crtc;
drmModeCrtcPtr r;
crtc.count_connectors = 0;
crtc.connectors = 0;
crtc.count_possibles = 0;
crtc.possibles = 0;
crtc.crtc_id = crtcId;
if (ioctl(fd, DRM_IOCTL_MODE_GETCRTC, &crtc))
@ -278,12 +274,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
memcpy(&r->mode, &crtc.mode, sizeof(struct drm_mode_modeinfo));
r->buffer_id = crtc.fb_id;
r->gamma_size = crtc.gamma_size;
r->count_connectors = crtc.count_connectors;
r->count_possibles = crtc.count_possibles;
/* TODO we realy should test if these alloc & cpy fails. */
r->connectors = crtc.connectors;
r->possibles = crtc.possibles;
return r;
}
@ -362,6 +352,8 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
if (!(r = drmMalloc(sizeof(*r))))
return 0;
r->encoder_id = enc.encoder_id;
r->crtc = enc.crtc;
r->encoder_type = enc.encoder_type;
r->crtcs = enc.crtcs;
r->clones = enc.clones;
@ -411,7 +403,7 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
}
r->connector_id = conn.connector;
r->crtc = conn.crtc;
r->encoder = conn.encoder;
r->connection = conn.connection;
r->mmWidth = conn.mm_width;
r->mmHeight = conn.mm_height;

View File

@ -112,6 +112,7 @@ typedef struct _drmModeCrtc {
typedef struct _drmModeEncoder {
unsigned int encoder_id;
unsigned int encoder_type;
uint32_t crtc;
uint32_t crtcs;
uint32_t clones;
} drmModeEncoder, *drmModeEncoderPtr;
@ -134,7 +135,7 @@ typedef enum {
typedef struct _drmModeConnector {
unsigned int connector_id;
unsigned int crtc; /**< Crtc currently connected to */
unsigned int encoder; /**< Crtc currently connected to */
unsigned int connector_type;
unsigned int connector_type_id;
drmModeConnection connection;

View File

@ -1015,8 +1015,6 @@ int drm_mode_getcrtc(struct drm_device *dev,
{
struct drm_mode_crtc *crtc_resp = data;
struct drm_crtc *crtc;
struct drm_connector *connector;
int ocount;
int ret = 0;
mutex_lock(&dev->mode_config.mutex);
@ -1039,11 +1037,6 @@ int drm_mode_getcrtc(struct drm_device *dev,
drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode);
crtc_resp->mode_valid = 1;
ocount = 0;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder->crtc == crtc)
crtc_resp->connectors |= 1 << (ocount++);
}
} else {
crtc_resp->mode_valid = 0;

View File

@ -57,7 +57,7 @@ int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uin
printf("Connector: %d-%d\n", connector->connector_type, connector->connector_type_id);
printf("\tid : %i\n", id);
printf("\tcrtc id : %i\n", connector->crtc);
printf("\tencoder id : %i\n", connector->encoder);
printf("\tconn : %s\n", getConnectionText(connector->connection));
printf("\tsize : %ix%i (mm)\n", connector->mmWidth, connector->mmHeight);
printf("\tcount_modes : %i\n", connector->count_modes);
@ -67,7 +67,7 @@ int printConnector(int fd, drmModeResPtr res, drmModeConnectorPtr connector, uin
for (i = 0; i < connector->count_encoders; i++) {
enc = drmModeGetEncoder(fd, connector->encoders[i]);
if (enc) {
printf("Encoder: %d %d %d %d\n", enc->encoder_id, enc->encoder_type, enc->crtcs, enc->clones);
printf("Encoder: %d %d %d %d %d\n", enc->crtc, enc->encoder_id, enc->encoder_type, enc->crtcs, enc->clones);
}
}