drm: add more encoder interfaces

main
Dave Airlie 2008-05-30 12:14:44 +10:00
parent 16a8f824fa
commit fae2c17b31
3 changed files with 25 additions and 0 deletions

View File

@ -381,6 +381,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
out.count_props = 0; out.count_props = 0;
out.props_ptr = 0; out.props_ptr = 0;
out.prop_values_ptr = 0; out.prop_values_ptr = 0;
out.count_encoders = 0;
out.encoders_ptr = 0;
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
return 0; return 0;
@ -393,6 +395,9 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
if (out.count_modes) if (out.count_modes)
out.modes_ptr = VOID2U64(drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo))); out.modes_ptr = VOID2U64(drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo)));
if (out.count_encoders)
out.encoders_ptr = VOID2U64(drmMalloc(out.count_encoders*sizeof(uint32_t)));
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
goto err_allocs; goto err_allocs;
@ -416,6 +421,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t)); r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t));
r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t)); r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t));
r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo)); r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo));
r->count_encoders = out.count_encoders;
r->encoders = drmAllocCpy(U642VOID(out.encoders_ptr), out.count_encoders, sizeof(uint32_t));
r->output_type = out.output_type; r->output_type = out.output_type;
r->output_type_id = out.output_type_id; r->output_type_id = out.output_type_id;
@ -423,6 +430,7 @@ err_allocs:
drmFree(U642VOID(out.prop_values_ptr)); drmFree(U642VOID(out.prop_values_ptr));
drmFree(U642VOID(out.props_ptr)); drmFree(U642VOID(out.props_ptr));
drmFree(U642VOID(out.modes_ptr)); drmFree(U642VOID(out.modes_ptr));
drmFree(U642VOID(out.encoders_ptr));
return r; return r;
} }

View File

@ -154,6 +154,8 @@ typedef struct _drmModeOutput {
uint32_t *props; /**< List of property ids */ uint32_t *props; /**< List of property ids */
uint64_t *prop_values; /**< List of property values */ uint64_t *prop_values; /**< List of property values */
int count_encoders;
uint32_t *encoders; /**< List of encoder ids */
} drmModeOutput, *drmModeOutputPtr; } drmModeOutput, *drmModeOutputPtr;

View File

@ -1026,9 +1026,11 @@ struct drm_mode_card_res {
uint64_t fb_id_ptr; uint64_t fb_id_ptr;
uint64_t crtc_id_ptr; uint64_t crtc_id_ptr;
uint64_t output_id_ptr; uint64_t output_id_ptr;
uint64_t encoder_id_ptr;
int count_fbs; int count_fbs;
int count_crtcs; int count_crtcs;
int count_outputs; int count_outputs;
int count_encoders;
int min_width, max_width; int min_width, max_width;
int min_height, max_height; int min_height, max_height;
}; };
@ -1051,6 +1053,15 @@ struct drm_mode_crtc {
struct drm_mode_modeinfo mode; struct drm_mode_modeinfo mode;
}; };
struct drm_mode_get_encoder {
uint32_t encoder_type;
uint32_t encoder_id;
uint32_t crtcs;
uint32_t clones;
};
#define DRM_MODE_OUTPUT_NONE 0 #define DRM_MODE_OUTPUT_NONE 0
#define DRM_MODE_OUTPUT_DAC 1 #define DRM_MODE_OUTPUT_DAC 1
#define DRM_MODE_OUTPUT_TMDS 2 #define DRM_MODE_OUTPUT_TMDS 2
@ -1059,12 +1070,15 @@ struct drm_mode_crtc {
struct drm_mode_get_output { struct drm_mode_get_output {
uint64_t encoders_ptr;
uint64_t modes_ptr; uint64_t modes_ptr;
uint64_t props_ptr; uint64_t props_ptr;
uint64_t prop_values_ptr; uint64_t prop_values_ptr;
int count_modes; int count_modes;
int count_props; int count_props;
int count_encoders;
unsigned int output; /**< Id */ unsigned int output; /**< Id */
unsigned int crtc; /**< Id of crtc */ unsigned int crtc; /**< Id of crtc */
unsigned int output_type; unsigned int output_type;
@ -1277,6 +1291,7 @@ struct drm_mode_hotplug {
#define DRM_IOCTL_WAIT_HOTPLUG DRM_IOWR(0xAE, union drm_wait_hotplug) #define DRM_IOCTL_WAIT_HOTPLUG DRM_IOWR(0xAE, union drm_wait_hotplug)
#define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xAF, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xAF, struct drm_mode_fb_cmd)
#define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xB0, struct drm_mode_get_encoder)
/*@}*/ /*@}*/
/** /**