drm: Extract drm_drv.h
I want to move dumb buffer documentation into the right vfuncs, and for that I first need to be able to pull that into kerneldoc without having to clean up all of drmP.h. Also, header-splitting is nice. While at it shuffle all the function declarations for drm_drv.c into the right spots, and drop the kerneldoc for drm_minor_acquire/release since it's only used internally. v2: Keep all existing copyright notices (Chris). Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
parent
8a5846bf5d
commit
85e634bce0
@ -32,7 +32,10 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <drm/drm_drv.h>
|
||||
#include <drm/drmP.h>
|
||||
|
||||
#include "drm_crtc_internal.h"
|
||||
#include "drm_legacy.h"
|
||||
#include "drm_internal.h"
|
||||
@ -257,10 +260,7 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)
|
||||
drm_debugfs_cleanup(minor);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_minor_acquire - Acquire a DRM minor
|
||||
* @minor_id: Minor ID of the DRM-minor
|
||||
*
|
||||
/*
|
||||
* Looks up the given minor-ID and returns the respective DRM-minor object. The
|
||||
* refence-count of the underlying device is increased so you must release this
|
||||
* object with drm_minor_release().
|
||||
@ -268,10 +268,6 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)
|
||||
* As long as you hold this minor, it is guaranteed that the object and the
|
||||
* minor->dev pointer will stay valid! However, the device may get unplugged and
|
||||
* unregistered while you hold the minor.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to minor-object with increased device-refcount, or PTR_ERR on
|
||||
* failure.
|
||||
*/
|
||||
struct drm_minor *drm_minor_acquire(unsigned int minor_id)
|
||||
{
|
||||
@ -294,12 +290,6 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id)
|
||||
return minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_minor_release - Release DRM minor
|
||||
* @minor: Pointer to DRM minor object
|
||||
*
|
||||
* Release a minor that was previously acquired via drm_minor_acquire().
|
||||
*/
|
||||
void drm_minor_release(struct drm_minor *minor)
|
||||
{
|
||||
drm_dev_unref(minor->dev);
|
||||
|
@ -46,6 +46,10 @@ void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
|
||||
void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv,
|
||||
struct dma_buf *dma_buf);
|
||||
|
||||
/* drm_drv.c */
|
||||
struct drm_minor *drm_minor_acquire(unsigned int minor_id);
|
||||
void drm_minor_release(struct drm_minor *minor);
|
||||
|
||||
/* drm_info.c */
|
||||
int drm_name_info(struct seq_file *m, void *data);
|
||||
int drm_clients_info(struct seq_file *m, void* data);
|
||||
|
@ -76,6 +76,7 @@
|
||||
#include <drm/drm_os_linux.h>
|
||||
#include <drm/drm_sarea.h>
|
||||
#include <drm/drm_vma_manager.h>
|
||||
#include <drm/drm_drv.h>
|
||||
|
||||
struct module;
|
||||
|
||||
@ -137,34 +138,10 @@ struct dma_buf_attachment;
|
||||
#define DRM_UT_VBL 0x20
|
||||
#define DRM_UT_STATE 0x40
|
||||
|
||||
extern __printf(6, 7)
|
||||
void drm_dev_printk(const struct device *dev, const char *level,
|
||||
unsigned int category, const char *function_name,
|
||||
const char *prefix, const char *format, ...);
|
||||
|
||||
extern __printf(3, 4)
|
||||
void drm_printk(const char *level, unsigned int category,
|
||||
const char *format, ...);
|
||||
|
||||
/***********************************************************************/
|
||||
/** \name DRM template customization defaults */
|
||||
/*@{*/
|
||||
|
||||
/* driver capabilities and requirements mask */
|
||||
#define DRIVER_USE_AGP 0x1
|
||||
#define DRIVER_LEGACY 0x2
|
||||
#define DRIVER_PCI_DMA 0x8
|
||||
#define DRIVER_SG 0x10
|
||||
#define DRIVER_HAVE_DMA 0x20
|
||||
#define DRIVER_HAVE_IRQ 0x40
|
||||
#define DRIVER_IRQ_SHARED 0x80
|
||||
#define DRIVER_GEM 0x1000
|
||||
#define DRIVER_MODESET 0x2000
|
||||
#define DRIVER_PRIME 0x4000
|
||||
#define DRIVER_RENDER 0x8000
|
||||
#define DRIVER_ATOMIC 0x10000
|
||||
#define DRIVER_KMS_LEGACY_CONTEXT 0x20000
|
||||
|
||||
/***********************************************************************/
|
||||
/** \name Macros to make printk easier */
|
||||
/*@{*/
|
||||
@ -480,263 +457,6 @@ struct drm_lock_data {
|
||||
#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1)
|
||||
#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
|
||||
|
||||
/**
|
||||
* DRM driver structure. This structure represent the common code for
|
||||
* a family of cards. There will one drm_device for each card present
|
||||
* in this family
|
||||
*/
|
||||
struct drm_driver {
|
||||
int (*load) (struct drm_device *, unsigned long flags);
|
||||
int (*firstopen) (struct drm_device *);
|
||||
int (*open) (struct drm_device *, struct drm_file *);
|
||||
void (*preclose) (struct drm_device *, struct drm_file *file_priv);
|
||||
void (*postclose) (struct drm_device *, struct drm_file *);
|
||||
void (*lastclose) (struct drm_device *);
|
||||
int (*unload) (struct drm_device *);
|
||||
int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
int (*dma_quiescent) (struct drm_device *);
|
||||
int (*context_dtor) (struct drm_device *dev, int context);
|
||||
int (*set_busid)(struct drm_device *dev, struct drm_master *master);
|
||||
|
||||
/**
|
||||
* get_vblank_counter - get raw hardware vblank counter
|
||||
* @dev: DRM device
|
||||
* @pipe: counter to fetch
|
||||
*
|
||||
* Driver callback for fetching a raw hardware vblank counter for @crtc.
|
||||
* If a device doesn't have a hardware counter, the driver can simply
|
||||
* use drm_vblank_no_hw_counter() function. The DRM core will account for
|
||||
* missed vblank events while interrupts where disabled based on system
|
||||
* timestamps.
|
||||
*
|
||||
* Wraparound handling and loss of events due to modesetting is dealt
|
||||
* with in the DRM core code.
|
||||
*
|
||||
* RETURNS
|
||||
* Raw vblank counter value.
|
||||
*/
|
||||
u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* enable_vblank - enable vblank interrupt events
|
||||
* @dev: DRM device
|
||||
* @pipe: which irq to enable
|
||||
*
|
||||
* Enable vblank interrupts for @crtc. If the device doesn't have
|
||||
* a hardware vblank counter, the driver should use the
|
||||
* drm_vblank_no_hw_counter() function that keeps a virtual counter.
|
||||
*
|
||||
* RETURNS
|
||||
* Zero on success, appropriate errno if the given @crtc's vblank
|
||||
* interrupt cannot be enabled.
|
||||
*/
|
||||
int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* disable_vblank - disable vblank interrupt events
|
||||
* @dev: DRM device
|
||||
* @pipe: which irq to enable
|
||||
*
|
||||
* Disable vblank interrupts for @crtc. If the device doesn't have
|
||||
* a hardware vblank counter, the driver should use the
|
||||
* drm_vblank_no_hw_counter() function that keeps a virtual counter.
|
||||
*/
|
||||
void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* Called by \c drm_device_is_agp. Typically used to determine if a
|
||||
* card is really attached to AGP or not.
|
||||
*
|
||||
* \param dev DRM device handle
|
||||
*
|
||||
* \returns
|
||||
* One of three values is returned depending on whether or not the
|
||||
* card is absolutely \b not AGP (return of 0), absolutely \b is AGP
|
||||
* (return of 1), or may or may not be AGP (return of 2).
|
||||
*/
|
||||
int (*device_is_agp) (struct drm_device *dev);
|
||||
|
||||
/**
|
||||
* Called by vblank timestamping code.
|
||||
*
|
||||
* Return the current display scanout position from a crtc, and an
|
||||
* optional accurate ktime_get timestamp of when position was measured.
|
||||
*
|
||||
* \param dev DRM device.
|
||||
* \param pipe Id of the crtc to query.
|
||||
* \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* \param *vpos Target location for current vertical scanout position.
|
||||
* \param *hpos Target location for current horizontal scanout position.
|
||||
* \param *stime Target location for timestamp taken immediately before
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* \param *etime Target location for timestamp taken immediately after
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* \param mode Current display timings.
|
||||
*
|
||||
* Returns vpos as a positive number while in active scanout area.
|
||||
* Returns vpos as a negative number inside vblank, counting the number
|
||||
* of scanlines to go until end of vblank, e.g., -1 means "one scanline
|
||||
* until start of active scanout / end of vblank."
|
||||
*
|
||||
* \return Flags, or'ed together as follows:
|
||||
*
|
||||
* DRM_SCANOUTPOS_VALID = Query successful.
|
||||
* DRM_SCANOUTPOS_INVBL = Inside vblank.
|
||||
* DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of
|
||||
* this flag means that returned position may be offset by a constant
|
||||
* but unknown small number of scanlines wrt. real scanout position.
|
||||
*
|
||||
*/
|
||||
int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
|
||||
unsigned int flags, int *vpos, int *hpos,
|
||||
ktime_t *stime, ktime_t *etime,
|
||||
const struct drm_display_mode *mode);
|
||||
|
||||
/**
|
||||
* Called by \c drm_get_last_vbltimestamp. Should return a precise
|
||||
* timestamp when the most recent VBLANK interval ended or will end.
|
||||
*
|
||||
* Specifically, the timestamp in @vblank_time should correspond as
|
||||
* closely as possible to the time when the first video scanline of
|
||||
* the video frame after the end of VBLANK will start scanning out,
|
||||
* the time immediately after end of the VBLANK interval. If the
|
||||
* @crtc is currently inside VBLANK, this will be a time in the future.
|
||||
* If the @crtc is currently scanning out a frame, this will be the
|
||||
* past start time of the current scanout. This is meant to adhere
|
||||
* to the OpenML OML_sync_control extension specification.
|
||||
*
|
||||
* \param dev dev DRM device handle.
|
||||
* \param pipe crtc for which timestamp should be returned.
|
||||
* \param *max_error Maximum allowable timestamp error in nanoseconds.
|
||||
* Implementation should strive to provide timestamp
|
||||
* with an error of at most *max_error nanoseconds.
|
||||
* Returns true upper bound on error for timestamp.
|
||||
* \param *vblank_time Target location for returned vblank timestamp.
|
||||
* \param flags 0 = Defaults, no special treatment needed.
|
||||
* \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank
|
||||
* irq handler. Some drivers need to apply some workarounds
|
||||
* for gpu-specific vblank irq quirks if flag is set.
|
||||
*
|
||||
* \returns
|
||||
* Zero if timestamping isn't supported in current display mode or a
|
||||
* negative number on failure. A positive status code on success,
|
||||
* which describes how the vblank_time timestamp was computed.
|
||||
*/
|
||||
int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
|
||||
int *max_error,
|
||||
struct timeval *vblank_time,
|
||||
unsigned flags);
|
||||
|
||||
/* these have to be filled in */
|
||||
|
||||
irqreturn_t(*irq_handler) (int irq, void *arg);
|
||||
void (*irq_preinstall) (struct drm_device *dev);
|
||||
int (*irq_postinstall) (struct drm_device *dev);
|
||||
void (*irq_uninstall) (struct drm_device *dev);
|
||||
|
||||
/* Master routines */
|
||||
int (*master_create)(struct drm_device *dev, struct drm_master *master);
|
||||
void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
|
||||
/**
|
||||
* master_set is called whenever the minor master is set.
|
||||
* master_drop is called whenever the minor master is dropped.
|
||||
*/
|
||||
|
||||
int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
bool from_open);
|
||||
void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv);
|
||||
|
||||
int (*debugfs_init)(struct drm_minor *minor);
|
||||
void (*debugfs_cleanup)(struct drm_minor *minor);
|
||||
|
||||
/**
|
||||
* @gem_free_object: deconstructor for drm_gem_objects
|
||||
*
|
||||
* This is deprecated and should not be used by new drivers. Use
|
||||
* @gem_free_object_unlocked instead.
|
||||
*/
|
||||
void (*gem_free_object) (struct drm_gem_object *obj);
|
||||
|
||||
/**
|
||||
* @gem_free_object_unlocked: deconstructor for drm_gem_objects
|
||||
*
|
||||
* This is for drivers which are not encumbered with dev->struct_mutex
|
||||
* legacy locking schemes. Use this hook instead of @gem_free_object.
|
||||
*/
|
||||
void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
|
||||
|
||||
int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
|
||||
void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
|
||||
|
||||
/**
|
||||
* Hook for allocating the GEM object struct, for use by core
|
||||
* helpers.
|
||||
*/
|
||||
struct drm_gem_object *(*gem_create_object)(struct drm_device *dev,
|
||||
size_t size);
|
||||
|
||||
/* prime: */
|
||||
/* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */
|
||||
int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
uint32_t handle, uint32_t flags, int *prime_fd);
|
||||
/* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */
|
||||
int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
int prime_fd, uint32_t *handle);
|
||||
/* export GEM -> dmabuf */
|
||||
struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
|
||||
struct drm_gem_object *obj, int flags);
|
||||
/* import dmabuf -> GEM */
|
||||
struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
|
||||
struct dma_buf *dma_buf);
|
||||
/* low-level interface used by drm_gem_prime_{import,export} */
|
||||
int (*gem_prime_pin)(struct drm_gem_object *obj);
|
||||
void (*gem_prime_unpin)(struct drm_gem_object *obj);
|
||||
struct reservation_object * (*gem_prime_res_obj)(
|
||||
struct drm_gem_object *obj);
|
||||
struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
|
||||
struct drm_gem_object *(*gem_prime_import_sg_table)(
|
||||
struct drm_device *dev,
|
||||
struct dma_buf_attachment *attach,
|
||||
struct sg_table *sgt);
|
||||
void *(*gem_prime_vmap)(struct drm_gem_object *obj);
|
||||
void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
|
||||
int (*gem_prime_mmap)(struct drm_gem_object *obj,
|
||||
struct vm_area_struct *vma);
|
||||
|
||||
/* vga arb irq handler */
|
||||
void (*vgaarb_irq)(struct drm_device *dev, bool state);
|
||||
|
||||
/* dumb alloc support */
|
||||
int (*dumb_create)(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args);
|
||||
int (*dumb_map_offset)(struct drm_file *file_priv,
|
||||
struct drm_device *dev, uint32_t handle,
|
||||
uint64_t *offset);
|
||||
int (*dumb_destroy)(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
uint32_t handle);
|
||||
|
||||
/* Driver private ops for this object */
|
||||
const struct vm_operations_struct *gem_vm_ops;
|
||||
|
||||
int major;
|
||||
int minor;
|
||||
int patchlevel;
|
||||
char *name;
|
||||
char *desc;
|
||||
char *date;
|
||||
|
||||
u32 driver_features;
|
||||
int dev_priv_size;
|
||||
const struct drm_ioctl_desc *ioctls;
|
||||
int num_ioctls;
|
||||
const struct file_operations *fops;
|
||||
|
||||
/* List of devices hanging off this driver with stealth attach. */
|
||||
struct list_head legacy_dev_list;
|
||||
};
|
||||
|
||||
enum drm_minor_type {
|
||||
DRM_MINOR_PRIMARY,
|
||||
DRM_MINOR_CONTROL,
|
||||
@ -1011,11 +731,6 @@ void drm_clflush_virt_range(void *addr, unsigned long length);
|
||||
extern void drm_vblank_pre_modeset(struct drm_device *dev, unsigned int pipe);
|
||||
extern void drm_vblank_post_modeset(struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/* drm_drv.c */
|
||||
void drm_put_dev(struct drm_device *dev);
|
||||
void drm_unplug_dev(struct drm_device *dev);
|
||||
extern unsigned int drm_debug;
|
||||
|
||||
/* Debugfs support */
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
extern int drm_debugfs_create_files(const struct drm_info_list *files,
|
||||
@ -1068,18 +783,6 @@ extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
|
||||
extern void drm_sysfs_hotplug_event(struct drm_device *dev);
|
||||
|
||||
|
||||
struct drm_device *drm_dev_alloc(struct drm_driver *driver,
|
||||
struct device *parent);
|
||||
int drm_dev_init(struct drm_device *dev,
|
||||
struct drm_driver *driver,
|
||||
struct device *parent);
|
||||
void drm_dev_ref(struct drm_device *dev);
|
||||
void drm_dev_unref(struct drm_device *dev);
|
||||
int drm_dev_register(struct drm_device *dev, unsigned long flags);
|
||||
void drm_dev_unregister(struct drm_device *dev);
|
||||
|
||||
struct drm_minor *drm_minor_acquire(unsigned int minor_id);
|
||||
void drm_minor_release(struct drm_minor *minor);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
340
include/drm/drm_drv.h
Normal file
340
include/drm/drm_drv.h
Normal file
@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum.
|
||||
* Copyright 2016 Intel Corp.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _DRM_DRV_H_
|
||||
#define _DRM_DRV_H_
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/irqreturn.h>
|
||||
|
||||
struct drm_device;
|
||||
struct drm_file;
|
||||
struct drm_gem_object;
|
||||
struct drm_master;
|
||||
struct drm_minor;
|
||||
struct dma_buf_attachment;
|
||||
struct drm_display_mode;
|
||||
struct drm_mode_create_dumb;
|
||||
|
||||
/* driver capabilities and requirements mask */
|
||||
#define DRIVER_USE_AGP 0x1
|
||||
#define DRIVER_LEGACY 0x2
|
||||
#define DRIVER_PCI_DMA 0x8
|
||||
#define DRIVER_SG 0x10
|
||||
#define DRIVER_HAVE_DMA 0x20
|
||||
#define DRIVER_HAVE_IRQ 0x40
|
||||
#define DRIVER_IRQ_SHARED 0x80
|
||||
#define DRIVER_GEM 0x1000
|
||||
#define DRIVER_MODESET 0x2000
|
||||
#define DRIVER_PRIME 0x4000
|
||||
#define DRIVER_RENDER 0x8000
|
||||
#define DRIVER_ATOMIC 0x10000
|
||||
#define DRIVER_KMS_LEGACY_CONTEXT 0x20000
|
||||
|
||||
/**
|
||||
* struct drm_driver - DRM driver structure
|
||||
*
|
||||
* This structure represent the common code for a family of cards. There will
|
||||
* one drm_device for each card present in this family. It contains lots of
|
||||
* vfunc entries, and a pile of those probably should be moved to more
|
||||
* appropriate places like &drm_mode_config_funcs or into a new operations
|
||||
* structure for GEM drivers.
|
||||
*/
|
||||
struct drm_driver {
|
||||
int (*load) (struct drm_device *, unsigned long flags);
|
||||
int (*firstopen) (struct drm_device *);
|
||||
int (*open) (struct drm_device *, struct drm_file *);
|
||||
void (*preclose) (struct drm_device *, struct drm_file *file_priv);
|
||||
void (*postclose) (struct drm_device *, struct drm_file *);
|
||||
void (*lastclose) (struct drm_device *);
|
||||
int (*unload) (struct drm_device *);
|
||||
int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
int (*dma_quiescent) (struct drm_device *);
|
||||
int (*context_dtor) (struct drm_device *dev, int context);
|
||||
int (*set_busid)(struct drm_device *dev, struct drm_master *master);
|
||||
|
||||
/**
|
||||
* get_vblank_counter - get raw hardware vblank counter
|
||||
* @dev: DRM device
|
||||
* @pipe: counter to fetch
|
||||
*
|
||||
* Driver callback for fetching a raw hardware vblank counter for @crtc.
|
||||
* If a device doesn't have a hardware counter, the driver can simply
|
||||
* use drm_vblank_no_hw_counter() function. The DRM core will account for
|
||||
* missed vblank events while interrupts where disabled based on system
|
||||
* timestamps.
|
||||
*
|
||||
* Wraparound handling and loss of events due to modesetting is dealt
|
||||
* with in the DRM core code.
|
||||
*
|
||||
* RETURNS
|
||||
* Raw vblank counter value.
|
||||
*/
|
||||
u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* enable_vblank - enable vblank interrupt events
|
||||
* @dev: DRM device
|
||||
* @pipe: which irq to enable
|
||||
*
|
||||
* Enable vblank interrupts for @crtc. If the device doesn't have
|
||||
* a hardware vblank counter, the driver should use the
|
||||
* drm_vblank_no_hw_counter() function that keeps a virtual counter.
|
||||
*
|
||||
* RETURNS
|
||||
* Zero on success, appropriate errno if the given @crtc's vblank
|
||||
* interrupt cannot be enabled.
|
||||
*/
|
||||
int (*enable_vblank) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* disable_vblank - disable vblank interrupt events
|
||||
* @dev: DRM device
|
||||
* @pipe: which irq to enable
|
||||
*
|
||||
* Disable vblank interrupts for @crtc. If the device doesn't have
|
||||
* a hardware vblank counter, the driver should use the
|
||||
* drm_vblank_no_hw_counter() function that keeps a virtual counter.
|
||||
*/
|
||||
void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* Called by \c drm_device_is_agp. Typically used to determine if a
|
||||
* card is really attached to AGP or not.
|
||||
*
|
||||
* \param dev DRM device handle
|
||||
*
|
||||
* \returns
|
||||
* One of three values is returned depending on whether or not the
|
||||
* card is absolutely \b not AGP (return of 0), absolutely \b is AGP
|
||||
* (return of 1), or may or may not be AGP (return of 2).
|
||||
*/
|
||||
int (*device_is_agp) (struct drm_device *dev);
|
||||
|
||||
/**
|
||||
* Called by vblank timestamping code.
|
||||
*
|
||||
* Return the current display scanout position from a crtc, and an
|
||||
* optional accurate ktime_get timestamp of when position was measured.
|
||||
*
|
||||
* \param dev DRM device.
|
||||
* \param pipe Id of the crtc to query.
|
||||
* \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* \param *vpos Target location for current vertical scanout position.
|
||||
* \param *hpos Target location for current horizontal scanout position.
|
||||
* \param *stime Target location for timestamp taken immediately before
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* \param *etime Target location for timestamp taken immediately after
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* \param mode Current display timings.
|
||||
*
|
||||
* Returns vpos as a positive number while in active scanout area.
|
||||
* Returns vpos as a negative number inside vblank, counting the number
|
||||
* of scanlines to go until end of vblank, e.g., -1 means "one scanline
|
||||
* until start of active scanout / end of vblank."
|
||||
*
|
||||
* \return Flags, or'ed together as follows:
|
||||
*
|
||||
* DRM_SCANOUTPOS_VALID = Query successful.
|
||||
* DRM_SCANOUTPOS_INVBL = Inside vblank.
|
||||
* DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of
|
||||
* this flag means that returned position may be offset by a constant
|
||||
* but unknown small number of scanlines wrt. real scanout position.
|
||||
*
|
||||
*/
|
||||
int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
|
||||
unsigned int flags, int *vpos, int *hpos,
|
||||
ktime_t *stime, ktime_t *etime,
|
||||
const struct drm_display_mode *mode);
|
||||
|
||||
/**
|
||||
* Called by \c drm_get_last_vbltimestamp. Should return a precise
|
||||
* timestamp when the most recent VBLANK interval ended or will end.
|
||||
*
|
||||
* Specifically, the timestamp in @vblank_time should correspond as
|
||||
* closely as possible to the time when the first video scanline of
|
||||
* the video frame after the end of VBLANK will start scanning out,
|
||||
* the time immediately after end of the VBLANK interval. If the
|
||||
* @crtc is currently inside VBLANK, this will be a time in the future.
|
||||
* If the @crtc is currently scanning out a frame, this will be the
|
||||
* past start time of the current scanout. This is meant to adhere
|
||||
* to the OpenML OML_sync_control extension specification.
|
||||
*
|
||||
* \param dev dev DRM device handle.
|
||||
* \param pipe crtc for which timestamp should be returned.
|
||||
* \param *max_error Maximum allowable timestamp error in nanoseconds.
|
||||
* Implementation should strive to provide timestamp
|
||||
* with an error of at most *max_error nanoseconds.
|
||||
* Returns true upper bound on error for timestamp.
|
||||
* \param *vblank_time Target location for returned vblank timestamp.
|
||||
* \param flags 0 = Defaults, no special treatment needed.
|
||||
* \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank
|
||||
* irq handler. Some drivers need to apply some workarounds
|
||||
* for gpu-specific vblank irq quirks if flag is set.
|
||||
*
|
||||
* \returns
|
||||
* Zero if timestamping isn't supported in current display mode or a
|
||||
* negative number on failure. A positive status code on success,
|
||||
* which describes how the vblank_time timestamp was computed.
|
||||
*/
|
||||
int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe,
|
||||
int *max_error,
|
||||
struct timeval *vblank_time,
|
||||
unsigned flags);
|
||||
|
||||
/* these have to be filled in */
|
||||
|
||||
irqreturn_t(*irq_handler) (int irq, void *arg);
|
||||
void (*irq_preinstall) (struct drm_device *dev);
|
||||
int (*irq_postinstall) (struct drm_device *dev);
|
||||
void (*irq_uninstall) (struct drm_device *dev);
|
||||
|
||||
/* Master routines */
|
||||
int (*master_create)(struct drm_device *dev, struct drm_master *master);
|
||||
void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
|
||||
/**
|
||||
* master_set is called whenever the minor master is set.
|
||||
* master_drop is called whenever the minor master is dropped.
|
||||
*/
|
||||
|
||||
int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
bool from_open);
|
||||
void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv);
|
||||
|
||||
int (*debugfs_init)(struct drm_minor *minor);
|
||||
void (*debugfs_cleanup)(struct drm_minor *minor);
|
||||
|
||||
/**
|
||||
* @gem_free_object: deconstructor for drm_gem_objects
|
||||
*
|
||||
* This is deprecated and should not be used by new drivers. Use
|
||||
* @gem_free_object_unlocked instead.
|
||||
*/
|
||||
void (*gem_free_object) (struct drm_gem_object *obj);
|
||||
|
||||
/**
|
||||
* @gem_free_object_unlocked: deconstructor for drm_gem_objects
|
||||
*
|
||||
* This is for drivers which are not encumbered with dev->struct_mutex
|
||||
* legacy locking schemes. Use this hook instead of @gem_free_object.
|
||||
*/
|
||||
void (*gem_free_object_unlocked) (struct drm_gem_object *obj);
|
||||
|
||||
int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
|
||||
void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
|
||||
|
||||
/**
|
||||
* Hook for allocating the GEM object struct, for use by core
|
||||
* helpers.
|
||||
*/
|
||||
struct drm_gem_object *(*gem_create_object)(struct drm_device *dev,
|
||||
size_t size);
|
||||
|
||||
/* prime: */
|
||||
/* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */
|
||||
int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
uint32_t handle, uint32_t flags, int *prime_fd);
|
||||
/* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */
|
||||
int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
int prime_fd, uint32_t *handle);
|
||||
/* export GEM -> dmabuf */
|
||||
struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
|
||||
struct drm_gem_object *obj, int flags);
|
||||
/* import dmabuf -> GEM */
|
||||
struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
|
||||
struct dma_buf *dma_buf);
|
||||
/* low-level interface used by drm_gem_prime_{import,export} */
|
||||
int (*gem_prime_pin)(struct drm_gem_object *obj);
|
||||
void (*gem_prime_unpin)(struct drm_gem_object *obj);
|
||||
struct reservation_object * (*gem_prime_res_obj)(
|
||||
struct drm_gem_object *obj);
|
||||
struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj);
|
||||
struct drm_gem_object *(*gem_prime_import_sg_table)(
|
||||
struct drm_device *dev,
|
||||
struct dma_buf_attachment *attach,
|
||||
struct sg_table *sgt);
|
||||
void *(*gem_prime_vmap)(struct drm_gem_object *obj);
|
||||
void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
|
||||
int (*gem_prime_mmap)(struct drm_gem_object *obj,
|
||||
struct vm_area_struct *vma);
|
||||
|
||||
/* vga arb irq handler */
|
||||
void (*vgaarb_irq)(struct drm_device *dev, bool state);
|
||||
|
||||
/* dumb alloc support */
|
||||
int (*dumb_create)(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args);
|
||||
int (*dumb_map_offset)(struct drm_file *file_priv,
|
||||
struct drm_device *dev, uint32_t handle,
|
||||
uint64_t *offset);
|
||||
int (*dumb_destroy)(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
uint32_t handle);
|
||||
|
||||
/* Driver private ops for this object */
|
||||
const struct vm_operations_struct *gem_vm_ops;
|
||||
|
||||
int major;
|
||||
int minor;
|
||||
int patchlevel;
|
||||
char *name;
|
||||
char *desc;
|
||||
char *date;
|
||||
|
||||
u32 driver_features;
|
||||
int dev_priv_size;
|
||||
const struct drm_ioctl_desc *ioctls;
|
||||
int num_ioctls;
|
||||
const struct file_operations *fops;
|
||||
|
||||
/* List of devices hanging off this driver with stealth attach. */
|
||||
struct list_head legacy_dev_list;
|
||||
};
|
||||
|
||||
extern __printf(6, 7)
|
||||
void drm_dev_printk(const struct device *dev, const char *level,
|
||||
unsigned int category, const char *function_name,
|
||||
const char *prefix, const char *format, ...);
|
||||
extern __printf(3, 4)
|
||||
void drm_printk(const char *level, unsigned int category,
|
||||
const char *format, ...);
|
||||
extern unsigned int drm_debug;
|
||||
|
||||
int drm_dev_init(struct drm_device *dev,
|
||||
struct drm_driver *driver,
|
||||
struct device *parent);
|
||||
struct drm_device *drm_dev_alloc(struct drm_driver *driver,
|
||||
struct device *parent);
|
||||
int drm_dev_register(struct drm_device *dev, unsigned long flags);
|
||||
void drm_dev_unregister(struct drm_device *dev);
|
||||
|
||||
void drm_dev_ref(struct drm_device *dev);
|
||||
void drm_dev_unref(struct drm_device *dev);
|
||||
void drm_put_dev(struct drm_device *dev);
|
||||
void drm_unplug_dev(struct drm_device *dev);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user