Rev 4104 | Rev 5060 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4104 | Rev 4560 | ||
---|---|---|---|
Line 196... | Line 196... | ||
196 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, |
196 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" }, |
197 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, |
197 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" }, |
198 | { DRM_MODE_CONNECTOR_TV, "TV" }, |
198 | { DRM_MODE_CONNECTOR_TV, "TV" }, |
199 | { DRM_MODE_CONNECTOR_eDP, "eDP" }, |
199 | { DRM_MODE_CONNECTOR_eDP, "eDP" }, |
200 | { DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" }, |
200 | { DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" }, |
- | 201 | { DRM_MODE_CONNECTOR_DSI, "DSI" }, |
|
201 | }; |
202 | }; |
Line 202... | Line 203... | ||
202 | 203 | ||
203 | static const struct drm_prop_enum_list drm_encoder_enum_list[] = |
204 | static const struct drm_prop_enum_list drm_encoder_enum_list[] = |
204 | { { DRM_MODE_ENCODER_NONE, "None" }, |
205 | { { DRM_MODE_ENCODER_NONE, "None" }, |
205 | { DRM_MODE_ENCODER_DAC, "DAC" }, |
206 | { DRM_MODE_ENCODER_DAC, "DAC" }, |
206 | { DRM_MODE_ENCODER_TMDS, "TMDS" }, |
207 | { DRM_MODE_ENCODER_TMDS, "TMDS" }, |
207 | { DRM_MODE_ENCODER_LVDS, "LVDS" }, |
208 | { DRM_MODE_ENCODER_LVDS, "LVDS" }, |
208 | { DRM_MODE_ENCODER_TVDAC, "TV" }, |
209 | { DRM_MODE_ENCODER_TVDAC, "TV" }, |
- | 210 | { DRM_MODE_ENCODER_VIRTUAL, "Virtual" }, |
|
209 | { DRM_MODE_ENCODER_VIRTUAL, "Virtual" }, |
211 | { DRM_MODE_ENCODER_DSI, "DSI" }, |
Line 210... | Line 212... | ||
210 | }; |
212 | }; |
211 | 213 | ||
212 | void drm_connector_ida_init(void) |
214 | void drm_connector_ida_init(void) |
Line 667... | Line 669... | ||
667 | dev->mode_config.num_crtc--; |
669 | dev->mode_config.num_crtc--; |
668 | } |
670 | } |
669 | EXPORT_SYMBOL(drm_crtc_cleanup); |
671 | EXPORT_SYMBOL(drm_crtc_cleanup); |
Line 670... | Line 672... | ||
670 | 672 | ||
- | 673 | /** |
|
- | 674 | * drm_crtc_index - find the index of a registered CRTC |
|
- | 675 | * @crtc: CRTC to find index for |
|
- | 676 | * |
|
- | 677 | * Given a registered CRTC, return the index of that CRTC within a DRM |
|
- | 678 | * device's list of CRTCs. |
|
- | 679 | */ |
|
- | 680 | unsigned int drm_crtc_index(struct drm_crtc *crtc) |
|
- | 681 | { |
|
- | 682 | unsigned int index = 0; |
|
- | 683 | struct drm_crtc *tmp; |
|
- | 684 | ||
- | 685 | list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { |
|
- | 686 | if (tmp == crtc) |
|
- | 687 | return index; |
|
- | 688 | ||
- | 689 | index++; |
|
- | 690 | } |
|
- | 691 | ||
- | 692 | BUG(); |
|
- | 693 | } |
|
- | 694 | EXPORT_SYMBOL(drm_crtc_index); |
|
- | 695 | ||
671 | /** |
696 | /** |
672 | * drm_mode_probed_add - add a mode to a connector's probed mode list |
697 | * drm_mode_probed_add - add a mode to a connector's probed mode list |
673 | * @connector: connector the new mode |
698 | * @connector: connector the new mode |
674 | * @mode: mode data |
699 | * @mode: mode data |
675 | * |
700 | * |
Line 1295... | Line 1320... | ||
1295 | strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); |
1320 | strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); |
1296 | out->name[DRM_DISPLAY_MODE_LEN-1] = 0; |
1321 | out->name[DRM_DISPLAY_MODE_LEN-1] = 0; |
1297 | } |
1322 | } |
Line 1298... | Line 1323... | ||
1298 | 1323 | ||
1299 | /** |
1324 | /** |
1300 | * drm_crtc_convert_to_umode - convert a modeinfo into a drm_display_mode |
1325 | * drm_crtc_convert_umode - convert a modeinfo into a drm_display_mode |
1301 | * @out: drm_display_mode to return to the user |
1326 | * @out: drm_display_mode to return to the user |
1302 | * @in: drm_mode_modeinfo to use |
1327 | * @in: drm_mode_modeinfo to use |
1303 | * |
1328 | * |
1304 | * Convert a drm_mode_modeinfo into a drm_display_mode structure to return to |
1329 | * Convert a drm_mode_modeinfo into a drm_display_mode structure to return to |
Line 1311... | Line 1336... | ||
1311 | const struct drm_mode_modeinfo *in) |
1336 | const struct drm_mode_modeinfo *in) |
1312 | { |
1337 | { |
1313 | if (in->clock > INT_MAX || in->vrefresh > INT_MAX) |
1338 | if (in->clock > INT_MAX || in->vrefresh > INT_MAX) |
1314 | return -ERANGE; |
1339 | return -ERANGE; |
Line -... | Line 1340... | ||
- | 1340 | ||
- | 1341 | if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX) |
|
- | 1342 | return -EINVAL; |
|
1315 | 1343 | ||
1316 | out->clock = in->clock; |
1344 | out->clock = in->clock; |
1317 | out->hdisplay = in->hdisplay; |
1345 | out->hdisplay = in->hdisplay; |
1318 | out->hsync_start = in->hsync_start; |
1346 | out->hsync_start = in->hsync_start; |
1319 | out->hsync_end = in->hsync_end; |
1347 | out->hsync_end = in->hsync_end; |
Line 1548... | Line 1576... | ||
1548 | drm_modeset_lock_all(dev); |
1576 | drm_modeset_lock_all(dev); |
Line 1549... | Line 1577... | ||
1549 | 1577 | ||
1550 | obj = drm_mode_object_find(dev, crtc_resp->crtc_id, |
1578 | obj = drm_mode_object_find(dev, crtc_resp->crtc_id, |
1551 | DRM_MODE_OBJECT_CRTC); |
1579 | DRM_MODE_OBJECT_CRTC); |
1552 | if (!obj) { |
1580 | if (!obj) { |
1553 | ret = -EINVAL; |
1581 | ret = -ENOENT; |
1554 | goto out; |
1582 | goto out; |
1555 | } |
1583 | } |
Line 1556... | Line 1584... | ||
1556 | crtc = obj_to_crtc(obj); |
1584 | crtc = obj_to_crtc(obj); |
Line 1575... | Line 1603... | ||
1575 | out: |
1603 | out: |
1576 | drm_modeset_unlock_all(dev); |
1604 | drm_modeset_unlock_all(dev); |
1577 | return ret; |
1605 | return ret; |
1578 | } |
1606 | } |
Line -... | Line 1607... | ||
- | 1607 | ||
- | 1608 | static bool drm_mode_expose_to_userspace(const struct drm_display_mode *mode, |
|
- | 1609 | const struct drm_file *file_priv) |
|
- | 1610 | { |
|
- | 1611 | /* |
|
- | 1612 | * If user-space hasn't configured the driver to expose the stereo 3D |
|
- | 1613 | * modes, don't expose them. |
|
- | 1614 | */ |
|
- | 1615 | if (!file_priv->stereo_allowed && drm_mode_is_stereo(mode)) |
|
- | 1616 | return false; |
|
- | 1617 | ||
- | 1618 | return true; |
|
- | 1619 | } |
|
1579 | 1620 | ||
1580 | /** |
1621 | /** |
1581 | * drm_mode_getconnector - get connector configuration |
1622 | * drm_mode_getconnector - get connector configuration |
1582 | * @dev: drm device for the ioctl |
1623 | * @dev: drm device for the ioctl |
1583 | * @data: data pointer for the ioctl |
1624 | * @data: data pointer for the ioctl |
Line 1619... | Line 1660... | ||
1619 | mutex_lock(&dev->mode_config.mutex); |
1660 | mutex_lock(&dev->mode_config.mutex); |
Line 1620... | Line 1661... | ||
1620 | 1661 | ||
1621 | obj = drm_mode_object_find(dev, out_resp->connector_id, |
1662 | obj = drm_mode_object_find(dev, out_resp->connector_id, |
1622 | DRM_MODE_OBJECT_CONNECTOR); |
1663 | DRM_MODE_OBJECT_CONNECTOR); |
1623 | if (!obj) { |
1664 | if (!obj) { |
1624 | ret = -EINVAL; |
1665 | ret = -ENOENT; |
1625 | goto out; |
1666 | goto out; |
1626 | } |
1667 | } |
Line 1627... | Line 1668... | ||
1627 | connector = obj_to_connector(obj); |
1668 | connector = obj_to_connector(obj); |
Line 1640... | Line 1681... | ||
1640 | dev->mode_config.max_height); |
1681 | dev->mode_config.max_height); |
1641 | } |
1682 | } |
Line 1642... | Line 1683... | ||
1642 | 1683 | ||
1643 | /* delayed so we get modes regardless of pre-fill_modes state */ |
1684 | /* delayed so we get modes regardless of pre-fill_modes state */ |
- | 1685 | list_for_each_entry(mode, &connector->modes, head) |
|
1644 | list_for_each_entry(mode, &connector->modes, head) |
1686 | if (drm_mode_expose_to_userspace(mode, file_priv)) |
Line 1645... | Line 1687... | ||
1645 | mode_count++; |
1687 | mode_count++; |
1646 | 1688 | ||
1647 | out_resp->connector_id = connector->base.id; |
1689 | out_resp->connector_id = connector->base.id; |
Line 1662... | Line 1704... | ||
1662 | */ |
1704 | */ |
1663 | if ((out_resp->count_modes >= mode_count) && mode_count) { |
1705 | if ((out_resp->count_modes >= mode_count) && mode_count) { |
1664 | copied = 0; |
1706 | copied = 0; |
1665 | mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr; |
1707 | mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr; |
1666 | list_for_each_entry(mode, &connector->modes, head) { |
1708 | list_for_each_entry(mode, &connector->modes, head) { |
- | 1709 | if (!drm_mode_expose_to_userspace(mode, file_priv)) |
|
- | 1710 | continue; |
|
- | 1711 | ||
1667 | drm_crtc_convert_to_umode(&u_mode, mode); |
1712 | drm_crtc_convert_to_umode(&u_mode, mode); |
1668 | if (copy_to_user(mode_ptr + copied, |
1713 | if (copy_to_user(mode_ptr + copied, |
1669 | &u_mode, sizeof(u_mode))) { |
1714 | &u_mode, sizeof(u_mode))) { |
1670 | ret = -EFAULT; |
1715 | ret = -EFAULT; |
1671 | goto out; |
1716 | goto out; |
Line 1731... | Line 1776... | ||
1731 | 1776 | ||
1732 | drm_modeset_lock_all(dev); |
1777 | drm_modeset_lock_all(dev); |
1733 | obj = drm_mode_object_find(dev, enc_resp->encoder_id, |
1778 | obj = drm_mode_object_find(dev, enc_resp->encoder_id, |
1734 | DRM_MODE_OBJECT_ENCODER); |
1779 | DRM_MODE_OBJECT_ENCODER); |
1735 | if (!obj) { |
1780 | if (!obj) { |
1736 | ret = -EINVAL; |
1781 | ret = -ENOENT; |
1737 | goto out; |
1782 | goto out; |
1738 | } |
1783 | } |
Line 1739... | Line 1784... | ||
1739 | encoder = obj_to_encoder(obj); |
1784 | encoder = obj_to_encoder(obj); |
Line 2038... | Line 2083... | ||
2038 | return ret; |
2083 | return ret; |
2039 | } |
2084 | } |
2040 | EXPORT_SYMBOL(drm_mode_set_config_internal); |
2085 | EXPORT_SYMBOL(drm_mode_set_config_internal); |
Line 2041... | Line 2086... | ||
2041 | 2086 | ||
- | 2087 | #if 0 |
|
- | 2088 | /* |
|
- | 2089 | * Checks that the framebuffer is big enough for the CRTC viewport |
|
- | 2090 | * (x, y, hdisplay, vdisplay) |
|
- | 2091 | */ |
|
- | 2092 | static int drm_crtc_check_viewport(const struct drm_crtc *crtc, |
|
- | 2093 | int x, int y, |
|
- | 2094 | const struct drm_display_mode *mode, |
|
- | 2095 | const struct drm_framebuffer *fb) |
|
- | 2096 | ||
- | 2097 | { |
|
- | 2098 | int hdisplay, vdisplay; |
|
- | 2099 | ||
- | 2100 | hdisplay = mode->hdisplay; |
|
- | 2101 | vdisplay = mode->vdisplay; |
|
- | 2102 | ||
- | 2103 | if (drm_mode_is_stereo(mode)) { |
|
- | 2104 | struct drm_display_mode adjusted = *mode; |
|
- | 2105 | ||
- | 2106 | drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE); |
|
- | 2107 | hdisplay = adjusted.crtc_hdisplay; |
|
- | 2108 | vdisplay = adjusted.crtc_vdisplay; |
|
- | 2109 | } |
|
- | 2110 | ||
- | 2111 | if (crtc->invert_dimensions) |
|
- | 2112 | swap(hdisplay, vdisplay); |
|
- | 2113 | ||
- | 2114 | if (hdisplay > fb->width || |
|
- | 2115 | vdisplay > fb->height || |
|
- | 2116 | x > fb->width - hdisplay || |
|
- | 2117 | y > fb->height - vdisplay) { |
|
- | 2118 | DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n", |
|
- | 2119 | fb->width, fb->height, hdisplay, vdisplay, x, y, |
|
- | 2120 | crtc->invert_dimensions ? " (inverted)" : ""); |
|
- | 2121 | return -ENOSPC; |
|
- | 2122 | } |
|
- | 2123 | ||
- | 2124 | return 0; |
|
- | 2125 | } |
|
2042 | #if 0 |
2126 | |
2043 | /** |
2127 | /** |
2044 | * drm_mode_setcrtc - set CRTC configuration |
2128 | * drm_mode_setcrtc - set CRTC configuration |
2045 | * @dev: drm device for the ioctl |
2129 | * @dev: drm device for the ioctl |
2046 | * @data: data pointer for the ioctl |
2130 | * @data: data pointer for the ioctl |
Line 2078... | Line 2162... | ||
2078 | drm_modeset_lock_all(dev); |
2162 | drm_modeset_lock_all(dev); |
2079 | obj = drm_mode_object_find(dev, crtc_req->crtc_id, |
2163 | obj = drm_mode_object_find(dev, crtc_req->crtc_id, |
2080 | DRM_MODE_OBJECT_CRTC); |
2164 | DRM_MODE_OBJECT_CRTC); |
2081 | if (!obj) { |
2165 | if (!obj) { |
2082 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id); |
2166 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id); |
2083 | ret = -EINVAL; |
2167 | ret = -ENOENT; |
2084 | goto out; |
2168 | goto out; |
2085 | } |
2169 | } |
2086 | crtc = obj_to_crtc(obj); |
2170 | crtc = obj_to_crtc(obj); |
2087 | DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id); |
2171 | DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id); |
Line 2088... | Line 2172... | ||
2088 | 2172 | ||
2089 | if (crtc_req->mode_valid) { |
- | |
2090 | int hdisplay, vdisplay; |
2173 | if (crtc_req->mode_valid) { |
2091 | /* If we have a mode we need a framebuffer. */ |
2174 | /* If we have a mode we need a framebuffer. */ |
2092 | /* If we pass -1, set the mode with the currently bound fb */ |
2175 | /* If we pass -1, set the mode with the currently bound fb */ |
2093 | if (crtc_req->fb_id == -1) { |
2176 | if (crtc_req->fb_id == -1) { |
2094 | if (!crtc->fb) { |
2177 | if (!crtc->fb) { |
Line 2102... | Line 2185... | ||
2102 | } else { |
2185 | } else { |
2103 | fb = drm_framebuffer_lookup(dev, crtc_req->fb_id); |
2186 | fb = drm_framebuffer_lookup(dev, crtc_req->fb_id); |
2104 | if (!fb) { |
2187 | if (!fb) { |
2105 | DRM_DEBUG_KMS("Unknown FB ID%d\n", |
2188 | DRM_DEBUG_KMS("Unknown FB ID%d\n", |
2106 | crtc_req->fb_id); |
2189 | crtc_req->fb_id); |
2107 | ret = -EINVAL; |
2190 | ret = -ENOENT; |
2108 | goto out; |
2191 | goto out; |
2109 | } |
2192 | } |
2110 | } |
2193 | } |
Line 2111... | Line 2194... | ||
2111 | 2194 | ||
Line 2121... | Line 2204... | ||
2121 | goto out; |
2204 | goto out; |
2122 | } |
2205 | } |
Line 2123... | Line 2206... | ||
2123 | 2206 | ||
Line 2124... | Line -... | ||
2124 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); |
- | |
2125 | - | ||
2126 | hdisplay = mode->hdisplay; |
- | |
2127 | vdisplay = mode->vdisplay; |
- | |
2128 | - | ||
2129 | if (crtc->invert_dimensions) |
- | |
2130 | swap(hdisplay, vdisplay); |
- | |
2131 | - | ||
2132 | if (hdisplay > fb->width || |
- | |
2133 | vdisplay > fb->height || |
- | |
2134 | crtc_req->x > fb->width - hdisplay || |
- | |
2135 | crtc_req->y > fb->height - vdisplay) { |
- | |
2136 | DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n", |
2207 | drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); |
2137 | fb->width, fb->height, |
2208 | |
2138 | hdisplay, vdisplay, crtc_req->x, crtc_req->y, |
2209 | ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y, |
2139 | crtc->invert_dimensions ? " (inverted)" : ""); |
2210 | mode, fb); |
2140 | ret = -ENOSPC; |
2211 | if (ret) |
2141 | goto out; |
2212 | goto out; |
Line 2142... | Line 2213... | ||
2142 | } |
2213 | |
2143 | } |
2214 | } |
2144 | 2215 | ||
Line 2182... | Line 2253... | ||
2182 | obj = drm_mode_object_find(dev, out_id, |
2253 | obj = drm_mode_object_find(dev, out_id, |
2183 | DRM_MODE_OBJECT_CONNECTOR); |
2254 | DRM_MODE_OBJECT_CONNECTOR); |
2184 | if (!obj) { |
2255 | if (!obj) { |
2185 | DRM_DEBUG_KMS("Connector id %d unknown\n", |
2256 | DRM_DEBUG_KMS("Connector id %d unknown\n", |
2186 | out_id); |
2257 | out_id); |
2187 | ret = -EINVAL; |
2258 | ret = -ENOENT; |
2188 | goto out; |
2259 | goto out; |
2189 | } |
2260 | } |
2190 | connector = obj_to_connector(obj); |
2261 | connector = obj_to_connector(obj); |
2191 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
2262 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
2192 | connector->base.id, |
2263 | connector->base.id, |
Line 2230... | Line 2301... | ||
2230 | return -EINVAL; |
2301 | return -EINVAL; |
Line 2231... | Line 2302... | ||
2231 | 2302 | ||
2232 | obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); |
2303 | obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); |
2233 | if (!obj) { |
2304 | if (!obj) { |
2234 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id); |
2305 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id); |
2235 | return -EINVAL; |
2306 | return -ENOENT; |
2236 | } |
2307 | } |
Line 2237... | Line 2308... | ||
2237 | crtc = obj_to_crtc(obj); |
2308 | crtc = obj_to_crtc(obj); |
2238 | 2309 | ||
Line 2282... | Line 2353... | ||
2282 | { |
2353 | { |
2283 | struct drm_mode_cursor2 *req = data; |
2354 | struct drm_mode_cursor2 *req = data; |
2284 | return drm_mode_cursor_common(dev, req, file_priv); |
2355 | return drm_mode_cursor_common(dev, req, file_priv); |
2285 | } |
2356 | } |
2286 | #endif |
2357 | #endif |
- | 2358 | ||
2287 | /* Original addfb only supported RGB formats, so figure out which one */ |
2359 | /* Original addfb only supported RGB formats, so figure out which one */ |
2288 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) |
2360 | uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth) |
2289 | { |
2361 | { |
2290 | uint32_t fmt; |
2362 | uint32_t fmt; |
Line 2439... | Line 2511... | ||
2439 | case DRM_FORMAT_YVU422: |
2511 | case DRM_FORMAT_YVU422: |
2440 | case DRM_FORMAT_YUV444: |
2512 | case DRM_FORMAT_YUV444: |
2441 | case DRM_FORMAT_YVU444: |
2513 | case DRM_FORMAT_YVU444: |
2442 | return 0; |
2514 | return 0; |
2443 | default: |
2515 | default: |
- | 2516 | DRM_DEBUG_KMS("invalid pixel format %s\n", |
|
- | 2517 | drm_get_format_name(r->pixel_format)); |
|
2444 | return -EINVAL; |
2518 | return -EINVAL; |
2445 | } |
2519 | } |
2446 | } |
2520 | } |
Line 2447... | Line 2521... | ||
2447 | 2521 | ||
Line 2604... | Line 2678... | ||
2604 | 2678 | ||
2605 | fail_lookup: |
2679 | fail_lookup: |
2606 | mutex_unlock(&dev->mode_config.fb_lock); |
2680 | mutex_unlock(&dev->mode_config.fb_lock); |
Line 2607... | Line 2681... | ||
2607 | mutex_unlock(&file_priv->fbs_lock); |
2681 | mutex_unlock(&file_priv->fbs_lock); |
2608 | 2682 | ||
Line 2609... | Line 2683... | ||
2609 | return -EINVAL; |
2683 | return -ENOENT; |
2610 | } |
2684 | } |
2611 | 2685 | ||
Line 2632... | Line 2706... | ||
2632 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2706 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2633 | return -EINVAL; |
2707 | return -EINVAL; |
Line 2634... | Line 2708... | ||
2634 | 2708 | ||
2635 | fb = drm_framebuffer_lookup(dev, r->fb_id); |
2709 | fb = drm_framebuffer_lookup(dev, r->fb_id); |
2636 | if (!fb) |
2710 | if (!fb) |
Line 2637... | Line 2711... | ||
2637 | return -EINVAL; |
2711 | return -ENOENT; |
2638 | 2712 | ||
2639 | r->height = fb->height; |
2713 | r->height = fb->height; |
2640 | r->width = fb->width; |
2714 | r->width = fb->width; |
Line 2677... | Line 2751... | ||
2677 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2751 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
2678 | return -EINVAL; |
2752 | return -EINVAL; |
Line 2679... | Line 2753... | ||
2679 | 2753 | ||
2680 | fb = drm_framebuffer_lookup(dev, r->fb_id); |
2754 | fb = drm_framebuffer_lookup(dev, r->fb_id); |
2681 | if (!fb) |
2755 | if (!fb) |
Line 2682... | Line 2756... | ||
2682 | return -EINVAL; |
2756 | return -ENOENT; |
2683 | 2757 | ||
Line 2684... | Line 2758... | ||
2684 | num_clips = r->num_clips; |
2758 | num_clips = r->num_clips; |
Line 2715... | Line 2789... | ||
2715 | goto out_err2; |
2789 | goto out_err2; |
2716 | } |
2790 | } |
2717 | } |
2791 | } |
Line 2718... | Line 2792... | ||
2718 | 2792 | ||
2719 | if (fb->funcs->dirty) { |
- | |
2720 | drm_modeset_lock_all(dev); |
2793 | if (fb->funcs->dirty) { |
2721 | ret = fb->funcs->dirty(fb, file_priv, flags, r->color, |
2794 | ret = fb->funcs->dirty(fb, file_priv, flags, r->color, |
2722 | clips, num_clips); |
- | |
2723 | drm_modeset_unlock_all(dev); |
2795 | clips, num_clips); |
2724 | } else { |
2796 | } else { |
2725 | ret = -ENOSYS; |
2797 | ret = -ENOSYS; |
Line 2726... | Line 2798... | ||
2726 | } |
2798 | } |
Line 3012... | Line 3084... | ||
3012 | return -EINVAL; |
3084 | return -EINVAL; |
Line 3013... | Line 3085... | ||
3013 | 3085 | ||
3014 | drm_modeset_lock_all(dev); |
3086 | drm_modeset_lock_all(dev); |
3015 | obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY); |
3087 | obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY); |
3016 | if (!obj) { |
3088 | if (!obj) { |
3017 | ret = -EINVAL; |
3089 | ret = -ENOENT; |
3018 | goto done; |
3090 | goto done; |
3019 | } |
3091 | } |
Line 3020... | Line 3092... | ||
3020 | property = obj_to_property(obj); |
3092 | property = obj_to_property(obj); |
Line 3143... | Line 3215... | ||
3143 | return -EINVAL; |
3215 | return -EINVAL; |
Line 3144... | Line 3216... | ||
3144 | 3216 | ||
3145 | drm_modeset_lock_all(dev); |
3217 | drm_modeset_lock_all(dev); |
3146 | obj = drm_mode_object_find(dev, out_resp->blob_id, DRM_MODE_OBJECT_BLOB); |
3218 | obj = drm_mode_object_find(dev, out_resp->blob_id, DRM_MODE_OBJECT_BLOB); |
3147 | if (!obj) { |
3219 | if (!obj) { |
3148 | ret = -EINVAL; |
3220 | ret = -ENOENT; |
3149 | goto done; |
3221 | goto done; |
3150 | } |
3222 | } |
Line 3151... | Line 3223... | ||
3151 | blob = obj_to_blob(obj); |
3223 | blob = obj_to_blob(obj); |
Line 3265... | Line 3337... | ||
3265 | 3337 | ||
Line 3266... | Line 3338... | ||
3266 | drm_modeset_lock_all(dev); |
3338 | drm_modeset_lock_all(dev); |
3267 | 3339 | ||
3268 | obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); |
3340 | obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); |
3269 | if (!obj) { |
3341 | if (!obj) { |
3270 | ret = -EINVAL; |
3342 | ret = -ENOENT; |
3271 | goto out; |
3343 | goto out; |
3272 | } |
3344 | } |
3273 | if (!obj->properties) { |
3345 | if (!obj->properties) { |
Line 3318... | Line 3390... | ||
3318 | return -EINVAL; |
3390 | return -EINVAL; |
Line 3319... | Line 3391... | ||
3319 | 3391 | ||
Line 3320... | Line 3392... | ||
3320 | drm_modeset_lock_all(dev); |
3392 | drm_modeset_lock_all(dev); |
3321 | 3393 | ||
- | 3394 | arg_obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); |
|
3322 | arg_obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); |
3395 | if (!arg_obj) { |
- | 3396 | ret = -ENOENT; |
|
3323 | if (!arg_obj) |
3397 | goto out; |
3324 | goto out; |
3398 | } |
Line 3325... | Line 3399... | ||
3325 | if (!arg_obj->properties) |
3399 | if (!arg_obj->properties) |
3326 | goto out; |
3400 | goto out; |
Line 3332... | Line 3406... | ||
3332 | if (i == arg_obj->properties->count) |
3406 | if (i == arg_obj->properties->count) |
3333 | goto out; |
3407 | goto out; |
Line 3334... | Line 3408... | ||
3334 | 3408 | ||
3335 | prop_obj = drm_mode_object_find(dev, arg->prop_id, |
3409 | prop_obj = drm_mode_object_find(dev, arg->prop_id, |
3336 | DRM_MODE_OBJECT_PROPERTY); |
3410 | DRM_MODE_OBJECT_PROPERTY); |
- | 3411 | if (!prop_obj) { |
|
3337 | if (!prop_obj) |
3412 | ret = -ENOENT; |
- | 3413 | goto out; |
|
3338 | goto out; |
3414 | } |
Line 3339... | Line 3415... | ||
3339 | property = obj_to_property(prop_obj); |
3415 | property = obj_to_property(prop_obj); |
3340 | 3416 | ||
Line 3420... | Line 3496... | ||
3420 | return -EINVAL; |
3496 | return -EINVAL; |
Line 3421... | Line 3497... | ||
3421 | 3497 | ||
3422 | drm_modeset_lock_all(dev); |
3498 | drm_modeset_lock_all(dev); |
3423 | obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); |
3499 | obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); |
3424 | if (!obj) { |
3500 | if (!obj) { |
3425 | ret = -EINVAL; |
3501 | ret = -ENOENT; |
3426 | goto out; |
3502 | goto out; |
3427 | } |
3503 | } |
Line 3428... | Line 3504... | ||
3428 | crtc = obj_to_crtc(obj); |
3504 | crtc = obj_to_crtc(obj); |
Line 3479... | Line 3555... | ||
3479 | return -EINVAL; |
3555 | return -EINVAL; |
Line 3480... | Line 3556... | ||
3480 | 3556 | ||
3481 | drm_modeset_lock_all(dev); |
3557 | drm_modeset_lock_all(dev); |
3482 | obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); |
3558 | obj = drm_mode_object_find(dev, crtc_lut->crtc_id, DRM_MODE_OBJECT_CRTC); |
3483 | if (!obj) { |
3559 | if (!obj) { |
3484 | ret = -EINVAL; |
3560 | ret = -ENOENT; |
3485 | goto out; |
3561 | goto out; |
3486 | } |
3562 | } |
Line 3487... | Line 3563... | ||
3487 | crtc = obj_to_crtc(obj); |
3563 | crtc = obj_to_crtc(obj); |
Line 3599... | Line 3675... | ||
3599 | case DRM_FORMAT_BGRA8888: |
3675 | case DRM_FORMAT_BGRA8888: |
3600 | *depth = 32; |
3676 | *depth = 32; |
3601 | *bpp = 32; |
3677 | *bpp = 32; |
3602 | break; |
3678 | break; |
3603 | default: |
3679 | default: |
3604 | DRM_DEBUG_KMS("unsupported pixel format\n"); |
3680 | DRM_DEBUG_KMS("unsupported pixel format %s\n", |
- | 3681 | drm_get_format_name(format)); |
|
3605 | *depth = 0; |
3682 | *depth = 0; |
3606 | *bpp = 0; |
3683 | *bpp = 0; |
3607 | break; |
3684 | break; |
3608 | } |
3685 | } |
3609 | } |
3686 | } |