Commit 3f346d5d authored by Dave Airlie's avatar Dave Airlie

Merge tag 'topic/drm-misc-2016-09-25' of git://anongit.freedesktop.org/drm-intel into drm-next

- more core cleanup patches to prep drm_file to be used for
  kernel-internal contexts (David Herrmann)
- more split-up+docs for drm_crtc.c
- lots of small fixes and polish all over

* tag 'topic/drm-misc-2016-09-25' of git://anongit.freedesktop.org/drm-intel: (37 commits)
  drm: bridge: analogix/dp: mark symbols static where possible
  drm/bochs: mark bochs_connector_get_modes() static
  drm/bridge: analogix_dp: Improve panel on time
  drm/bridge: analogix_dp: Don't read EDID if panel present
  drm/bridge: analogix_dp: Remove duplicated code
  Revert "drm/i2c: tda998x: don't register the connector"
  drm: Fix plane type uabi breakage
  dma-buf/sync_file: free fences array in num_fences is 1
  drm/i2c: tda998x: don't register the connector
  drm: Don't swallow error codes in drm_dev_alloc()
  drm: Distinguish no name from ENOMEM in set_unique()
  drm: Remove dirty property from docs
  drm/doc: Document color space handling
  drm: Extract drm_color_mgmt.[hc]
  drm/doc: Polish plane composition property docs
  drm: Conslidate blending properties in drm_blend.[hc]
  drm/doc: Polish for drm_plane.[hc]
  drm: Extract drm_plane.[hc]
  drm/tilcdc: Add atomic and crtc headers to crtc.c
  drm: Fix typo in encoder docs
  ...
parents 196ebdcc 089cfdd9
...@@ -126,6 +126,13 @@ Default bridge callback sequence ...@@ -126,6 +126,13 @@ Default bridge callback sequence
.. kernel-doc:: drivers/gpu/drm/drm_bridge.c .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
:doc: bridge callbacks :doc: bridge callbacks
Bridge Helper Reference
-------------------------
.. kernel-doc:: include/drm/drm_bridge.h
:internal:
.. kernel-doc:: drivers/gpu/drm/drm_bridge.c .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
:export: :export:
...@@ -201,6 +208,9 @@ Output Probing Helper Functions Reference ...@@ -201,6 +208,9 @@ Output Probing Helper Functions Reference
EDID Helper Functions Reference EDID Helper Functions Reference
=============================== ===============================
.. kernel-doc:: include/drm/drm_edid.h
:internal:
.. kernel-doc:: drivers/gpu/drm/drm_edid.c .. kernel-doc:: drivers/gpu/drm/drm_edid.c
:export: :export:
......
...@@ -110,6 +110,21 @@ Note that dumb objects may not be used for gpu acceleration, as has been ...@@ -110,6 +110,21 @@ Note that dumb objects may not be used for gpu acceleration, as has been
attempted on some ARM embedded platforms. Such drivers really must have attempted on some ARM embedded platforms. Such drivers really must have
a hardware-specific ioctl to allocate suitable buffer objects. a hardware-specific ioctl to allocate suitable buffer objects.
Plane Abstraction
=================
.. kernel-doc:: drivers/gpu/drm/drm_plane.c
:doc: overview
Plane Functions Reference
-------------------------
.. kernel-doc:: include/drm/drm_plane.h
:internal:
.. kernel-doc:: drivers/gpu/drm/drm_plane.c
:export:
Display Modes Function Reference Display Modes Function Reference
================================ ================================
...@@ -177,50 +192,6 @@ allocated and zeroed by the driver, possibly as part of a larger ...@@ -177,50 +192,6 @@ allocated and zeroed by the driver, possibly as part of a larger
structure, and registered with a call to :c:func:`drm_crtc_init()` structure, and registered with a call to :c:func:`drm_crtc_init()`
with a pointer to CRTC functions. with a pointer to CRTC functions.
Planes (:c:type:`struct drm_plane <drm_plane>`)
-----------------------------------------------
A plane represents an image source that can be blended with or overlayed
on top of a CRTC during the scanout process. Planes are associated with
a frame buffer to crop a portion of the image memory (source) and
optionally scale it to a destination size. The result is then blended
with or overlayed on top of a CRTC.
The DRM core recognizes three types of planes:
- DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.
Primary planes are the planes operated upon by CRTC modesetting and
flipping operations described in the page_flip hook in
:c:type:`struct drm_crtc_funcs <drm_crtc_funcs>`.
- DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.
Cursor planes are the planes operated upon by the
DRM_IOCTL_MODE_CURSOR and DRM_IOCTL_MODE_CURSOR2 ioctls.
- DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor
planes. Some drivers refer to these types of planes as "sprites"
internally.
For compatibility with legacy userspace, only overlay planes are made
available to userspace by default. Userspace clients may set the
DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate
that they wish to receive a universal plane list containing all plane
types.
Plane Initialization
~~~~~~~~~~~~~~~~~~~~
To create a plane, a KMS drivers allocates and zeroes an instances of
:c:type:`struct drm_plane <drm_plane>` (possibly as part of a
larger structure) and registers it with a call to
:c:func:`drm_universal_plane_init()`. The function takes a
bitmask of the CRTCs that can be associated with the plane, a pointer to
the plane functions, a list of format supported formats, and the type of
plane (primary, cursor, or overlay) being initialized.
Cursor and overlay planes are optional. All drivers should provide one
primary plane per CRTC (although this requirement may change in the
future); drivers that do not wish to provide special handling for
primary planes may make use of the helper functions described in ? to
create and register a primary plane with standard capabilities.
Cleanup Cleanup
------- -------
...@@ -316,12 +287,27 @@ Property Types and Blob Property Support ...@@ -316,12 +287,27 @@ Property Types and Blob Property Support
.. kernel-doc:: drivers/gpu/drm/drm_property.c .. kernel-doc:: drivers/gpu/drm/drm_property.c
:export: :export:
Blending and Z-Position properties Plane Composition Properties
---------------------------------- ----------------------------
.. kernel-doc:: drivers/gpu/drm/drm_blend.c
:doc: overview
.. kernel-doc:: drivers/gpu/drm/drm_blend.c .. kernel-doc:: drivers/gpu/drm/drm_blend.c
:export: :export:
Color Management Properties
---------------------------
.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c
:doc: overview
.. kernel-doc:: include/drm/drm_color_mgmt.h
:internal:
.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c
:export:
Existing KMS Properties Existing KMS Properties
----------------------- -----------------------
......
Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,Description/Restrictions Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,Description/Restrictions
DRM,Generic,“rotation”,BITMASK,"{ 0, ""rotate-0"" }, { 1, ""rotate-90"" }, { 2, ""rotate-180"" }, { 3, ""rotate-270"" }, { 4, ""reflect-x"" }, { 5, ""reflect-y"" }","CRTC, Plane",rotate-(degrees) rotates the image by the specified amount in degrees in counter clockwise direction. reflect-x and reflect-y reflects the image along the specified axis prior to rotation
,,“scaling mode”,ENUM,"{ ""None"", ""Full"", ""Center"", ""Full aspect"" }",Connector,"Supported by: amdgpu, gma500, i915, nouveau and radeon." ,,“scaling mode”,ENUM,"{ ""None"", ""Full"", ""Center"", ""Full aspect"" }",Connector,"Supported by: amdgpu, gma500, i915, nouveau and radeon."
,Connector,“EDID”,BLOB | IMMUTABLE,0,Connector,Contains id of edid blob ptr object. ,Connector,“EDID”,BLOB | IMMUTABLE,0,Connector,Contains id of edid blob ptr object.
,,“DPMS”,ENUM,"{ “On”, “Standby”, “Suspend”, “Off” }",Connector,Contains DPMS operation mode value. ,,“DPMS”,ENUM,"{ “On”, “Standby”, “Suspend”, “Off” }",Connector,Contains DPMS operation mode value.
,,“PATH”,BLOB | IMMUTABLE,0,Connector,Contains topology path to a connector. ,,“PATH”,BLOB | IMMUTABLE,0,Connector,Contains topology path to a connector.
,,“TILE”,BLOB | IMMUTABLE,0,Connector,Contains tiling information for a connector. ,,“TILE”,BLOB | IMMUTABLE,0,Connector,Contains tiling information for a connector.
,,“CRTC_ID”,OBJECT,DRM_MODE_OBJECT_CRTC,Connector,CRTC that connector is attached to (atomic) ,,“CRTC_ID”,OBJECT,DRM_MODE_OBJECT_CRTC,Connector,CRTC that connector is attached to (atomic)
,Plane,“type”,ENUM | IMMUTABLE,"{ ""Overlay"", ""Primary"", ""Cursor"" }",Plane,Plane type
,,“SRC_X”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source x coordinate in 16.16 fixed point (atomic)
,,“SRC_Y”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source y coordinate in 16.16 fixed point (atomic)
,,“SRC_W”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source width in 16.16 fixed point (atomic)
,,“SRC_H”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source height in 16.16 fixed point (atomic)
,,“CRTC_X”,SIGNED_RANGE,"Min=INT_MIN, Max=INT_MAX",Plane,Scanout CRTC (destination) x coordinate (atomic)
,,“CRTC_Y”,SIGNED_RANGE,"Min=INT_MIN, Max=INT_MAX",Plane,Scanout CRTC (destination) y coordinate (atomic)
,,“CRTC_W”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout CRTC (destination) width (atomic)
,,“CRTC_H”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout CRTC (destination) height (atomic)
,,“FB_ID”,OBJECT,DRM_MODE_OBJECT_FB,Plane,Scanout framebuffer (atomic)
,,“CRTC_ID”,OBJECT,DRM_MODE_OBJECT_CRTC,Plane,CRTC that plane is attached to (atomic)
,,“zpos”,RANGE,"Min=0, Max=UINT_MAX","Plane,Z-order of the plane.Planes with higher Z-order values are displayed on top, planes with identical Z-order values are display in an undefined order"
,DVI-I,“subconnector”,ENUM,"{ “Unknown”, “DVI-D”, “DVI-A” }",Connector,TBD ,DVI-I,“subconnector”,ENUM,"{ “Unknown”, “DVI-D”, “DVI-A” }",Connector,TBD
,,“select subconnector”,ENUM,"{ “Automatic”, “DVI-D”, “DVI-A” }",Connector,TBD ,,“select subconnector”,ENUM,"{ “Automatic”, “DVI-D”, “DVI-A” }",Connector,TBD
,TV,“subconnector”,ENUM,"{ ""Unknown"", ""Composite"", ""SVIDEO"", ""Component"", ""SCART"" }",Connector,TBD ,TV,“subconnector”,ENUM,"{ ""Unknown"", ""Composite"", ""SVIDEO"", ""Component"", ""SCART"" }",Connector,TBD
...@@ -36,12 +23,6 @@ DRM,Generic,“rotation”,BITMASK,"{ 0, ""rotate-0"" }, { 1, ""rotate-90"" }, { ...@@ -36,12 +23,6 @@ DRM,Generic,“rotation”,BITMASK,"{ 0, ""rotate-0"" }, { 1, ""rotate-90"" }, {
,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
,,“dirty”,ENUM | IMMUTABLE,"{ ""Off"", ""On"", ""Annotate"" }",Connector,TBD
,,“DEGAMMA_LUT”,BLOB,0,CRTC,DRM property to set the degamma lookup table (LUT) mapping pixel data from the framebuffer before it is given to the transformation matrix. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]).
,,“DEGAMMA_LUT_SIZE”,RANGE | IMMUTABLE,"Min=0, Max=UINT_MAX",CRTC,DRM property to gives the size of the lookup table to be set on the DEGAMMA_LUT property (the size depends on the underlying hardware).
,,“CTM”,BLOB,0,CRTC,DRM property to set the current transformation matrix (CTM) apply to pixel data after the lookup through the degamma LUT and before the lookup through the gamma LUT. The data is an interpreted as a struct drm_color_ctm.
,,“GAMMA_LUT”,BLOB,0,CRTC,DRM property to set the gamma lookup table (LUT) mapping pixel data after to the transformation matrix to data sent to the connector. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]).
,,“GAMMA_LUT_SIZE”,RANGE | IMMUTABLE,"Min=0, Max=UINT_MAX",CRTC,DRM property to gives the size of the lookup table to be set on the GAMMA_LUT property (the size depends on the underlying hardware).
i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255." i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
...@@ -95,7 +76,6 @@ armada,CRTC,"""CSC_YUV""",ENUM,"{ ""Auto"" , ""CCIR601"", ""CCIR709"" }",CRTC,TB ...@@ -95,7 +76,6 @@ armada,CRTC,"""CSC_YUV""",ENUM,"{ ""Auto"" , ""CCIR601"", ""CCIR709"" }",CRTC,TB
,,"""contrast""",RANGE,"Min=0, Max=0x7fff",Plane,TBD ,,"""contrast""",RANGE,"Min=0, Max=0x7fff",Plane,TBD
,,"""saturation""",RANGE,"Min=0, Max=0x7fff",Plane,TBD ,,"""saturation""",RANGE,"Min=0, Max=0x7fff",Plane,TBD
exynos,CRTC,“mode”,ENUM,"{ ""normal"", ""blank"" }",CRTC,TBD exynos,CRTC,“mode”,ENUM,"{ ""normal"", ""blank"" }",CRTC,TBD
,Overlay,“zpos”,RANGE,"Min=0, Max=MAX_PLANE-1",Plane,TBD
i2c/ch7006_drv,Generic,“scale”,RANGE,"Min=0, Max=2",Connector,TBD i2c/ch7006_drv,Generic,“scale”,RANGE,"Min=0, Max=2",Connector,TBD
,TV,“mode”,ENUM,"{ ""PAL"", ""PAL-M"",""PAL-N""}, ”PAL-Nc"" , ""PAL-60"", ""NTSC-M"", ""NTSC-J"" }",Connector,TBD ,TV,“mode”,ENUM,"{ ""PAL"", ""PAL-M"",""PAL-N""}, ”PAL-Nc"" , ""PAL-60"", ""NTSC-M"", ""NTSC-J"" }",Connector,TBD
nouveau,NV10 Overlay,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD nouveau,NV10 Overlay,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD
...@@ -126,4 +106,3 @@ radeon,DVI-I,“coherent”,RANGE,"Min=0, Max=1",Connector,TBD ...@@ -126,4 +106,3 @@ radeon,DVI-I,“coherent”,RANGE,"Min=0, Max=1",Connector,TBD
,FMT Dithering,“dither”,ENUM,"{ ""off"", ""on"" }",Connector,TBD ,FMT Dithering,“dither”,ENUM,"{ ""off"", ""on"" }",Connector,TBD
rcar-du,Generic,"""alpha""",RANGE,"Min=0, Max=255",Plane,TBD rcar-du,Generic,"""alpha""",RANGE,"Min=0, Max=255",Plane,TBD
,,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD ,,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD
,,"""zpos""",RANGE,"Min=1, Max=7",Plane,TBD
...@@ -150,6 +150,7 @@ static int sync_file_set_fence(struct sync_file *sync_file, ...@@ -150,6 +150,7 @@ static int sync_file_set_fence(struct sync_file *sync_file,
*/ */
if (num_fences == 1) { if (num_fences == 1) {
sync_file->fence = fences[0]; sync_file->fence = fences[0];
kfree(fences);
} else { } else {
array = fence_array_create(num_fences, fences, array = fence_array_create(num_fences, fences,
fence_context_alloc(1), 1, false); fence_context_alloc(1), 1, false);
...@@ -253,10 +254,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, ...@@ -253,10 +254,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
for (; i_b < b_num_fences; i_b++) for (; i_b < b_num_fences; i_b++)
add_fence(fences, &i, b_fences[i_b]); add_fence(fences, &i, b_fences[i_b]);
if (i == 0) { if (i == 0)
add_fence(fences, &i, a_fences[0]); fences[i++] = fence_get(a_fences[0]);
i++;
}
if (num_fences > i) { if (num_fences > i) {
nfences = krealloc(fences, i * sizeof(*fences), nfences = krealloc(fences, i * sizeof(*fences),
......
...@@ -14,7 +14,8 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ ...@@ -14,7 +14,8 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \
drm_rect.o drm_vma_manager.o drm_flip_work.o \ drm_rect.o drm_vma_manager.o drm_flip_work.o \
drm_modeset_lock.o drm_atomic.o drm_bridge.o \ drm_modeset_lock.o drm_atomic.o drm_bridge.o \
drm_framebuffer.o drm_connector.o drm_blend.o \ drm_framebuffer.o drm_connector.o drm_blend.o \
drm_encoder.o drm_mode_object.o drm_property.o drm_encoder.o drm_mode_object.o drm_property.o \
drm_plane.o drm_color_mgmt.o
drm-$(CONFIG_COMPAT) += drm_ioc32.o drm-$(CONFIG_COMPAT) += drm_ioc32.o
drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
......
...@@ -246,7 +246,8 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) ...@@ -246,7 +246,8 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
if (amdgpu_ttm_tt_get_usermm(bo->ttm)) if (amdgpu_ttm_tt_get_usermm(bo->ttm))
return -EPERM; return -EPERM;
return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp); return drm_vma_node_verify_access(&rbo->gem_base.vma_node,
filp->private_data);
} }
static void amdgpu_move_null(struct ttm_buffer_object *bo, static void amdgpu_move_null(struct ttm_buffer_object *bo,
......
...@@ -198,8 +198,8 @@ static int arcpgu_probe(struct platform_device *pdev) ...@@ -198,8 +198,8 @@ static int arcpgu_probe(struct platform_device *pdev)
int ret; int ret;
drm = drm_dev_alloc(&arcpgu_drm_driver, &pdev->dev); drm = drm_dev_alloc(&arcpgu_drm_driver, &pdev->dev);
if (!drm) if (IS_ERR(drm))
return -ENOMEM; return PTR_ERR(drm);
ret = arcpgu_load(drm); ret = arcpgu_load(drm);
if (ret) if (ret)
......
...@@ -326,8 +326,8 @@ static int hdlcd_drm_bind(struct device *dev) ...@@ -326,8 +326,8 @@ static int hdlcd_drm_bind(struct device *dev)
return -ENOMEM; return -ENOMEM;
drm = drm_dev_alloc(&hdlcd_driver, dev); drm = drm_dev_alloc(&hdlcd_driver, dev);
if (!drm) if (IS_ERR(drm))
return -ENOMEM; return PTR_ERR(drm);
drm->dev_private = hdlcd; drm->dev_private = hdlcd;
dev_set_drvdata(dev, drm); dev_set_drvdata(dev, drm);
......
...@@ -311,8 +311,8 @@ static int malidp_bind(struct device *dev) ...@@ -311,8 +311,8 @@ static int malidp_bind(struct device *dev)
return ret; return ret;
drm = drm_dev_alloc(&malidp_driver, dev); drm = drm_dev_alloc(&malidp_driver, dev);
if (!drm) { if (IS_ERR(drm)) {
ret = -ENOMEM; ret = PTR_ERR(drm);
goto alloc_fail; goto alloc_fail;
} }
......
...@@ -150,7 +150,8 @@ static int ast_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp) ...@@ -150,7 +150,8 @@ static int ast_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
{ {
struct ast_bo *astbo = ast_bo(bo); struct ast_bo *astbo = ast_bo(bo);
return drm_vma_node_verify_access(&astbo->gem.vma_node, filp); return drm_vma_node_verify_access(&astbo->gem.vma_node,
filp->private_data);
} }
static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev, static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
......
...@@ -797,8 +797,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev) ...@@ -797,8 +797,8 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
int ret; int ret;
ddev = drm_dev_alloc(&atmel_hlcdc_dc_driver, &pdev->dev); ddev = drm_dev_alloc(&atmel_hlcdc_dc_driver, &pdev->dev);
if (!ddev) if (IS_ERR(ddev))
return -ENOMEM; return PTR_ERR(ddev);
ret = atmel_hlcdc_dc_load(ddev); ret = atmel_hlcdc_dc_load(ddev);
if (ret) if (ret)
......
...@@ -178,7 +178,7 @@ static void bochs_encoder_init(struct drm_device *dev) ...@@ -178,7 +178,7 @@ static void bochs_encoder_init(struct drm_device *dev)
} }
int bochs_connector_get_modes(struct drm_connector *connector) static int bochs_connector_get_modes(struct drm_connector *connector)
{ {
int count; int count;
......
...@@ -128,7 +128,8 @@ static int bochs_bo_verify_access(struct ttm_buffer_object *bo, ...@@ -128,7 +128,8 @@ static int bochs_bo_verify_access(struct ttm_buffer_object *bo,
{ {
struct bochs_bo *bochsbo = bochs_bo(bo); struct bochs_bo *bochsbo = bochs_bo(bo);
return drm_vma_node_verify_access(&bochsbo->gem.vma_node, filp); return drm_vma_node_verify_access(&bochsbo->gem.vma_node,
filp->private_data);
} }
static int bochs_ttm_io_mem_reserve(struct ttm_bo_device *bdev, static int bochs_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
......
...@@ -20,15 +20,6 @@ ...@@ -20,15 +20,6 @@
#define MAX_CR_LOOP 5 #define MAX_CR_LOOP 5
#define MAX_EQ_LOOP 5 #define MAX_EQ_LOOP 5
/* I2C EDID Chip ID, Slave Address */
#define I2C_EDID_DEVICE_ADDR 0x50
#define I2C_E_EDID_DEVICE_ADDR 0x30
#define EDID_BLOCK_LENGTH 0x80
#define EDID_HEADER_PATTERN 0x00
#define EDID_EXTENSION_FLAG 0x7e
#define EDID_CHECKSUM 0x7f
/* DP_MAX_LANE_COUNT */ /* DP_MAX_LANE_COUNT */
#define DPCD_ENHANCED_FRAME_CAP(x) (((x) >> 7) & 0x1) #define DPCD_ENHANCED_FRAME_CAP(x) (((x) >> 7) & 0x1)
#define DPCD_MAX_LANE_COUNT(x) ((x) & 0x1f) #define DPCD_MAX_LANE_COUNT(x) ((x) & 0x1f)
...@@ -166,6 +157,7 @@ struct analogix_dp_device { ...@@ -166,6 +157,7 @@ struct analogix_dp_device {
struct drm_device *drm_dev; struct drm_device *drm_dev;
struct drm_connector connector; struct drm_connector connector;
struct drm_bridge *bridge; struct drm_bridge *bridge;
struct drm_dp_aux aux;
struct clk *clock; struct clk *clock;
unsigned int irq; unsigned int irq;
void __iomem *reg_base; void __iomem *reg_base;
...@@ -176,7 +168,6 @@ struct analogix_dp_device { ...@@ -176,7 +168,6 @@ struct analogix_dp_device {
int dpms_mode; int dpms_mode;
int hpd_gpio; int hpd_gpio;
bool force_hpd; bool force_hpd;
unsigned char edid[EDID_BLOCK_LENGTH * 2];
bool psr_support; bool psr_support;
struct mutex panel_lock; struct mutex panel_lock;
...@@ -210,33 +201,6 @@ void analogix_dp_reset_aux(struct analogix_dp_device *dp); ...@@ -210,33 +201,6 @@ void analogix_dp_reset_aux(struct analogix_dp_device *dp);
void analogix_dp_init_aux(struct analogix_dp_device *dp); void analogix_dp_init_aux(struct analogix_dp_device *dp);
int analogix_dp_get_plug_in_status(struct analogix_dp_device *dp); int analogix_dp_get_plug_in_status(struct analogix_dp_device *dp);
void analogix_dp_enable_sw_function(struct analogix_dp_device *dp); void analogix_dp_enable_sw_function(struct analogix_dp_device *dp);
int analogix_dp_start_aux_transaction(struct analogix_dp_device *dp);
int analogix_dp_write_byte_to_dpcd(struct analogix_dp_device *dp,
unsigned int reg_addr,
unsigned char data);
int analogix_dp_read_byte_from_dpcd(struct analogix_dp_device *dp,
unsigned int reg_addr,
unsigned char *data);
int analogix_dp_write_bytes_to_dpcd(struct analogix_dp_device *dp,
unsigned int reg_addr,
unsigned int count,
unsigned char data[]);
int analogix_dp_read_bytes_from_dpcd(struct analogix_dp_device *dp,
unsigned int reg_addr,
unsigned int count,
unsigned char data[]);
int analogix_dp_select_i2c_device(struct analogix_dp_device *dp,
unsigned int device_addr,
unsigned int reg_addr);
int analogix_dp_read_byte_from_i2c(struct analogix_dp_device *dp,
unsigned int device_addr,
unsigned int reg_addr,
unsigned int *data);
int analogix_dp_read_bytes_from_i2c(struct analogix_dp_device *dp,
unsigned int device_addr,
unsigned int reg_addr,
unsigned int count,
unsigned char edid[]);
void analogix_dp_set_link_bandwidth(struct analogix_dp_device *dp, u32 bwtype); void analogix_dp_set_link_bandwidth(struct analogix_dp_device *dp, u32 bwtype);
void analogix_dp_get_link_bandwidth(struct analogix_dp_device *dp, u32 *bwtype); void analogix_dp_get_link_bandwidth(struct analogix_dp_device *dp, u32 *bwtype);
void analogix_dp_set_lane_count(struct analogix_dp_device *dp, u32 count); void analogix_dp_set_lane_count(struct analogix_dp_device *dp, u32 count);
...@@ -285,5 +249,7 @@ void analogix_dp_disable_scrambling(struct analogix_dp_device *dp); ...@@ -285,5 +249,7 @@ void analogix_dp_disable_scrambling(struct analogix_dp_device *dp);
void analogix_dp_enable_psr_crc(struct analogix_dp_device *dp); void analogix_dp_enable_psr_crc(struct analogix_dp_device *dp);
void analogix_dp_send_psr_spd(struct analogix_dp_device *dp, void analogix_dp_send_psr_spd(struct analogix_dp_device *dp,
struct edp_vsc_psr *vsc); struct edp_vsc_psr *vsc);
ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
struct drm_dp_aux_msg *msg);
#endif /* _ANALOGIX_DP_CORE_H */ #endif /* _ANALOGIX_DP_CORE_H */
...@@ -150,7 +150,8 @@ static int cirrus_bo_verify_access(struct ttm_buffer_object *bo, struct file *fi ...@@ -150,7 +150,8 @@ static int cirrus_bo_verify_access(struct ttm_buffer_object *bo, struct file *fi
{ {
struct cirrus_bo *cirrusbo = cirrus_bo(bo); struct cirrus_bo *cirrusbo = cirrus_bo(bo);
return drm_vma_node_verify_access(&cirrusbo->gem.vma_node, filp); return drm_vma_node_verify_access(&cirrusbo->gem.vma_node,
filp->private_data);
} }
static int cirrus_ttm_io_mem_reserve(struct ttm_bo_device *bdev, static int cirrus_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
......
...@@ -1693,7 +1693,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, ...@@ -1693,7 +1693,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,
} }
EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); EXPORT_SYMBOL(drm_atomic_helper_prepare_planes);
bool plane_crtc_active(struct drm_plane_state *state) static bool plane_crtc_active(const struct drm_plane_state *state)
{ {
return state->crtc && state->crtc->state->active; return state->crtc && state->crtc->state->active;
} }
......
This diff is collapsed.
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <drm/drm_crtc.h> #include <drm/drm_bridge.h>
#include "drm/drmP.h"
/** /**
* DOC: overview * DOC: overview
......
...@@ -755,7 +755,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev, ...@@ -755,7 +755,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
return -EINVAL; return -EINVAL;
} }
entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) { if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc); atomic_dec(&dev->buf_alloc);
...@@ -905,14 +905,14 @@ int drm_legacy_addbufs_pci(struct drm_device *dev, ...@@ -905,14 +905,14 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
return -EINVAL; return -EINVAL;
} }
entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) { if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc); atomic_dec(&dev->buf_alloc);
return -ENOMEM; return -ENOMEM;
} }
entry->seglist = kzalloc(count * sizeof(*entry->seglist), GFP_KERNEL); entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL);
if (!entry->seglist) { if (!entry->seglist) {
kfree(entry->buflist); kfree(entry->buflist);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -923,8 +923,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev, ...@@ -923,8 +923,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
/* Keep the original pagelist until we know all the allocations /* Keep the original pagelist until we know all the allocations
* have succeeded * have succeeded
*/ */
temp_pagelist = kmalloc((dma->page_count + (count << page_order)) * temp_pagelist = kmalloc_array(dma->page_count + (count << page_order),
sizeof(*dma->pagelist), GFP_KERNEL); sizeof(*dma->pagelist),
GFP_KERNEL);
if (!temp_pagelist) { if (!temp_pagelist) {
kfree(entry->buflist); kfree(entry->buflist);
kfree(entry->seglist); kfree(entry->seglist);
...@@ -1116,8 +1117,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev, ...@@ -1116,8 +1117,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
return -EINVAL; return -EINVAL;
} }
entry->buflist = kzalloc(count * sizeof(*entry->buflist), entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
GFP_KERNEL);
if (!entry->buflist) { if (!entry->buflist) {
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
atomic_dec(&dev->buf_alloc); atomic_dec(&dev->buf_alloc);
......
/*
* Copyright (c) 2016 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <drm/drmP.h>
#include <drm/drm_crtc.h>
#include <drm/drm_color_mgmt.h>
#include "drm_crtc_internal.h"
/**
* DOC: overview
*
* Color management or color space adjustments is supported through a set of 5
* properties on the &drm_crtc object. They are set up by calling
* drm_crtc_enable_color_mgmt().
*
* "DEGAMMA_LUT”:
* Blob property to set the degamma lookup table (LUT) mapping pixel data
* from the framebuffer before it is given to the transformation matrix.
* The data is interpreted as an array of struct &drm_color_lut elements.
* Hardware might choose not to use the full precision of the LUT elements
* nor use all the elements of the LUT (for example the hardware might
* choose to interpolate between LUT[0] and LUT[4]).
*
* “DEGAMMA_LUT_SIZE”:
* Unsinged range property to give the size of the lookup table to be set
* on the DEGAMMA_LUT property (the size depends on the underlying
* hardware). If drivers support multiple LUT sizes then they should
* publish the largest size, and sub-sample smaller sized LUTs (e.g. for
* split-gamma modes) appropriately.
*
* “CTM”:
* Blob property to set the current transformation matrix (CTM) apply to
* pixel data after the lookup through the degamma LUT and before the
* lookup through the gamma LUT. The data is interpreted as a struct
* &drm_color_ctm.
*
* “GAMMA_LUT”:
* Blob property to set the gamma lookup table (LUT) mapping pixel data
* after the transformation matrix to data sent to the connector. The
* data is interpreted as an array of struct &drm_color_lut elements.
* Hardware might choose not to use the full precision of the LUT elements
* nor use all the elements of the LUT (for example the hardware might
* choose to interpolate between LUT[0] and LUT[4]).
*
* “GAMMA_LUT_SIZE”:
* Unsigned range property to give the size of the lookup table to be set
* on the GAMMA_LUT property (the size depends on the underlying hardware).
* If drivers support multiple LUT sizes then they should publish the
* largest size, and sub-sample smaller sized LUTs (e.g. for split-gamma
* modes) appropriately.
*
* There is also support for a legacy gamma table, which is set up by calling
* drm_mode_crtc_set_gamma_size(). Drivers which support both should use
* drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the
* "GAMMA_LUT" property above.
*/
/**
* drm_crtc_enable_color_mgmt - enable color management properties
* @crtc: DRM CRTC
* @degamma_lut_size: the size of the degamma lut (before CSC)
* @has_ctm: whether to attach ctm_property for CSC matrix
* @gamma_lut_size: the size of the gamma lut (after CSC)
*
* This function lets the driver enable the color correction
* properties on a CRTC. This includes 3 degamma, csc and gamma
* properties that userspace can set and 2 size properties to inform
* the userspace of the lut sizes. Each of the properties are
* optional. The gamma and degamma properties are only attached if
* their size is not 0 and ctm_property is only attached if has_ctm is
* true.
*/
void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
uint degamma_lut_size,
bool has_ctm,
uint gamma_lut_size)
{
struct drm_device *dev = crtc->dev;
struct drm_mode_config *config = &dev->mode_config;
if (degamma_lut_size) {
drm_object_attach_property(&crtc->base,
config->degamma_lut_property, 0);
drm_object_attach_property(&crtc->base,
config->degamma_lut_size_property,
degamma_lut_size);
}
if (has_ctm)
drm_object_attach_property(&crtc->base,
config->ctm_property, 0);
if (gamma_lut_size) {
drm_object_attach_property(&crtc->base,
config->gamma_lut_property, 0);
drm_object_attach_property(&crtc->base,
config->gamma_lut_size_property,
gamma_lut_size);
}
}
EXPORT_SYMBOL(drm_crtc_enable_color_mgmt);
/**
* drm_mode_crtc_set_gamma_size - set the gamma table size
* @crtc: CRTC to set the gamma table size for
* @gamma_size: size of the gamma table
*
* Drivers which support gamma tables should set this to the supported gamma
* table size when initializing the CRTC. Currently the drm core only supports a
* fixed gamma table size.
*
* Returns:
* Zero on success, negative errno on failure.
*/
int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
int gamma_size)
{
uint16_t *r_base, *g_base, *b_base;
int i;
crtc->gamma_size = gamma_size;
crtc->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3,
GFP_KERNEL);
if (!crtc->gamma_store) {
crtc->gamma_size = 0;
return -ENOMEM;
}
r_base = crtc->gamma_store;
g_base = r_base + gamma_size;
b_base = g_base + gamma_size;
for (i = 0; i < gamma_size; i++) {
r_base[i] = i << 8;
g_base[i] = i << 8;
b_base[i] = i << 8;
}
return 0;
}
EXPORT_SYMBOL(drm_mode_crtc_set_gamma_size);
/**
* drm_mode_gamma_set_ioctl - set the gamma table
* @dev: DRM device
* @data: ioctl data
* @file_priv: DRM file info
*
* Set the gamma table of a CRTC to the one passed in by the user. Userspace can
* inquire the required gamma table size through drm_mode_gamma_get_ioctl.
*
* Called by the user via ioctl.
*
* Returns:
* Zero on success, negative errno on failure.
*/
int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
struct drm_mode_crtc_lut *crtc_lut = data;
struct drm_crtc *crtc;
void *r_base, *g_base, *b_base;
int size;
int ret = 0;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
drm_modeset_lock_all(dev);
crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
if (!crtc) {
ret = -ENOENT;
goto out;
}
if (crtc->funcs->gamma_set == NULL) {
ret = -ENOSYS;
goto out;
}
/* memcpy into gamma store */
if (crtc_lut->gamma_size != crtc->gamma_size) {
ret = -EINVAL;
goto out;
}
size = crtc_lut->gamma_size * (sizeof(uint16_t));
r_base = crtc->gamma_store;
if (copy_from_user(r_base, (void __user *)(unsigned long)crtc_lut->red, size)) {
ret = -EFAULT;
goto out;
}
g_base = r_base + size;
if (copy_from_user(g_base, (void __user *)(unsigned long)crtc_lut->green, size)) {
ret = -EFAULT;
goto out;
}
b_base = g_base + size;
if (copy_from_user(b_base, (void __user *)(unsigned long)crtc_lut->blue, size)) {
ret = -EFAULT;
goto out;
}
ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size);
out:
drm_modeset_unlock_all(dev);
return ret;
}
/**
* drm_mode_gamma_get_ioctl - get the gamma table
* @dev: DRM device
* @data: ioctl data
* @file_priv: DRM file info
*
* Copy the current gamma table into the storage provided. This also provides
* the gamma table size the driver expects, which can be used to size the
* allocated storage.
*
* Called by the user via ioctl.
*
* Returns:
* Zero on success, negative errno on failure.
*/
int drm_mode_gamma_get_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
struct drm_mode_crtc_lut *crtc_lut = data;
struct drm_crtc *crtc;
void *r_base, *g_base, *b_base;
int size;
int ret = 0;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
drm_modeset_lock_all(dev);
crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
if (!crtc) {
ret = -ENOENT;
goto out;
}
/* memcpy into gamma store */
if (crtc_lut->gamma_size != crtc->gamma_size) {
ret = -EINVAL;
goto out;
}
size = crtc_lut->gamma_size * (sizeof(uint16_t));
r_base = crtc->gamma_store;
if (copy_to_user((void __user *)(unsigned long)crtc_lut->red, r_base, size)) {
ret = -EFAULT;
goto out;
}
g_base = r_base + size;
if (copy_to_user((void __user *)(unsigned long)crtc_lut->green, g_base, size)) {
ret = -EFAULT;
goto out;
}
b_base = g_base + size;
if (copy_to_user((void __user *)(unsigned long)crtc_lut->blue, b_base, size)) {
ret = -EFAULT;
goto out;
}
out:
drm_modeset_unlock_all(dev);
return ret;
}
This diff is collapsed.
...@@ -29,7 +29,14 @@ ...@@ -29,7 +29,14 @@
#include <drm/drm_dp_helper.h> #include <drm/drm_dp_helper.h>
/* drm_fb_helper.c */ /* drm_fb_helper.c */
#ifdef CONFIG_DRM_FBDEV_EMULATION
int drm_fb_helper_modinit(void); int drm_fb_helper_modinit(void);
#else
static inline int drm_fb_helper_modinit(void)
{
return 0;
}
#endif
/* drm_dp_aux_dev.c */ /* drm_dp_aux_dev.c */
#ifdef CONFIG_DRM_DP_AUX_CHARDEV #ifdef CONFIG_DRM_DP_AUX_CHARDEV
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj, int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
struct drm_property *property, struct drm_property *property,
uint64_t value); uint64_t value);
int drm_plane_check_pixel_format(const struct drm_plane *plane,
u32 format);
int drm_crtc_check_viewport(const struct drm_crtc *crtc, int drm_crtc_check_viewport(const struct drm_crtc *crtc,
int x, int y, int x, int y,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
...@@ -56,28 +54,19 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, ...@@ -56,28 +54,19 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
/* IOCTLs */ /* IOCTLs */
int drm_mode_getresources(struct drm_device *dev, int drm_mode_getresources(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_getplane_res(struct drm_device *dev, void *data,
struct drm_file *file_priv);
int drm_mode_getcrtc(struct drm_device *dev, int drm_mode_getcrtc(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_setcrtc(struct drm_device *dev, int drm_mode_setcrtc(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_getplane(struct drm_device *dev,
void *data, struct drm_file *file_priv); /* drm_color_mgmt.c */
int drm_mode_setplane(struct drm_device *dev,
void *data, struct drm_file *file_priv); /* IOCTLs */
int drm_mode_cursor_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_cursor2_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_gamma_get_ioctl(struct drm_device *dev, int drm_mode_gamma_get_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_gamma_set_ioctl(struct drm_device *dev, int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_page_flip_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
/* drm_property.c */ /* drm_property.c */
void drm_property_destroy_user_blobs(struct drm_device *dev, void drm_property_destroy_user_blobs(struct drm_device *dev,
struct drm_file *file_priv); struct drm_file *file_priv);
...@@ -155,6 +144,9 @@ drm_internal_framebuffer_create(struct drm_device *dev, ...@@ -155,6 +144,9 @@ drm_internal_framebuffer_create(struct drm_device *dev,
const struct drm_mode_fb_cmd2 *r, const struct drm_mode_fb_cmd2 *r,
struct drm_file *file_priv); struct drm_file *file_priv);
void drm_framebuffer_free(struct kref *kref); void drm_framebuffer_free(struct kref *kref);
int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h,
const struct drm_framebuffer *fb);
/* IOCTL */ /* IOCTL */
int drm_mode_addfb(struct drm_device *dev, int drm_mode_addfb(struct drm_device *dev,
...@@ -177,6 +169,23 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, ...@@ -177,6 +169,23 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
int drm_modeset_register_all(struct drm_device *dev); int drm_modeset_register_all(struct drm_device *dev);
void drm_modeset_unregister_all(struct drm_device *dev); void drm_modeset_unregister_all(struct drm_device *dev);
/* drm_blend.c */
int drm_atomic_normalize_zpos(struct drm_device *dev, /* drm_plane.c */
struct drm_atomic_state *state); int drm_plane_register_all(struct drm_device *dev);
void drm_plane_unregister_all(struct drm_device *dev);
int drm_plane_check_pixel_format(const struct drm_plane *plane,
u32 format);
/* IOCTL */
int drm_mode_getplane_res(struct drm_device *dev, void *data,
struct drm_file *file_priv);
int drm_mode_getplane(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_setplane(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_cursor_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_cursor2_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
int drm_mode_page_flip_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/seq_file.h>
#include <drm/drm_dp_helper.h> #include <drm/drm_dp_helper.h>
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_core.h>
#include "drm_crtc_internal.h" #include "drm_crtc_internal.h"
#include "drm_legacy.h" #include "drm_legacy.h"
#include "drm_internal.h" #include "drm_internal.h"
...@@ -46,8 +45,8 @@ ...@@ -46,8 +45,8 @@
unsigned int drm_debug = 0; unsigned int drm_debug = 0;
EXPORT_SYMBOL(drm_debug); EXPORT_SYMBOL(drm_debug);
MODULE_AUTHOR(CORE_AUTHOR); MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl");
MODULE_DESCRIPTION(CORE_DESC); MODULE_DESCRIPTION("DRM shared core routines");
MODULE_LICENSE("GPL and additional rights"); MODULE_LICENSE("GPL and additional rights");
MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n" MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
"\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n" "\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n"
...@@ -339,6 +338,9 @@ void drm_minor_release(struct drm_minor *minor) ...@@ -339,6 +338,9 @@ void drm_minor_release(struct drm_minor *minor)
static int drm_dev_set_unique(struct drm_device *dev, const char *name) static int drm_dev_set_unique(struct drm_device *dev, const char *name)
{ {
if (!name)
return -EINVAL;
kfree(dev->unique); kfree(dev->unique);
dev->unique = kstrdup(name, GFP_KERNEL); dev->unique = kstrdup(name, GFP_KERNEL);
...@@ -589,7 +591,7 @@ EXPORT_SYMBOL(drm_dev_init); ...@@ -589,7 +591,7 @@ EXPORT_SYMBOL(drm_dev_init);
* own struct should look at using drm_dev_init() instead. * own struct should look at using drm_dev_init() instead.
* *
* RETURNS: * RETURNS:
* Pointer to new DRM device, or NULL if out of memory. * Pointer to new DRM device, or ERR_PTR on failure.
*/ */
struct drm_device *drm_dev_alloc(struct drm_driver *driver, struct drm_device *drm_dev_alloc(struct drm_driver *driver,
struct device *parent) struct device *parent)
...@@ -599,12 +601,12 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -599,12 +601,12 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) if (!dev)
return NULL; return ERR_PTR(-ENOMEM);
ret = drm_dev_init(dev, driver, parent); ret = drm_dev_init(dev, driver, parent);
if (ret) { if (ret) {
kfree(dev); kfree(dev);
return NULL; return ERR_PTR(ret);
} }
return dev; return dev;
...@@ -821,53 +823,48 @@ static const struct file_operations drm_stub_fops = { ...@@ -821,53 +823,48 @@ static const struct file_operations drm_stub_fops = {
.llseek = noop_llseek, .llseek = noop_llseek,
}; };
static void drm_core_exit(void)
{
unregister_chrdev(DRM_MAJOR, "drm");
debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
idr_destroy(&drm_minors_idr);
drm_connector_ida_destroy();
drm_global_release();
}
static int __init drm_core_init(void) static int __init drm_core_init(void)
{ {
int ret = -ENOMEM; int ret;
drm_global_init(); drm_global_init();
drm_connector_ida_init(); drm_connector_ida_init();
idr_init(&drm_minors_idr); idr_init(&drm_minors_idr);
if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
goto err_p1;
ret = drm_sysfs_init(); ret = drm_sysfs_init();
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "DRM: Error creating drm class.\n"); DRM_ERROR("Cannot create DRM class: %d\n", ret);
goto err_p2; goto error;
} }
drm_debugfs_root = debugfs_create_dir("dri", NULL); drm_debugfs_root = debugfs_create_dir("dri", NULL);
if (!drm_debugfs_root) { if (!drm_debugfs_root) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri\n"); ret = -ENOMEM;
ret = -1; DRM_ERROR("Cannot create debugfs-root: %d\n", ret);
goto err_p3; goto error;
} }
DRM_INFO("Initialized %s %d.%d.%d %s\n", ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); if (ret < 0)
goto error;
DRM_INFO("Initialized\n");
return 0; return 0;
err_p3:
drm_sysfs_destroy();
err_p2:
unregister_chrdev(DRM_MAJOR, "drm");
idr_destroy(&drm_minors_idr); error:
err_p1: drm_core_exit();
return ret; return ret;
} }
static void __exit drm_core_exit(void)
{
debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
unregister_chrdev(DRM_MAJOR, "drm");
drm_connector_ida_destroy();
idr_destroy(&drm_minors_idr);
}
module_init(drm_core_init); module_init(drm_core_init);
module_exit(drm_core_exit); module_exit(drm_core_exit);
...@@ -31,20 +31,21 @@ ...@@ -31,20 +31,21 @@
* *
* Encoders represent the connecting element between the CRTC (as the overall * Encoders represent the connecting element between the CRTC (as the overall
* pixel pipeline, represented by struct &drm_crtc) and the connectors (as the * pixel pipeline, represented by struct &drm_crtc) and the connectors (as the
* generic sink entity, represented by struct &drm_connector). Encoders are * generic sink entity, represented by struct &drm_connector). An encoder takes
* objects exposed to userspace, originally to allow userspace to infer cloning * pixel data from a CRTC and converts it to a format suitable for any attached
* and connector/CRTC restrictions. Unfortunately almost all drivers get this * connector. Encoders are objects exposed to userspace, originally to allow
* wrong, making the uabi pretty much useless. On top of that the exposed * userspace to infer cloning and connector/CRTC restrictions. Unfortunately
* restrictions are too simple for todays hardware, and the recommend way to * almost all drivers get this wrong, making the uabi pretty much useless. On
* infer restrictions is by using the DRM_MODE_ATOMIC_TEST_ONLY flag for the * top of that the exposed restrictions are too simple for today's hardware, and
* atomic IOCTL. * the recommended way to infer restrictions is by using the
* DRM_MODE_ATOMIC_TEST_ONLY flag for the atomic IOCTL.
* *
* Otherwise encoders aren't used in the uapi at all (any modeset request from * Otherwise encoders aren't used in the uapi at all (any modeset request from
* userspace directly connects a connector with a CRTC), drivers are therefore * userspace directly connects a connector with a CRTC), drivers are therefore
* free to use them however they wish. Modeset helper libraries make strong use * free to use them however they wish. Modeset helper libraries make strong use
* of encoders to facilitate code sharing. But for more complex settings it is * of encoders to facilitate code sharing. But for more complex settings it is
* usually better to move shared code into a separate &drm_bridge. Compared to * usually better to move shared code into a separate &drm_bridge. Compared to
* encoders bridges also have the benefit of not being purely an internal * encoders, bridges also have the benefit of being purely an internal
* abstraction since they are not exposed to userspace at all. * abstraction since they are not exposed to userspace at all.
* *
* Encoders are initialized with drm_encoder_init() and cleaned up using * Encoders are initialized with drm_encoder_init() and cleaned up using
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include "drm_crtc_helper_internal.h"
static bool drm_fbdev_emulation = true; static bool drm_fbdev_emulation = true;
module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600); module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
MODULE_PARM_DESC(fbdev_emulation, MODULE_PARM_DESC(fbdev_emulation,
......
...@@ -199,7 +199,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) ...@@ -199,7 +199,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
filp->private_data = priv; filp->private_data = priv;
priv->filp = filp; priv->filp = filp;
priv->uid = current_euid();
priv->pid = get_pid(task_pid(current)); priv->pid = get_pid(task_pid(current));
priv->minor = minor; priv->minor = minor;
......
...@@ -62,6 +62,32 @@ ...@@ -62,6 +62,32 @@
* &drm_framebuffer. * &drm_framebuffer.
*/ */
int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h,
const struct drm_framebuffer *fb)
{
unsigned int fb_width, fb_height;
fb_width = fb->width << 16;
fb_height = fb->height << 16;
/* Make sure source coordinates are inside the fb. */
if (src_w > fb_width ||
src_x > fb_width - src_w ||
src_h > fb_height ||
src_y > fb_height - src_h) {
DRM_DEBUG_KMS("Invalid source coordinates "
"%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
src_w >> 16, ((src_w & 0xffff) * 15625) >> 10,
src_h >> 16, ((src_h & 0xffff) * 15625) >> 10,
src_x >> 16, ((src_x & 0xffff) * 15625) >> 10,
src_y >> 16, ((src_y & 0xffff) * 15625) >> 10);
return -ENOSPC;
}
return 0;
}
/** /**
* drm_mode_addfb - add an FB to the graphics configuration * drm_mode_addfb - add an FB to the graphics configuration
* @dev: drm device for the ioctl * @dev: drm device for the ioctl
......
...@@ -257,7 +257,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) ...@@ -257,7 +257,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
if (drm_core_check_feature(dev, DRIVER_PRIME)) if (drm_core_check_feature(dev, DRIVER_PRIME))
drm_gem_remove_prime_handles(obj, file_priv); drm_gem_remove_prime_handles(obj, file_priv);
drm_vma_node_revoke(&obj->vma_node, file_priv->filp); drm_vma_node_revoke(&obj->vma_node, file_priv);
if (dev->driver->gem_close_object) if (dev->driver->gem_close_object)
dev->driver->gem_close_object(obj, file_priv); dev->driver->gem_close_object(obj, file_priv);
...@@ -372,7 +372,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv, ...@@ -372,7 +372,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
handle = ret; handle = ret;
ret = drm_vma_node_allow(&obj->vma_node, file_priv->filp); ret = drm_vma_node_allow(&obj->vma_node, file_priv);
if (ret) if (ret)
goto err_remove; goto err_remove;
...@@ -386,7 +386,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv, ...@@ -386,7 +386,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
return 0; return 0;
err_revoke: err_revoke:
drm_vma_node_revoke(&obj->vma_node, file_priv->filp); drm_vma_node_revoke(&obj->vma_node, file_priv);
err_remove: err_remove:
spin_lock(&file_priv->table_lock); spin_lock(&file_priv->table_lock);
idr_remove(&file_priv->object_idr, handle); idr_remove(&file_priv->object_idr, handle);
...@@ -991,7 +991,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -991,7 +991,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
if (!obj) if (!obj)
return -EINVAL; return -EINVAL;
if (!drm_vma_node_is_allowed(node, filp)) { if (!drm_vma_node_is_allowed(node, priv)) {
drm_gem_object_unreference_unlocked(obj); drm_gem_object_unreference_unlocked(obj);
return -EACCES; return -EACCES;
} }
......
...@@ -80,6 +80,7 @@ int drm_clients_info(struct seq_file *m, void *data) ...@@ -80,6 +80,7 @@ int drm_clients_info(struct seq_file *m, void *data)
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
struct drm_file *priv; struct drm_file *priv;
kuid_t uid;
seq_printf(m, seq_printf(m,
"%20s %5s %3s master a %5s %10s\n", "%20s %5s %3s master a %5s %10s\n",
...@@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data) ...@@ -98,13 +99,14 @@ int drm_clients_info(struct seq_file *m, void *data)
rcu_read_lock(); /* locks pid_task()->comm */ rcu_read_lock(); /* locks pid_task()->comm */
task = pid_task(priv->pid, PIDTYPE_PID); task = pid_task(priv->pid, PIDTYPE_PID);
uid = task ? __task_cred(task)->euid : GLOBAL_ROOT_UID;
seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n", seq_printf(m, "%20s %5d %3d %c %c %5d %10u\n",
task ? task->comm : "<unknown>", task ? task->comm : "<unknown>",
pid_vnr(priv->pid), pid_vnr(priv->pid),
priv->minor->index, priv->minor->index,
drm_is_current_master(priv) ? 'y' : 'n', drm_is_current_master(priv) ? 'y' : 'n',
priv->authenticated ? 'y' : 'n', priv->authenticated ? 'y' : 'n',
from_kuid_munged(seq_user_ns(m), priv->uid), from_kuid_munged(seq_user_ns(m), uid),
priv->magic); priv->magic);
rcu_read_unlock(); rcu_read_unlock();
} }
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#define DRM_IF_MAJOR 1
#define DRM_IF_MINOR 4
/* drm_irq.c */ /* drm_irq.c */
extern unsigned int drm_timestamp_monotonic; extern unsigned int drm_timestamp_monotonic;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_core.h>
#define DRM_IOCTL_VERSION32 DRM_IOWR(0x00, drm_version32_t) #define DRM_IOCTL_VERSION32 DRM_IOWR(0x00, drm_version32_t)
#define DRM_IOCTL_GET_UNIQUE32 DRM_IOWR(0x01, drm_unique32_t) #define DRM_IOCTL_GET_UNIQUE32 DRM_IOWR(0x01, drm_unique32_t)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_core.h>
#include <drm/drm_auth.h> #include <drm/drm_auth.h>
#include "drm_legacy.h" #include "drm_legacy.h"
#include "drm_internal.h" #include "drm_internal.h"
......
...@@ -236,8 +236,8 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, ...@@ -236,8 +236,8 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
DRM_DEBUG("\n"); DRM_DEBUG("\n");
dev = drm_dev_alloc(driver, &pdev->dev); dev = drm_dev_alloc(driver, &pdev->dev);
if (!dev) if (IS_ERR(dev))
return -ENOMEM; return PTR_ERR(dev);
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
if (ret) if (ret)
......
This diff is collapsed.
...@@ -48,8 +48,8 @@ static int drm_get_platform_dev(struct platform_device *platdev, ...@@ -48,8 +48,8 @@ static int drm_get_platform_dev(struct platform_device *platdev,
DRM_DEBUG("\n"); DRM_DEBUG("\n");
dev = drm_dev_alloc(driver, &platdev->dev); dev = drm_dev_alloc(driver, &platdev->dev);
if (!dev) if (IS_ERR(dev))
return -ENOMEM; return PTR_ERR(dev);
dev->platformdev = platdev; dev->platformdev = platdev;
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <drm/drm_sysfs.h> #include <drm/drm_sysfs.h>
#include <drm/drm_core.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include "drm_internal.h" #include "drm_internal.h"
...@@ -37,12 +36,7 @@ static char *drm_devnode(struct device *dev, umode_t *mode) ...@@ -37,12 +36,7 @@ static char *drm_devnode(struct device *dev, umode_t *mode)
return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
} }
static CLASS_ATTR_STRING(version, S_IRUGO, static CLASS_ATTR_STRING(version, S_IRUGO, "drm 1.1.0 20060810");
CORE_NAME " "
__stringify(CORE_MAJOR) "."
__stringify(CORE_MINOR) "."
__stringify(CORE_PATCHLEVEL) " "
CORE_DATE);
/** /**
* drm_sysfs_init - initialize sysfs helpers * drm_sysfs_init - initialize sysfs helpers
......
This diff is collapsed.
...@@ -529,8 +529,8 @@ static int etnaviv_bind(struct device *dev) ...@@ -529,8 +529,8 @@ static int etnaviv_bind(struct device *dev)
int ret; int ret;
drm = drm_dev_alloc(&etnaviv_drm_driver, dev); drm = drm_dev_alloc(&etnaviv_drm_driver, dev);
if (!drm) if (IS_ERR(drm))
return -ENOMEM; return PTR_ERR(drm);
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv) {
......
...@@ -410,8 +410,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev) ...@@ -410,8 +410,8 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
fsl_dev->tcon = fsl_tcon_init(dev); fsl_dev->tcon = fsl_tcon_init(dev);
drm = drm_dev_alloc(driver, dev); drm = drm_dev_alloc(driver, dev);
if (!drm) { if (IS_ERR(drm)) {
ret = -ENOMEM; ret = PTR_ERR(drm);
goto disable_pix_clk; goto disable_pix_clk;
} }
......
...@@ -207,8 +207,8 @@ static int kirin_drm_bind(struct device *dev) ...@@ -207,8 +207,8 @@ static int kirin_drm_bind(struct device *dev)
int ret; int ret;
drm_dev = drm_dev_alloc(driver, dev); drm_dev = drm_dev_alloc(driver, dev);
if (!drm_dev) if (IS_ERR(drm_dev))
return -ENOMEM; return PTR_ERR(drm_dev);
drm_dev->platformdev = to_platform_device(dev); drm_dev->platformdev = to_platform_device(dev);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment