You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued
Tvrtko needs
commit b3c11ac267
Author: Eric Engestrom <eric@engestrom.ch>
Date: Sat Nov 12 01:12:56 2016 +0000
drm: move allocation out of drm_get_format_name()
to be able to apply his patches without conflicts.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
+28
-302
@@ -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;
|
||||
|
||||
@@ -135,35 +136,12 @@ struct dma_buf_attachment;
|
||||
#define DRM_UT_PRIME 0x08
|
||||
#define DRM_UT_ATOMIC 0x10
|
||||
#define DRM_UT_VBL 0x20
|
||||
|
||||
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, ...);
|
||||
#define DRM_UT_STATE 0x40
|
||||
|
||||
/***********************************************************************/
|
||||
/** \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 */
|
||||
/*@{*/
|
||||
@@ -306,6 +284,27 @@ void drm_printk(const char *level, unsigned int category,
|
||||
#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
|
||||
DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
|
||||
|
||||
/* Format strings and argument splitters to simplify printing
|
||||
* various "complex" objects
|
||||
*/
|
||||
#define DRM_MODE_FMT "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
|
||||
#define DRM_MODE_ARG(m) \
|
||||
(m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \
|
||||
(m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
|
||||
(m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
|
||||
(m)->type, (m)->flags
|
||||
|
||||
#define DRM_RECT_FMT "%dx%d%+d%+d"
|
||||
#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
|
||||
|
||||
/* for rect's in fixed-point format: */
|
||||
#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
|
||||
#define DRM_RECT_FP_ARG(r) \
|
||||
drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
|
||||
drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
|
||||
(r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
|
||||
(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
|
||||
|
||||
/*@}*/
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -458,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,
|
||||
@@ -941,8 +683,13 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv)
|
||||
extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv);
|
||||
extern long drm_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
#ifdef CONFIG_COMPAT
|
||||
extern long drm_compat_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
#else
|
||||
/* Let drm_compat_ioctl be assigned to .compat_ioctl unconditionally */
|
||||
#define drm_compat_ioctl NULL
|
||||
#endif
|
||||
extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
|
||||
|
||||
/* File Operations (drm_fops.c) */
|
||||
@@ -980,15 +727,6 @@ void drm_clflush_virt_range(void *addr, unsigned long length);
|
||||
* DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
|
||||
*/
|
||||
|
||||
/* Modesetting support */
|
||||
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,
|
||||
@@ -1041,18 +779,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);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ struct __drm_crtcs_state {
|
||||
struct drm_crtc *ptr;
|
||||
struct drm_crtc_state *state;
|
||||
struct drm_crtc_commit *commit;
|
||||
s64 __user *out_fence_ptr;
|
||||
};
|
||||
|
||||
struct __drm_connnectors_state {
|
||||
@@ -345,6 +346,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
|
||||
struct drm_crtc *crtc);
|
||||
void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
|
||||
struct drm_framebuffer *fb);
|
||||
void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
|
||||
struct dma_fence *fence);
|
||||
int __must_check
|
||||
drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
|
||||
struct drm_crtc *crtc);
|
||||
@@ -364,6 +367,13 @@ int __must_check drm_atomic_check_only(struct drm_atomic_state *state);
|
||||
int __must_check drm_atomic_commit(struct drm_atomic_state *state);
|
||||
int __must_check drm_atomic_nonblocking_commit(struct drm_atomic_state *state);
|
||||
|
||||
void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct drm_minor;
|
||||
int drm_atomic_debugfs_init(struct drm_minor *minor);
|
||||
#endif
|
||||
|
||||
#define for_each_connector_in_state(__state, connector, connector_state, __i) \
|
||||
for ((__i) = 0; \
|
||||
(__i) < (__state)->num_connector && \
|
||||
|
||||
@@ -37,6 +37,7 @@ struct drm_crtc;
|
||||
struct drm_encoder;
|
||||
struct drm_property;
|
||||
struct drm_property_blob;
|
||||
struct drm_printer;
|
||||
struct edid;
|
||||
|
||||
enum drm_connector_force {
|
||||
@@ -481,6 +482,18 @@ struct drm_connector_funcs {
|
||||
const struct drm_connector_state *state,
|
||||
struct drm_property *property,
|
||||
uint64_t *val);
|
||||
|
||||
/**
|
||||
* @atomic_print_state:
|
||||
*
|
||||
* If driver subclasses struct &drm_connector_state, it should implement
|
||||
* this optional hook for printing additional driver specific state.
|
||||
*
|
||||
* Do not call this directly, use drm_atomic_connector_print_state()
|
||||
* instead.
|
||||
*/
|
||||
void (*atomic_print_state)(struct drm_printer *p,
|
||||
const struct drm_connector_state *state);
|
||||
};
|
||||
|
||||
/* mode specified on the command line */
|
||||
@@ -761,6 +774,30 @@ int drm_mode_connector_set_tile_property(struct drm_connector *connector);
|
||||
int drm_mode_connector_update_edid_property(struct drm_connector *connector,
|
||||
const struct edid *edid);
|
||||
|
||||
/**
|
||||
* struct drm_tile_group - Tile group metadata
|
||||
* @refcount: reference count
|
||||
* @dev: DRM device
|
||||
* @id: tile group id exposed to userspace
|
||||
* @group_data: Sink-private data identifying this group
|
||||
*
|
||||
* @group_data corresponds to displayid vend/prod/serial for external screens
|
||||
* with an EDID.
|
||||
*/
|
||||
struct drm_tile_group {
|
||||
struct kref refcount;
|
||||
struct drm_device *dev;
|
||||
int id;
|
||||
u8 group_data[8];
|
||||
};
|
||||
|
||||
struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
|
||||
char topology[8]);
|
||||
struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
|
||||
char topology[8]);
|
||||
void drm_mode_put_tile_group(struct drm_device *dev,
|
||||
struct drm_tile_group *tg);
|
||||
|
||||
/**
|
||||
* drm_for_each_connector - iterate over all connectors
|
||||
* @connector: the loop cursor
|
||||
|
||||
+50
-637
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,430 @@
|
||||
/*
|
||||
* 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:
|
||||
*
|
||||
* Driver callback for fetching a raw hardware vblank counter for the
|
||||
* CRTC specified with the pipe argument. 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, as long as drivers call
|
||||
* drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
|
||||
* enabling a CRTC.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Raw vblank counter value.
|
||||
*/
|
||||
u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* @enable_vblank:
|
||||
*
|
||||
* Enable vblank interrupts for the CRTC specified with the pipe
|
||||
* argument.
|
||||
*
|
||||
* 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 interrupts for the CRTC specified with the pipe
|
||||
* argument.
|
||||
*/
|
||||
void (*disable_vblank) (struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
/**
|
||||
* @device_is_agp:
|
||||
*
|
||||
* Called by drm_device_is_agp(). Typically used to determine if a card
|
||||
* is really attached to AGP or not.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* One of three values is returned depending on whether or not the
|
||||
* card is absolutely not AGP (return of 0), absolutely is AGP
|
||||
* (return of 1), or may or may not be AGP (return of 2).
|
||||
*/
|
||||
int (*device_is_agp) (struct drm_device *dev);
|
||||
|
||||
/**
|
||||
* @get_scanout_position:
|
||||
*
|
||||
* Called by vblank timestamping code.
|
||||
*
|
||||
* Returns the current display scanout position from a crtc, and an
|
||||
* optional accurate ktime_get() timestamp of when position was
|
||||
* measured. Note that this is a helper callback which is only used if a
|
||||
* driver uses drm_calc_vbltimestamp_from_scanoutpos() for the
|
||||
* @get_vblank_timestamp callback.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* dev:
|
||||
* DRM device.
|
||||
* pipe:
|
||||
* Id of the crtc to query.
|
||||
* flags:
|
||||
* Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
|
||||
* vpos:
|
||||
* Target location for current vertical scanout position.
|
||||
* hpos:
|
||||
* Target location for current horizontal scanout position.
|
||||
* stime:
|
||||
* Target location for timestamp taken immediately before
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* etime:
|
||||
* Target location for timestamp taken immediately after
|
||||
* scanout position query. Can be NULL to skip timestamp.
|
||||
* 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."
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @get_vblank_timestamp:
|
||||
*
|
||||
* Called by 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.
|
||||
*
|
||||
* Paramters:
|
||||
*
|
||||
* dev:
|
||||
* dev DRM device handle.
|
||||
* pipe:
|
||||
* crtc for which timestamp should be returned.
|
||||
* 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.
|
||||
* vblank_time:
|
||||
* Target location for returned vblank timestamp.
|
||||
* flags:
|
||||
* 0 = Defaults, no special treatment needed.
|
||||
* 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_create:
|
||||
*
|
||||
* Called whenever a new master is created. Only used by vmwgfx.
|
||||
*/
|
||||
int (*master_create)(struct drm_device *dev, struct drm_master *master);
|
||||
|
||||
/**
|
||||
* @master_destroy:
|
||||
*
|
||||
* Called whenever a master is destroyed. Only used by vmwgfx.
|
||||
*/
|
||||
void (*master_destroy)(struct drm_device *dev, struct drm_master *master);
|
||||
|
||||
/**
|
||||
* @master_set:
|
||||
*
|
||||
* Called whenever the minor master is set. Only used by vmwgfx.
|
||||
*/
|
||||
int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
|
||||
bool from_open);
|
||||
/**
|
||||
* @master_drop:
|
||||
*
|
||||
* Called whenever the minor master is dropped. Only used by vmwgfx.
|
||||
*/
|
||||
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_create:
|
||||
*
|
||||
* This creates a new dumb buffer in the driver's backing storage manager (GEM,
|
||||
* TTM or something else entirely) and returns the resulting buffer handle. This
|
||||
* handle can then be wrapped up into a framebuffer modeset object.
|
||||
*
|
||||
* Note that userspace is not allowed to use such objects for render
|
||||
* acceleration - drivers must create their own private ioctls for such a use
|
||||
* case.
|
||||
*
|
||||
* Width, height and depth are specified in the &drm_mode_create_dumb
|
||||
* argument. The callback needs to fill the handle, pitch and size for
|
||||
* the created buffer.
|
||||
*
|
||||
* Called by the user via ioctl.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Zero on success, negative errno on failure.
|
||||
*/
|
||||
int (*dumb_create)(struct drm_file *file_priv,
|
||||
struct drm_device *dev,
|
||||
struct drm_mode_create_dumb *args);
|
||||
/**
|
||||
* @dumb_map_offset:
|
||||
*
|
||||
* Allocate an offset in the drm device node's address space to be able to
|
||||
* memory map a dumb buffer. GEM-based drivers must use
|
||||
* drm_gem_create_mmap_offset() to implement this.
|
||||
*
|
||||
* Called by the user via ioctl.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Zero on success, negative errno on failure.
|
||||
*/
|
||||
int (*dumb_map_offset)(struct drm_file *file_priv,
|
||||
struct drm_device *dev, uint32_t handle,
|
||||
uint64_t *offset);
|
||||
/**
|
||||
* @dumb_destroy:
|
||||
*
|
||||
* This destroys the userspace handle for the given dumb backing storage buffer.
|
||||
* Since buffer objects must be reference counted in the kernel a buffer object
|
||||
* won't be immediately freed if a framebuffer modeset object still uses it.
|
||||
*
|
||||
* Called by the user via ioctl.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Zero on success, negative errno on failure.
|
||||
*/
|
||||
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
|
||||
@@ -12,6 +12,8 @@ struct drm_fb_helper;
|
||||
struct drm_device;
|
||||
struct drm_file;
|
||||
struct drm_mode_fb_cmd2;
|
||||
struct drm_plane;
|
||||
struct drm_plane_state;
|
||||
|
||||
struct drm_fbdev_cma *drm_fbdev_cma_init_with_funcs(struct drm_device *dev,
|
||||
unsigned int preferred_bpp, unsigned int num_crtc,
|
||||
@@ -41,6 +43,9 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
|
||||
struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
|
||||
unsigned int plane);
|
||||
|
||||
int drm_fb_cma_prepare_fb(struct drm_plane *plane,
|
||||
struct drm_plane_state *state);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct seq_file;
|
||||
|
||||
|
||||
@@ -228,7 +228,9 @@ struct drm_fb_helper {
|
||||
.fb_set_par = drm_fb_helper_set_par, \
|
||||
.fb_setcmap = drm_fb_helper_setcmap, \
|
||||
.fb_blank = drm_fb_helper_blank, \
|
||||
.fb_pan_display = drm_fb_helper_pan_display
|
||||
.fb_pan_display = drm_fb_helper_pan_display, \
|
||||
.fb_debug_enter = drm_fb_helper_debug_enter, \
|
||||
.fb_debug_leave = drm_fb_helper_debug_leave
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
|
||||
|
||||
@@ -45,6 +45,14 @@ struct drm_format_info {
|
||||
u8 vsub;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_format_name_buf - name of a DRM format
|
||||
* @str: string buffer containing the format name
|
||||
*/
|
||||
struct drm_format_name_buf {
|
||||
char str[32];
|
||||
};
|
||||
|
||||
const struct drm_format_info *__drm_format_info(u32 format);
|
||||
const struct drm_format_info *drm_format_info(u32 format);
|
||||
uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
|
||||
@@ -54,6 +62,6 @@ int drm_format_horz_chroma_subsampling(uint32_t format);
|
||||
int drm_format_vert_chroma_subsampling(uint32_t format);
|
||||
int drm_format_plane_width(int width, uint32_t format, int plane);
|
||||
int drm_format_plane_height(int height, uint32_t format, int plane);
|
||||
char *drm_get_format_name(uint32_t format) __malloc;
|
||||
const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf);
|
||||
|
||||
#endif /* __DRM_FOURCC_H__ */
|
||||
|
||||
+29
-34
@@ -130,42 +130,37 @@ struct drm_vblank_crtc {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
extern int drm_irq_install(struct drm_device *dev, int irq);
|
||||
extern int drm_irq_uninstall(struct drm_device *dev);
|
||||
int drm_irq_install(struct drm_device *dev, int irq);
|
||||
int drm_irq_uninstall(struct drm_device *dev);
|
||||
|
||||
extern int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs);
|
||||
extern int drm_wait_vblank(struct drm_device *dev, void *data,
|
||||
struct drm_file *filp);
|
||||
extern u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe);
|
||||
extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
|
||||
extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
|
||||
struct timeval *vblanktime);
|
||||
extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
|
||||
struct drm_pending_vblank_event *e);
|
||||
extern void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
|
||||
struct drm_pending_vblank_event *e);
|
||||
extern bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
extern bool drm_crtc_handle_vblank(struct drm_crtc *crtc);
|
||||
extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
|
||||
extern void drm_crtc_vblank_put(struct drm_crtc *crtc);
|
||||
extern void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
|
||||
extern void drm_vblank_off(struct drm_device *dev, unsigned int pipe);
|
||||
extern void drm_vblank_on(struct drm_device *dev, unsigned int pipe);
|
||||
extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
|
||||
extern void drm_crtc_vblank_reset(struct drm_crtc *crtc);
|
||||
extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
|
||||
extern void drm_vblank_cleanup(struct drm_device *dev);
|
||||
extern u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
|
||||
extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
|
||||
int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs);
|
||||
u32 drm_crtc_vblank_count(struct drm_crtc *crtc);
|
||||
u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
|
||||
struct timeval *vblanktime);
|
||||
void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
|
||||
struct drm_pending_vblank_event *e);
|
||||
void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
|
||||
struct drm_pending_vblank_event *e);
|
||||
bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
bool drm_crtc_handle_vblank(struct drm_crtc *crtc);
|
||||
int drm_crtc_vblank_get(struct drm_crtc *crtc);
|
||||
void drm_crtc_vblank_put(struct drm_crtc *crtc);
|
||||
void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe);
|
||||
void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
|
||||
void drm_crtc_vblank_off(struct drm_crtc *crtc);
|
||||
void drm_crtc_vblank_reset(struct drm_crtc *crtc);
|
||||
void drm_crtc_vblank_on(struct drm_crtc *crtc);
|
||||
void drm_vblank_cleanup(struct drm_device *dev);
|
||||
u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
|
||||
u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
|
||||
|
||||
extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
|
||||
unsigned int pipe, int *max_error,
|
||||
struct timeval *vblank_time,
|
||||
unsigned flags,
|
||||
const struct drm_display_mode *mode);
|
||||
extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode);
|
||||
int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
|
||||
unsigned int pipe, int *max_error,
|
||||
struct timeval *vblank_time,
|
||||
unsigned flags,
|
||||
const struct drm_display_mode *mode);
|
||||
void drm_calc_timestamping_constants(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode);
|
||||
|
||||
/**
|
||||
* drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
#include <linux/seq_file.h>
|
||||
#endif
|
||||
#ifdef CONFIG_DRM_DEBUG_MM
|
||||
#include <linux/stackdepot.h>
|
||||
#endif
|
||||
|
||||
enum drm_mm_search_flags {
|
||||
DRM_MM_SEARCH_DEFAULT = 0,
|
||||
@@ -74,6 +77,9 @@ struct drm_mm_node {
|
||||
u64 size;
|
||||
u64 __subtree_last;
|
||||
struct drm_mm *mm;
|
||||
#ifdef CONFIG_DRM_DEBUG_MM
|
||||
depot_stack_handle_t stack;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct drm_mm {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -361,8 +361,8 @@ struct drm_crtc_helper_funcs {
|
||||
*
|
||||
* Note that the power state of the display pipe when this function is
|
||||
* called depends upon the exact helpers and calling sequence the driver
|
||||
* has picked. See drm_atomic_commit_planes() for a discussion of the
|
||||
* tradeoffs and variants of plane commit helpers.
|
||||
* has picked. See drm_atomic_helper_commit_planes() for a discussion of
|
||||
* the tradeoffs and variants of plane commit helpers.
|
||||
*
|
||||
* This callback is used by the atomic modeset helpers and by the
|
||||
* transitional plane helpers, but it is optional.
|
||||
@@ -385,8 +385,8 @@ struct drm_crtc_helper_funcs {
|
||||
*
|
||||
* Note that the power state of the display pipe when this function is
|
||||
* called depends upon the exact helpers and calling sequence the driver
|
||||
* has picked. See drm_atomic_commit_planes() for a discussion of the
|
||||
* tradeoffs and variants of plane commit helpers.
|
||||
* has picked. See drm_atomic_helper_commit_planes() for a discussion of
|
||||
* the tradeoffs and variants of plane commit helpers.
|
||||
*
|
||||
* This callback is used by the atomic modeset helpers and by the
|
||||
* transitional plane helpers, but it is optional.
|
||||
@@ -940,8 +940,8 @@ struct drm_plane_helper_funcs {
|
||||
*
|
||||
* Note that the power state of the display pipe when this function is
|
||||
* called depends upon the exact helpers and calling sequence the driver
|
||||
* has picked. See drm_atomic_commit_planes() for a discussion of the
|
||||
* tradeoffs and variants of plane commit helpers.
|
||||
* has picked. See drm_atomic_helper_commit_planes() for a discussion of
|
||||
* the tradeoffs and variants of plane commit helpers.
|
||||
*
|
||||
* This callback is used by the atomic modeset helpers and by the
|
||||
* transitional plane helpers, but it is optional.
|
||||
@@ -963,8 +963,8 @@ struct drm_plane_helper_funcs {
|
||||
*
|
||||
* Note that the power state of the display pipe when this function is
|
||||
* called depends upon the exact helpers and calling sequence the driver
|
||||
* has picked. See drm_atomic_commit_planes() for a discussion of the
|
||||
* tradeoffs and variants of plane commit helpers.
|
||||
* has picked. See drm_atomic_helper_commit_planes() for a discussion of
|
||||
* the tradeoffs and variants of plane commit helpers.
|
||||
*
|
||||
* This callback is used by the atomic modeset helpers and by the
|
||||
* transitional plane helpers, but it is optional.
|
||||
|
||||
@@ -82,8 +82,6 @@ struct drm_modeset_lock {
|
||||
struct list_head head;
|
||||
};
|
||||
|
||||
extern struct ww_class crtc_ww_class;
|
||||
|
||||
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
|
||||
uint32_t flags);
|
||||
void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
|
||||
@@ -91,15 +89,7 @@ void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
|
||||
void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
|
||||
int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
|
||||
|
||||
/**
|
||||
* drm_modeset_lock_init - initialize lock
|
||||
* @lock: lock to init
|
||||
*/
|
||||
static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock)
|
||||
{
|
||||
ww_mutex_init(&lock->mutex, &crtc_ww_class);
|
||||
INIT_LIST_HEAD(&lock->head);
|
||||
}
|
||||
void drm_modeset_lock_init(struct drm_modeset_lock *lock);
|
||||
|
||||
/**
|
||||
* drm_modeset_lock_fini - cleanup lock
|
||||
|
||||
+87
-14
@@ -28,15 +28,11 @@
|
||||
#include <drm/drm_mode_object.h>
|
||||
|
||||
struct drm_crtc;
|
||||
struct drm_printer;
|
||||
|
||||
/**
|
||||
* struct drm_plane_state - mutable plane state
|
||||
* @plane: backpointer to the plane
|
||||
* @crtc: currently bound CRTC, NULL if disabled
|
||||
* @fb: currently bound framebuffer
|
||||
* @fence: optional fence to wait for before scanning out @fb
|
||||
* @crtc_x: left position of visible portion of plane on crtc
|
||||
* @crtc_y: upper position of visible portion of plane on crtc
|
||||
* @crtc_w: width of visible portion of plane on crtc
|
||||
* @crtc_h: height of visible portion of plane on crtc
|
||||
* @src_x: left position of visible portion of plane within
|
||||
@@ -47,22 +43,61 @@ struct drm_crtc;
|
||||
* @src_h: height of visible portion of plane (in 16.16)
|
||||
* @rotation: rotation of the plane
|
||||
* @zpos: priority of the given plane on crtc (optional)
|
||||
* Note that multiple active planes on the same crtc can have an identical
|
||||
* zpos value. The rule to solving the conflict is to compare the plane
|
||||
* object IDs; the plane with a higher ID must be stacked on top of a
|
||||
* plane with a lower ID.
|
||||
* @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
|
||||
* where N is the number of active planes for given crtc
|
||||
* where N is the number of active planes for given crtc. Note that
|
||||
* the driver must call drm_atomic_normalize_zpos() to update this before
|
||||
* it can be trusted.
|
||||
* @src: clipped source coordinates of the plane (in 16.16)
|
||||
* @dst: clipped destination coordinates of the plane
|
||||
* @visible: visibility of the plane
|
||||
* @state: backpointer to global drm_atomic_state
|
||||
*/
|
||||
struct drm_plane_state {
|
||||
struct drm_plane *plane;
|
||||
|
||||
struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
|
||||
struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
|
||||
/**
|
||||
* @crtc:
|
||||
*
|
||||
* Currently bound CRTC, NULL if disabled. Do not this write directly,
|
||||
* use drm_atomic_set_crtc_for_plane()
|
||||
*/
|
||||
struct drm_crtc *crtc;
|
||||
|
||||
/**
|
||||
* @fb:
|
||||
*
|
||||
* Currently bound framebuffer. Do not write this directly, use
|
||||
* drm_atomic_set_fb_for_plane()
|
||||
*/
|
||||
struct drm_framebuffer *fb;
|
||||
|
||||
/**
|
||||
* @fence:
|
||||
*
|
||||
* Optional fence to wait for before scanning out @fb. Do not write this
|
||||
* directly, use drm_atomic_set_fence_for_plane()
|
||||
*/
|
||||
struct dma_fence *fence;
|
||||
|
||||
/* Signed dest location allows it to be partially off screen */
|
||||
int32_t crtc_x, crtc_y;
|
||||
/**
|
||||
* @crtc_x:
|
||||
*
|
||||
* Left position of visible portion of plane on crtc, signed dest
|
||||
* location allows it to be partially off screen.
|
||||
*/
|
||||
|
||||
int32_t crtc_x;
|
||||
/**
|
||||
* @crtc_y:
|
||||
*
|
||||
* Upper position of visible portion of plane on crtc, signed dest
|
||||
* location allows it to be partially off screen.
|
||||
*/
|
||||
int32_t crtc_y;
|
||||
|
||||
uint32_t crtc_w, crtc_h;
|
||||
|
||||
/* Source values are 16.16 fixed point */
|
||||
@@ -79,15 +114,41 @@ struct drm_plane_state {
|
||||
/* Clipped coordinates */
|
||||
struct drm_rect src, dst;
|
||||
|
||||
/*
|
||||
* Is the plane actually visible? Can be false even
|
||||
* if fb!=NULL and crtc!=NULL, due to clipping.
|
||||
/**
|
||||
* @visible:
|
||||
*
|
||||
* Visibility of the plane. This can be false even if fb!=NULL and
|
||||
* crtc!=NULL, due to clipping.
|
||||
*/
|
||||
bool visible;
|
||||
|
||||
struct drm_atomic_state *state;
|
||||
};
|
||||
|
||||
static inline struct drm_rect
|
||||
drm_plane_state_src(const struct drm_plane_state *state)
|
||||
{
|
||||
struct drm_rect src = {
|
||||
.x1 = state->src_x,
|
||||
.y1 = state->src_y,
|
||||
.x2 = state->src_x + state->src_w,
|
||||
.y2 = state->src_y + state->src_h,
|
||||
};
|
||||
return src;
|
||||
}
|
||||
|
||||
static inline struct drm_rect
|
||||
drm_plane_state_dest(const struct drm_plane_state *state)
|
||||
{
|
||||
struct drm_rect dest = {
|
||||
.x1 = state->crtc_x,
|
||||
.y1 = state->crtc_y,
|
||||
.x2 = state->crtc_x + state->crtc_w,
|
||||
.y2 = state->crtc_y + state->crtc_h,
|
||||
};
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct drm_plane_funcs - driver plane control functions
|
||||
*/
|
||||
@@ -316,6 +377,18 @@ struct drm_plane_funcs {
|
||||
* before data structures are torndown.
|
||||
*/
|
||||
void (*early_unregister)(struct drm_plane *plane);
|
||||
|
||||
/**
|
||||
* @atomic_print_state:
|
||||
*
|
||||
* If driver subclasses struct &drm_plane_state, it should implement
|
||||
* this optional hook for printing additional driver specific state.
|
||||
*
|
||||
* Do not call this directly, use drm_atomic_plane_print_state()
|
||||
* instead.
|
||||
*/
|
||||
void (*atomic_print_state)(struct drm_printer *p,
|
||||
const struct drm_plane_state *state);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Red Hat
|
||||
*
|
||||
* 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 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
|
||||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
|
||||
*
|
||||
* Authors:
|
||||
* Rob Clark <robdclark@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef DRM_PRINT_H_
|
||||
#define DRM_PRINT_H_
|
||||
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
/**
|
||||
* DOC: print
|
||||
*
|
||||
* A simple wrapper for dev_printk(), seq_printf(), etc. Allows same
|
||||
* debug code to be used for both debugfs and printk logging.
|
||||
*
|
||||
* For example::
|
||||
*
|
||||
* void log_some_info(struct drm_printer *p)
|
||||
* {
|
||||
* drm_printf(p, "foo=%d\n", foo);
|
||||
* drm_printf(p, "bar=%d\n", bar);
|
||||
* }
|
||||
*
|
||||
* #ifdef CONFIG_DEBUG_FS
|
||||
* void debugfs_show(struct seq_file *f)
|
||||
* {
|
||||
* struct drm_printer p = drm_seq_file_printer(f);
|
||||
* log_some_info(&p);
|
||||
* }
|
||||
* #endif
|
||||
*
|
||||
* void some_other_function(...)
|
||||
* {
|
||||
* struct drm_printer p = drm_info_printer(drm->dev);
|
||||
* log_some_info(&p);
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct drm_printer - drm output "stream"
|
||||
* @printfn: actual output fxn
|
||||
* @arg: output fxn specific data
|
||||
*
|
||||
* Do not use struct members directly. Use drm_printer_seq_file(),
|
||||
* drm_printer_info(), etc to initialize. And drm_printf() for output.
|
||||
*/
|
||||
struct drm_printer {
|
||||
void (*printfn)(struct drm_printer *p, struct va_format *vaf);
|
||||
void *arg;
|
||||
};
|
||||
|
||||
void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
|
||||
void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
|
||||
|
||||
void drm_printf(struct drm_printer *p, const char *f, ...);
|
||||
|
||||
|
||||
/**
|
||||
* drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
|
||||
* @f: the struct &seq_file to output to
|
||||
*
|
||||
* RETURNS:
|
||||
* The &drm_printer object
|
||||
*/
|
||||
static inline struct drm_printer drm_seq_file_printer(struct seq_file *f)
|
||||
{
|
||||
struct drm_printer p = {
|
||||
.printfn = __drm_printfn_seq_file,
|
||||
.arg = f,
|
||||
};
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_info_printer - construct a &drm_printer that outputs to dev_printk()
|
||||
* @dev: the struct &device pointer
|
||||
*
|
||||
* RETURNS:
|
||||
* The &drm_printer object
|
||||
*/
|
||||
static inline struct drm_printer drm_info_printer(struct device *dev)
|
||||
{
|
||||
struct drm_printer p = {
|
||||
.printfn = __drm_printfn_info,
|
||||
.arg = dev,
|
||||
};
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif /* DRM_PRINT_H_ */
|
||||
Reference in New Issue
Block a user