mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-21 05:10:11 +01:00
drm: fixup some interfaces so test code works again
This commit is contained in:
parent
e439e74776
commit
dba95ec343
4 changed files with 7 additions and 21 deletions
|
|
@ -254,10 +254,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId)
|
||||||
struct drm_mode_crtc crtc;
|
struct drm_mode_crtc crtc;
|
||||||
drmModeCrtcPtr r;
|
drmModeCrtcPtr r;
|
||||||
|
|
||||||
crtc.count_connectors = 0;
|
|
||||||
crtc.connectors = 0;
|
|
||||||
crtc.count_possibles = 0;
|
|
||||||
crtc.possibles = 0;
|
|
||||||
crtc.crtc_id = crtcId;
|
crtc.crtc_id = crtcId;
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETCRTC, &crtc))
|
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));
|
memcpy(&r->mode, &crtc.mode, sizeof(struct drm_mode_modeinfo));
|
||||||
r->buffer_id = crtc.fb_id;
|
r->buffer_id = crtc.fb_id;
|
||||||
r->gamma_size = crtc.gamma_size;
|
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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -362,6 +352,8 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
|
||||||
if (!(r = drmMalloc(sizeof(*r))))
|
if (!(r = drmMalloc(sizeof(*r))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
r->encoder_id = enc.encoder_id;
|
||||||
|
r->crtc = enc.crtc;
|
||||||
r->encoder_type = enc.encoder_type;
|
r->encoder_type = enc.encoder_type;
|
||||||
r->crtcs = enc.crtcs;
|
r->crtcs = enc.crtcs;
|
||||||
r->clones = enc.clones;
|
r->clones = enc.clones;
|
||||||
|
|
@ -411,7 +403,7 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
r->connector_id = conn.connector;
|
r->connector_id = conn.connector;
|
||||||
r->crtc = conn.crtc;
|
r->encoder = conn.encoder;
|
||||||
r->connection = conn.connection;
|
r->connection = conn.connection;
|
||||||
r->mmWidth = conn.mm_width;
|
r->mmWidth = conn.mm_width;
|
||||||
r->mmHeight = conn.mm_height;
|
r->mmHeight = conn.mm_height;
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ typedef struct _drmModeCrtc {
|
||||||
typedef struct _drmModeEncoder {
|
typedef struct _drmModeEncoder {
|
||||||
unsigned int encoder_id;
|
unsigned int encoder_id;
|
||||||
unsigned int encoder_type;
|
unsigned int encoder_type;
|
||||||
|
uint32_t crtc;
|
||||||
uint32_t crtcs;
|
uint32_t crtcs;
|
||||||
uint32_t clones;
|
uint32_t clones;
|
||||||
} drmModeEncoder, *drmModeEncoderPtr;
|
} drmModeEncoder, *drmModeEncoderPtr;
|
||||||
|
|
@ -134,7 +135,7 @@ typedef enum {
|
||||||
typedef struct _drmModeConnector {
|
typedef struct _drmModeConnector {
|
||||||
unsigned int connector_id;
|
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;
|
||||||
unsigned int connector_type_id;
|
unsigned int connector_type_id;
|
||||||
drmModeConnection connection;
|
drmModeConnection connection;
|
||||||
|
|
|
||||||
|
|
@ -1015,8 +1015,6 @@ int drm_mode_getcrtc(struct drm_device *dev,
|
||||||
{
|
{
|
||||||
struct drm_mode_crtc *crtc_resp = data;
|
struct drm_mode_crtc *crtc_resp = data;
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
struct drm_connector *connector;
|
|
||||||
int ocount;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
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);
|
drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode);
|
||||||
crtc_resp->mode_valid = 1;
|
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 {
|
} else {
|
||||||
crtc_resp->mode_valid = 0;
|
crtc_resp->mode_valid = 0;
|
||||||
|
|
|
||||||
|
|
@ -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("Connector: %d-%d\n", connector->connector_type, connector->connector_type_id);
|
||||||
printf("\tid : %i\n", 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("\tconn : %s\n", getConnectionText(connector->connection));
|
||||||
printf("\tsize : %ix%i (mm)\n", connector->mmWidth, connector->mmHeight);
|
printf("\tsize : %ix%i (mm)\n", connector->mmWidth, connector->mmHeight);
|
||||||
printf("\tcount_modes : %i\n", connector->count_modes);
|
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++) {
|
for (i = 0; i < connector->count_encoders; i++) {
|
||||||
enc = drmModeGetEncoder(fd, connector->encoders[i]);
|
enc = drmModeGetEncoder(fd, connector->encoders[i]);
|
||||||
if (enc) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue