diff options
author | Leo (Sunpeng) Li <sunpeng.li@amd.com> | 2018-05-02 10:02:10 -0400 |
---|---|---|
committer | Leo (Sunpeng) Li <sunpeng.li@amd.com> | 2018-05-02 10:13:31 -0400 |
commit | 88cb2a6ec6d4b39349c68ecd5057750d99305bdd (patch) | |
tree | 3f1d4812e3ca14bc4de4e4613b61a2e4dcd3ed3f | |
parent | 431c3eb2110b7b42dc0c0c3fd8181f2d958be257 (diff) |
Use DRM's color LUT/CTM structs
They're already included via xf86drm.h
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
-rw-r--r-- | demo.c | 30 |
1 files changed, 6 insertions, 24 deletions
@@ -44,24 +44,6 @@ #define PROP_DEGAMMA "DEGAMMA_LUT" #define PROP_CTM "CTM" -/** - * The below data structures are identical to the ones used by DRM. They are - * here to help us structure the data being passed to the kernel. - */ -struct _drm_color_ctm { - /* Transformation matrix in S31.32 format. */ - __s64 matrix[9]; -}; - -struct _drm_color_lut { - /* - * Data is U0.16 fixed point format. - */ - __u16 red; - __u16 green; - __u16 blue; - __u16 reserved; -}; /* Struct to make constructing luts easier. */ struct color3d { @@ -123,7 +105,7 @@ static int open_drm_device() * @lut_size: Number of entries in the LUT. */ static void coeffs_to_lut(struct color3d *coeffs, - struct _drm_color_lut *lut, + struct drm_color_lut *lut, int lut_size) { int i; @@ -147,7 +129,7 @@ static void coeffs_to_lut(struct color3d *coeffs, * placed here. */ static void coeffs_to_ctm(double *coeffs, - struct _drm_color_ctm *ctm) + struct drm_color_ctm *ctm) { int i; for (i = 0; i < 9; i++) { @@ -301,14 +283,14 @@ static int set_output_blob(Display *dpy, RROutput output, static int set_gamma(Display *dpy, RROutput output, int drm_fd, struct color3d *coeffs, int is_srgb, int is_degamma) { - struct _drm_color_lut lut[LUT_SIZE]; + struct drm_color_lut lut[LUT_SIZE]; int zero = 0; int ret = 0; char *prop_name = is_degamma ? PROP_DEGAMMA : PROP_GAMMA; if (!is_srgb) { /* Using LUT */ - size_t size = sizeof(struct _drm_color_lut) * LUT_SIZE; + size_t size = sizeof(struct drm_color_lut) * LUT_SIZE; coeffs_to_lut(coeffs, lut, LUT_SIZE); ret = set_output_blob(dpy, output, prop_name, 16, lut, size); if (ret) @@ -335,8 +317,8 @@ static int set_gamma(Display *dpy, RROutput output, int drm_fd, */ static int set_ctm(Display *dpy, RROutput output, int drm_fd, double *coeffs) { - size_t blob_size = sizeof(struct _drm_color_ctm); - struct _drm_color_ctm ctm; + size_t blob_size = sizeof(struct drm_color_ctm); + struct drm_color_ctm ctm; int ret; |