]> Git Repo - linux.git/commitdiff
Merge tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel...
authorDave Airlie <[email protected]>
Thu, 9 Jun 2016 01:19:28 +0000 (11:19 +1000)
committerDave Airlie <[email protected]>
Thu, 9 Jun 2016 01:19:28 +0000 (11:19 +1000)
As promised, piles of prep work all around:
- drm_atomic_state rework, prep for nonblocking commit helpers
- fence patches from Gustavo and Christian to prep for atomic fences and
  some cool work in ttm/amdgpu from Christian
- drm event prep for both nonblocking commit and atomic fences
- Gustavo seems on a crusade against the non-kms-native version of the
  vblank functions.
- prep work from Boris to nuke all the silly ->best_encoder
  implementations we have (we really only need that for truly dynamic
  cases like dvi-i vs dvi-d or dp mst selecting the right transcoder on
  intel)
- prep work from Laurent to rework the format handling functions
- and few small things all over

* tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel: (47 commits)
  drm/dsi: Implement set tear scanline
  drm/fb_cma_helper: Implement fb_mmap callback
  drm/qxl: Remove useless drm_fb_get_bpp_depth() call
  drm/ast: Remove useless drm_fb_get_bpp_depth() call
  drm/atomic: Fix remaining places where !funcs->best_encoder is valid
  drm/core: Change declaration for gamma_set.
  Documentation: add fence-array to kernel DocBook
  drm/shmobile: use drm_crtc_vblank_{get,put}()
  drm/radeon: use drm_crtc_vblank_{get,put}()
  drm/qxl: use drm_crtc_vblank_{get,put}()
  drm/atmel: use drm_crtc_vblank_{get,put}()
  drm/armada: use drm_crtc_vblank_{get,put}()
  drm/amdgpu: use drm_crtc_vblank_{get,put}()
  drm/virtio: use drm_crtc_send_vblank_event()
  drm/udl: use drm_crtc_send_vblank_event()
  drm/qxl: use drm_crtc_send_vblank_event()
  drm/atmel: use drm_crtc_send_vblank_event()
  drm/armada: use drm_crtc_send_vblank_event()
  drm/doc: Switch to sphinx/rst fixed-width quoting
  drm/doc: Drop kerneldoc for static functions in drm_irq.c
  ...

1  2 
Documentation/DocBook/device-drivers.tmpl
drivers/gpu/drm/arc/arcpgu_drv.c
drivers/gpu/drm/arm/hdlcd_crtc.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_fb_cma_helper.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/mgag200/mgag200_mode.c
include/linux/fence.h

index 8c68768ebee57ea0c2daaab4eec5d146c4d36ec7,5744ec7d2d303db97e8fc9aa01e7311a89e7d948..c3313d45f4d69d55c8926f419366f0982c6f40d1
@@@ -128,44 -128,18 +128,48 @@@ X!Edrivers/base/interface.
  !Edrivers/base/platform.c
  !Edrivers/base/bus.c
       </sect1>
 -     <sect1><title>Device Drivers DMA Management</title>
 +     <sect1>
 +       <title>Buffer Sharing and Synchronization</title>
 +       <para>
 +         The dma-buf subsystem provides the framework for sharing buffers
 +         for hardware (DMA) access across multiple device drivers and
 +         subsystems, and for synchronizing asynchronous hardware access.
 +       </para>
 +       <para>
 +         This is used, for example, by drm "prime" multi-GPU support, but
 +         is of course not limited to GPU use cases.
 +       </para>
 +       <para>
 +         The three main components of this are: (1) dma-buf, representing
 +         a sg_table and exposed to userspace as a file descriptor to allow
 +         passing between devices, (2) fence, which provides a mechanism
 +         to signal when one device as finished access, and (3) reservation,
 +         which manages the shared or exclusive fence(s) associated with
 +         the buffer.
 +       </para>
 +       <sect2><title>dma-buf</title>
  !Edrivers/dma-buf/dma-buf.c
 +!Iinclude/linux/dma-buf.h
 +       </sect2>
 +       <sect2><title>reservation</title>
 +!Pdrivers/dma-buf/reservation.c Reservation Object Overview
 +!Edrivers/dma-buf/reservation.c
 +!Iinclude/linux/reservation.h
 +       </sect2>
 +       <sect2><title>fence</title>
  !Edrivers/dma-buf/fence.c
 -!Edrivers/dma-buf/seqno-fence.c
 -!Edrivers/dma-buf/fence-array.c
  !Iinclude/linux/fence.h
 +!Edrivers/dma-buf/seqno-fence.c
  !Iinclude/linux/seqno-fence.h
++!Edrivers/dma-buf/fence-array.c
+ !Iinclude/linux/fence-array.h
+ !Edrivers/dma-buf/reservation.c
+ !Iinclude/linux/reservation.h
  !Edrivers/dma-buf/sync_file.c
  !Iinclude/linux/sync_file.h
 +       </sect2>
 +     </sect1>
 +     <sect1><title>Device Drivers DMA Management</title>
  !Edrivers/base/dma-coherent.c
  !Edrivers/base/dma-mapping.c
       </sect1>
index bc53ebb83f755d7b5a63e20a834654251d0b5a56,69b5be0f9fb8af359d71c485b55f4ccb3fc64c87..7675bbc701333d1285356d226d9adc6fea494eca
@@@ -92,7 -92,7 +92,7 @@@ static void arcpgu_preclose(struct drm_
                if (e->base.file_priv != file)
                        continue;
                list_del(&e->base.link);
-               e->base.destroy(&e->base);
+               kfree(&e->base);
        }
        spin_unlock_irqrestore(&drm->event_lock, flags);
  }
@@@ -207,7 -207,7 +207,7 @@@ static struct drm_driver arcpgu_drm_dri
        .get_vblank_counter = drm_vblank_no_hw_counter,
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 -      .gem_free_object = drm_gem_cma_free_object,
 +      .gem_free_object_unlocked = drm_gem_cma_free_object,
        .gem_vm_ops = &drm_gem_cma_vm_ops,
        .gem_prime_export = drm_gem_prime_export,
        .gem_prime_import = drm_gem_prime_import,
index 0813c2f069319967458fdafdfd8f5a57421d558b,b44f72722764d22fa06228bb36b03d81a9708d36..48019ae22ddba5fcbb3283e94a016543fba3d8b3
   *
   */
  
 +static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
 +{
 +      struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
 +
 +      /* stop the controller on cleanup */
 +      hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
 +      drm_crtc_cleanup(crtc);
 +}
 +
  static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
 -      .destroy = drm_crtc_cleanup,
 +      .destroy = hdlcd_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
        .page_flip = drm_atomic_helper_page_flip,
        .reset = drm_atomic_helper_crtc_reset,
@@@ -106,7 -97,7 +106,7 @@@ static void hdlcd_crtc_mode_set_nofb(st
        struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
        struct drm_display_mode *m = &crtc->state->adjusted_mode;
        struct videomode vm;
 -      unsigned int polarities, line_length, err;
 +      unsigned int polarities, err;
  
        vm.vfront_porch = m->crtc_vsync_start - m->crtc_vdisplay;
        vm.vback_porch = m->crtc_vtotal - m->crtc_vsync_end;
        if (m->flags & DRM_MODE_FLAG_PVSYNC)
                polarities |= HDLCD_POLARITY_VSYNC;
  
 -      line_length = crtc->primary->state->fb->pitches[0];
 -
        /* Allow max number of outstanding requests and largest burst size */
        hdlcd_write(hdlcd, HDLCD_REG_BUS_OPTIONS,
                    HDLCD_BUS_MAX_OUTSTAND | HDLCD_BUS_BURST_16);
  
 -      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, line_length);
 -      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, line_length);
 -      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, m->crtc_vdisplay - 1);
        hdlcd_write(hdlcd, HDLCD_REG_V_DATA, m->crtc_vdisplay - 1);
        hdlcd_write(hdlcd, HDLCD_REG_V_BACK_PORCH, vm.vback_porch - 1);
        hdlcd_write(hdlcd, HDLCD_REG_V_FRONT_PORCH, vm.vfront_porch - 1);
        hdlcd_write(hdlcd, HDLCD_REG_V_SYNC, vm.vsync_len - 1);
 +      hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
        hdlcd_write(hdlcd, HDLCD_REG_H_BACK_PORCH, vm.hback_porch - 1);
        hdlcd_write(hdlcd, HDLCD_REG_H_FRONT_PORCH, vm.hfront_porch - 1);
        hdlcd_write(hdlcd, HDLCD_REG_H_SYNC, vm.hsync_len - 1);
 -      hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
        hdlcd_write(hdlcd, HDLCD_REG_POLARITIES, polarities);
  
        err = hdlcd_set_pxl_fmt(crtc);
@@@ -148,19 -144,20 +148,19 @@@ static void hdlcd_crtc_enable(struct dr
        struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
  
        clk_prepare_enable(hdlcd->clk);
 +      hdlcd_crtc_mode_set_nofb(crtc);
        hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1);
 -      drm_crtc_vblank_on(crtc);
  }
  
  static void hdlcd_crtc_disable(struct drm_crtc *crtc)
  {
        struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
  
 -      if (!crtc->primary->fb)
 +      if (!crtc->state->active)
                return;
  
 -      clk_disable_unprepare(hdlcd->clk);
        hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
 -      drm_crtc_vblank_off(crtc);
 +      clk_disable_unprepare(hdlcd->clk);
  }
  
  static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
  static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
                                    struct drm_crtc_state *state)
  {
 -      struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
 -      unsigned long flags;
 -
 -      if (crtc->state->event) {
 -              struct drm_pending_vblank_event *event = crtc->state->event;
 +      struct drm_pending_vblank_event *event = crtc->state->event;
  
 +      if (event) {
                crtc->state->event = NULL;
 -              event->pipe = drm_crtc_index(crtc);
 -
 -              WARN_ON(drm_crtc_vblank_get(crtc) != 0);
  
 -              spin_lock_irqsave(&crtc->dev->event_lock, flags);
 -              list_add_tail(&event->base.link, &hdlcd->event_list);
 -              spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 +              spin_lock_irq(&crtc->dev->event_lock);
 +              if (drm_crtc_vblank_get(crtc) == 0)
 +                      drm_crtc_arm_vblank_event(crtc, event);
 +              else
 +                      drm_crtc_send_vblank_event(crtc, event);
 +              spin_unlock_irq(&crtc->dev->event_lock);
        }
  }
  
- static void hdlcd_crtc_atomic_flush(struct drm_crtc *crtc,
-                                   struct drm_crtc_state *state)
- {
- }
- static bool hdlcd_crtc_mode_fixup(struct drm_crtc *crtc,
-                       const struct drm_display_mode *mode,
-                       struct drm_display_mode *adjusted_mode)
- {
-       return true;
- }
  static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
-       .mode_fixup     = hdlcd_crtc_mode_fixup,
-       .mode_set       = drm_helper_crtc_mode_set,
-       .mode_set_base  = drm_helper_crtc_mode_set_base,
-       .mode_set_nofb  = hdlcd_crtc_mode_set_nofb,
        .enable         = hdlcd_crtc_enable,
        .disable        = hdlcd_crtc_disable,
-       .prepare        = hdlcd_crtc_disable,
-       .commit         = hdlcd_crtc_enable,
        .atomic_check   = hdlcd_crtc_atomic_check,
        .atomic_begin   = hdlcd_crtc_atomic_begin,
-       .atomic_flush   = hdlcd_crtc_atomic_flush,
  };
  
  static int hdlcd_plane_atomic_check(struct drm_plane *plane,
                                    struct drm_plane_state *state)
  {
 +      u32 src_w, src_h;
 +
 +      src_w = state->src_w >> 16;
 +      src_h = state->src_h >> 16;
 +
 +      /* we can't do any scaling of the plane source */
 +      if ((src_w != state->crtc_w) || (src_h != state->crtc_h))
 +              return -EINVAL;
 +
        return 0;
  }
  
@@@ -242,31 -214,20 +223,31 @@@ static void hdlcd_plane_atomic_update(s
  {
        struct hdlcd_drm_private *hdlcd;
        struct drm_gem_cma_object *gem;
 +      unsigned int depth, bpp;
 +      u32 src_w, src_h, dest_w, dest_h;
        dma_addr_t scanout_start;
  
 -      if (!plane->state->crtc || !plane->state->fb)
 +      if (!plane->state->fb)
                return;
  
 -      hdlcd = crtc_to_hdlcd_priv(plane->state->crtc);
 +      drm_fb_get_bpp_depth(plane->state->fb->pixel_format, &depth, &bpp);
 +      src_w = plane->state->src_w >> 16;
 +      src_h = plane->state->src_h >> 16;
 +      dest_w = plane->state->crtc_w;
 +      dest_h = plane->state->crtc_h;
        gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
 -      scanout_start = gem->paddr;
 +      scanout_start = gem->paddr + plane->state->fb->offsets[0] +
 +              plane->state->crtc_y * plane->state->fb->pitches[0] +
 +              plane->state->crtc_x * bpp / 8;
 +
 +      hdlcd = plane->dev->dev_private;
 +      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
 +      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
 +      hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
        hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
  }
  
  static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
 -      .prepare_fb = NULL,
 -      .cleanup_fb = NULL,
        .atomic_check = hdlcd_plane_atomic_check,
        .atomic_update = hdlcd_plane_atomic_update,
  };
@@@ -314,6 -275,16 +295,6 @@@ static struct drm_plane *hdlcd_plane_in
        return plane;
  }
  
 -void hdlcd_crtc_suspend(struct drm_crtc *crtc)
 -{
 -      hdlcd_crtc_disable(crtc);
 -}
 -
 -void hdlcd_crtc_resume(struct drm_crtc *crtc)
 -{
 -      hdlcd_crtc_enable(crtc);
 -}
 -
  int hdlcd_setup_crtc(struct drm_device *drm)
  {
        struct hdlcd_drm_private *hdlcd = drm->dev_private;
index bd12231ab0cdeeb431b8eba261d1a18459556da5,461b39c9bf708786e435059d64fa5841d99b5476..613f6c99b76a67e9e6054661f56ac695b7eb4253
@@@ -374,8 -374,8 +374,8 @@@ static void atmel_hlcdc_crtc_finish_pag
  
        spin_lock_irqsave(&dev->event_lock, flags);
        if (crtc->event) {
-               drm_send_vblank_event(dev, crtc->id, crtc->event);
-               drm_vblank_put(dev, crtc->id);
+               drm_crtc_send_vblank_event(&crtc->base, crtc->event);
+               drm_crtc_vblank_put(&crtc->base);
                crtc->event = NULL;
        }
        spin_unlock_irqrestore(&dev->event_lock, flags);
@@@ -391,11 -391,12 +391,11 @@@ void atmel_hlcdc_crtc_reset(struct drm_
  {
        struct atmel_hlcdc_crtc_state *state;
  
 -      if (crtc->state && crtc->state->mode_blob)
 -              drm_property_unreference_blob(crtc->state->mode_blob);
 -
        if (crtc->state) {
 +              __drm_atomic_helper_crtc_destroy_state(crtc->state);
                state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
                kfree(state);
 +              crtc->state = NULL;
        }
  
        state = kzalloc(sizeof(*state), GFP_KERNEL);
@@@ -414,9 -415,8 +414,9 @@@ atmel_hlcdc_crtc_duplicate_state(struc
                return NULL;
  
        state = kmalloc(sizeof(*state), GFP_KERNEL);
 -      if (state)
 -              __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
 +      if (!state)
 +              return NULL;
 +      __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
  
        cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
        state->output_mode = cur->output_mode;
index c204ef32df16425bc0c18bd10735baf4414e6530,1db198df301414d5b315b61c0844cddd51786534..5e4b820a977c981f9583a6d1adbe21968e807729
  void drm_atomic_state_default_release(struct drm_atomic_state *state)
  {
        kfree(state->connectors);
-       kfree(state->connector_states);
        kfree(state->crtcs);
-       kfree(state->crtc_states);
        kfree(state->planes);
-       kfree(state->plane_states);
  }
  EXPORT_SYMBOL(drm_atomic_state_default_release);
  
@@@ -72,18 -69,10 +69,10 @@@ drm_atomic_state_init(struct drm_devic
                               sizeof(*state->crtcs), GFP_KERNEL);
        if (!state->crtcs)
                goto fail;
-       state->crtc_states = kcalloc(dev->mode_config.num_crtc,
-                                    sizeof(*state->crtc_states), GFP_KERNEL);
-       if (!state->crtc_states)
-               goto fail;
        state->planes = kcalloc(dev->mode_config.num_total_plane,
                                sizeof(*state->planes), GFP_KERNEL);
        if (!state->planes)
                goto fail;
-       state->plane_states = kcalloc(dev->mode_config.num_total_plane,
-                                     sizeof(*state->plane_states), GFP_KERNEL);
-       if (!state->plane_states)
-               goto fail;
  
        state->dev = dev;
  
@@@ -139,40 -128,40 +128,40 @@@ void drm_atomic_state_default_clear(str
        DRM_DEBUG_ATOMIC("Clearing atomic state %p\n", state);
  
        for (i = 0; i < state->num_connector; i++) {
-               struct drm_connector *connector = state->connectors[i];
+               struct drm_connector *connector = state->connectors[i].ptr;
  
                if (!connector)
                        continue;
  
                connector->funcs->atomic_destroy_state(connector,
-                                                      state->connector_states[i]);
-               state->connectors[i] = NULL;
-               state->connector_states[i] = NULL;
+                                                      state->connectors[i].state);
+               state->connectors[i].ptr = NULL;
+               state->connectors[i].state = NULL;
                drm_connector_unreference(connector);
        }
  
        for (i = 0; i < config->num_crtc; i++) {
-               struct drm_crtc *crtc = state->crtcs[i];
+               struct drm_crtc *crtc = state->crtcs[i].ptr;
  
                if (!crtc)
                        continue;
  
                crtc->funcs->atomic_destroy_state(crtc,
-                                                 state->crtc_states[i]);
-               state->crtcs[i] = NULL;
-               state->crtc_states[i] = NULL;
+                                                 state->crtcs[i].state);
+               state->crtcs[i].ptr = NULL;
+               state->crtcs[i].state = NULL;
        }
  
        for (i = 0; i < config->num_total_plane; i++) {
-               struct drm_plane *plane = state->planes[i];
+               struct drm_plane *plane = state->planes[i].ptr;
  
                if (!plane)
                        continue;
  
                plane->funcs->atomic_destroy_state(plane,
-                                                  state->plane_states[i]);
-               state->planes[i] = NULL;
-               state->plane_states[i] = NULL;
+                                                  state->planes[i].state);
+               state->planes[i].ptr = NULL;
+               state->planes[i].state = NULL;
        }
  }
  EXPORT_SYMBOL(drm_atomic_state_default_clear);
@@@ -270,8 -259,8 +259,8 @@@ drm_atomic_get_crtc_state(struct drm_at
        if (!crtc_state)
                return ERR_PTR(-ENOMEM);
  
-       state->crtc_states[index] = crtc_state;
-       state->crtcs[index] = crtc;
+       state->crtcs[index].state = crtc_state;
+       state->crtcs[index].ptr = crtc;
        crtc_state->state = state;
  
        DRM_DEBUG_ATOMIC("Added [CRTC:%d:%s] %p state to %p\n",
@@@ -351,8 -340,6 +340,8 @@@ int drm_atomic_set_mode_prop_for_crtc(s
        drm_property_unreference_blob(state->mode_blob);
        state->mode_blob = NULL;
  
 +      memset(&state->mode, 0, sizeof(state->mode));
 +
        if (blob) {
                if (blob->length != sizeof(struct drm_mode_modeinfo) ||
                    drm_mode_convert_umode(&state->mode,
                DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
                                 state->mode.name, state);
        } else {
 -              memset(&state->mode, 0, sizeof(state->mode));
                state->enable = false;
                DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
                                 state);
@@@ -632,8 -620,8 +621,8 @@@ drm_atomic_get_plane_state(struct drm_a
        if (!plane_state)
                return ERR_PTR(-ENOMEM);
  
-       state->plane_states[index] = plane_state;
-       state->planes[index] = plane;
+       state->planes[index].state = plane_state;
+       state->planes[index].ptr = plane;
        plane_state->state = state;
  
        DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
@@@ -897,8 -885,7 +886,7 @@@ drm_atomic_get_connector_state(struct d
        index = drm_connector_index(connector);
  
        if (index >= state->num_connector) {
-               struct drm_connector **c;
-               struct drm_connector_state **cs;
+               struct __drm_connnectors_state *c;
                int alloc = max(index + 1, config->num_connector);
  
                c = krealloc(state->connectors, alloc * sizeof(*state->connectors), GFP_KERNEL);
                memset(&state->connectors[state->num_connector], 0,
                       sizeof(*state->connectors) * (alloc - state->num_connector));
  
-               cs = krealloc(state->connector_states, alloc * sizeof(*state->connector_states), GFP_KERNEL);
-               if (!cs)
-                       return ERR_PTR(-ENOMEM);
-               state->connector_states = cs;
-               memset(&state->connector_states[state->num_connector], 0,
-                      sizeof(*state->connector_states) * (alloc - state->num_connector));
                state->num_connector = alloc;
        }
  
-       if (state->connector_states[index])
-               return state->connector_states[index];
+       if (state->connectors[index].state)
+               return state->connectors[index].state;
  
        connector_state = connector->funcs->atomic_duplicate_state(connector);
        if (!connector_state)
                return ERR_PTR(-ENOMEM);
  
        drm_connector_reference(connector);
-       state->connector_states[index] = connector_state;
-       state->connectors[index] = connector;
+       state->connectors[index].state = connector_state;
+       state->connectors[index].ptr = connector;
        connector_state->state = state;
  
        DRM_DEBUG_ATOMIC("Added [CONNECTOR:%d] %p state to %p\n",
@@@ -1432,7 -1412,8 +1413,8 @@@ EXPORT_SYMBOL(drm_atomic_nonblocking_co
   */
  
  static struct drm_pending_vblank_event *create_vblank_event(
-               struct drm_device *dev, struct drm_file *file_priv, uint64_t user_data)
+               struct drm_device *dev, struct drm_file *file_priv,
+               struct fence *fence, uint64_t user_data)
  {
        struct drm_pending_vblank_event *e = NULL;
        int ret;
        e->event.base.length = sizeof(e->event);
        e->event.user_data = user_data;
  
-       ret = drm_event_reserve_init(dev, file_priv, &e->base, &e->event.base);
-       if (ret) {
-               kfree(e);
-               return NULL;
+       if (file_priv) {
+               ret = drm_event_reserve_init(dev, file_priv, &e->base,
+                                            &e->event.base);
+               if (ret) {
+                       kfree(e);
+                       return NULL;
+               }
        }
  
+       e->base.fence = fence;
        return e;
  }
  
@@@ -1690,7 -1676,8 +1677,8 @@@ retry
                for_each_crtc_in_state(state, crtc, crtc_state, i) {
                        struct drm_pending_vblank_event *e;
  
-                       e = create_vblank_event(dev, file_priv, arg->user_data);
+                       e = create_vblank_event(dev, file_priv, NULL,
+                                               arg->user_data);
                        if (!e) {
                                ret = -ENOMEM;
                                goto out;
index 1e28eeefcd65f4dec459c0c29614bcabbf15f916,889e01f1b3f2176641bf1af0c10c213a407a1d0d..da2f28ea5fad6f2bb8a722d47a1c35786cda4bfa
@@@ -535,7 -535,7 +535,7 @@@ EXPORT_SYMBOL(drm_framebuffer_unregiste
   *
   * Cleanup framebuffer. This function is intended to be used from the drivers
   * ->destroy callback. It can also be used to clean up driver private
-  *  framebuffers embedded into a larger structure.
+  * framebuffers embedded into a larger structure.
   *
   * Note that this function does not remove the fb from active usuage - if it is
   * still used anywhere, hilarity can ensue since userspace could call getfb on
@@@ -692,7 -692,7 +692,7 @@@ int drm_crtc_init_with_planes(struct dr
        crtc->base.properties = &crtc->properties;
  
        list_add_tail(&crtc->head, &config->crtc_list);
-       config->num_crtc++;
+       crtc->index = config->num_crtc++;
  
        crtc->primary = primary;
        crtc->cursor = cursor;
@@@ -722,6 -722,11 +722,11 @@@ void drm_crtc_cleanup(struct drm_crtc *
  {
        struct drm_device *dev = crtc->dev;
  
+       /* Note that the crtc_list is considered to be static; should we
+        * remove the drm_crtc at runtime we would have to decrement all
+        * the indices on the drm_crtc after us in the crtc_list.
+        */
        kfree(crtc->gamma_store);
        crtc->gamma_store = NULL;
  
  }
  EXPORT_SYMBOL(drm_crtc_cleanup);
  
- /**
-  * drm_crtc_index - find the index of a registered CRTC
-  * @crtc: CRTC to find index for
-  *
-  * Given a registered CRTC, return the index of that CRTC within a DRM
-  * device's list of CRTCs.
-  */
- unsigned int drm_crtc_index(struct drm_crtc *crtc)
- {
-       unsigned int index = 0;
-       struct drm_crtc *tmp;
-       drm_for_each_crtc(tmp, crtc->dev) {
-               if (tmp == crtc)
-                       return index;
-               index++;
-       }
-       BUG();
- }
- EXPORT_SYMBOL(drm_crtc_index);
  /*
   * drm_mode_remove - remove and free a mode
   * @connector: connector list to modify
@@@ -1166,7 -1148,7 +1148,7 @@@ int drm_encoder_init(struct drm_device 
        }
  
        list_add_tail(&encoder->head, &dev->mode_config.encoder_list);
-       dev->mode_config.num_encoder++;
+       encoder->index = dev->mode_config.num_encoder++;
  
  out_put:
        if (ret)
@@@ -1179,29 -1161,6 +1161,6 @@@ out_unlock
  }
  EXPORT_SYMBOL(drm_encoder_init);
  
- /**
-  * drm_encoder_index - find the index of a registered encoder
-  * @encoder: encoder to find index for
-  *
-  * Given a registered encoder, return the index of that encoder within a DRM
-  * device's list of encoders.
-  */
- unsigned int drm_encoder_index(struct drm_encoder *encoder)
- {
-       unsigned int index = 0;
-       struct drm_encoder *tmp;
-       drm_for_each_encoder(tmp, encoder->dev) {
-               if (tmp == encoder)
-                       return index;
-               index++;
-       }
-       BUG();
- }
- EXPORT_SYMBOL(drm_encoder_index);
  /**
   * drm_encoder_cleanup - cleans up an initialised encoder
   * @encoder: encoder to cleanup
@@@ -1212,6 -1171,11 +1171,11 @@@ void drm_encoder_cleanup(struct drm_enc
  {
        struct drm_device *dev = encoder->dev;
  
+       /* Note that the encoder_list is considered to be static; should we
+        * remove the drm_encoder at runtime we would have to decrement all
+        * the indices on the drm_encoder after us in the encoder_list.
+        */
        drm_modeset_lock_all(dev);
        drm_mode_object_unregister(dev, &encoder->base);
        kfree(encoder->name);
@@@ -1300,7 -1264,7 +1264,7 @@@ int drm_universal_plane_init(struct drm
        plane->type = type;
  
        list_add_tail(&plane->head, &config->plane_list);
-       config->num_total_plane++;
+       plane->index = config->num_total_plane++;
        if (plane->type == DRM_PLANE_TYPE_OVERLAY)
                config->num_overlay_plane++;
  
@@@ -1374,6 -1338,11 +1338,11 @@@ void drm_plane_cleanup(struct drm_plan
  
        BUG_ON(list_empty(&plane->head));
  
+       /* Note that the plane_list is considered to be static; should we
+        * remove the drm_plane at runtime we would have to decrement all
+        * the indices on the drm_plane after us in the plane_list.
+        */
        list_del(&plane->head);
        dev->mode_config.num_total_plane--;
        if (plane->type == DRM_PLANE_TYPE_OVERLAY)
  }
  EXPORT_SYMBOL(drm_plane_cleanup);
  
- /**
-  * drm_plane_index - find the index of a registered plane
-  * @plane: plane to find index for
-  *
-  * Given a registered plane, return the index of that CRTC within a DRM
-  * device's list of planes.
-  */
- unsigned int drm_plane_index(struct drm_plane *plane)
- {
-       unsigned int index = 0;
-       struct drm_plane *tmp;
-       drm_for_each_plane(tmp, plane->dev) {
-               if (tmp == plane)
-                       return index;
-               index++;
-       }
-       BUG();
- }
- EXPORT_SYMBOL(drm_plane_index);
  /**
   * drm_plane_from_index - find the registered plane at an index
   * @dev: DRM device
@@@ -1425,13 -1371,11 +1371,11 @@@ struct drm_plane 
  drm_plane_from_index(struct drm_device *dev, int idx)
  {
        struct drm_plane *plane;
-       unsigned int i = 0;
  
-       drm_for_each_plane(plane, dev) {
-               if (i == idx)
+       drm_for_each_plane(plane, dev)
+               if (idx == plane->index)
                        return plane;
-               i++;
-       }
        return NULL;
  }
  EXPORT_SYMBOL(drm_plane_from_index);
@@@ -2821,6 -2765,8 +2765,6 @@@ int drm_mode_setcrtc(struct drm_device 
                        goto out;
                }
  
 -              drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 -
                /*
                 * Check whether the primary plane supports the fb pixel format.
                 * Drivers not implementing the universal planes API use a
@@@ -4839,8 -4785,7 +4783,8 @@@ bool drm_property_change_valid_get(stru
                if (value == 0)
                        return true;
  
 -              return _object_find(property->dev, value, property->values[0]) != NULL;
 +              *ref = _object_find(property->dev, value, property->values[0]);
 +              return *ref != NULL;
        }
  
        for (i = 0; i < property->num_values; i++)
@@@ -5227,7 -5172,7 +5171,7 @@@ int drm_mode_gamma_set_ioctl(struct drm
                goto out;
        }
  
-       crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size);
+       ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size);
  
  out:
        drm_modeset_unlock_all(dev);
index 5075fae3c4e207da059773cb8bd57f70746bfccd,b6808020dd21695400bb8b4ad65dfce103809bed..2e7ef0b325e29d4d67248fc90502747eb0e609a2
@@@ -23,6 -23,7 +23,7 @@@
  #include <drm/drm_crtc_helper.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_fb_cma_helper.h>
+ #include <linux/dma-mapping.h>
  #include <linux/module.h>
  
  #define DEFAULT_FBDEFIO_DELAY_MS 50
@@@ -52,7 -53,7 +53,7 @@@ struct drm_fbdev_cma 
   * will be set up automatically. dirty() is called by
   * drm_fb_helper_deferred_io() in process context (struct delayed_work).
   *
-  * Example fbdev deferred io code:
+  * Example fbdev deferred io code::
   *
   *     static int driver_fbdev_fb_dirty(struct drm_framebuffer *fb,
   *                                      struct drm_file *file_priv,
@@@ -162,6 -163,10 +163,10 @@@ static struct drm_fb_cma *drm_fb_cma_al
   * drm_fb_cma_create_with_funcs() - helper function for the
   *                                  &drm_mode_config_funcs ->fb_create
   *                                  callback function
+  * @dev: DRM device
+  * @file_priv: drm file for the ioctl call
+  * @mode_cmd: metadata from the userspace fb creation request
+  * @funcs: vtable to be used for the new framebuffer object
   *
   * This can be used to set &drm_framebuffer_funcs for drivers that need the
   * dirty() callback. Use drm_fb_cma_create() if you don't need to change
@@@ -223,6 -228,9 +228,9 @@@ EXPORT_SYMBOL_GPL(drm_fb_cma_create_wit
  
  /**
   * drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function
+  * @dev: DRM device
+  * @file_priv: drm file for the ioctl call
+  * @mode_cmd: metadata from the userspace fb creation request
   *
   * If your hardware has special alignment or pitch requirements these should be
   * checked before calling this function. Use drm_fb_cma_create_with_funcs() if
@@@ -246,7 -254,7 +254,7 @@@ EXPORT_SYMBOL_GPL(drm_fb_cma_create)
   * This function will usually be called from the CRTC callback functions.
   */
  struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
-       unsigned int plane)
+                                                 unsigned int plane)
  {
        struct drm_fb_cma *fb_cma = to_fb_cma(fb);
  
  EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_obj);
  
  #ifdef CONFIG_DEBUG_FS
- /*
-  * drm_fb_cma_describe() - Helper to dump information about a single
-  * CMA framebuffer object
-  */
  static void drm_fb_cma_describe(struct drm_framebuffer *fb, struct seq_file *m)
  {
        struct drm_fb_cma *fb_cma = to_fb_cma(fb);
  
  /**
   * drm_fb_cma_debugfs_show() - Helper to list CMA framebuffer objects
-  * in debugfs.
+  *                           in debugfs.
+  * @m: output file
+  * @arg: private data for the callback
   */
  int drm_fb_cma_debugfs_show(struct seq_file *m, void *arg)
  {
  EXPORT_SYMBOL_GPL(drm_fb_cma_debugfs_show);
  #endif
  
+ static int drm_fb_cma_mmap(struct fb_info *info, struct vm_area_struct *vma)
+ {
+       return dma_mmap_writecombine(info->device, vma, info->screen_base,
+                                    info->fix.smem_start, info->fix.smem_len);
+ }
  static struct fb_ops drm_fbdev_cma_ops = {
        .owner          = THIS_MODULE,
        .fb_fillrect    = drm_fb_helper_sys_fillrect,
        .fb_blank       = drm_fb_helper_blank,
        .fb_pan_display = drm_fb_helper_pan_display,
        .fb_setcmap     = drm_fb_helper_setcmap,
+       .fb_mmap        = drm_fb_cma_mmap,
  };
  
  static int drm_fbdev_cma_deferred_io_mmap(struct fb_info *info,
@@@ -445,7 -458,7 +458,7 @@@ err_cma_destroy
  err_fb_info_destroy:
        drm_fb_helper_release_fbi(helper);
  err_gem_free_object:
 -      dev->driver->gem_free_object(&obj->base);
 +      drm_gem_object_unreference_unlocked(&obj->base);
        return ret;
  }
  EXPORT_SYMBOL(drm_fbdev_cma_create_with_funcs);
index e5e6f504d8ccafbd9ffe3bacad547279f09ae00c,f8f70c85b648d81428363f31683abf4012271d2d..fc5040ae5f256ef2987fba0ce19ad1a8736ff5ef
@@@ -544,6 -544,7 +544,7 @@@ EXPORT_SYMBOL(drm_gtf_mode_complex)
   *
   * This function is to create the modeline based on the GTF algorithm.
   * Generalized Timing Formula is derived from:
+  *
   *    GTF Spreadsheet by Andy Morrish (1/5/97)
   *    available at http://www.vesa.org
   *
   * I also refer to the function of fb_get_mode in the file of
   * drivers/video/fbmon.c
   *
-  * Standard GTF parameters:
+  * Standard GTF parameters::
+  *
   *     M = 600
   *     C = 40
   *     K = 128
@@@ -1518,8 -1520,6 +1520,8 @@@ int drm_mode_convert_umode(struct drm_d
        if (out->status != MODE_OK)
                goto out;
  
 +      drm_mode_set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);
 +
        ret = 0;
  
  out:
index d347dca17267eca63c60cff0df63b5e854333dc9,f6d5892d03f1ff6cb8c9c1b278eb7f7b6854bdb0..6b21cb27e1cc77fe0476017c26676c786c5bca8f
@@@ -182,7 -182,7 +182,7 @@@ static int mga_g200se_set_plls(struct m
                        }
                }
  
 -              fvv = pllreffreq * testn / testm;
 +              fvv = pllreffreq * (n + 1) / (m + 1);
                fvv = (fvv - 800000) / 50000;
  
                if (fvv > 15)
        WREG_DAC(MGA1064_PIX_PLLC_M, m);
        WREG_DAC(MGA1064_PIX_PLLC_N, n);
        WREG_DAC(MGA1064_PIX_PLLC_P, p);
 +
 +      if (mdev->unique_rev_id >= 0x04) {
 +              WREG_DAC(0x1a, 0x09);
 +              msleep(20);
 +              WREG_DAC(0x1a, 0x01);
 +
 +      }
 +
        return 0;
  }
  
@@@ -1352,19 -1344,20 +1352,20 @@@ static void mga_crtc_commit(struct drm_
   * use this for 8-bit mode so can't perform smooth fades on deeper modes,
   * but it's a requirement that we provide the function
   */
- static void mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
-                                 u16 *blue, uint32_t start, uint32_t size)
+ static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
+                             u16 *blue, uint32_t size)
  {
        struct mga_crtc *mga_crtc = to_mga_crtc(crtc);
-       int end = (start + size > MGAG200_LUT_SIZE) ? MGAG200_LUT_SIZE : start + size;
        int i;
  
-       for (i = start; i < end; i++) {
+       for (i = 0; i < size; i++) {
                mga_crtc->lut_r[i] = red[i] >> 8;
                mga_crtc->lut_g[i] = green[i] >> 8;
                mga_crtc->lut_b[i] = blue[i] >> 8;
        }
        mga_crtc_load_lut(crtc);
+       return 0;
  }
  
  /* Simple cleanup function */
diff --combined include/linux/fence.h
index 2056e9fd0138357726864b61c6af1dea9fa11981,18a97c6b79dbda890b5b5c95d277311f1c7e996b..44d945e964730a56820eeea163a4af2c80b0a4c2
@@@ -49,8 -49,6 +49,8 @@@ struct fence_cb
   * @timestamp: Timestamp when the fence was signaled.
   * @status: Optional, only valid if < 0, must be set before calling
   * fence_signal, indicates that the fence has completed with an error.
 + * @child_list: list of children fences
 + * @active_list: list of active fences
   *
   * the flags member must be manipulated and read using the appropriate
   * atomic ops (bit_*), so taking the spinlock will not be needed most
@@@ -77,7 -75,8 +77,8 @@@ struct fence 
        struct rcu_head rcu;
        struct list_head cb_list;
        spinlock_t *lock;
-       unsigned context, seqno;
+       u64 context;
+       unsigned seqno;
        unsigned long flags;
        ktime_t timestamp;
        int status;
@@@ -180,7 -179,7 +181,7 @@@ struct fence_ops 
  };
  
  void fence_init(struct fence *fence, const struct fence_ops *ops,
-               spinlock_t *lock, unsigned context, unsigned seqno);
+               spinlock_t *lock, u64 context, unsigned seqno);
  
  void fence_release(struct kref *kref);
  void fence_free(struct fence *fence);
@@@ -354,27 -353,27 +355,27 @@@ static inline signed long fence_wait(st
        return ret < 0 ? ret : 0;
  }
  
- unsigned fence_context_alloc(unsigned num);
+ u64 fence_context_alloc(unsigned num);
  
  #define FENCE_TRACE(f, fmt, args...) \
        do {                                                            \
                struct fence *__ff = (f);                               \
                if (config_enabled(CONFIG_FENCE_TRACE))                 \
-                       pr_info("f %u#%u: " fmt,                        \
+                       pr_info("f %llu#%u: " fmt,                      \
                                __ff->context, __ff->seqno, ##args);    \
        } while (0)
  
  #define FENCE_WARN(f, fmt, args...) \
        do {                                                            \
                struct fence *__ff = (f);                               \
-               pr_warn("f %u#%u: " fmt, __ff->context, __ff->seqno,    \
+               pr_warn("f %llu#%u: " fmt, __ff->context, __ff->seqno,  \
                         ##args);                                       \
        } while (0)
  
  #define FENCE_ERR(f, fmt, args...) \
        do {                                                            \
                struct fence *__ff = (f);                               \
-               pr_err("f %u#%u: " fmt, __ff->context, __ff->seqno,     \
+               pr_err("f %llu#%u: " fmt, __ff->context, __ff->seqno,   \
                        ##args);                                        \
        } while (0)
  
This page took 0.146065 seconds and 4 git commands to generate.