drm: Make the CRTC gamma_set operation optional
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 17 May 2012 11:27:24 +0000 (13:27 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 22 May 2012 09:35:15 +0000 (10:35 +0100)
Drivers for hardware without gamma support should not be forced to
implement a no-op gamma set operation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Clark <rob.clark@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_fb_helper.c
drivers/staging/omapdrm/omap_crtc.c

index 404597e8150ab1959bf9db500743f75a19f39c2e..6cb47d9f0ca2603de2d3af1f859419d65151ef1c 100644 (file)
@@ -3332,6 +3332,11 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
        }
        crtc = obj_to_crtc(obj);
 
+       if (crtc->funcs->gamma_set == NULL) {
+               ret = -ENOSYS;
+               goto out;
+       }
+
        /* memcpy into gamma store */
        if (crtc_lut->gamma_size != crtc->gamma_size) {
                ret = -EINVAL;
index 9b773d51cff502780ec31911d6569ff08f5e4b50..5683b7fdd7466a16a5d1c4df0477c734fed7b0d4 100644 (file)
@@ -136,6 +136,9 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
 {
        uint16_t *r_base, *g_base, *b_base;
 
+       if (crtc->funcs->gamma_set == NULL)
+               return;
+
        r_base = crtc->gamma_store;
        g_base = r_base + crtc->gamma_size;
        b_base = g_base + crtc->gamma_size;
index 490a7f15604bad28b1b4d6e6fd2d4156ba54d88e..8b864afb40b6a9e531e883f5d7d3c393c74efadc 100644 (file)
@@ -36,12 +36,6 @@ struct omap_crtc {
        struct drm_framebuffer *old_fb;
 };
 
-static void omap_crtc_gamma_set(struct drm_crtc *crtc,
-               u16 *red, u16 *green, u16 *blue, uint32_t start, uint32_t size)
-{
-       /* not supported.. at least not yet */
-}
-
 static void omap_crtc_destroy(struct drm_crtc *crtc)
 {
        struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
@@ -198,7 +192,6 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
 }
 
 static const struct drm_crtc_funcs omap_crtc_funcs = {
-       .gamma_set = omap_crtc_gamma_set,
        .set_config = drm_crtc_helper_set_config,
        .destroy = omap_crtc_destroy,
        .page_flip = omap_crtc_page_flip_locked,