summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/xf86drmMode.c21
-rw-r--r--libdrm/xf86drmMode.h10
-rw-r--r--linux-core/drm_crtc.c18
-rw-r--r--shared-core/drm.h21
-rw-r--r--tests/modeprint/modetest.c25
5 files changed, 48 insertions, 47 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index ca21a961..c3921ee9 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -284,11 +284,6 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
{
struct drm_mode_crtc crtc;
- crtc.count_connectors = 0;
- crtc.connectors = 0;
- crtc.count_possibles = 0;
- crtc.possibles = 0;
-
crtc.x = x;
crtc.y = y;
crtc.crtc_id = crtcId;
@@ -343,8 +338,8 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
enc.encoder_id = encoder_id;
enc.encoder_type = 0;
- enc.crtcs = 0;
- enc.clones = 0;
+ enc.possible_crtcs = 0;
+ enc.possible_clones = 0;
if (ioctl(fd, DRM_IOCTL_MODE_GETENCODER, &enc))
return 0;
@@ -353,10 +348,10 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
return 0;
r->encoder_id = enc.encoder_id;
- r->crtc = enc.crtc;
+ r->crtc_id = enc.crtc_id;
r->encoder_type = enc.encoder_type;
- r->crtcs = enc.crtcs;
- r->clones = enc.clones;
+ r->possible_crtcs = enc.possible_crtcs;
+ r->possible_clones = enc.possible_clones;
return r;
}
@@ -370,7 +365,7 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
struct drm_mode_get_connector conn;
drmModeConnectorPtr r = NULL;
- conn.connector = connector_id;
+ conn.connector_id = connector_id;
conn.connector_type_id = 0;
conn.connector_type = 0;
conn.count_modes = 0;
@@ -402,8 +397,8 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
goto err_allocs;
}
- r->connector_id = conn.connector;
- r->encoder = conn.encoder;
+ r->connector_id = conn.connector_id;
+ r->encoder_id = conn.encoder_id;
r->connection = conn.connection;
r->mmWidth = conn.mm_width;
r->mmHeight = conn.mm_height;
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index 3e2f5c0e..59612a94 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -92,7 +92,7 @@ typedef struct _drmModeCrtc {
unsigned int crtc_id;
unsigned int buffer_id; /**< FB id to connect to 0 = disconnect */
- uint32_t x, y; /**< Position on the frameuffer */
+ uint32_t x, y; /**< Position on the framebuffer */
uint32_t width, height;
int mode_valid;
struct drm_mode_modeinfo mode;
@@ -104,9 +104,9 @@ typedef struct _drmModeCrtc {
typedef struct _drmModeEncoder {
unsigned int encoder_id;
unsigned int encoder_type;
- uint32_t crtc;
- uint32_t crtcs;
- uint32_t clones;
+ unsigned int crtc_id;
+ uint32_t possible_crtcs;
+ uint32_t possible_clones;
} drmModeEncoder, *drmModeEncoderPtr;
typedef enum {
@@ -126,7 +126,7 @@ typedef enum {
typedef struct _drmModeConnector {
unsigned int connector_id;
- unsigned int encoder; /**< Encoder currently connected to */
+ unsigned int encoder_id; /**< Encoder currently connected to */
unsigned int connector_type;
unsigned int connector_type_id;
drmModeConnection connection;
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index 3ee0f86c..f8e09a8c 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -1046,7 +1046,6 @@ int drm_mode_getcrtc(struct drm_device *dev,
else
crtc_resp->fb_id = 0;
- crtc_resp->connectors = 0;
if (crtc->enabled) {
drm_crtc_convert_to_umode(&crtc_resp->mode, &crtc->mode);
@@ -1099,11 +1098,11 @@ int drm_mode_getconnector(struct drm_device *dev,
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
- DRM_DEBUG("connector id %d:\n", out_resp->connector);
+ DRM_DEBUG("connector id %d:\n", out_resp->connector_id);
mutex_lock(&dev->mode_config.mutex);
- obj = drm_mode_object_find(dev, out_resp->connector, DRM_MODE_OBJECT_CONNECTOR);
+ obj = drm_mode_object_find(dev, out_resp->connector_id, DRM_MODE_OBJECT_CONNECTOR);
if (!obj) {
ret = -EINVAL;
goto out;
@@ -1130,6 +1129,7 @@ int drm_mode_getconnector(struct drm_device *dev,
list_for_each_entry(mode, &connector->modes, head)
mode_count++;
+ out_resp->connector_id = connector->base.id;
out_resp->connector_type = connector->connector_type;
out_resp->connector_type_id = connector->connector_type_id;
out_resp->mm_width = connector->display_info.width_mm;
@@ -1137,9 +1137,9 @@ int drm_mode_getconnector(struct drm_device *dev,
out_resp->subpixel = connector->display_info.subpixel_order;
out_resp->connection = connector->status;
if (connector->encoder)
- out_resp->encoder = connector->encoder->base.id;
+ out_resp->encoder_id = connector->encoder->base.id;
else
- out_resp->encoder = 0;
+ out_resp->encoder_id = 0;
/* this ioctl is called twice, once to determine how much space is needed, and the 2nd time to fill it */
if ((out_resp->count_modes >= mode_count) && mode_count) {
@@ -1215,13 +1215,13 @@ int drm_mode_getencoder(struct drm_device *dev,
encoder = obj_to_encoder(obj);
if (encoder->crtc)
- enc_resp->crtc = encoder->crtc->base.id;
+ enc_resp->crtc_id = encoder->crtc->base.id;
else
- enc_resp->crtc = 0;
+ enc_resp->crtc_id = 0;
enc_resp->encoder_type = encoder->encoder_type;
enc_resp->encoder_id = encoder->base.id;
- enc_resp->crtcs = encoder->possible_crtcs;
- enc_resp->clones = encoder->possible_clones;
+ enc_resp->possible_crtcs = encoder->possible_crtcs;
+ enc_resp->possible_clones = encoder->possible_clones;
out:
mutex_unlock(&dev->mode_config.mutex);
diff --git a/shared-core/drm.h b/shared-core/drm.h
index c9b40e78..b64e265d 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -1059,17 +1059,13 @@ struct drm_mode_card_res {
struct drm_mode_crtc {
uint64_t set_connectors_ptr;
+ int count_connectors;
unsigned int crtc_id; /**< Id */
unsigned int fb_id; /**< Id of framebuffer */
int x, y; /**< Position on the frameuffer */
- int count_connectors;
- unsigned int connectors; /**< Connectors that are connected */
-
- int count_possibles;
- unsigned int possibles; /**< Connectors that can be connected */
uint32_t gamma_size;
int mode_valid;
struct drm_mode_modeinfo mode;
@@ -1083,12 +1079,13 @@ struct drm_mode_crtc {
struct drm_mode_get_encoder {
- uint32_t encoder_type;
- uint32_t encoder_id;
+ unsigned int encoder_type;
+ unsigned int encoder_id;
+
+ unsigned int crtc_id; /**< Id of crtc */
- unsigned int crtc; /**< Id of crtc */
- uint32_t crtcs;
- uint32_t clones;
+ uint32_t possible_crtcs;
+ uint32_t possible_clones;
};
/* This is for connectors with multiple signal types. */
@@ -1126,8 +1123,8 @@ struct drm_mode_get_connector {
int count_props;
int count_encoders;
- unsigned int encoder; /**< Current Encoder */
- unsigned int connector; /**< Id */
+ unsigned int encoder_id; /**< Current Encoder */
+ unsigned int connector_id; /**< Id */
unsigned int connector_type;
unsigned int connector_type_id;
diff --git a/tests/modeprint/modetest.c b/tests/modeprint/modetest.c
index d5cbbc56..cefa5262 100644
--- a/tests/modeprint/modetest.c
+++ b/tests/modeprint/modetest.c
@@ -17,6 +17,7 @@ int full_modes;
int encoders;
int crtcs;
int fbs;
+char *module_name;
const char* getConnectionText(drmModeConnection conn)
{
@@ -115,7 +116,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("\tencoder id : %i\n", connector->encoder);
+ printf("\tencoder id : %i\n", connector->encoder_id);
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);
@@ -159,10 +160,10 @@ int printEncoder(int fd, drmModeResPtr res, drmModeEncoderPtr encoder, uint32_t
{
printf("Encoder\n");
printf("\tid :%i\n", id);
- printf("\tcrtc :%d\n", encoder->crtc);
+ printf("\tcrtc_id :%d\n", encoder->crtc_id);
printf("\ttype :%d\n", encoder->encoder_type);
- printf("\tcrtcs :%d\n", encoder->crtcs);
- printf("\tclones :%d\n", encoder->clones);
+ printf("\tpossible_crtcs :%d\n", encoder->possible_crtcs);
+ printf("\tpossible_clones :%d\n", encoder->possible_clones);
return 0;
}
@@ -283,7 +284,9 @@ void args(int argc, char **argv)
full_props = 0;
connectors = 0;
- for (i = 1; i < argc; i++) {
+ module_name = argv[1];
+
+ for (i = 2; i < argc; i++) {
if (strcmp(argv[i], "-fb") == 0) {
fbs = 1;
} else if (strcmp(argv[i], "-crtcs") == 0) {
@@ -316,9 +319,9 @@ void args(int argc, char **argv)
full_props = 1;
connectors = 1;
}
- }
+ }
- if (argc == 1) {
+ if (argc == 2) {
fbs = 1;
edid = 1;
crtcs = 1;
@@ -329,16 +332,22 @@ void args(int argc, char **argv)
connectors = 1;
}
}
+
int main(int argc, char **argv)
{
int fd;
drmModeResPtr res;
+ if (argc == 1) {
+ printf("Please add modulename as first argument\n");
+ return 1;
+ }
+
args(argc, argv);
printf("Starting test\n");
- fd = drmOpen("i915", NULL);
+ fd = drmOpen(module_name, NULL);
if (fd < 0) {
printf("Failed to open the card fd (%d)\n",fd);