export output name to userspace
parent
40bd6dcd86
commit
1e39dc4323
|
@ -40,6 +40,7 @@
|
||||||
#include "xf86drmMode.h"
|
#include "xf86drmMode.h"
|
||||||
#include "xf86drm.h"
|
#include "xf86drm.h"
|
||||||
#include <drm.h>
|
#include <drm.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Util functions
|
* Util functions
|
||||||
|
@ -385,7 +386,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
|
||||||
r->crtcs = out.crtcs;
|
r->crtcs = out.crtcs;
|
||||||
r->clones = out.clones;
|
r->clones = out.clones;
|
||||||
r->modes = drmAllocCpy(out.modes, out.count_modes, sizeof(uint32_t));
|
r->modes = drmAllocCpy(out.modes, out.count_modes, sizeof(uint32_t));
|
||||||
|
strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN);
|
||||||
|
r->name[DRM_OUTPUT_NAME_LEN-1] = 0;
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
err_allocs:
|
err_allocs:
|
||||||
|
|
|
@ -120,7 +120,7 @@ typedef enum {
|
||||||
typedef struct _drmModeOutput {
|
typedef struct _drmModeOutput {
|
||||||
|
|
||||||
unsigned int crtc; /**< Crtc currently connected to */
|
unsigned int crtc; /**< Crtc currently connected to */
|
||||||
|
unsigned char name[DRM_OUTPUT_NAME_LEN];
|
||||||
drmModeConnection connection;
|
drmModeConnection connection;
|
||||||
uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
|
uint32_t mmWidth, mmHeight; /**< HxW in millimeters */
|
||||||
drmModeSubPixel subpixel;
|
drmModeSubPixel subpixel;
|
||||||
|
|
|
@ -838,16 +838,19 @@ int drm_mode_getoutput(struct inode *inode, struct file *filp,
|
||||||
if (copy_from_user(&out_resp, argp, sizeof(out_resp)))
|
if (copy_from_user(&out_resp, argp, sizeof(out_resp)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
DRM_DEBUG("output id %d\n", out_resp.output);
|
DRM_DEBUG("output id %d:\n", out_resp.output);
|
||||||
output= idr_find(&dev->mode_config.crtc_idr, out_resp.output);
|
output= idr_find(&dev->mode_config.crtc_idr, out_resp.output);
|
||||||
if (!output || (output->id != out_resp.output))
|
if (!output || (output->id != out_resp.output))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
DRM_DEBUG("about to count modes\n");
|
DRM_DEBUG("about to count modes: %s\n", output->name);
|
||||||
list_for_each_entry(mode, &output->modes, head)
|
list_for_each_entry(mode, &output->modes, head)
|
||||||
mode_count++;
|
mode_count++;
|
||||||
|
|
||||||
DRM_DEBUG("about to count modes %d %d %p\n", mode_count, out_resp.count_modes, output->crtc);
|
DRM_DEBUG("about to count modes %d %d %p\n", mode_count, out_resp.count_modes, output->crtc);
|
||||||
|
strncpy(out_resp.name, output->name, DRM_OUTPUT_NAME_LEN);
|
||||||
|
out_resp.name[DRM_OUTPUT_NAME_LEN-1] = 0;
|
||||||
|
|
||||||
out_resp.mm_width = output->mm_width;
|
out_resp.mm_width = output->mm_width;
|
||||||
out_resp.mm_height = output->mm_height;
|
out_resp.mm_height = output->mm_height;
|
||||||
out_resp.subpixel = output->subpixel_order;
|
out_resp.subpixel = output->subpixel_order;
|
||||||
|
|
|
@ -891,7 +891,7 @@ typedef union drm_mm_init_arg{
|
||||||
/*
|
/*
|
||||||
* Drm mode setting
|
* Drm mode setting
|
||||||
*/
|
*/
|
||||||
|
#define DRM_OUTPUT_NAME_LEN 32
|
||||||
#define DRM_DISPLAY_MODE_LEN 32
|
#define DRM_DISPLAY_MODE_LEN 32
|
||||||
|
|
||||||
struct drm_mode_modeinfo {
|
struct drm_mode_modeinfo {
|
||||||
|
@ -946,6 +946,7 @@ struct drm_mode_get_output {
|
||||||
|
|
||||||
unsigned int output; /**< Id */
|
unsigned int output; /**< Id */
|
||||||
unsigned int crtc; /**< Id of crtc */
|
unsigned int crtc; /**< Id of crtc */
|
||||||
|
unsigned char name[DRM_OUTPUT_NAME_LEN];
|
||||||
|
|
||||||
unsigned int connection;
|
unsigned int connection;
|
||||||
unsigned int mm_width, mm_height; /**< HxW in millimeters */
|
unsigned int mm_width, mm_height; /**< HxW in millimeters */
|
||||||
|
|
Loading…
Reference in New Issue