* [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info
@ 2010-05-07 15:18 Jerome Glisse
2010-05-07 15:40 ` Alex Deucher
2010-05-11 4:07 ` Dave Airlie
0 siblings, 2 replies; 7+ messages in thread
From: Jerome Glisse @ 2010-05-07 15:18 UTC (permalink / raw)
To: airlied; +Cc: Jerome Glisse, dri-devel
Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
crtc id. Bump the minor version so userspace can enable conditionaly
features depend on this.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
---
drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
drivers/gpu/drm/radeon/radeon_kms.c | 18 ++++++++++++++++++
include/drm/radeon_drm.h | 1 +
3 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index b3749d4..df96ace 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -44,9 +44,10 @@
* - 2.1.0 - add square tiling interface
* - 2.2.0 - add r6xx/r7xx const buffer support
* - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
+ * - 2.4.0 - add crtc id query
*/
#define KMS_DRIVER_MAJOR 2
-#define KMS_DRIVER_MINOR 3
+#define KMS_DRIVER_MINOR 4
#define KMS_DRIVER_PATCHLEVEL 0
int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d3657dc..04ad452 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
{
struct radeon_device *rdev = dev->dev_private;
struct drm_radeon_info *info;
+ struct radeon_mode_info *minfo = &rdev->mode_info;
uint32_t *value_ptr;
uint32_t value;
+ struct drm_crtc *crtc;
+ int i, found;
info = data;
value_ptr = (uint32_t *)((unsigned long)info->value);
+ value = *value_ptr;
switch (info->request) {
case RADEON_INFO_DEVICE_ID:
value = dev->pci_device;
@@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
case RADEON_INFO_ACCEL_WORKING:
value = rdev->accel_working;
break;
+ case RADEON_INFO_CRTC_FROM_ID:
+ for (i = 0, found = 0; i < 6; i++) {
+ crtc = (struct drm_crtc *)minfo->crtcs[i];
+ if (crtc && crtc->base.id == value) {
+ value = i;
+ found = 1;
+ break;
+ }
+ }
+ if (!found) {
+ DRM_ERROR("unknown crtc id %d\n", value);
+ return -EINVAL;
+ }
+ break;
default:
DRM_DEBUG("Invalid request %d\n", info->request);
return -EINVAL;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 81e614b..3ff9fc0 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -902,6 +902,7 @@ struct drm_radeon_cs {
#define RADEON_INFO_NUM_GB_PIPES 0x01
#define RADEON_INFO_NUM_Z_PIPES 0x02
#define RADEON_INFO_ACCEL_WORKING 0x03
+#define RADEON_INFO_CRTC_FROM_ID 0x04
struct drm_radeon_info {
uint32_t request;
--
1.7.0.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info
2010-05-07 15:18 [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info Jerome Glisse
@ 2010-05-07 15:40 ` Alex Deucher
2010-05-07 16:22 ` Jerome Glisse
2010-05-07 16:25 ` Alex Deucher
2010-05-11 4:07 ` Dave Airlie
1 sibling, 2 replies; 7+ messages in thread
From: Alex Deucher @ 2010-05-07 15:40 UTC (permalink / raw)
To: Jerome Glisse; +Cc: dri-devel
On Fri, May 7, 2010 at 11:18 AM, Jerome Glisse <jglisse@redhat.com> wrote:
> Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
> crtc id. Bump the minor version so userspace can enable conditionaly
> features depend on this.
Just curious what we need this for? Couldn't the id be handled in the
drm via relocs?
Alex
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> ---
> drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
> drivers/gpu/drm/radeon/radeon_kms.c | 18 ++++++++++++++++++
> include/drm/radeon_drm.h | 1 +
> 3 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index b3749d4..df96ace 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -44,9 +44,10 @@
> * - 2.1.0 - add square tiling interface
> * - 2.2.0 - add r6xx/r7xx const buffer support
> * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
> + * - 2.4.0 - add crtc id query
> */
> #define KMS_DRIVER_MAJOR 2
> -#define KMS_DRIVER_MINOR 3
> +#define KMS_DRIVER_MINOR 4
> #define KMS_DRIVER_PATCHLEVEL 0
> int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
> int radeon_driver_unload_kms(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d3657dc..04ad452 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> {
> struct radeon_device *rdev = dev->dev_private;
> struct drm_radeon_info *info;
> + struct radeon_mode_info *minfo = &rdev->mode_info;
> uint32_t *value_ptr;
> uint32_t value;
> + struct drm_crtc *crtc;
> + int i, found;
>
> info = data;
> value_ptr = (uint32_t *)((unsigned long)info->value);
> + value = *value_ptr;
> switch (info->request) {
> case RADEON_INFO_DEVICE_ID:
> value = dev->pci_device;
> @@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> case RADEON_INFO_ACCEL_WORKING:
> value = rdev->accel_working;
> break;
> + case RADEON_INFO_CRTC_FROM_ID:
> + for (i = 0, found = 0; i < 6; i++) {
> + crtc = (struct drm_crtc *)minfo->crtcs[i];
> + if (crtc && crtc->base.id == value) {
> + value = i;
> + found = 1;
> + break;
> + }
> + }
> + if (!found) {
> + DRM_ERROR("unknown crtc id %d\n", value);
> + return -EINVAL;
> + }
> + break;
> default:
> DRM_DEBUG("Invalid request %d\n", info->request);
> return -EINVAL;
> diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
> index 81e614b..3ff9fc0 100644
> --- a/include/drm/radeon_drm.h
> +++ b/include/drm/radeon_drm.h
> @@ -902,6 +902,7 @@ struct drm_radeon_cs {
> #define RADEON_INFO_NUM_GB_PIPES 0x01
> #define RADEON_INFO_NUM_Z_PIPES 0x02
> #define RADEON_INFO_ACCEL_WORKING 0x03
> +#define RADEON_INFO_CRTC_FROM_ID 0x04
>
> struct drm_radeon_info {
> uint32_t request;
> --
> 1.7.0.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info
2010-05-07 15:40 ` Alex Deucher
@ 2010-05-07 16:22 ` Jerome Glisse
2010-10-24 19:00 ` Lucas Clemente Vella
2010-05-07 16:25 ` Alex Deucher
1 sibling, 1 reply; 7+ messages in thread
From: Jerome Glisse @ 2010-05-07 16:22 UTC (permalink / raw)
To: Alex Deucher; +Cc: dri-devel
On Fri, May 07, 2010 at 11:40:41AM -0400, Alex Deucher wrote:
> On Fri, May 7, 2010 at 11:18 AM, Jerome Glisse <jglisse@redhat.com> wrote:
> > Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
> > crtc id. Bump the minor version so userspace can enable conditionaly
> > features depend on this.
>
> Just curious what we need this for? Couldn't the id be handled in the
> drm via relocs?
>
> Alex
>
It's for vblank event, i would have prefer that vblank event
directly took kms crtc id but as intel also supported UMS this
wasn't an option i guess. I am pondering on adding a new interface
which directly took drm crtc_id.
Cheers,
Jerome
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info
2010-05-07 15:40 ` Alex Deucher
2010-05-07 16:22 ` Jerome Glisse
@ 2010-05-07 16:25 ` Alex Deucher
1 sibling, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2010-05-07 16:25 UTC (permalink / raw)
To: Jerome Glisse; +Cc: dri-devel
On Fri, May 7, 2010 at 11:40 AM, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Fri, May 7, 2010 at 11:18 AM, Jerome Glisse <jglisse@redhat.com> wrote:
>> Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
>> crtc id. Bump the minor version so userspace can enable conditionaly
>> features depend on this.
>
> Just curious what we need this for? Couldn't the id be handled in the
> drm via relocs?
>
Nevermind, just saw the ddx patch.
> Alex
>
>>
>> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
>> ---
>> drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
>> drivers/gpu/drm/radeon/radeon_kms.c | 18 ++++++++++++++++++
>> include/drm/radeon_drm.h | 1 +
>> 3 files changed, 21 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
>> index b3749d4..df96ace 100644
>> --- a/drivers/gpu/drm/radeon/radeon_drv.c
>> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
>> @@ -44,9 +44,10 @@
>> * - 2.1.0 - add square tiling interface
>> * - 2.2.0 - add r6xx/r7xx const buffer support
>> * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
>> + * - 2.4.0 - add crtc id query
>> */
>> #define KMS_DRIVER_MAJOR 2
>> -#define KMS_DRIVER_MINOR 3
>> +#define KMS_DRIVER_MINOR 4
>> #define KMS_DRIVER_PATCHLEVEL 0
>> int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
>> int radeon_driver_unload_kms(struct drm_device *dev);
>> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
>> index d3657dc..04ad452 100644
>> --- a/drivers/gpu/drm/radeon/radeon_kms.c
>> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
>> @@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>> {
>> struct radeon_device *rdev = dev->dev_private;
>> struct drm_radeon_info *info;
>> + struct radeon_mode_info *minfo = &rdev->mode_info;
>> uint32_t *value_ptr;
>> uint32_t value;
>> + struct drm_crtc *crtc;
>> + int i, found;
>>
>> info = data;
>> value_ptr = (uint32_t *)((unsigned long)info->value);
>> + value = *value_ptr;
>> switch (info->request) {
>> case RADEON_INFO_DEVICE_ID:
>> value = dev->pci_device;
>> @@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>> case RADEON_INFO_ACCEL_WORKING:
>> value = rdev->accel_working;
>> break;
>> + case RADEON_INFO_CRTC_FROM_ID:
>> + for (i = 0, found = 0; i < 6; i++) {
>> + crtc = (struct drm_crtc *)minfo->crtcs[i];
>> + if (crtc && crtc->base.id == value) {
>> + value = i;
>> + found = 1;
>> + break;
>> + }
>> + }
>> + if (!found) {
>> + DRM_ERROR("unknown crtc id %d\n", value);
>> + return -EINVAL;
>> + }
>> + break;
>> default:
>> DRM_DEBUG("Invalid request %d\n", info->request);
>> return -EINVAL;
>> diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
>> index 81e614b..3ff9fc0 100644
>> --- a/include/drm/radeon_drm.h
>> +++ b/include/drm/radeon_drm.h
>> @@ -902,6 +902,7 @@ struct drm_radeon_cs {
>> #define RADEON_INFO_NUM_GB_PIPES 0x01
>> #define RADEON_INFO_NUM_Z_PIPES 0x02
>> #define RADEON_INFO_ACCEL_WORKING 0x03
>> +#define RADEON_INFO_CRTC_FROM_ID 0x04
>>
>> struct drm_radeon_info {
>> uint32_t request;
>> --
>> 1.7.0.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info
2010-05-07 15:18 [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info Jerome Glisse
2010-05-07 15:40 ` Alex Deucher
@ 2010-05-11 4:07 ` Dave Airlie
1 sibling, 0 replies; 7+ messages in thread
From: Dave Airlie @ 2010-05-11 4:07 UTC (permalink / raw)
To: Jerome Glisse; +Cc: dri-devel
On Sat, May 8, 2010 at 1:18 AM, Jerome Glisse <jglisse@redhat.com> wrote:
> Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm
> crtc id. Bump the minor version so userspace can enable conditionaly
> features depend on this.
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> ---
> drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
> drivers/gpu/drm/radeon/radeon_kms.c | 18 ++++++++++++++++++
> include/drm/radeon_drm.h | 1 +
> 3 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index b3749d4..df96ace 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -44,9 +44,10 @@
> * - 2.1.0 - add square tiling interface
> * - 2.2.0 - add r6xx/r7xx const buffer support
> * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
> + * - 2.4.0 - add crtc id query
> */
> #define KMS_DRIVER_MAJOR 2
> -#define KMS_DRIVER_MINOR 3
> +#define KMS_DRIVER_MINOR 4
> #define KMS_DRIVER_PATCHLEVEL 0
> int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
> int radeon_driver_unload_kms(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index d3657dc..04ad452 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> {
> struct radeon_device *rdev = dev->dev_private;
> struct drm_radeon_info *info;
> + struct radeon_mode_info *minfo = &rdev->mode_info;
> uint32_t *value_ptr;
> uint32_t value;
> + struct drm_crtc *crtc;
> + int i, found;
>
> info = data;
> value_ptr = (uint32_t *)((unsigned long)info->value);
> + value = *value_ptr;
> switch (info->request) {
> case RADEON_INFO_DEVICE_ID:
> value = dev->pci_device;
> @@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
> case RADEON_INFO_ACCEL_WORKING:
> value = rdev->accel_working;
> break;
> + case RADEON_INFO_CRTC_FROM_ID:
> + for (i = 0, found = 0; i < 6; i++) {
> + crtc = (struct drm_crtc *)minfo->crtcs[i];
> + if (crtc && crtc->base.id == value) {
> + value = i;
> + found = 1;
> + break;
> + }
> + }
> + if (!found) {
> + DRM_ERROR("unknown crtc id %d\n", value);
Don't drm error or hardcode 6 here.
we have rdev->num_crtc and DRM erroring from a path triggerable
directly from a user doing something bad is generally a bad idea.
Dave.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-10-25 7:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 15:18 [PATCH] drm/radeon/kms: add query for crtc hw id from crtc id to get info Jerome Glisse
2010-05-07 15:40 ` Alex Deucher
2010-05-07 16:22 ` Jerome Glisse
2010-10-24 19:00 ` Lucas Clemente Vella
2010-10-25 7:23 ` Michel Dänzer
2010-05-07 16:25 ` Alex Deucher
2010-05-11 4:07 ` Dave Airlie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.