Re: [PATCH hwc v2 5/6] drm_hwcomposer: Add GetCrtcCount function

2017-09-28 Thread Robert Foss
On Wed, 2017-09-27 at 15:12 -0400, Sean Paul wrote:
> On Wed, Sep 27, 2017 at 7:58 AM, Robert Foss  om> wrote:
> > This GetCrtrcCount helper functions enables convenient
> > fetching of the number of Crtcs from DrmResources.
> > 
> > Signed-off-by: Robert Foss 
> > ---
> >  drmresources.cpp | 4 
> >  drmresources.h   | 1 +
> >  2 files changed, 5 insertions(+)
> > 
> > diff --git a/drmresources.cpp b/drmresources.cpp
> > index 762f5ef..0578cc6 100644
> > --- a/drmresources.cpp
> > +++ b/drmresources.cpp
> > @@ -241,6 +241,10 @@ DrmPlane *DrmResources::GetPlane(uint32_t id)
> > const {
> >    return NULL;
> >  }
> > 
> > +uint32_t DrmResources::GetCrtcCount() const {
> > +  return (uint32_t) crtcs_.size();
> > +}
> 
> The "blessed" way of doing this would be to add a new function
> 
> const std::vector () const {
>   return crtcs_;
> }
> 
> and then use crtcs()->size() wherever needed.
> 
> 

Yeah, that is nicer and more versatile.



Rob.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH hwc v2 5/6] drm_hwcomposer: Add GetCrtcCount function

2017-09-27 Thread Sean Paul
On Wed, Sep 27, 2017 at 7:58 AM, Robert Foss  wrote:
> This GetCrtrcCount helper functions enables convenient
> fetching of the number of Crtcs from DrmResources.
>
> Signed-off-by: Robert Foss 
> ---
>  drmresources.cpp | 4 
>  drmresources.h   | 1 +
>  2 files changed, 5 insertions(+)
>
> diff --git a/drmresources.cpp b/drmresources.cpp
> index 762f5ef..0578cc6 100644
> --- a/drmresources.cpp
> +++ b/drmresources.cpp
> @@ -241,6 +241,10 @@ DrmPlane *DrmResources::GetPlane(uint32_t id) const {
>return NULL;
>  }
>
> +uint32_t DrmResources::GetCrtcCount() const {
> +  return (uint32_t) crtcs_.size();
> +}

The "blessed" way of doing this would be to add a new function

const std::vector () const {
  return crtcs_;
}

and then use crtcs()->size() wherever needed.



> +
>  uint32_t DrmResources::next_mode_id() {
>return ++mode_id_;
>  }
> diff --git a/drmresources.h b/drmresources.h
> index a2d8d16..0cc2456 100644
> --- a/drmresources.h
> +++ b/drmresources.h
> @@ -66,6 +66,7 @@ class DrmResources {
>int GetConnectorProperty(const DrmConnector , const char 
> *prop_name,
> DrmProperty *property);
>
> +  uint32_t GetCrtcCount() const;
>uint32_t next_mode_id();
>
>int CreatePropertyBlob(void *data, size_t length, uint32_t *blob_id);
> --
> 2.11.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH hwc v2 5/6] drm_hwcomposer: Add GetCrtcCount function

2017-09-27 Thread Robert Foss
This GetCrtrcCount helper functions enables convenient
fetching of the number of Crtcs from DrmResources.

Signed-off-by: Robert Foss 
---
 drmresources.cpp | 4 
 drmresources.h   | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drmresources.cpp b/drmresources.cpp
index 762f5ef..0578cc6 100644
--- a/drmresources.cpp
+++ b/drmresources.cpp
@@ -241,6 +241,10 @@ DrmPlane *DrmResources::GetPlane(uint32_t id) const {
   return NULL;
 }
 
+uint32_t DrmResources::GetCrtcCount() const {
+  return (uint32_t) crtcs_.size();
+}
+
 uint32_t DrmResources::next_mode_id() {
   return ++mode_id_;
 }
diff --git a/drmresources.h b/drmresources.h
index a2d8d16..0cc2456 100644
--- a/drmresources.h
+++ b/drmresources.h
@@ -66,6 +66,7 @@ class DrmResources {
   int GetConnectorProperty(const DrmConnector , const char 
*prop_name,
DrmProperty *property);
 
+  uint32_t GetCrtcCount() const;
   uint32_t next_mode_id();
 
   int CreatePropertyBlob(void *data, size_t length, uint32_t *blob_id);
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel